summaryrefslogtreecommitdiffstats
path: root/nsframework/framework_unified/client
diff options
context:
space:
mode:
Diffstat (limited to 'nsframework/framework_unified/client')
-rw-r--r--nsframework/framework_unified/client/Makefile269
-rw-r--r--nsframework/framework_unified/client/NS_ConfigParser/cfg/depends.mk25
-rw-r--r--nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_internal.h54
-rw-r--r--nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_parser.h148
-rw-r--r--nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_reader.h133
-rw-r--r--nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_writer.h146
-rw-r--r--nsframework/framework_unified/client/NS_ConfigParser/include/ns_config_parser_frameworkunifiedlog.h88
-rw-r--r--nsframework/framework_unified/client/NS_ConfigParser/src/makefile_PosixBasedOS001207
-rw-r--r--nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_parser.cpp365
-rw-r--r--nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_reader.cpp117
-rw-r--r--nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_writer.cpp135
-rw-r--r--nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_reader.cpp346
-rw-r--r--nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_reader_writer.cpp74
-rw-r--r--nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_writer.cpp227
-rw-r--r--nsframework/framework_unified/client/NS_ConfigParser/src/ns_reader.cpp36
-rw-r--r--nsframework/framework_unified/client/NS_ConfigParser/src/ns_writer.cpp36
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/cfg/depends.mk25
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_core.h676
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_error_internal.hpp43
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_internal.h675
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_utility.h41
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_msgprofiler.h148
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_finalstate.h97
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_framework_core.h89
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_multithreading_internal.h30
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_dispatcher.cpp2382
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_dispatch.cpp983
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_error.cpp130
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_logger.cpp575
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_message_center.cpp502
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_npservice.cpp867
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_session.cpp1357
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_sync.cpp439
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_system.cpp77
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_msgprofiler.cpp210
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_multithreading.cpp531
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_service_if.cpp128
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_thread_priority.cpp156
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_timer.cpp67
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/makefile_PosixBasedOS001214
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_action.cpp32
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_compositestate.cpp371
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_conditionconnector.cpp152
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_deephistorystate.cpp79
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_dispatcher.cpp240
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_externaltransition.cpp225
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_finalstate.cpp79
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_framework_dispatch.cpp485
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_guard.cpp41
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_historystate.cpp148
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsm.cpp529
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsmframework.cpp1419
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_leafstate.cpp78
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_localtransition.cpp84
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_multithreading.cpp211
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_orthogonalstate.cpp337
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_shallowhistorystate.cpp74
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_state.cpp634
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_transition.cpp57
-rw-r--r--nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/makefile99
-rw-r--r--nsframework/framework_unified/client/NS_Logger/cfg/depends.mk25
-rw-r--r--nsframework/framework_unified/client/NS_Logger/include/frameworkunified_stub.h111
-rw-r--r--nsframework/framework_unified/client/NS_Logger/include/ns_logger_internal.h44
-rw-r--r--nsframework/framework_unified/client/NS_Logger/src/makefile_PosixBasedOS001223
-rw-r--r--nsframework/framework_unified/client/NS_Logger/src/ns_logger.cpp2260
-rw-r--r--nsframework/framework_unified/client/NS_Logger/tool/nslogsw.cpp114
-rw-r--r--nsframework/framework_unified/client/NS_MessageCenter/cfg/depends.mk25
-rw-r--r--nsframework/framework_unified/client/NS_MessageCenter/include/ns_mc_internal.h93
-rw-r--r--nsframework/framework_unified/client/NS_MessageCenter/include/ns_message_center_internal.h185
-rw-r--r--nsframework/framework_unified/client/NS_MessageCenter/src/makefile_PosixBasedOS001214
-rw-r--r--nsframework/framework_unified/client/NS_MessageCenter/src/ns_message_center.c1269
-rw-r--r--nsframework/framework_unified/client/NS_MessageQueue/cfg/depends.mk25
-rw-r--r--nsframework/framework_unified/client/NS_MessageQueue/include/ns_mq_anomaly.h35
-rw-r--r--nsframework/framework_unified/client/NS_MessageQueue/include/ns_mq_internal.h58
-rw-r--r--nsframework/framework_unified/client/NS_MessageQueue/include/ns_msg_queue.h295
-rw-r--r--nsframework/framework_unified/client/NS_MessageQueue/src/makefile_PosixBasedOS001207
-rw-r--r--nsframework/framework_unified/client/NS_MessageQueue/src/ns_mq_string.c60
-rw-r--r--nsframework/framework_unified/client/NS_MessageQueue/src/ns_msg_queue.c596
-rw-r--r--nsframework/framework_unified/client/NS_NPServiceIf/cfg/depends.mk25
-rw-r--r--nsframework/framework_unified/client/NS_NPServiceIf/include/ns_np_service_internal.h75
-rw-r--r--nsframework/framework_unified/client/NS_NPServiceIf/src/makefile_PosixBasedOS001208
-rw-r--r--nsframework/framework_unified/client/NS_NPServiceIf/src/ns_np_service_api.c1001
-rw-r--r--nsframework/framework_unified/client/NS_NPServiceIf/src/ns_np_service_nor_persistence.cpp498
-rw-r--r--nsframework/framework_unified/client/NS_ResourceControler/src/ns_resource_controler.cpp168
-rw-r--r--nsframework/framework_unified/client/NS_RingBuffer/src/ns_ringbuffer.cpp1029
-rw-r--r--nsframework/framework_unified/client/NS_SharedMemIf/api/nsapi_sharedmem.cpp431
-rw-r--r--nsframework/framework_unified/client/NS_SharedMemIf/cfg/depends.mk25
-rw-r--r--nsframework/framework_unified/client/NS_SharedMemIf/src/makefile_PosixBasedOS001190
-rw-r--r--nsframework/framework_unified/client/NS_SharedMemIf/src/ns_shared_mem_if.cpp254
-rw-r--r--nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem.cpp697
-rw-r--r--nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem_reader.cpp169
-rw-r--r--nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem_writer.cpp137
-rw-r--r--nsframework/framework_unified/client/NS_Timer/cfg/depends.mk25
-rw-r--r--nsframework/framework_unified/client/NS_Timer/include/ns_timer_handle.h48
-rw-r--r--nsframework/framework_unified/client/NS_Timer/include/ns_timer_internal.h28
-rw-r--r--nsframework/framework_unified/client/NS_Timer/src/makefile_PosixBasedOS001206
-rw-r--r--nsframework/framework_unified/client/NS_Timer/src/mod_version.c51
-rw-r--r--nsframework/framework_unified/client/NS_Timer/src/ns_timer.c514
-rw-r--r--nsframework/framework_unified/client/NS_Timer/src/ns_timer_class.cpp177
-rw-r--r--nsframework/framework_unified/client/NS_Utility/Makefile19
-rw-r--r--nsframework/framework_unified/client/NS_Utility/buildversioncheck/Makefile21
-rw-r--r--nsframework/framework_unified/client/NS_Utility/buildversioncheck/library/Makefile62
-rw-r--r--nsframework/framework_unified/client/NS_Utility/buildversioncheck/library/src/NS_BuildVersionCheck.cpp85
-rw-r--r--nsframework/framework_unified/client/NS_UtilityCenter/cfg/depends.mk25
-rw-r--r--nsframework/framework_unified/client/NS_UtilityCenter/include/ns_utility_if_internal.h193
-rw-r--r--nsframework/framework_unified/client/NS_UtilityCenter/include/ns_utility_sys_internal.hpp353
-rw-r--r--nsframework/framework_unified/client/NS_UtilityCenter/src/frameworkunified_version.cpp236
-rw-r--r--nsframework/framework_unified/client/NS_UtilityCenter/src/makefile_PosixBasedOS001194
-rw-r--r--nsframework/framework_unified/client/NS_UtilityCenter/src/ns_endianess.cpp52
-rw-r--r--nsframework/framework_unified/client/NS_UtilityCenter/src/ns_util_crc.cpp125
-rw-r--r--nsframework/framework_unified/client/NS_UtilityCenter/src/ns_util_directory.cpp145
-rw-r--r--nsframework/framework_unified/client/NS_UtilityCenter/src/ns_utility.cpp144
-rw-r--r--nsframework/framework_unified/client/NS_XMLConfigeParser/Makefile20
-rw-r--r--nsframework/framework_unified/client/NS_XMLConfigeParser/library/Makefile19
-rw-r--r--nsframework/framework_unified/client/NS_XMLConfigeParser/library/cfg/depends.mk25
-rw-r--r--nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_XML.h113
-rw-r--r--nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_cfg.h104
-rw-r--r--nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_internal.h60
-rw-r--r--nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_xmlconfig_parser_frameworkunifiedlog.h88
-rw-r--r--nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/Makefile57
-rw-r--r--nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/makefile_PosixBasedOS001208
-rw-r--r--nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_reader.cpp522
-rw-r--r--nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_writer.cpp338
-rw-r--r--nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser.cpp354
-rw-r--r--nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_attributes.cpp55
-rw-r--r--nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_node.cpp658
-rw-r--r--nsframework/framework_unified/client/NS__CWORD77__ServiceIf/cfg/depends.mk25
-rw-r--r--nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__service_if.cpp367
-rw-r--r--nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__session_if.cpp325
-rw-r--r--nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified_stub.h20
-rw-r--r--nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/makefile_PosixBasedOS001208
-rw-r--r--nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__common_internal.h51
-rw-r--r--nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_internal.h64
-rw-r--r--nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_table.cpp538
-rw-r--r--nsframework/framework_unified/client/NativeServices/Makefile29
-rw-r--r--nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_arm.mk88
-rw-r--r--nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_armv7.mk96
-rw-r--r--nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_x86.mk89
-rw-r--r--nsframework/framework_unified/client/NativeServices/cfg/analysis.mk73
-rw-r--r--nsframework/framework_unified/client/NativeServices/cfg/common.mk175
-rw-r--r--nsframework/framework_unified/client/NativeServices/cfg/config.mk115
-rw-r--r--nsframework/framework_unified/client/NativeServices/cfg/depends.mk115
-rw-r--r--nsframework/framework_unified/client/NativeServices/cfg/nativeserviceslibraries.mk54
-rw-r--r--nsframework/framework_unified/client/NativeServices/makefile_PosixBasedOS00155
-rw-r--r--nsframework/framework_unified/client/NativeServices/scfg/ns_filestorage.sql9
-rw-r--r--nsframework/framework_unified/client/NativeServices/scfg/ns_logger_frameworkunifiedlog.cfg278
-rw-r--r--nsframework/framework_unified/client/NativeServices/scfg/ns_logger_frameworkunifiedlog__CWORD84_.cfg427
-rw-r--r--nsframework/framework_unified/client/include/native_service/XMLParser.h289
-rw-r--r--nsframework/framework_unified/client/include/native_service/framework_unified.h130
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified__CWORD77__service_if.h554
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified__CWORD77__session_if.h495
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_application.h376
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_dispatcher.h803
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_framework_error.hpp77
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_framework_if.h6007
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_framework_sync.h370
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_framework_system_if.h110
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_framework_types.h173
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_multithreading.h745
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_service_if.h267
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_service_protocol.h116
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_action.h150
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_compositestate.h434
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_conditionconnector.h203
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_deephistorystate.h141
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_dispatcher.h338
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_eventdata.h83
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_eventfactory.h114
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_externaltransition.h268
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_dispatch.h1054
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_if.h486
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_types.h494
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_guard.h145
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_historystate.h253
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_hsm.h798
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_hsmframework.h873
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_internaltransition.h111
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_leafstate.h252
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_localtransition.h163
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_multithreading.h227
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_orthogonalstate.h513
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_reaction.h184
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_shallowhistorystate.h163
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_state.h872
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_sm_transition.h150
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_thread_priority.h235
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_timer.h143
-rw-r--r--nsframework/framework_unified/client/include/native_service/frameworkunified_types.h268
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns__CWORD77__common.h129
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_if.h183
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_key.h53
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_table.h1217
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns__CWORD77__notifications.h53
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns__CWORD77__types.h68
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_buildversioncheck.hpp227
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_config_parser_if.h1038
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_endianess.h192
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_eventlogger.h103
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_logger_if.h1646
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_mc_system_info.h103
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_message_center_if.h1536
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_msgs.h64
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_np_service.h271
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_np_service_if.h2482
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_np_service_nor_persistence.h151
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_np_service_nor_persistence_internal.h131
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_np_service_notification.h50
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_np_service_protocol.h116
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_np_types.h47
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_plogger_if.h288
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_rcs_data_handler.hpp1159
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_rcs_logger_types.h104
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_rcs_plugin.hpp328
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_reader.h207
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_resource_controler.h216
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_ringbuffer.h523
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_shared_mem.h100
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_shared_mem_if.h196
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_sharedmem.h486
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_sharedmem_reader.h340
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_sharedmem_writer.h283
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_system_mode.h67
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_timer_if.h317
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_timer_if.hpp393
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_transmit_log.h256
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_util_crc.h111
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_util_directory.h160
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_utility.hpp572
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_utility_if.h76
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_utility_sys.hpp321
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_version.h48
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_version_if.h510
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_writer.h229
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_xml_reader.h291
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_xml_writer.h336
-rw-r--r--nsframework/framework_unified/client/include/native_service/ns_xmlparser_if.h1150
-rw-r--r--nsframework/framework_unified/client/include/native_service/nsfw_message.h65
-rw-r--r--nsframework/framework_unified/client/include/native_service/nslogutil_cmd_if.h86
-rw-r--r--nsframework/framework_unified/client/include/native_service/wpf_legacy.h152
-rw-r--r--nsframework/framework_unified/client/include/ns__CWORD77__template.h60
-rw-r--r--nsframework/framework_unified/client/include/ns_logger_additional_if.h40
-rw-r--r--nsframework/framework_unified/client/include/nsverutil_cmd_if.h25
-rw-r--r--nsframework/framework_unified/client/libNS_FrameworkUnified.ver144
243 files changed, 76619 insertions, 0 deletions
diff --git a/nsframework/framework_unified/client/Makefile b/nsframework/framework_unified/client/Makefile
new file mode 100644
index 00000000..29ed6284
--- /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 100644
index 00000000..93b9f97a
--- /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 100644
index 00000000..64aad8b0
--- /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 100644
index 00000000..8d7a47fd
--- /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 100644
index 00000000..d47c04b1
--- /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 100644
index 00000000..58d16399
--- /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 100644
index 00000000..c48f09d7
--- /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 100644
index 00000000..1e6e556b
--- /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 100644
index 00000000..a2abd785
--- /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 100644
index 00000000..9eeb3c00
--- /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 100644
index 00000000..4bf16d5f
--- /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 100644
index 00000000..839053af
--- /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 100644
index 00000000..6c2b2d6e
--- /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 100644
index 00000000..601500de
--- /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 100644
index 00000000..ff3cc7a4
--- /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 100644
index 00000000..b2b52f08
--- /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 100644
index 00000000..93b9f97a
--- /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 100644
index 00000000..cb8bcee7
--- /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 100644
index 00000000..8599fb22
--- /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 100644
index 00000000..4d38828a
--- /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 100644
index 00000000..b78297e3
--- /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 100644
index 00000000..f512e760
--- /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 100644
index 00000000..20ed3f62
--- /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 100644
index 00000000..ea564df7
--- /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 100644
index 00000000..ff670295
--- /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 100644
index 00000000..250edce2
--- /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 100644
index 00000000..cb573c97
--- /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 100644
index 00000000..cf079222
--- /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 100644
index 00000000..29125271
--- /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 100644
index 00000000..ea953c98
--- /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 100644
index 00000000..063e3572
--- /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 100644
index 00000000..7c9935be
--- /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 100644
index 00000000..80eec1fe
--- /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 100644
index 00000000..3a2d434a
--- /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 100644
index 00000000..468478ca
--- /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 100644
index 00000000..986f3b34
--- /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 100644
index 00000000..dccffa8c
--- /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 100644
index 00000000..88b5c501
--- /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 100644
index 00000000..0663b858
--- /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 100644
index 00000000..025ec700
--- /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 100644
index 00000000..0cb4d670
--- /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 100644
index 00000000..d975e930
--- /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 100644
index 00000000..6f273190
--- /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 100644
index 00000000..baac0d46
--- /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 100644
index 00000000..a73408a8
--- /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 100644
index 00000000..294dcf55
--- /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 100644
index 00000000..8b361fa4
--- /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 100644
index 00000000..dfb2d5cd
--- /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 100644
index 00000000..7afabdb6
--- /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 100644
index 00000000..96402769
--- /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 100644
index 00000000..f6cdb098
--- /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 100644
index 00000000..da060f2a
--- /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 100644
index 00000000..6c44ebbb
--- /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 100644
index 00000000..b5f9c0ae
--- /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 100644
index 00000000..33dab562
--- /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 100644
index 00000000..a8289a0a
--- /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 100644
index 00000000..97b6e3bb
--- /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 100644
index 00000000..af90583b
--- /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 100644
index 00000000..1162f61b
--- /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 100644
index 00000000..964a1f50
--- /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 100644
index 00000000..93b9f97a
--- /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 100644
index 00000000..22630385
--- /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 100644
index 00000000..97bde912
--- /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 100644
index 00000000..25318bee
--- /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 100644
index 00000000..94f775ce
--- /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 100644
index 00000000..b81b4a6e
--- /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 100644
index 00000000..93b9f97a
--- /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 100644
index 00000000..2b6dae89
--- /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 100644
index 00000000..a99e8119
--- /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 100644
index 00000000..c654ef76
--- /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 100644
index 00000000..fe841285
--- /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 100644
index 00000000..93b9f97a
--- /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 100644
index 00000000..5b02e2b2
--- /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 100644
index 00000000..ca022181
--- /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 100644
index 00000000..111b5bec
--- /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 100644
index 00000000..054db6dc
--- /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 100644
index 00000000..8749a990
--- /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 100644
index 00000000..19900617
--- /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 100644
index 00000000..93b9f97a
--- /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 100644
index 00000000..469b4c03
--- /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 100644
index 00000000..cbfc140f
--- /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 100644
index 00000000..d41514d1
--- /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 100644
index 00000000..a7777432
--- /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 100644
index 00000000..5122e39d
--- /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 100644
index 00000000..1fbc5b57
--- /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 100644
index 00000000..89c7421b
--- /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 100644
index 00000000..93b9f97a
--- /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 100644
index 00000000..dc225c4a
--- /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 100644
index 00000000..e60a4047
--- /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 100644
index 00000000..fe1e9bc4
--- /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 100644
index 00000000..79f9f543
--- /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 100644
index 00000000..25614157
--- /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 100644
index 00000000..93b9f97a
--- /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 100644
index 00000000..7d082e78
--- /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 100644
index 00000000..43418a22
--- /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 100644
index 00000000..b3eb74da
--- /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 100644
index 00000000..c6e28eb5
--- /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 100644
index 00000000..d24264b1
--- /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 100644
index 00000000..47b41e9a
--- /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 100644
index 00000000..2f4dfef6
--- /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 100644
index 00000000..03ca87c1
--- /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 100644
index 00000000..e1b0a6d5
--- /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 100644
index 00000000..633797bf
--- /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 100644
index 00000000..93b9f97a
--- /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 100644
index 00000000..fc0b7616
--- /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 100644
index 00000000..8c71ace2
--- /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 100644
index 00000000..3ee907f3
--- /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 100644
index 00000000..14ad4d80
--- /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 100644
index 00000000..3dea53cb
--- /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 100644
index 00000000..af823648
--- /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 100644
index 00000000..a8b4263d
--- /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 100644
index 00000000..d9e6776c
--- /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 100644
index 00000000..1cc5e18b
--- /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 100644
index 00000000..520b5f72
--- /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 100644
index 00000000..93b9f97a
--- /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 100644
index 00000000..4186f095
--- /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 100644
index 00000000..6dcf11ad
--- /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 100644
index 00000000..97c9be68
--- /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 100644
index 00000000..05874893
--- /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 100644
index 00000000..9ec700c3
--- /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 100644
index 00000000..cdf3238e
--- /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 100644
index 00000000..01abb973
--- /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 100644
index 00000000..2876e228
--- /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 100644
index 00000000..cb058658
--- /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 100644
index 00000000..27b6badc
--- /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 100644
index 00000000..47f6caa8
--- /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 100644
index 00000000..93b9f97a
--- /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 100644
index 00000000..39657831
--- /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 100644
index 00000000..1211f915
--- /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 100644
index 00000000..68efb44c
--- /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 100644
index 00000000..88693cd7
--- /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 100644
index 00000000..78f96a75
--- /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 100644
index 00000000..1ad792ed
--- /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 100644
index 00000000..b48062ae
--- /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 100644
index 00000000..c346b289
--- /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 100644
index 00000000..3baa0f25
--- /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 100644
index 00000000..68d15dad
--- /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 100644
index 00000000..528e7eab
--- /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 100644
index 00000000..c1e14fd5
--- /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 100644
index 00000000..10a9a6bb
--- /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 100644
index 00000000..5eb23f4f
--- /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 100644
index 00000000..57ecd9b2
--- /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 100644
index 00000000..67205f11
--- /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 100644
index 00000000..9b512f43
--- /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 100644
index 00000000..b6aa172a
--- /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 100644
index 00000000..729fe2fd
--- /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 100644
index 00000000..0ca29e52
--- /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 100644
index 00000000..36467ba4
--- /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 100644
index 00000000..b3c2f295
--- /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 100644
index 00000000..823257f6
--- /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 100644
index 00000000..2c189a70
--- /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 100644
index 00000000..9d967515
--- /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 100644
index 00000000..8aa45725
--- /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 100644
index 00000000..8c8e3f5a
--- /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 100644
index 00000000..44ef8542
--- /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 100644
index 00000000..3573e8cc
--- /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 100644
index 00000000..af7a4f9b
--- /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 100644
index 00000000..aa4119df
--- /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 100644
index 00000000..b9435969
--- /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 100644
index 00000000..b142d110
--- /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 100644
index 00000000..e66119e9
--- /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 100644
index 00000000..58dbf225
--- /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 100644
index 00000000..72ac6400
--- /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 100644
index 00000000..110c1517
--- /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 100644
index 00000000..fbb74eeb
--- /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 100644
index 00000000..2f392bab
--- /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 100644
index 00000000..e54d095e
--- /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 100644
index 00000000..02a2b3b7
--- /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 100644
index 00000000..a4668064
--- /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 100644
index 00000000..70afea16
--- /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 100644
index 00000000..8c90e595
--- /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 100644
index 00000000..fb00ecd3
--- /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 100644
index 00000000..1792f72f
--- /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 100644
index 00000000..47d5914b
--- /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 100644
index 00000000..1a8e1d74
--- /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 100644
index 00000000..fd61117f
--- /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 100644
index 00000000..71eebecf
--- /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 100644
index 00000000..e1aa6bda
--- /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 100644
index 00000000..99975eb1
--- /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 100644
index 00000000..827b180b
--- /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 100644
index 00000000..c9ea8c7f
--- /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 100644
index 00000000..83beea0a
--- /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 100644
index 00000000..945749db
--- /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 100644
index 00000000..438e2e5a
--- /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 100644
index 00000000..232c91e7
--- /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 100644
index 00000000..2af26a31
--- /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 100644
index 00000000..7a3c762e
--- /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 100644
index 00000000..faaf3aa0
--- /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 100644
index 00000000..e472b303
--- /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 100644
index 00000000..0fab83bf
--- /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 100644
index 00000000..6e3fbc19
--- /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 100644
index 00000000..73f6a203
--- /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 100644
index 00000000..5d7e3999
--- /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 100644
index 00000000..ae6ce838
--- /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 100644
index 00000000..d7f702c8
--- /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 100644
index 00000000..b40c01eb
--- /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 100644
index 00000000..33fa8582
--- /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 100644
index 00000000..ab96e115
--- /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 100644
index 00000000..a1ca9ef7
--- /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 100644
index 00000000..b61268aa
--- /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 100644
index 00000000..cfd350f6
--- /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 100644
index 00000000..48c83e71
--- /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 100644
index 00000000..e2a2deb7
--- /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 100644
index 00000000..b1889582
--- /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 100644
index 00000000..88daef7b
--- /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 100644
index 00000000..ea149c5a
--- /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 100644
index 00000000..5d389ec6
--- /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 100644
index 00000000..475950bb
--- /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 100644
index 00000000..01559d97
--- /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 100644
index 00000000..f926f38e
--- /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 100644
index 00000000..6f303f1c
--- /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 100644
index 00000000..cc28f7c1
--- /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 100644
index 00000000..617aa1d6
--- /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 100644
index 00000000..f306a52d
--- /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 100644
index 00000000..0cce23af
--- /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 100644
index 00000000..b67cd17e
--- /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 100644
index 00000000..981c1ad7
--- /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 100644
index 00000000..25c5da19
--- /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 100644
index 00000000..d8ac8b93
--- /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 100644
index 00000000..9a34909e
--- /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 100644
index 00000000..de6e9f94
--- /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 100644
index 00000000..9815904c
--- /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 100644
index 00000000..549fc4c3
--- /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 100644
index 00000000..ffcd8c8a
--- /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 100644
index 00000000..e61ec7ef
--- /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 100644
index 00000000..55280071
--- /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 100644
index 00000000..945275c0
--- /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 100644
index 00000000..07fe4f55
--- /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 100644
index 00000000..ee103376
--- /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 100644
index 00000000..5780144d
--- /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 100644
index 00000000..fad7efff
--- /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 100644
index 00000000..d0f5172e
--- /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 100644
index 00000000..788b6a4f
--- /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 100644
index 00000000..91e88c03
--- /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 100644
index 00000000..7686553e
--- /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 100644
index 00000000..f944dddb
--- /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 100644
index 00000000..b5872c57
--- /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 100644
index 00000000..90f03b79
--- /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 100644
index 00000000..7553f911
--- /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 100644
index 00000000..e4069dd9
--- /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 100644
index 00000000..4d67e189
--- /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 100644
index 00000000..70705e84
--- /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 100644
index 00000000..764c5bbd
--- /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:
+ *;
+};
+