diff options
author | Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com> | 2020-11-20 23:36:23 +0900 |
---|---|---|
committer | Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com> | 2020-11-22 09:02:55 +0900 |
commit | 17cf21bcf8a2e29d2cbcf0a313474d2a4ee44f5d (patch) | |
tree | 582a9768558d9eaf261ca5df6136e9de54c95816 /service/system/interface_unified/library | |
parent | 9e86046cdb356913ae026f616e5bf17f6f238aa5 (diff) |
Re-organized sub-directory by category
Since all the sub-directories were placed in the
first level, created sub-directories, "hal", "module",
and "service" for classification and relocated each component.
Signed-off-by: Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com>
Change-Id: Ifdf743ac0d1893bd8e445455cf0d2c199a011d5c
Diffstat (limited to 'service/system/interface_unified/library')
72 files changed, 19219 insertions, 0 deletions
diff --git a/service/system/interface_unified/library/Makefile b/service/system/interface_unified/library/Makefile new file mode 100755 index 0000000..e784550 --- /dev/null +++ b/service/system/interface_unified/library/Makefile @@ -0,0 +1,127 @@ +# +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# installed shared library(.so) +INST_SHLIBS := libSS_SystemIfUnified + +# compiled sources +libSS_SystemIfUnified_SRCS := ss_framework_if.cpp \ + ss_heartbeat_client.cpp \ + ss_sm_client.cpp \ + ss_string_maps.cpp \ + ss_system_process.cpp \ + ss_system_timer.cpp \ + ss_last_to_order.cpp +libSS_SystemIfUnified_SRCS += ss_devicedetection_service_ifc.cpp +libSS_SystemIfUnified_SRCS += ss_logger_service_ifc.cpp +libSS_SystemIfUnified_SRCS += ss_power_client.cpp \ + ss_pwrsvc_if.cpp + +# additional source path +VPATH += ./src +VPATH += ./include/$(COMPONENT_NAME) + +# installed headers +INST_HEADERS = interface_unified.h +INST_HEADERS += interfaceunified_system_application.h \ + interfaceunified_system_types.h \ + ss_client_names.h \ + ss_devicedetection_service.h \ + ss_devicedetection_service_ifc.h \ + ss_devicedetection_service_notifications.h \ + ss_devicedetection_service_protocol.h \ + ss_devicedetection_service_types.h \ + ss_error_event_common.h \ + ss_error_message.h \ + ss_heartbeat_if.h \ + ss_heartbeat_notifications.h \ + ss_heartbeat_service_protocol.h \ + ss_logger_service.h \ + ss_logger_service_ifc.h \ + ss_logger_service_notifications.h \ + ss_logger_service_protocol.h \ + ss_power_service_if.h \ + ss_power_service_notifications.h \ + ss_power_service_protocol.h \ + ss_power_service.h \ + ss_services.h \ + ss_sm_client_if.h \ + ss_sys_boot_area_map.h \ + ss_sm_thread_names.h \ + ss_string_maps.h \ + ss_system_if.h \ + ss_system_manager_if.h \ + ss_system_manager_notifications.h \ + ss_system_manager_protocol.h \ + ss_system_process.h \ + ss_system_timer.h \ + ss_system_types.h \ + ss_boot_map.h \ + ss_templates.h \ + ss_test_clients.h \ + ss_version.h \ + ss_last_to_order.h +INST_HEADERS += ss_logger_store_logs.h +INST_HEADERS += ss_devicedetection_service_local.h \ + ss_devicedetection_service_protocol_local.h \ + ss_devicedetection_service_types_local.h \ + ss_error_event_common_local.h \ + ss_sm_client_if_local.h \ + ss_sm_thread_names_local.h \ + ss_system_manager_if_local.h \ + ss_system_manager_notifications_local.h \ + ss_system_manager_protocol_local.h \ + ss_logger_service_local.h \ + ss_power_service_local.h \ + ss_power_service_notifications_local.h + + + +# additional include path +CPPFLAGS += -I./include/ +CPPFLAGS += -I../../rom_access_library/library/include/ + +# additional compile option +CPPFLAGS += -DLINUX -fdata-sections -ffunction-sections +CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,9,8,3 + +CPPFLAGS_ss_devicedetection_service_ifc.os = -fno-exceptions +CPPFLAGS_ss_logger_service_ifc.os = -fno-exceptions +CPPFLAGS_ss_system_timer.os = -fno-exceptions +CPPFLAGS_ss_string_maps.os = -fno-exceptions +CPPFLAGS_ss_client_session.os = -fno-exceptions +CPPFLAGS_ss_framework_if.os = -fno-exceptions +CPPFLAGS_ss_ss_heartbeat_client.os = -fno-exceptions +CPPFLAGS_ss_parameter.os = -fno-exceptions +CPPFLAGS_ss_parameter_map.os = -fno-exceptions +CPPFLAGS_ss_str_stream.os = -fno-exceptions +CPPFLAGS_ss_system_config_reader.os = -fno-exceptions +CPPFLAGS_ss_system_shared_memory.os = -fno-exceptions +CPPFLAGS_ss_plm_if.os = -fno-exceptions +CPPFLAGS_ss_power_client.os = -fno-exceptions +CPPFLAGS_ss_pwrsvc_if.os = -fno-exceptions + +LDFLAGS += -Wl,--no-as-needed + +# linked libraries +LDLIBS += -Wl,-Bdynamic +LDLIBS += -Wl,-Bdynamic +LDLIBS += -Wl,-Bdynamic -lstdc++ + +LDFLAGS += -g -Wl,--gc-sections -shared + + +include ../../system_service.mk diff --git a/service/system/interface_unified/library/include/ss_devicedetection_service_if_interfaceunifiedlog.h b/service/system/interface_unified/library/include/ss_devicedetection_service_if_interfaceunifiedlog.h new file mode 100755 index 0000000..62f32b9 --- /dev/null +++ b/service/system/interface_unified/library/include/ss_devicedetection_service_if_interfaceunifiedlog.h @@ -0,0 +1,86 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_SystemServices_DeviceDetection +/// \brief This file supports AGL application logging. +/// +/////////////////////////////////////////////////////////////////////////////// +/** + * @file + */ +#ifndef INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_DEVICEDETECTION_SERVICE_IF_INTERFACEUNIFIEDLOG_H_ +#define INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_DEVICEDETECTION_SERVICE_IF_INTERFACEUNIFIEDLOG_H_ +#include <native_service/ns_logger_if.h> + +#define ZONE_INIT ZONEMASK(10) +#define ZONE_FUNC ZONEMASK(11) +#define ZONE_MEM ZONEMASK(12) +#define ZONE_13 ZONEMASK(13) +#define ZONE_14 ZONEMASK(14) +#define ZONE_15 ZONEMASK(15) +#define ZONE_16 ZONEMASK(16) +#define ZONE_17 ZONEMASK(17) +#define ZONE_18 ZONEMASK(18) +#define ZONE_19 ZONEMASK(19) +#define ZONE_20 ZONEMASK(20) +#define ZONE_21 ZONEMASK(21) +#define ZONE_22 ZONEMASK(22) +#define ZONE_23 ZONEMASK(23) +#define ZONE_24 ZONEMASK(24) +#define ZONE_25 ZONEMASK(25) +#define ZONE_26 ZONEMASK(26) +#define ZONE_27 ZONEMASK(27) +#define ZONE_28 ZONEMASK(28) +#define ZONE_INFO ZONEMASK(29) + +#define ZONE_TEXT_10 "Init" +#define ZONE_TEXT_11 "Function" +#define ZONE_TEXT_12 "Memory" +#define ZONE_TEXT_13 "" +#define ZONE_TEXT_14 "" +#define ZONE_TEXT_15 "" +#define ZONE_TEXT_16 "" +#define ZONE_TEXT_17 "" +#define ZONE_TEXT_18 "" +#define ZONE_TEXT_19 "" +#define ZONE_TEXT_20 "" +#define ZONE_TEXT_21 "" +#define ZONE_TEXT_22 "" +#define ZONE_TEXT_23 "" +#define ZONE_TEXT_24 "" +#define ZONE_TEXT_25 "" +#define ZONE_TEXT_26 "" +#define ZONE_TEXT_27 "" +#define ZONE_TEXT_28 "" +#define ZONE_TEXT_29 "Info" +// These ARE RESERVED AND SHOULDN'T BE TOUCHED +// USE THEM WHEN REALLY NEEDED!!!!! +#define ZONE_TEXT_30 "Warning" +#define ZONE_TEXT_31 "Error" +#define ZONE_WARN ZONEMASK(30) +#define ZONE_ERR ZONEMASK(31) + +#ifndef FRAMEWORKUNIFIEDLOGOPTIONS +#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT , LMSGQ, LSLOGGER +#endif + +#ifndef FRAMEWORKUNIFIEDLOGAPPZONES +#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR +#endif // FRAMEWORKUNIFIEDLOGAPPZONES + +extern const CHAR AppName[]; +#endif // INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_DEVICEDETECTION_SERVICE_IF_INTERFACEUNIFIEDLOG_H_ diff --git a/service/system/interface_unified/library/include/ss_last_to_order_local.h b/service/system/interface_unified/library/include/ss_last_to_order_local.h new file mode 100755 index 0000000..889a733 --- /dev/null +++ b/service/system/interface_unified/library/include/ss_last_to_order_local.h @@ -0,0 +1,41 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file ss_last_to_order_local.h + * @brief \~english This file contains declaration of SS_LAST_TO_ORDER_CONF_PATH + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#ifndef INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_LAST_TO_ORDER_LOCAL_H_ +#define INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_LAST_TO_ORDER_LOCAL_H_ + +#include <string> + +#define SS_LAST_TO_ORDER_CONF_PATH "/usr/agl/conf/BS/ss/system_manager/rodata/sm_last2order.cfo" + +#endif // INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_LAST_TO_ORDER_LOCAL_H_ +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/ss_logger_service_if_interfaceunifiedlog.h b/service/system/interface_unified/library/include/ss_logger_service_if_interfaceunifiedlog.h new file mode 100755 index 0000000..8989bf6 --- /dev/null +++ b/service/system/interface_unified/library/include/ss_logger_service_if_interfaceunifiedlog.h @@ -0,0 +1,86 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_SystemServices_Logger +/// \brief This file supports AGL application logging. +/// +/////////////////////////////////////////////////////////////////////////////// +/** + * @file + */ +#ifndef INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_LOGGER_SERVICE_IF_INTERFACEUNIFIEDLOG_H_ +#define INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_LOGGER_SERVICE_IF_INTERFACEUNIFIEDLOG_H_ +#include <native_service/ns_logger_if.h> + +#define ZONE_INIT ZONEMASK(10) +#define ZONE_FUNC ZONEMASK(11) +#define ZONE_MEM ZONEMASK(12) +#define ZONE_13 ZONEMASK(13) +#define ZONE_14 ZONEMASK(14) +#define ZONE_15 ZONEMASK(15) +#define ZONE_16 ZONEMASK(16) +#define ZONE_17 ZONEMASK(17) +#define ZONE_18 ZONEMASK(18) +#define ZONE_19 ZONEMASK(19) +#define ZONE_20 ZONEMASK(20) +#define ZONE_21 ZONEMASK(21) +#define ZONE_22 ZONEMASK(22) +#define ZONE_23 ZONEMASK(23) +#define ZONE_24 ZONEMASK(24) +#define ZONE_25 ZONEMASK(25) +#define ZONE_26 ZONEMASK(26) +#define ZONE_27 ZONEMASK(27) +#define ZONE_28 ZONEMASK(28) +#define ZONE_INFO ZONEMASK(29) + +#define ZONE_TEXT_10 "Init" +#define ZONE_TEXT_11 "Function" +#define ZONE_TEXT_12 "Memory" +#define ZONE_TEXT_13 "" +#define ZONE_TEXT_14 "" +#define ZONE_TEXT_15 "" +#define ZONE_TEXT_16 "" +#define ZONE_TEXT_17 "" +#define ZONE_TEXT_18 "" +#define ZONE_TEXT_19 "" +#define ZONE_TEXT_20 "" +#define ZONE_TEXT_21 "" +#define ZONE_TEXT_22 "" +#define ZONE_TEXT_23 "" +#define ZONE_TEXT_24 "" +#define ZONE_TEXT_25 "" +#define ZONE_TEXT_26 "" +#define ZONE_TEXT_27 "" +#define ZONE_TEXT_28 "" +#define ZONE_TEXT_29 "Info" +// These ARE RESERVED AND SHOULDN'T BE TOUCHED +// USE THEM WHEN REALLY NEEDED!!!!! +#define ZONE_TEXT_30 "Warning" +#define ZONE_TEXT_31 "Error" +#define ZONE_WARN ZONEMASK(30) +#define ZONE_ERR ZONEMASK(31) + +#ifndef FRAMEWORKUNIFIEDLOGOPTIONS +#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT , LMSGQ, LSLOGGER +#endif + +#ifndef FRAMEWORKUNIFIEDLOGAPPZONES +#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR +#endif + +extern const CHAR AppName[]; +#endif // INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_LOGGER_SERVICE_IF_INTERFACEUNIFIEDLOG_H_ diff --git a/service/system/interface_unified/library/include/ss_power_if_interfaceunifiedlog.h b/service/system/interface_unified/library/include/ss_power_if_interfaceunifiedlog.h new file mode 100755 index 0000000..d198030 --- /dev/null +++ b/service/system/interface_unified/library/include/ss_power_if_interfaceunifiedlog.h @@ -0,0 +1,85 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_PowerServiceIf +/// \brief This file supports 002 application logging. +/// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_POWER_IF_INTERFACEUNIFIEDLOG_H_ +#define INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_POWER_IF_INTERFACEUNIFIEDLOG_H_ +#include <native_service/ns_logger_if.h> + +#define ZONE_INIT ZONEMASK(10) +#define ZONE_FUNC ZONEMASK(11) +#define ZONE_MEM ZONEMASK(12) +#define ZONE_13 ZONEMASK(13) +#define ZONE_14 ZONEMASK(14) +#define ZONE_15 ZONEMASK(15) +#define ZONE_16 ZONEMASK(16) +#define ZONE_17 ZONEMASK(17) +#define ZONE_18 ZONEMASK(18) +#define ZONE_19 ZONEMASK(19) +#define ZONE_20 ZONEMASK(20) +#define ZONE_21 ZONEMASK(21) +#define ZONE_22 ZONEMASK(22) +#define ZONE_23 ZONEMASK(23) +#define ZONE_24 ZONEMASK(24) +#define ZONE_25 ZONEMASK(25) +#define ZONE_26 ZONEMASK(26) +#define ZONE_27 ZONEMASK(27) +#define ZONE_28 ZONEMASK(28) +#define ZONE_INFO ZONEMASK(29) + +#define ZONE_TEXT_10 "Init" +#define ZONE_TEXT_11 "Function" +#define ZONE_TEXT_12 "Memory" +#define ZONE_TEXT_13 "" +#define ZONE_TEXT_14 "" +#define ZONE_TEXT_15 "" +#define ZONE_TEXT_16 "" +#define ZONE_TEXT_17 "" +#define ZONE_TEXT_18 "" +#define ZONE_TEXT_19 "" +#define ZONE_TEXT_20 "" +#define ZONE_TEXT_21 "" +#define ZONE_TEXT_22 "" +#define ZONE_TEXT_23 "" +#define ZONE_TEXT_24 "" +#define ZONE_TEXT_25 "" +#define ZONE_TEXT_26 "" +#define ZONE_TEXT_27 "" +#define ZONE_TEXT_28 "" +#define ZONE_TEXT_29 "Info" +// These ARE RESERVED AND SHOULDN'T BE TOUCHED +// USE THEM WHEN REALLY NEEDED!!!!! +#define ZONE_TEXT_30 "Warning" +#define ZONE_TEXT_31 "Error" +#define ZONE_WARN ZONEMASK(30) +#define ZONE_ERR ZONEMASK(31) +#define ALL_ZONES_BUT_IPC_INFO 0xEFFFFFFF + +#ifndef FRAMEWORKUNIFIEDLOGOPTIONS +#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT, LMSGQ, LSLOGGER +#endif + +#ifndef FRAMEWORKUNIFIEDLOGAPPZONES +#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN +#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */ + +extern const CHAR AppName[]; +#endif // INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_POWER_IF_INTERFACEUNIFIEDLOG_H_ diff --git a/service/system/interface_unified/library/include/ss_system_if_interfaceunifiedlog.h b/service/system/interface_unified/library/include/ss_system_if_interfaceunifiedlog.h new file mode 100755 index 0000000..81ef016 --- /dev/null +++ b/service/system/interface_unified/library/include/ss_system_if_interfaceunifiedlog.h @@ -0,0 +1,89 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_SystemManagerIf +/// \brief This file supports AGL application logging. +/// +/////////////////////////////////////////////////////////////////////////////// +/** + * @file + */ +#ifndef INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_SYSTEM_IF_INTERFACEUNIFIEDLOG_H_ +#define INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_SYSTEM_IF_INTERFACEUNIFIEDLOG_H_ +#include <native_service/ns_logger_if.h> + +#define ZONE_INIT ZONEMASK(10) +#define ZONE_FUNC ZONEMASK(11) +#define ZONE_MEM ZONEMASK(12) +#define ZONE_13 ZONEMASK(13) +#define ZONE_14 ZONEMASK(14) +#define ZONE_15 ZONEMASK(15) +#define ZONE_16 ZONEMASK(16) +#define ZONE_17 ZONEMASK(17) +#define ZONE_18 ZONEMASK(18) +#define ZONE_19 ZONEMASK(19) +#define ZONE_20 ZONEMASK(20) +#define ZONE_21 ZONEMASK(21) +#define ZONE_22 ZONEMASK(22) +#define ZONE_23 ZONEMASK(23) +#define ZONE_24 ZONEMASK(24) +#define ZONE_25 ZONEMASK(25) +#define ZONE_26 ZONEMASK(26) +#define ZONE_27 ZONEMASK(27) +#define ZONE_28 ZONEMASK(28) +#define ZONE_INFO ZONEMASK(29) + + +#define ZONE_TEXT_10 "Init" +#define ZONE_TEXT_11 "Function" +#define ZONE_TEXT_12 "Memory" +#define ZONE_TEXT_13 "" +#define ZONE_TEXT_14 "" +#define ZONE_TEXT_15 "" +#define ZONE_TEXT_16 "" +#define ZONE_TEXT_17 "" +#define ZONE_TEXT_18 "" +#define ZONE_TEXT_19 "" +#define ZONE_TEXT_20 "" +#define ZONE_TEXT_21 "" +#define ZONE_TEXT_22 "" +#define ZONE_TEXT_23 "" +#define ZONE_TEXT_24 "" +#define ZONE_TEXT_25 "" +#define ZONE_TEXT_26 "" +#define ZONE_TEXT_27 "" +#define ZONE_TEXT_28 "" +#define ZONE_TEXT_29 "Info" +// These ARE RESERVED AND SHOULDN'T BE TOUCHED +// USE THEM WHEN REALLY NEEDED!!!!! +#define ZONE_TEXT_30 "Warning" +#define ZONE_TEXT_31 "Error" +#define ZONE_WARN ZONEMASK(30) +#define ZONE_ERR ZONEMASK(31) +#define ALL_ZONES_BUT_IPC_INFO 0xEFFFFFFF + +#ifndef FRAMEWORKUNIFIEDLOGOPTIONS +#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT , LMSGQ, LSLOGGER +#endif + +#ifndef FRAMEWORKUNIFIEDLOGAPPZONES +#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN +#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */ + +extern const CHAR AppName[]; + +#endif // INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_SYSTEM_IF_INTERFACEUNIFIEDLOG_H_ diff --git a/service/system/interface_unified/library/include/ss_system_timer_local.h b/service/system/interface_unified/library/include/ss_system_timer_local.h new file mode 100755 index 0000000..d694bdd --- /dev/null +++ b/service/system/interface_unified/library/include/ss_system_timer_local.h @@ -0,0 +1,44 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_system_timer_local.h + * @brief \~english This file supports a generic timer abstraction. + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#ifndef INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_SYSTEM_TIMER_LOCAL_H_ +#define INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_SYSTEM_TIMER_LOCAL_H_ + +enum { + NS_PER_MS = 1000000, + DEFAULT_TIMERID = 1000, + DEFAULT_NTIMERS = 10, +}; + +#endif // INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_SYSTEM_TIMER_LOCAL_H_ +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/interface_unified.h b/service/system/interface_unified/library/include/system_service/interface_unified.h new file mode 100755 index 0000000..a25423a --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/interface_unified.h @@ -0,0 +1,100 @@ +// +// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +/** + * @file interface_unified.h + * @brief \~english include all interface_unified head files + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +// include guard +#ifndef SYSTEMSERVICE_INTERFACEUNIFIED_H_ // NOLINT(build/header_guard) +#define SYSTEMSERVICE_INTERFACEUNIFIED_H_ + +#include "system_service/interfaceunified_system_application.h" +#include "system_service/interfaceunified_system_types.h" +#include "system_service/ss_boot_map.h" +#include "system_service/ss_client_names.h" +#include "system_service/ss_devicedetection_service.h" +#include "system_service/ss_devicedetection_service_ifc.h" +#include "system_service/ss_devicedetection_service_notifications.h" +#include "system_service/ss_devicedetection_service_protocol.h" +#include "system_service/ss_devicedetection_service_types.h" +#include "system_service/ss_error_event_common.h" +#include "system_service/ss_error_message.h" +#include "system_service/ss_heartbeat_if.h" +#include "system_service/ss_heartbeat_notifications.h" +#include "system_service/ss_heartbeat_service_protocol.h" +#include "system_service/ss_last_to_order.h" +#include "system_service/ss_logger_service.h" +#include "system_service/ss_logger_service_ifc.h" +#include "system_service/ss_logger_service_notifications.h" +#include "system_service/ss_logger_service_protocol.h" +#include "system_service/ss_services.h" +#include "system_service/ss_sm_client_if.h" +#include "system_service/ss_sm_thread_names.h" +#include "system_service/ss_string_maps.h" +#include "system_service/ss_sys_boot_area_map.h" +#include "system_service/ss_system_if.h" +#include "system_service/ss_system_manager_if.h" +#include "system_service/ss_system_manager_notifications.h" +#include "system_service/ss_system_manager_protocol.h" +#include "system_service/ss_system_process.h" +#include "system_service/ss_system_timer.h" +#include "system_service/ss_system_types.h" +#include "system_service/ss_templates.h" +#include "system_service/ss_test_clients.h" +#include "system_service/ss_version.h" + +// reference from logger_store_logs +#include "system_service/ss_logger_store_logs.h" + +// files with local +// reference from device_detection_service +#include "system_service/ss_devicedetection_service_local.h" +#include "system_service/ss_devicedetection_service_protocol_local.h" +#include "system_service/ss_devicedetection_service_types_local.h" +// reference from system_manager +#include "system_service/ss_error_event_common_local.h" +#include "system_service/ss_sm_client_if_local.h" +#include "system_service/ss_sm_thread_names_local.h" +#include "system_service/ss_system_manager_if_local.h" +#include "system_service/ss_system_manager_notifications_local.h" + +#include "system_service/ss_system_manager_protocol_local.h" +// reference from logger_service +#include "system_service/ss_logger_service_local.h" + +// reference from power_service +#include "system_service/ss_power_service_if.h" +#include "system_service/ss_power_service_notifications.h" +#include "system_service/ss_power_service_protocol.h" +#include "system_service/ss_power_service.h" +#include "system_service/ss_power_service_local.h" +#include "system_service/ss_power_service_notifications_local.h" + +#endif // SYSTEMSERVICE_INTERFACEUNIFIED_H_ +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/interfaceunified_system_application.h b/service/system/interface_unified/library/include/system_service/interfaceunified_system_application.h new file mode 100755 index 0000000..fe5224e --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/interfaceunified_system_application.h @@ -0,0 +1,219 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file interfaceunified_system_application.h + * @brief This file supports the System Manager AGL framework client + * interface. + */ + +#ifndef INTERFACEUNIFIED_SYSTEM_APPLICATION_H_ // NOLINT (build/header_guard) +#define INTERFACEUNIFIED_SYSTEM_APPLICATION_H_ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#include <native_service/frameworkunified_types.h> + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup InterfaceunifiedSystemConnectToPowerSerivce + /// \~english @par Summary + /// Subscribe and attach call backs to notifications, to PowerSerivce! + /// \~english @param [in] hApp + /// HANDLE - App handle + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.) + /// \~english @par Preconditions + /// \~english @par Change of the internal state + /// - Change of internal state according to the API does not occur. + /// \~english @par Conditions of processing failure + /// - Pointer (pNtfyHandler) is NULL to the structure of the Notification Handler specified in the argument. + /// [eFrameworkunifiedStatusInvldParam] + /// - Notification Handler number specified in the argument (uiHandlerCount) 0. [eFrameworkunifiedStatusInvldParam] + /// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam] + /// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam] + /// - Notification Handler number specified in the argument (uiHandlerCount) has exceeded + /// the maximum number of Notification.[eFrameworkunifiedStatusFail] + /// - The acquisition of the buffer for storing a plurality of information of + /// Notification Handler specified by the argument has failed. [eFrameworkunifiedStatusInvldParam] + /// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc). + /// [eFrameworkunifiedStatusFail] + /// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam] + /// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid). + /// [eFrameworkunifiedStatusInvldParam] + /// - Message queue name of HANDLE specified in the argument (hApp) + /// is not appropriate(The name is NULL, more than 20byte) [eFrameworkunifiedStatusInvldHandle] + /// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission. + /// [eFrameworkunifiedStatusInvldHndlType] + /// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull] + /// - It is invalid transmission file descriptor of the session message to the NPP Service. + /// [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message + /// for the NPP Service. [eFrameworkunifiedStatusErrNoEINTR] + /// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize] + /// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message for the NPP Service. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// None + /// \~english @par Detail + /// Subscribe and attach call backs to notifications, to PowerSerivce! \n + /// if callback has not subscribe,resubscribe! \n + /// if callback has been subscribed,initialize! + /// \~english @see FrameworkunifiedGetAppName FrameworkunifiedSubscribeNotificationsWithCallback + //////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus InterfaceunifiedSystemConnectToPowerSerivce(HANDLE hApp); + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup InterfaceunifiedSystemConnectToPowerSerivce + /// \~english @par Summary + /// Called from framework for every app to start connection to HeartBeat + /// \~english @param [in] hApp + /// HANDLE - App handle, Handle to message queue of HeartBeat Service. + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.) + /// \~english @par Preconditions + /// \~english @par Change of the internal state + /// - Change of internal state according to the API does not occur. + /// \~english @par Conditions of processing failure + /// - Pointer (pNtfyHandler) is NULL to the structure of the Notification Handler specified + /// in the argument. [eFrameworkunifiedStatusInvldParam] + /// - Notification Handler number specified in the argument (uiHandlerCount) 0. [eFrameworkunifiedStatusInvldParam] + /// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam] + /// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam] + /// - Notification Handler number specified in the argument (uiHandlerCount) has exceeded + /// the maximum number of Notification. [eFrameworkunifiedStatusFail] + /// - The acquisition of the buffer for storing a plurality of information of + /// Notification Handler specified by the argument has failed. [eFrameworkunifiedStatusInvldParam] + /// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc). + /// [eFrameworkunifiedStatusFail] + /// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam] + /// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid). + /// [eFrameworkunifiedStatusInvldParam] + /// - Message queue name of HANDLE specified in the argument (hApp) + /// is not appropriate(The name is NULL, more than 20byte) [eFrameworkunifiedStatusInvldHandle] + /// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission. + // [eFrameworkunifiedStatusInvldHndlType] + /// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull] + /// - It is invalid transmission file descriptor of the session message to the NPP Service. + /// [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of + /// the session message for the NPP Service. [eFrameworkunifiedStatusErrNoEINTR] + /// - Incorrect size of the transmit buffer of the session message to the NPP Service. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Any errors occur during the transmission of a session message to the NPP Service. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message + /// for the NPP Service. [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// None + /// \~english @par Detail + /// Called from framework for every app to start connection to HeartBeat \n + /// if app has not connection,reconnection! \n + /// if app has been connectioned,initialize it! + /// \~english @see FrameworkunifiedGetAppName FrameworkunifiedAttachCallbacksToDispatcher + //////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus InterfaceunifiedSystemConnectToHeartBeatService(HANDLE hApp); + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup InterfaceunifiedSystemConnectToPowerSerivce + /// \~english @par Summary + /// Subscribe and attach callbacks to System Manager Service! + /// \~english @param [in] hApp + /// HANDLE - App handle. + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.) + /// \~english @par Preconditions + /// \~english @par Change of the internal state + /// - Change of internal state according to the API does not occur. + /// \~english @par Conditions of processing failure + /// - Pointer (pNtfyHandler) is NULL to the structure of + /// the Notification Handler specified in the argument. [eFrameworkunifiedStatusInvldParam] + /// - Notification Handler number specified in the argument (uiHandlerCount) 0. [eFrameworkunifiedStatusInvldParam] + /// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam] + /// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam] + /// - Notification Handler number specified in the argument (uiHandlerCount) + /// has exceeded the maximum number of Notification. [eFrameworkunifiedStatusFail] + /// - The acquisition of the buffer for storing a plurality of information of + /// Notification Handler specified by the argument has failed. [eFrameworkunifiedStatusInvldParam] + /// - Can not be acquired memory in the acquisition of the buffer of + /// the message for transmission (malloc). [eFrameworkunifiedStatusFail] + /// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam] + /// - HANDLE specified in the argument message queue HANDLE in (hApp) + /// is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldParam] + /// - Message queue name of HANDLE specified in the argument (hApp) + /// is not appropriate(The name is NULL, more than 20byte) [eFrameworkunifiedStatusInvldHandle] + /// - Message queue type of HANDLE specified in the argument (hApp) + /// is not a transmission. [eFrameworkunifiedStatusInvldHndlType] + /// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull] + /// - It is invalid transmission file descriptor of the session message to the NPP Service. + /// [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of + /// the session message for the NPP Service. [eFrameworkunifiedStatusErrNoEINTR] + /// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize] + /// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message for + /// the NPP Service. [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// None + /// \~english @par Detail + /// Subscribe and attach callbacks to System Manager Service! \n + /// if app has not Subscribed,resubscribe! + /// \~english @see FrameworkunifiedGetAppName SystemManagerOpenSender + //////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus InterfaceunifiedSystemConnectToSystemManagerService(HANDLE hApp); + +/** @}*/ +/** @}*/ +/** @}*/ + + +#endif /* INTERFACEUNIFIED_SYSTEM_APPLICATION_H_ */ // NOLINT (build/header_guard) diff --git a/service/system/interface_unified/library/include/system_service/interfaceunified_system_types.h b/service/system/interface_unified/library/include/system_service/interfaceunified_system_types.h new file mode 100755 index 0000000..d3d3abd --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/interfaceunified_system_types.h @@ -0,0 +1,165 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file interfaceunified_system_types.h + * @brief \~english This file supports the System Manager audio source types. + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#ifndef INTERFACEUNIFIED_SYSTEM_TYPES_H_ // NOLINT (build/header_guard) +#define INTERFACEUNIFIED_SYSTEM_TYPES_H_ + + +typedef enum _SS_Sources { + SS_SOURCE_NA = 0, + SS_SOURCE_FM = 1, //## To be integrated into SS_SOURCE_AMFM for _CWORD71_ + SS_SOURCE_AM = 2, //## To be integrated into SS_SOURCE_AMFM for _CWORD71_ + + SS_SOURCE_CD = 3, // For Audio CDs + SS_SOURCE_AUX = 4, + + SS_SOURCE_PHONE = 5, // Will be deprecated soon, use specific Incoming or Outgoing call. + SS_SOURCE_TA = 6, // ## To be integrated into SS_SOURCE_AMFM for _CWORD71_ + SS_SOURCE_CHIMES = 7, + SS_SOURCE_NAVI = 8, + + SS_SOURCE_MSC = 9, ///< Any mass storage device (USB-MSC, SD, HDD etc.,) + SS_SOURCE_MTP = 10, ///< _CWORD104_, MTP protocol devices(like _CWORD28_ over USB) + + SS_SOURCE__CWORD57_ = 11, // ## To be integrated into SS_SOURCE_USB and SS_SOURCE_USB2 for _CWORD71_ + + SS_SOURCE__CWORD73__APP = 12, ///< _CWORD73_ based audio application (_CWORD74_ over BT/USB) - _CWORD22_, _CWORD13_ etc., + SS_SOURCE__CWORD73__VIDEO_MODE = 13, ///< _CWORD73_ Video Mode (_CWORD57_ playback) + + SS_SOURCE_STREAMING = 14, ///< Streaming over Wi-fi + SS_SOURCE_BT_AUDIO = 15, ///< Bluetooth Audio + SS_SOURCE_BT_SPP = 16, ///< Bluetooth SPP based audio application (_CWORD28_/BB etc.,) + + SS_SOURCE_SPEECH = 17, ///< Speech audio playback + + SS_SOURCE_USB = SS_SOURCE_MSC, ///< will be deprecated soon + + SS_SOURCE__CWORD59_ = 18, + SS_SOURCE_ADRM = 19, + SS_SOURCE__CWORD60_ = 20, + SS_SOURCE_ADRA = 21, + + + SS_SOURCE_INCOMING_CALL = SS_SOURCE_PHONE, + + SS_SOURCE_PRIVATE_MODE_CALL = 24, + + SS_SOURCE_HANDSFREE_SPEAKING = 25, + + SS_SOURCE_FM_DAB = 29, + SS_SOURCE_SD_CARD = 30, + SS_SOURCE_SDARS = 31, + SS_SOURCE_BROWSER_ENT = 32, + SS_SOURCE_ML_ENT = 33, + SS_SOURCE_ML_INFO = 34, + + SS_SOURCE_DATA_CD = 35, // For Data CDs + + SS_SOURCE_TAS = 40, // TA on same frequency + + SS_SOURCE_DTV = 41, + SS_SOURCE_DVD = 42, + SS_SOURCE_BD = 43, + SS_SOURCE_DELIVERY_APP = 44, + SS_SOURCE_ENTUNE_ENT = 45, + SS_SOURCE_HDD_AUDIO = 46, + SS_SOURCE_JOYFUL_TALK = 47, + SS_SOURCE_CLEARANCE_SONAR = 48, // Not used, To be deleted + SS_SOURCE_DSRC = 49, + SS_SOURCE_ENTUNE_INFO = 50, // Not used, To be deleted + SS_SOURCE_HELPNET = 51, + SS_SOURCE_OTV = 52, + SS_SOURCE_MIRACAST = 53, + SS_SOURCE_RSE = 54, + SS_SOURCE_INSIDER = 55, + SS_SOURCE_MAIL = 56, + SS_SOURCE_MAIL_RINGTONE = 57, + SS_SOURCE_BD_REAR = 58, + SS_SOURCE_HDMI_REAR = 59, + SS_SOURCE_SD_CARD_REAR = 60, + SS_SOURCE_MIRACAST_REAR = 61, + SS_SOURCE_USB_REAR = 62, // Not used, To be deleted + SS_SOURCE_DLNA_REAR = 63, + SS_SOURCE_BROWSER_INFO = 64, + SS_SOURCE_DSRC_ENT = 65, + SS_SOURCE_RECDATA_PLAY = 66, +// add Source ## + SS_SOURCE_AMFM = SS_SOURCE_FM, + SS_SOURCE_DLNA = 67, + SS_SOURCE_USB2 = 68, +// add interrupt audio source ## + SS_SOURCE_VDSP = 69, + SS_SOURCE_NAVI_VR = 70, + SS_SOURCE_STARTUPBGM = 71, + SS_SOURCE_STARTUPBGM_INIT = 72, + SS_SOURCE_MAIL_INFO = 73, + + SS_SOURCE_DIAG = 74, + SS_SOURCE_MAYDAY = 75, + SS_SOURCE_DCM = 76, + SS_SOURCE_SD_VIDEO = 77, + + SS_SOURCE_DELIVERY_APP_INFO = 78, + + SS_SOURCE__CWORD27__INFO = 86, + + // Declaration of special sources starting from 100 + SS_SOURCE_POWER_OFF = 100 // Being used by Mode +}SS_SOURCE, *PSS_SOURCE; + + +typedef enum _SS_Zones { + SS_ZONE_NA = 0, + SS_ZONE_DRIVER = 1, ///< Zero/Driver zone + SS_ZONE_REAR1, + SS_ZONE_REAR2, + SS_ZONE_REAR3, + SS_ZONE_ALL +}SS_ZONE, *PSS_ZONE; + + +typedef enum E_AUDIO_PORT { + SS_AUDIO_INPUT_PORT_1 = 0x01, ///< Enum representing MCASP2 + SS_AUDIO_INPUT_PORT_2 = 0x02, ///< Enum representing MCBSP + SS_AUDIO_INPUT_PORT_3 = 0x03, ///< Enum representing MCASP3 + SS_AUDIO_INPUT_PORT_4 = 0x04, ///< Enum representing MCASP3 + SS_AUDIO_INPUT_PORT_5 = 0x05 ///< Enum representing other port +}SS_AUDIO_INPUT_PORT, *PSS_AUDIO_INPUT_PORT; + +typedef enum _SS_Device_Context { + SINGLE_CONTEXT = 0, + MULTI_CONTEXT = 1 +}SS_DEVICE_CONTEXT, *PSS_DEVICE_CONTEXT; + +#endif /* INTERFACEUNIFIED_SYSTEM_TYPES_H_ */ // NOLINT (build/header_guard) +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_boot_map.h b/service/system/interface_unified/library/include/system_service/ss_boot_map.h new file mode 100755 index 0000000..364d5ed --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_boot_map.h @@ -0,0 +1,25 @@ +/* + * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + */ +#ifndef _SS_BOOT_MAP_H_ // NOLINT (build/header_guard) +#define _SS_BOOT_MAP_H_ + +#include <system_service/ss_sm_boot_access.h> + +#endif //_SS_BOOT_MAP_H_ // NOLINT (build/header_guard) + diff --git a/service/system/interface_unified/library/include/system_service/ss_client_names.h b/service/system/interface_unified/library/include/system_service/ss_client_names.h new file mode 100755 index 0000000..23604a1 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_client_names.h @@ -0,0 +1,77 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_client_names.h + * @brief This file supports contains the queue names of the client + * services that System Services needs to know about. + */ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#ifndef SS_CLIENT_NAMES_H_ // NOLINT (build/header_guard) +#define SS_CLIENT_NAMES_H_ + +#define SERVICE__CWORD69_ "_CWORD69_" +#define SERVICE_AS_AUDIO "AS_AudioService" +#define SERVICE_AS_MODE "AS_ModeService" +#define SERVICE_BR_BROWSER "BR_BrowserService" +#define SERVICE_CAN_SHADOW "VS_CANShadow" +#define SERVICE__CWORD51__BT "_CWORD51__BT" +#define SERVICE__CWORD51__DR "_CWORD51__DR" +#define SERVICE_DAB "RS_Master_Tuner" +#define SERVICE_HMI "HMI" +#define SERVICE_HMI__CWORD46_ "HMI__CWORD46_Service" +#define SERVICE_HMI__CWORD77_ "HMI__CWORD77_Service" +#define SERVICE_IPC_MP_SHADOW "PS_IPC_MP_Shadow" +#define SERVICE_KEY_HANDLER "PS_KeyHandler" +#define SERVICE_MM_ICD "MM_ICDService" +#define SERVICE_MM_MEDIA "MM_MediaService" +#define SERVICE_MM__CWORD21_ "MM__CWORD21_Service" +#define SERVICE_NAV "NAV_NavigationService" +#define SERVICE_NAV_LOC "NAV_LocationService" +#define SERVICE_NS_NPP "NS_NPPService" +#define SERVICE_NS_SHARED_MEM "NS_SharedMem" +#define SERVICE_NW_BT "NW_BluetoothService" +#define SERVICE_NW_CONNECTION "NW_ConnectionService" +#define SERVICE_NW_MESSAGING "NW_MessagingService" +#define SERVICE_NW_PHONE "NW_PhoneService" +#define SERVICE_NW_PHONE_BOOK "NW_PhoneBookService" +#define SERVICE_PSM_SHADOW "PS_PSMShadow" +#define SERVICE_PS_IPC "PS_IPC" +#define SERVICE_PS_SWDL_SHADOW "PS_SoftwareUpdateShadow" +#define SERVICE_SDARS "RS_XSDARSService" +#define SERVICE_TUNER "RS_Radio" +#define SERVICE_VS__CWORD85_ "VS__CWORD85_Service" +#define SERVICE_VS_DIAG "VS_DiagService" +#define SERVICE_VS_DIAG_DISP "DiagDispatcherService" +#define SERVICE_VS_RVC "VS_RVCService" +#define SERVICE_VS_VEHICLE "VS_VehicleService" + +#endif /* SS_CLIENT_NAMES_H_ */ // NOLINT (build/header_guard) + +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_devicedetection_service.h b/service/system/interface_unified/library/include/system_service/ss_devicedetection_service.h new file mode 100755 index 0000000..134ab1f --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_devicedetection_service.h @@ -0,0 +1,640 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_devicedetection_service.h + * @brief This file supports the Device Detection service. + */ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup device_detection_service + * @ingroup system_service + * @{ + */ + +#ifndef _SS_DEVICEDETECTION_SERVER_H_ // NOLINT (build/header_guard) +#define _SS_DEVICEDETECTION_SERVER_H_ + + +#include <native_service/frameworkunified_types.h> +#include <string> +#include "system_service/ss_devicedetection_service_types.h" + +/** + * \~english The max size of the file path. + */ +#define FILEPATH_SIZE (256) + +/** + * \~english The max size of URL. + */ +#define URL_SIZE (256) + +/** + * \~english The max size of the device name. + */ +#define SS_DEV_DEVICE_NAME_SIZE (64) + +/** + * \~english The max size of the name. + */ +#define SS_DEV_NAME_SIZE (256) + + +/** + * \~english Structure for FuseDAV info. + */ +typedef struct _FuseDAVInfo { + /** + * \~english FuseDAV server address + */ + int8_t url[URL_SIZE]; // FuseDAV server address +}SS_FuseDAVInfo; + +/** + * \~english Structure for USB device info. + */ +typedef struct _UsbInfo { + /** + * \~english Bus Number + */ + uint8_t bus_no; // Bus Number + /** + * \~english Device Number + */ + uint8_t dev_no; // Device Number + /** + * \~english Vendor ID + */ + uint16_t idVendor; // Vendor ID + /** + * \~english Product ID + */ + uint16_t idProduct; // Product ID + /** + * \~english reserved area + */ + uint8_t reserved[2]; + /** + * \~english Manufacturer Name + */ + CHAR manufacturerName[SS_DEV_NAME_SIZE]; // Manufacturer Name + /** + * \~english Product Name + */ + CHAR productName[SS_DEV_NAME_SIZE]; // Product Name + /** + * \~english Serial Number + */ + CHAR serial_no[SS_DEV_NAME_SIZE]; // Serial Number + /** + * \~english Device file path + */ + int8_t deviceFile[FILEPATH_SIZE]; // Device file path +}SS_UsbInfo; + +/** + * \~english CID(Card Identification Register Data)of SD/MMC card + */ +typedef struct _CID { + /** + * \~english Manufacturer ID + */ + uint8_t manufacturerID; /* Manufacturer ID */ + /** + * \~english Application ID + */ + uint16_t applicationID; /* Application ID */ + /** + * \~english Product Revision (PRV) + */ + uint8_t revision; /* Product Revision (PRV) */ + /** + * \~english Product Serial Number (PSN) + */ + uint32_t serialNumber; /* Product Serial Number (PSN) */ + /** + * \~english Product Name (PNM) + */ + uint8_t productName[6]; /* Product Name (PNM) */ + /** + * \~english Reserved area + */ + uint8_t reserve[2]; /* Reserve */ + /** + * \~english Manufacture date (MDT) + */ + uint16_t manufactureDate; /* Manufacture date (MDT) */ +}SS_CID; + +// CSD(Card Specification Register Data)of SD/MMC card +/** + * \~english CSD(Card Specification Register Data)of SD/MMC card + */ +typedef struct _CSD { + /** + * \~english CSD structure + */ + uint8_t csd_structure; /* CSD structure */ + /** + * \~english data read access-time-1 + */ + uint8_t taac; /* data read access-time-1 */ + /** + * \~english data read access-time-2 in CLK cycles (NSAC*100) + */ + uint8_t nsac; /* data read access-time-2 in CLK cycles (NSAC*100) */ + /** + * \~english max. data transfer rate + */ + uint8_t tran_speed; /* max. data transfer rate */ + /** + * \~english card command classes + */ + uint16_t ccc; /* card command classes */ + /** + * \~english max. read data block length + */ + uint8_t read_bl_len; /* max. read data block length */ + /** + * \~english partial blocks for read allowed + */ + uint8_t read_bl_partial; /* partial blocks for read allowed */ + /** + * \~english write block misalignment + */ + uint8_t write_blk_misalign; /* write block misalignment */ + /** + * \~english read block misalignment + */ + uint8_t read_blk_misalign; /* read block misalignment */ + /** + * \~english DSR implemented + */ + uint8_t dsr_imp; /* DSR implemented */ + /** + * \~english Reserve area 1 + */ + uint8_t reserve1; /* Reserve 1 */ + /** + * \~english device size + */ + uint32_t c_size; /* device size */ + /** + * \~english max. read current -VDD min + */ + uint8_t vdd_r_curr_min; /* max. read current @VDD min */ + /** + * \~english max. read current -VDD max + */ + uint8_t vdd_r_curr_max; /* max. read current @VDD max */ + /** + * \~english max. write current -VDD min + */ + uint8_t vdd_w_curr_min; /* max. write current @VDD min */ + /** + * \~english max. write current -VDD max + */ + uint8_t vdd_w_curr_max; /* max. write current @VDD max */ + /** + * \~english device size multiplier + */ + uint8_t c_size_mult; /* device size multiplier */ + /** + * \~english erase single block enable + */ + uint8_t erase_blk_en; /* erase single block enable */ + /** + * \~english erase sector size + */ + uint8_t sector_size; /* erase sector size */ + /** + * \~english write protect group size + */ + uint8_t wp_grp_size; /* write protect group size */ + /** + * \~english write protect group enable + */ + uint8_t wp_grp_enable; /* write protect group enable */ + /** + * \~english write speed factor + */ + uint8_t r2w_factor; /* write speed factor */ + /** + * \~english max. write data block length + */ + uint8_t write_bl_len; /* max. write data block length */ + /** + * \~english partial blocks for write allowed + */ + uint8_t write_bl_partial; /* partial blocks for write allowed */ + /** + * \~english File format group + */ + uint8_t file_format_grp; /* File format group */ + /** + * \~english copy flag + */ + uint8_t copy; /* copy flag */ + /** + * \~english permanent write protection + */ + uint8_t perm_write_protect; /* permanent write protection */ + /** + * \~english temporary write protection + */ + uint8_t tmp_write_protect; /* temporary write protection */ + /** + * \~english File format + */ + uint8_t file_format; /* File format */ + /** + * \~english Reserve area 2 + */ + uint8_t reserve2[3]; /* Reserve 2 */ +} SS_CSD; + +// Structure for SD device info. +/** + * \~english Structure for SD device info. + */ +typedef struct _SdInfo { + /** + * \~english CID + */ + SS_CID cid; // CID + /** + * \~english CSD + */ + SS_CSD csd; // CSD + /** + * \~english Device file path + */ + int8_t deviceFile[FILEPATH_SIZE]; // Device file path + /** + * \~english Current Partion No + */ + int32_t part_num; // Current Partion No + /** + * \~english Number of partions + */ + int32_t nparts; // Number of partions +}SS_SdInfo; + +// Structure for DISC info. +/** + * \~english Structure for DISC info. + */ +typedef struct _DiscInfo { + /** + * \~english Device file path + */ + int8_t deviceFile[FILEPATH_SIZE]; // Device file path + /** + * \~english Disc Type(eCD, eDVD, eBD) + */ + EDISC_TYPE disc_type; // Disc Type(eCD, eDVD, eBD) +}SS_DiscInfo; + +// Structure that is available when SS_DEV_ANY_USB_EV is published. +/** + * \~english Structure that is available when SS_DEV_ANY_USB_EV is published. + */ +typedef struct _UsbDeviceInfo { + /** + * \~english Insert:TURE, Remove:FALSE + */ + BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE + /** + * \~english USB Infomation + */ + SS_UsbInfo usb_info; // USB Infomation +}SS_UsbDeviceInfo; + +// Structure for device info. +/** + * \~english Structure for device info. + */ +typedef union _DeviceInfo { + /** + * \~english usb device info + */ + SS_UsbInfo usb_info; // usb device info + /** + * \~english sd info + */ + SS_SdInfo sd_info; // sd info + /** + * \~english disc info + */ + SS_DiscInfo disc_info; // disc info + /** + * \~english fusedav info + */ + SS_FuseDAVInfo fusedav_info; // fusedav info +}SS_DeviceInfo; + +// Structure for volume label infomation. +/** + * \~english Structure for volume label infomation. + */ +typedef struct _VolumeInfo { + /** + * \~english volume label's availability + */ + BOOL volume_label_availability; // volume label's availability + /** + * \~english volume label + */ + CHAR volume_label[SS_DEV_NAME_SIZE]; // volume label +}SS_VolumeInfo; + +// Structure that is available when SS_DEV_DETECT*_EV is published. +/** + * \~english Structure that is available when SS_DEV_DETECT*_EV is published. + */ +typedef struct _MediaDetectInfo { + /** + * \~english Deive type(eUSB,eSD...) + */ + EDEVICE_TYPE dev_type; // Deive type(eUSB,eSD...) + /** + * \~english Insert:TURE, Remove:FALSE + */ + BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE + /** + * \~english Device Infomation + */ + SS_DeviceInfo dev_info; // Device Infomation + /** + * \~english Mount path + */ + CHAR deviceMountpath[FILEPATH_SIZE]; // Mount path + /** + * \~english Do Not Used.(This member is for compatibility) + */ + CHAR filepathName[FILEPATH_SIZE]; // Do Not Used.(This menber is for compatibility) + /** + * \~english FuseDav:TRUE, Not FuseDav:FALSE + */ + BOOL bIsFuseDav; + /** + * \~english result of mount NORMAL:SS_DEV_OK, ERR:SS_DEV_ERR_MOUNT + */ + SS_DEV_ERROR err_code; // result of mount NORMAL:SS_DEV_OK, ERR:SS_DEV_ERR_MOUNT + /** + * \~english volume infomation (USB mass storage only support) + */ + SS_VolumeInfo volume_info; // volume infomation (USB mass storage only support) +}SS_MediaDetectInfo, *PSS_MediaDetectInfo; + +// Structure that is available when SS_DEV_DETECT_USB_NCM_EV is published. +/** + * \~english Structure that is available when SS_DEV_DETECT_USB_NCM_EV is published. + */ +typedef struct _NcmDetectInfo { + /** + * \~english Insert:TURE, Remove:FALSE + */ + BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE + /** + * \~english USB Infomation + */ + SS_UsbInfo usb_info; // USB Infomation + /** + * \~english Network Name + */ + int8_t networkName[SS_DEV_DEVICE_NAME_SIZE]; // Network Name +}SS_NcmDetectInfo; + +// Structure that is available when SS_DEV_DETECT_USB__CWORD57__EV is published. +/** + * \~english Structure that is available when SS_DEV_DETECT_USB__CWORD57__EV is published. + */ +typedef struct __CWORD57_DetectInfo { + /** + * \~english Insert:TURE, Remove:FALSE + */ + BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE + /** + * \~english USB Infomation + */ + SS_UsbInfo usb_info; // USB Infomation +}SS__CWORD57_DetectInfo; + +// Structure that is available when SS_DEV_DETECT_USB_ACM_EV is published. +/** + * \~english Structure that is available when SS_DEV_DETECT_USB_ACM_EV is published. + */ +typedef struct _AcmDetectInfo { + /** + * \~english Insert:TURE, Remove:FALSE + */ + BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE + /** + * \~english USB Infomation + */ + SS_UsbInfo usb_info; // USB Infomation + /** + * \~english ACM device file + */ + int8_t deviceFile[FILEPATH_SIZE]; // ACM device file +}SS_AcmDetectInfo; + +// Structure that is available when SS_DEV_DETECT_USB_DEV_MNG_EV is published. +/** + * \~english Structure that is available when SS_DEV_DETECT_USB_DEV_MNG_EV is published. + */ +typedef struct _DevMngDetectInfo { + /** + * \~english Insert:TURE, Remove:FALSE + */ + BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE + /** + * \~english USB Infomation + */ + SS_UsbInfo usb_info; // USB Infomation + /** + * \~english Device Manager device file + */ + int8_t deviceFile[FILEPATH_SIZE]; // Device Manager device file +}SS_DevMngDetectInfo; + +// Structure that is available when SS_DEV_DETECT_USB_DEV_VEHICLE_CTRL_EV is published. +/** + * \~english Structure that is available when SS_DEV_DETECT_USB_DEV_VEHICLE_CTRL_EV is published. + */ +typedef struct _VehicleCtrlDetectInfo { + /** + * \~english Insert:TURE, Remove:FALSE + */ + BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE + /** + * \~english USB Infomation + */ + SS_UsbInfo usb_info; // USB Infomation + /** + * \~english Vehicle control device file + */ + int8_t deviceFile[FILEPATH_SIZE]; // Vehicle control device file +}SS_VehicleCtrlDetectInfo; + +// Structure for audio detect info. +/** + * \~english Structure for audio detect info. + */ +typedef struct _AudioDetectInfo { + /** + * \~english Insert:TURE, Remove:FALSE + */ + BOOL bIsDeviceAvailable; + /** + * \~english USB Infomation + */ + SS_UsbInfo usb_info; + /** + * \~english Audio control device file + */ + int8_t audio_ctrl[FILEPATH_SIZE]; + /** + * \~english Audio Playback device file + */ + int8_t audio_play[FILEPATH_SIZE]; + /** + * \~english Audio Capture device file + */ + int8_t audio_capture[FILEPATH_SIZE]; +}SS_AudioDetectInfo; + +// Structure that is available when SS_DEV_DETECT_USB_DSRC_APP_EV is published. +/** + * \~english Structure that is available when SS_DEV_DETECT_USB_DSRC_APP_EV is published. + */ +typedef struct _DsrcAppDetectInfo { + /** + * \~english Insert:TURE, Remove:FALSE + */ + BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE + /** + * \~english USB Infomation + */ + SS_UsbInfo usb_info; // USB Infomation + /** + * \~english Dsrc Application device file + */ + int8_t deviceFile[FILEPATH_SIZE]; // Dsrc Application device file +}SS_DsrcAppDetectInfo; + +// Structure that is available when SS_DEV_DETECT_USB_DSRC_CTRL_EV is published. +/** + * \~english Structure that is available when SS_DEV_DETECT_USB_DSRC_CTRL_EV is published. + */ +typedef struct _DsrcCtrlDetectInfo { + /** + * \~english Insert:TURE, Remove:FALSE + */ + BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE + /** + * \~english USB Infomation + */ + SS_UsbInfo usb_info; // USB Infomation + /** + * \~english Dsrc Control device file + */ + int8_t deviceFile[FILEPATH_SIZE]; // Dsrc Control device file +}SS_DsrcCtrlDetectInfo; + +// Structure that is available when SS_DEV_DETECT_USB_IR_VICS_DATA_EV is published. +/** + * \~english Structure that is available when SS_DEV_DETECT_USB_IR_VICS_DATA_EV is published. + */ +typedef struct _IrVicsDataDetectInfo { + /** + * \~english Insert:TURE, Remove:FALSE + */ + BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE + /** + * \~english USB Infomation + */ + SS_UsbInfo usb_info; // USB Infomation + /** + * \~english Ir Vics Data device file + */ + int8_t deviceFile[FILEPATH_SIZE]; // Ir Vics Data device file +}SS_IrVicsDataDetectInfo; + +/** + * \~english USB overcurrent error info. + */ +typedef struct _UsbOverCurrentErrInfo { + /** + * \~english error port no + */ + uint8_t portNo; // error port no +} SS_UsbOverCurrentErrInfo; + +// Structure that is available when SS_DEV_INFO_USB_NOTIFY_EV is published. +/** + * \~english Structure that is available when SS_DEV_INFO_USB_NOTIFY_EV is published. + */ +typedef struct _UsbNotifyInfo { + /** + * \~english notify code + */ + SS_NOTIFY_CODE nofity_code; // notify code + /** + * \~english USB device information's availability + */ + BOOL usb_info_availability; // USB device information's availability + /** + * \~english USB device information + */ + SS_UsbInfo usb_info; // USB device information +} SS_UsbNotifyInfo; + +// Structure that is available when SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV is published. +/** + * \~english Structure that is available when SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV is published. + */ +typedef struct __CWORD57_RoleDetectInfo { + /** + * \~english Insert:TURE, Remove:FALSE + */ + BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE +} SS__CWORD57_RoleDetectInfo; + +// Structure that is available when SS_DEV_INFO_SD_FORMAT_COMP_EV is published. +/** + * \~english Structure that is available when SS_DEV_INFO_SD_FORMAT_COMP_EV is published. + */ +typedef struct _SDFormatInfo { + /** + * \~english Result of SD Format. + */ + SS_DEV_ERROR result; // Result of SD Format. +} SS_SDFormatInfo; + +#endif /* _SS_DEVICEDETECTION_SERVER_H_ */ // NOLINT (build/header_guard) + +/** @}*/ // end of device_detection_service +/** @}*/ // end of system_service +/** @}*/ // end of BaseSystem diff --git a/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_ifc.h b/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_ifc.h new file mode 100755 index 0000000..1ad7e67 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_ifc.h @@ -0,0 +1,1118 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_devicedetection_service_ifc.h + * @brief This file supports the Device Detection service interface. + */ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup device_detection_service + * @ingroup system_service + * @{ + */ +/** @addtogroup device_manager + * @ingroup device_detection_service + * @{ + */ + +#ifndef SS_DEVICE_DETECTION_SERVICE_IFC_H_ // NOLINT (build/header_guard) +#define SS_DEVICE_DETECTION_SERVICE_IFC_H_ + +#include <native_service/frameworkunified_types.h> +#include <native_service/frameworkunified_framework_types.h> +#include "system_service/ss_devicedetection_service_protocol.h" + +// CID(Card Identification Register Data)of SD/MMC card +typedef struct T_cid { + UI_8 mid; // Manufacture ID + UI_8 oid[3]; // OEM/Application ID + UI_8 pnm[6]; // Product name + UI_8 prv; // Product revision + UI_32 psn; // Product serial number + UI_16 mdt; // Manufacture date code + UI_8 cr7cs; // CRC7 Check sum +} Tcid; + +/** + * @class DeviceDetectionServiceIf + * \~english @brief Device detection + * \~english @par Brief Introduction + * Class to provide the device detection function + * + */ +class DeviceDetectionServiceIf { + public: + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup DeviceDetectionServiceIf + /// \~english @par Summary + /// Constructor of DeviceDetectionServiceIf class. + /// \~english @param None + /// \~english @retval None + /// \~english @par Preconditions + /// - None. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// None + /// \~english @par Detail + /// To generate a DeviceDetectionServiceIf class. \n + /// Member variables (m_hApp, m_hService, m_hSession) to be NULL initialization. \n + /// After the constructor, be sure to call Initialize method. + /// \~english @see ~DeviceDetectionServiceIf, Initialize + //////////////////////////////////////////////////////////////////////////////////// + DeviceDetectionServiceIf(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup ~DeviceDetectionServiceIf + /// \~english @par Summary + /// Destructor of DeviceDetectionServiceIf class. + /// \~english @param None + /// \~english @retval None + /// \~english @par Preconditions + /// - None. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// None + /// \~english @par Detail + /// To delete a DeviceDetectionServiceIf class. \n + /// Session is the case still open, to close the session.\n + /// Service is the case still open, to close the service. + /// Member variables (m_hApp, m_hService, m_hSession) to be NULL initialization. + /// \~english @see DeviceDetectionServiceIf + //////////////////////////////////////////////////////////////////////////////////// + virtual ~DeviceDetectionServiceIf(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup Initialize + /// \~english @par Summary + /// API to initialize the DeviceDetectionServiceIf class. + /// \~english @param [in] hApp + /// HANDLE - HANDLE for Application + /// \~english @retval TRUE Success + /// \~english @retval FALSE Failure + /// \~english @par Preconditions + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n + /// has been done. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// Conditions for return FALSE is as follows. + /// - NULL handle specified in the argument + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Sync only(None communication) + /// \~english @par Detail + /// Application to use the services of device_detection_service is, after generating a \n + /// DeviceDetectionServiceIf class, which is a method to be executed first. \n + /// Member variable(m_hApp) of DeviceDetectionServiceIf class initialized with hApp \n + /// that has been specified by the argument. + /// \~english @see DeviceDetectionServiceIf + //////////////////////////////////////////////////////////////////////////////////// + BOOL Initialize(HANDLE hApp); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup NotifyOnDeviceDetectionAvailability + /// \~english @par Summary + /// API to set the Callback function for Availability notification of Device Detection Service. + /// \~english @param [in] f_pCallBackFn + /// CbFuncPtr - Pointer to function callback for Device Detection Service Availability Notification + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.) + /// \~english @par Preconditions + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n + /// has been done. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Can not get the App/Thread name from HANDLE in the class member variables (m_hApp). + /// [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldParam] + /// - The acquisition of the buffer that stores the Callback information specified in the argument failed. + /// [eFrameworkunifiedStatusInvldParam] + /// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc). + /// [eFrameworkunifiedStatusFail] + /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hApp). [eFrameworkunifiedStatusInvldParam] + /// - Message queue HANDLE in HANDLE (m_hApp) of the class member variables are not appropriate(which is + /// invalid). [eFrameworkunifiedStatusInvldParam] + /// - It is not appropriate message queue name of HANDLE (m_hApp) in the class member variables(The name is + /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle] + /// - Is not a transmission type message queue type of HANDLE (m_hApp) in the class member variables. + /// [eFrameworkunifiedStatusInvldHndlType] + /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull] + /// - It is invalid transmission file descriptor of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message for + /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR] + /// - Incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Any errors occur during the transmission of a session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message for SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Method x Pub-Sub + /// \~english @par Detail + /// Which is a method to register a Callback function for the initialization of the \n + /// device_detection_service receives the timing at which the start (open) is possible \n + /// of completed service.\n + /// (Native Service of API: Use the FrameworkunifiedSubscribeNotificationsWithCallback, to register \n + /// a Callback function for Availability notification of Device Detection Service.) + /// \~english @see DetachDeviceDetectionAvailabilityCb + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus NotifyOnDeviceDetectionAvailability(CbFuncPtr f_pCallBackFn); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup NotifyOnOpenSessionAck + /// \~english @par Summary + /// API to set the Callback function for OpenSessionRequest response from the Device Detection Service. + /// \~english @param [in] f_pCallBackFn + /// CbFuncPtr - Callback function pointer for receiving the response of OpenSessionRequest + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @par Preconditions + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n + /// has been done. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldParam] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Sync only(None communication) + /// \~english @par Detail + /// To register the Callback function for receiving a response of completion of OpenSessionRequest to + /// Dispatcher. \n + /// (Native Service of API: Use the FrameworkunifiedAttachCallbackToDispatcher, to register a Callback function for receiving + /// \n + /// a response of completion of OpenSessionRequest to Dispatcher.) \n + /// On successful session establishment, the client can register for device information. + /// \~english @see DetachOpenSessionAckCb + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus NotifyOnOpenSessionAck(CbFuncPtr f_pCallBackFn); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup NotifyOnCloseSessionAck + /// \~english @par Summary + /// API to set the Callback function for CloseSessionRequest response from the Device Detection Service. + /// \~english @param [in] f_pCallBackFn + /// CbFuncPtr - Callback function pointer for receiving the response of CloseSessionRequest + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @par Preconditions + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n + /// has been done. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldParam] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Sync only(None communication) + /// \~english @par Detail + /// To register the Callback function for receiving a response of completion of CloseSessionRequest to + /// Dispatcher. \n + /// (Native Service of API: Use the FrameworkunifiedAttachCallbackToDispatcher, to register a Callback function for receiving + /// \n + /// a response of completion of CloseSessionRequest to Dispatcher.) \n + /// \~english @see DetachCloseSessionAckCb + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus NotifyOnCloseSessionAck(CbFuncPtr f_pCallBackFn); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup OpenSessionRequest + /// \~english @par Summary + /// API to perform the generation of the service/session of Device Detection Service + /// \~english @param None + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.) + /// \~english @par Preconditions + /// - SS_DeviceDetectionService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n + /// has been done, and Availability of Device Detection Service is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Service of Device Detection Service is not Availability state. [eFrameworkunifiedStatusFail] + /// - Service of Device Detection Service can not be opened (can not start). [eFrameworkunifiedStatusFail] + /// - SS_DeviceDetectionService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Is invalid transmission file descriptor of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to + /// SS_DeviceDetectionService. [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Method x Pub-Sub + /// \~english @par Detail + /// And generate the service of device_detection_service, which is a method for generating a session.\n + /// (To send the command of PROTOCOL_OPEN_SESSION_REQ to device_detection_service.)\n + /// If you already service has been created, once to close the service. + /// \~english @see CloseSessionRequest + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus OpenSessionRequest(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup DecodeOpenSessionResponse + /// \~english @par Summary + /// API to perform the generation of the service/session of Device Detection Service + /// \~english @param None + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @par Preconditions + /// - SS_DeviceDetectionService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n + /// has been done, and Availability of Device Detection Service is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hService/m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Incorrect PROTOCOL_OPEN_SESSION_ACK message length of Device Detection Service. [eFrameworkunifiedStatusFail] + /// - PROTOCOL_OPEN_SESSION_ACK message of Device Detection Service can not be acquired. [eFrameworkunifiedStatusFail] + /// - Can not session generation of message transmission to Device Detection Service. [eFrameworkunifiedStatusFail] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Sync only(None communication) + /// \~english @par Detail + /// Get the session initiation response message(PROTOCOL_OPEN_SESSION_ACK) of Device Detection \n + /// Service, and get the session ID from the message. \n + /// Acquired session ID, (after opening the message transmission queue) created after a session \n + /// of message transmission, hold as the session information in the session HANDLE (m_hSession).\n + /// of the class member variable. + /// \~english @see OpenSessionRequest, CloseSessionRequest + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus DecodeOpenSessionResponse(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup RegisterForDeviceDetectionEvent + /// \~english @par Summary + /// API to register a Callback function for receiving the timing of when an event occurs in the device. + /// \~english @param [in] f_eDevDetectEvent + /// SS_DeviceDetectionServerEvents - Event type (USB/SD/...etc event) + /// \~english @param [in] f_pCallBackFn + /// CbFuncPtr - Pointer to a callback function that corresponds to the event + /// \~english @param [in] pfilepath + /// PCSTR - Pointer to the file path name(Non-support:Be NULL) + /// \~english @par + /// Event type (enum values of SS_DeviceDetectionServerEvents) + /// - SS_DEV_DETECT_ANY_USB_EV : Notify the insertion and mount path of USB MassStorage class(USB + /// mass storage is subject) + /// - SS_DEV_DETECT_ANY_SD_EV : Notify the insertion and mount path of SD card + /// - SS_DEV_INFO_ANY_USB_EV : Notify the USB device insertion and removal detection(All USB + /// devices are subject) + /// - SS_DEV_DETECT_ANY_DISC_EV : Notify the insertion of DISC(BD, DVD, CD) and mount path of block + /// devices + /// - SS_DEV_DETECT_ANY_USB_NCM_EV : Notify the insertion and network IF name of the USB NCM class + /// device(for MirrorLink) + /// - SS_DEV_DETECT_ANY_USB__CWORD57__EV : Notify the insertion and removal and the device file name of the + /// _CWORD57_ device(Rather than the _CWORD57_ only class, the device is subject) + /// - SS_DEV_DETECT_ANY_USB_ACM_EV : Notify the insertion and removal and device file name of the USB + /// ACM class device(for DCM device) + /// - SS_DEV_DETECT_ANY_USB_DEV_MNG_EV : Notify the insertion and removal and device file name of the USB + /// DeviceManagementModel class(for DCM device) + /// - SS_DEV_DETECT_ANY_USB_VEHICLE_CTRL_EV : Notify the insertion and removal and device file name of the USB + /// Vehicle Control class(for DCM device) + /// - SS_DEV_DETECT_ANY_USB_DSRC_APP_EV : Notify the insertion and removal and device file name of the USB + /// DSRC Application class(for DSRC device) + /// - SS_DEV_DETECT_ANY_USB_DSRC_CTRL_EV : Notify the insertion and removal and device file name of the USB + /// DSRC Control class(for DSRC device) + /// - SS_DEV_DETECT_ANY_USB_IR_VICS_DATA_EV : Notify the insertion and removal and device file name of the USB + /// IR-VICS Data class(for DSRC device) + /// - SS_DEV_ERR_USB_OVER_CURRENT_EV : Notify the overcurrent detection error of USB + /// - SS_DEV_DETECT_ANY_USB_MTP_EV : Notify the insertion and mount path of USB MTP class device + /// - SS_DEV_INFO_ANY_USB_NOTIFY_EV : Notify the connection of non-compliant USB device + /// - SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV : Notify the insertion and removal of the _CWORD57_ device after + /// RoleSW(Rather than the _CWORD57_ only class, the device is subject) + /// - SS_DEV_INFO_SD_FORMAT_COMP_EV : Notify the SD format results + /// - SS_DEV_DETECT_ANY_USB_DCM_NCM_EV : Notify the insertion and removal and network IF name of the USB + /// NCM class device(for DCM) + /// - SS_DEV_INFO_ANY_USB_DVDP_EV : Notify the insertion and removal of the DVD-P device + /// \~english @par + /// For SS_DEV_INFO_ANY_USB_NOTIFY_EV, it is also notified in the event the following conditions. + /// - When the enumeration failed. + /// - When it detects the current excess of the USB device connected to the bus power HUB. + /// - When it is detected that the number of the USB device has exceeded the number of support. + /// - When it is detected that the HUB is connected beyond the HUB number that supports. + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_DeviceDetectionService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n + /// has been done, and Availability of Device Detection Service is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldParam] + /// - HANDLE in the class member variables (m_hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldParam] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_DeviceDetectionService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_DeviceDetectionService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_DeviceDetectionService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_DeviceDetectionService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to + /// SS_DeviceDetectionService. [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Pub-Sub x Pub-Sub + /// \~english @par Detail + /// Which is a method to register a callback function for receiving the timing of the \n + /// occurrence of an event in the device. \n + /// \~english @see UnRegisterForDeviceDetectionEvent + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus RegisterForDeviceDetectionEvent( + SS_DeviceDetectionServerEvents f_eDevDetectEvent, CbFuncPtr f_pCallBackFn, + PCSTR pfilepath = NULL); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup UnRegisterForDeviceDetectionEvent + /// \~english @par Summary + /// API to release a Callback function that corresponds to the event notification from the device + /// \~english @param [in] f_eDevDetectEvent + /// SS_DeviceDetectionServerEvents - Event notification type (USB/SD/...etc event) + /// \~english @par + /// Releasable event notification type (enum values of SS_DeviceDetectionServerEvents) + /// - SS_DEV_DETECT_ANY_USB_EV : Notify the insertion and mount path of USB MassStorage class(USB + /// mass storage is subject) + /// - SS_DEV_DETECT_ANY_SD_EV : Notify the insertion and mount path of SD card + /// - SS_DEV_INFO_ANY_USB_EV : Notify the USB device insertion and removal detection(All USB + /// devices are subject) + /// - SS_DEV_DETECT_ANY_DISC_EV : Notify the insertion of DISC(BD, DVD, CD) and mount path of block + /// devices + /// - SS_DEV_DETECT_ANY_USB_NCM_EV : Notify the insertion and network IF name of the USB NCM class + /// device(for MirrorLink) + /// - SS_DEV_DETECT_ANY_USB__CWORD57__EV : Notify the insertion and removal and the device file name of the + /// _CWORD57_ device(Rather than the _CWORD57_ only class, the device is subject) + /// - SS_DEV_DETECT_ANY_USB_ACM_EV : Notify the insertion and removal and device file name of the USB + /// ACM class device(for DCM device) + /// - SS_DEV_DETECT_ANY_USB_DEV_MNG_EV : Notify the insertion and removal and device file name of the USB + /// DeviceManagementModel class(for DCM device) + /// - SS_DEV_DETECT_ANY_USB_VEHICLE_CTRL_EV : Notify the insertion and removal and device file name of the USB + /// Vehicle Control class(for DCM device) + /// - SS_DEV_DETECT_ANY_USB_DSRC_APP_EV : Notify the insertion and removal and device file name of the USB + /// DSRC Application class(for DSRC device) + /// - SS_DEV_DETECT_ANY_USB_DSRC_CTRL_EV : Notify the insertion and removal and device file name of the USB + /// DSRC Control class(for DSRC device) + /// - SS_DEV_DETECT_ANY_USB_IR_VICS_DATA_EV : Notify the insertion and removal and device file name of the USB + /// IR-VICS Data class(for DSRC device) + /// - SS_DEV_ERR_USB_OVER_CURRENT_EV : Notify the overcurrent detection error of USB + /// - SS_DEV_DETECT_ANY_USB_MTP_EV : Notify the insertion and mount path of USB MTP class device + /// - SS_DEV_INFO_ANY_USB_NOTIFY_EV : Notify the connection of non-compliant USB device + /// - SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV : Notify the insertion and removal of the _CWORD57_ device after + /// RoleSW(Rather than the _CWORD57_ only class, the device is subject) + /// - SS_DEV_INFO_SD_FORMAT_COMP_EV : Notify the SD format results + /// - SS_DEV_DETECT_FILEPATHNAME_EV : Notify the specified file access in pfilepath + /// - SS_DEV_DETECT_ANY_USB_DCM_NCM_EV : Notify the insertion and removal and network IF name of the USB + /// NCM class device(for DCM) + /// - SS_DEV_INFO_ANY_USB_DVDP_EV : Notify the insertion and removal of the DVD-P device + /// \~english @par + /// For SS_DEV_INFO_ANY_USB_NOTIFY_EV, it is also notified in the event the following conditions. + /// - When the enumeration failed. + /// - When it detects the current excess of the USB device connected to the bus power HUB. + /// - When it is detected that the number of the USB device has exceeded the number of support. + /// - When it is detected that the HUB is connected beyond the HUB number that supports. + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_DeviceDetectionService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n + /// has been done, and Availability of Device Detection Service is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldParam] + /// - HANDLE in the class member variables (m_hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldParam] + /// - The service can not be determined from the HANDLE in the class member variables (m_hApp). [eFrameworkunifiedStatusFail] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_DeviceDetectionService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_DeviceDetectionService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_DeviceDetectionService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_DeviceDetectionService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to + /// SS_DeviceDetectionService. [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Pub-Sub x Pub-Sub + /// \~english @par Detail + /// Which is a method to release a callback function for receiving the timing of the \n + /// occurrence of an event in the device. \n + /// \~english @see RegisterForDeviceDetectionEvent + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus UnRegisterForDeviceDetectionEvent( + SS_DeviceDetectionServerEvents f_eDevDetectEvent); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup CloseSessionRequest + /// \~english @par Summary + /// API to perform the destruction of services/session of Device Detection Service + /// \~english @param None + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.) + /// \~english @par Preconditions + /// - SS_DeviceDetectionService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n + /// has been done, and Availability of Device Detection Service is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - SS_DeviceDetectionService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Is invalid transmission file descriptor of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to + /// SS_DeviceDetectionService. [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Method x Method + /// \~english @par Detail + /// And destruct the service of device_detection_service, which is a method for destructing a session.\n + /// (To send the command of PROTOCOL_CLOSE_SESSION_REQ to device_detection_service.)\n + /// \~english @see OpenSessionRequest + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus CloseSessionRequest(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup DetachDeviceDetectionAvailabilityCb + /// \~english @par Summary + /// API to release the Callback function for Availability notification of Device Detection Service. + /// \~english @param None + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.) + /// \~english @par Preconditions + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n + /// has been done, and Availability of Device Detection Service is TRUE. + /// - The call-back function for Availability notification has been registered. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Can not get the App/Thread name from HANDLE in the class member variables (m_hApp). + /// [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldParam] + /// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc). + /// [eFrameworkunifiedStatusFail] + /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hApp). [eFrameworkunifiedStatusInvldParam] + /// - Message queue HANDLE in HANDLE (m_hApp) of the class member variables are not appropriate(which is + /// invalid). [eFrameworkunifiedStatusInvldParam] + /// - It is not appropriate message queue name of HANDLE (m_hApp) in the class member variables(The name is + /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle] + /// - Is not a transmission type message queue type of HANDLE (m_hApp) in the class member variables. + /// [eFrameworkunifiedStatusInvldHndlType] + /// - Callback function for Availability notification is not registered. [eFrameworkunifiedStatusFail] + /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull] + /// - It is invalid transmission file descriptor of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message for + /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR] + /// - Incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Any errors occur during the transmission of a session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message for SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Sync only(None communication) + /// \~english @par Detail + /// Is a method for releasing a Callback function registered to receive the timing \n + /// initialization is completed device_detection_service + /// (Native Service of API: Use the FrameworkunifiedUnsubscribeNotificationWithCallback, to release \n + /// a Callback function for Availability notification of Device Detection Service.) + /// \~english @see NotifyOnDeviceDetectionAvailability + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus DetachDeviceDetectionAvailabilityCb(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup DetachOpenSessionAckCb + /// \~english @par Summary + /// API to release the Callback function for OpenSessionRequest response from the Device Detection Service. + /// \~english @param None + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @par Preconditions + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n + /// has been done. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldParam] + /// - Not Callback function information of the release target is present. [eFrameworkunifiedStatusFail] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Sync only(None communication) + /// \~english @par Detail + /// To cancel the Callback function for receiving a response of completion of OpenSessionRequest from + /// Dispatcher. \n + /// (Native Service of API: Use the FrameworkunifiedDetachCallbackFromDispatcher, to cancel a Callback function for receiving + /// \n + /// a response of completion of OpenSessionRequest from Dispatcher.) \n + /// \~english @see NotifyOnOpenSessionAck + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus DetachOpenSessionAckCb(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup DetachCloseSessionAckCb + /// \~english @par Summary + /// API to release the Callback function for CloseSessionRequest response from the Device Detection Service. + /// \~english @param None + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @par Preconditions + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n + /// has been done. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldParam] + /// - Not Callback function information of the release target is present. [eFrameworkunifiedStatusFail] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Sync only(None communication) + /// \~english @par Detail + /// To cancel the Callback function for receiving a response of completion of CloseSessionRequest from + /// Dispatcher. \n + /// (Native Service of API: Use the FrameworkunifiedDetachCallbackFromDispatcher, to cancel a Callback function for receiving + /// \n + /// a response of completion of CloseSessionRequest from Dispatcher.) \n + /// \~english @see NotifyOnCloseSessionAck + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus DetachCloseSessionAckCb(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup MountSD + /// \~english @par Summary + /// API to mount the specified SD partition + /// \~english @param [in] part_num + /// uint8_t - Partition number of SD card(From 0 to 3) + /// \~english @param [out] already_mounted + /// BOOL* - Mount existence result + /// \~english @par + /// - TRUE : Already mount + /// - FALSE : Mount request is accepted. Wait for mount notification. + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusAccessError Access error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.) + /// \~english @par Preconditions + /// - SS_DeviceDetectionService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n + /// has been done, and Availability of Device Detection Service is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - SD card partition number (part_num) exceeds the 3 specified by the argument. [eFrameworkunifiedStatusInvldParam] + /// - Can not have access to the device file for the SD. [eFrameworkunifiedStatusAccessError] + /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusNullPointer] + /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hSession). + /// [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) in the message queue name is NULL. + /// [eFrameworkunifiedStatusInvldHandle] + /// - Message queue HANDLE in HANDLE (m_hSession) of the class member variables are not appropriate(which is + /// invalid). [eFrameworkunifiedStatusInvldHandle] + /// - It is not appropriate message queue name of HANDLE (m_hSession) in the class member variables(The name is + /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle] + /// - Is not a transmission type message queue type of HANDLE (m_hSession) in the class member variables. + /// [eFrameworkunifiedStatusInvldHndlType] + /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull] + /// - It is invalid transmission file descriptor of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message for + /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR] + /// - Incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Any errors occur during the transmission of a session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message for SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Method only + /// \~english @par Detail + /// The API is a method used to mount the specified partition (area).\n + /// The target device is an SD card. + /// Service(Thread) to call this method is not limited. Therefore, \n + /// to be utilized as a mismatch does not occur between the service \n + /// to use the SD card. \n + /// SD card in the specified partition, already returned eFrameworkunifiedStatusOK \n + /// if mount existence results (already_mounted) in the TRUE that is mounted.\n + /// If it is not already mounted mount existence results (already_mounted) \n + /// and to FALSE, then carry out the SD of the mount request to Device \n + /// Detection Service. + /// \~english @see UmountSD, RegisterForDeviceDetectionEvent + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus MountSD(uint8_t part_num, BOOL *already_mounted); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup UmountSD + /// \~english @par Summary + /// API to mount the specified SD partition + /// \~english @param [in] part_num + /// uint8_t - Partition number of SD card(From 0 to 3) + /// \~english @param [out] already_umounted + /// BOOL* - Mount existence result + /// \~english @par + /// - TRUE : Already umount + /// - FALSE : Umount request is accepted. Wait for umount notification. + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusAccessError Access error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.) + /// \~english @par Preconditions + /// - SS_DeviceDetectionService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n + /// has been done, and Availability of Device Detection Service is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - SD card partition number (part_num) exceeds the 3 specified by the argument. [eFrameworkunifiedStatusInvldParam] + /// - Can not have access to the device file for the SD. [eFrameworkunifiedStatusAccessError] + /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusNullPointer] + /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hSession). + /// [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) in the message queue name is NULL. + /// [eFrameworkunifiedStatusInvldHandle] + /// - Message queue HANDLE in HANDLE (m_hSession) of the class member variables are not appropriate(which is + /// invalid). [eFrameworkunifiedStatusInvldHandle] + /// - It is not appropriate message queue name of HANDLE (m_hSession) in the class member variables(The name is + /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle] + /// - Is not a transmission type message queue type of HANDLE (m_hSession) in the class member variables. + /// [eFrameworkunifiedStatusInvldHndlType] + /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull] + /// - It is invalid transmission file descriptor of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message for + /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR] + /// - Incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Any errors occur during the transmission of a session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message for SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Method only + /// \~english @par Detail + /// The API is a method used to mount the specified partition (area).\n + /// The target device is an SD card. + /// Service(Thread) to call this method is not limited. Therefore, \n + /// to be utilized as a mismatch does not occur between the service \n + /// to use the SD card. \n + /// SD card in the specified partition, already returned eFrameworkunifiedStatusOK \n + /// if unmount existence results (already_unmounted) in the TRUE that is unmounted. + /// If it is not already unmounted unmount existence results (already_unmounted) \n + /// and to FALSE, then carry out the SD of the unmount request to Device \n + /// Detection Service. \n + /// That all of the services specifically, to call this API after the close \n + /// completion of the directory and file of the SD card. \n + /// Also, do not call this API in a state in which a directory on the SD card \n + /// in the current directory. (At SD drive processing threads in SS_DeviceDetectionService, \n + /// umount fails, error of SS_DEV_ERR_BUSY is returned as an asynchronous notification \n + /// events.) + /// \~english @see MountSD, RegisterForDeviceDetectionEvent + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus UmountSD(uint8_t part_num, BOOL *already_umounted); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup UsbVBusReset + /// \~english @par Summary + /// API to reset the VBUS of the specified USB port + /// \~english @param [in] port + /// uint8_t - USB port number + /// \~english @param [in] inteval + /// uint8_t - interval (interval * 100 [msec]) + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.) + /// \~english @par Preconditions + /// - SS_DeviceDetectionService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n + /// has been done, and Availability of Device Detection Service is TRUE. + /// - Checking USB port number should be done before calling this API. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Environment variable (TARGET_BOARD) is not defined. [eFrameworkunifiedStatusFail] + /// [eFrameworkunifiedStatusInvldParam] + /// - Name of the target board in the environment variable (TARGET_BOARD) is not correct. [eFrameworkunifiedStatusInvldParam] + /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusNullPointer] + /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hSession). + /// [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) in the message queue name is NULL. + /// [eFrameworkunifiedStatusInvldHandle] + /// - Message queue HANDLE in HANDLE (m_hSession) of the class member variables are not appropriate(which is + /// invalid). [eFrameworkunifiedStatusInvldHandle] + /// - It is not appropriate message queue name of HANDLE (m_hSession) in the class member variables(The name is + /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle] + /// - Is not a transmission type message queue type of HANDLE (m_hSession) in the class member variables. + /// [eFrameworkunifiedStatusInvldHndlType] + /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull] + /// - It is invalid transmission file descriptor of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message for + /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR] + /// - Incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Any errors occur during the transmission of a session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message for SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Fire and Forget only + /// \~english @par Detail + /// The API is a method for resetting the VBUS of the specified USB port.\n + /// Environment variable (TARGET_BOARD) is defined in the configure options \n + /// specified at the time of build. \n + /// (Example. TARGET_BOARD:_CWORD71__CWORD91__e2_na_t__CWORD84_2__CWORD71_) \n + /// Before reset USB port for DCM, the device files(dcm_acm, dcm_vc, dcm_wdm) \n + /// related to DCM-related must be closed. \n + /// *) Device file may not be created correctly when the process of Disconnect/Connect \n + /// without closing to work. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus UsbVBusReset(int8_t port); + EFrameworkunifiedStatus UsbVBusReset(int8_t port, uint8_t interval); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup RoleSwStateNotify + /// \~english @par Summary + /// API to notify RoleSW state + /// \~english @param [in] state + /// SS_DEV_ROLE_SW_STATE - RoleSW state + /// \~english @par + /// enum variable SS_DEV_ROLE_SW_STATE + /// - SS_DEV_ROLE_SW_START : Start + /// - SS_DEV_ROLE_SW_BEGIN_END : Beginning of End + /// - SS_DEV_ROLE_SW_END : End + /// - SS_DEV_ROLE_SW_RESTART : Restart + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle + /// \~english @retval eFrameworkunifiedStatusInvldQName Invalid Message Queue Name + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusBadConnection It can not be a socket connection + /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.) + /// \~english @par Preconditions + /// - SS_DeviceDetectionService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n + /// has been done, and Availability of Device Detection Service is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusNullPointer] + /// - It failed to open the message queue for messages received from SS_DeviceDetectionService. [eFrameworkunifiedStatusFail] + /// - It failed to buffer acquisition for messages received from SS_DeviceDetectionService(malloc failure). + /// [eFrameworkunifiedStatusFail] + /// - It failed to create a sequence ID of the message to be sent to the SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusFail] + /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hSession). + /// [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) in the message queue name is NULL. + /// [eFrameworkunifiedStatusInvldHandle] + /// - Message queue HANDLE name in the HANDLE (m_hSession) in the class member variables is NULL. + /// [eFrameworkunifiedStatusInvldQName] + /// - Message queue HANDLE name in the HANDLE (hService) in the class member variables exceeds 20byte. + /// [eFrameworkunifiedStatusInvldQName] + /// - Message queue HANDLE in HANDLE (m_hSession) of the class member variables are not appropriate(which is + /// invalid). [eFrameworkunifiedStatusInvldHandle] + /// - It is not appropriate message queue name of HANDLE (m_hSession) in the class member variables(The name is + /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle] + /// - Is not a transmission type message queue type of HANDLE (m_hSession) in the class member variables. + /// [eFrameworkunifiedStatusInvldHndlType] + /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull] + /// - It is invalid send and receive file descriptor of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the send and receive of the session message + /// for SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR] + /// - Incorrect size of the send and receive buffer of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Any errors occur during the send and receive of a session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for send and receive of the session message for + /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrOther] + /// - It failed to connect to the socket for the response message to be received from SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to wait control of the response message received from SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusFail] + /// - Interruption by the system call (signal) has occurred in wait in the response message received from + /// SS_DeviceDetectionService. [eFrameworkunifiedStatusFail] + /// - After the failure at the time of the response message received from SS_DeviceDetectionService, it failed + /// to re-connection of the Socket. [eFrameworkunifiedStatusBadConnection] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Sync x Method + /// \~english @par Detail + /// By executing this API, Device Detection Service recognizes the state \n + /// has been switched from the USB Host due to RoleSW to USB Function. \n + /// The initial state of Detection is a state(SS_DEV_ROLE_SW_END:End state) \n + /// that has not been RoleSW. \n + /// (It is a state that accepts a SS_DEV_ROLE_SW_START:Start.) + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus RoleSwStateNotify(SS_DEV_ROLE_SW_STATE state); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup FormatSD + /// \~english @par Summary + /// API to Format SD + /// \~english @param None + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusAccessError Access error occurred + /// \~english @retval eFrameworkunifiedStatusBadConnection It can not be a socket connection + /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.) + /// \~english @par Preconditions + /// - SS_DeviceDetectionService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n + /// has been done, and Availability of Device Detection Service is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Can not have access to the device file for the SD. [eFrameworkunifiedStatusAccessError] + /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusNullPointer] + /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hSession). + /// [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) in the message queue name is NULL. + /// [eFrameworkunifiedStatusInvldHandle] + /// - Message queue HANDLE in HANDLE (m_hSession) of the class member variables are not appropriate(which is + /// invalid). [eFrameworkunifiedStatusInvldHandle] + /// - It is not appropriate message queue name of HANDLE (m_hSession) in the class member variables(The name is + /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle] + /// - Is not a transmission type message queue type of HANDLE (m_hSession) in the class member variables. + /// [eFrameworkunifiedStatusInvldHndlType] + /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull] + /// - It is invalid transmission file descriptor of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message for + /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR] + /// - Incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Any errors occur during the transmission of a session message to SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message for SS_DeviceDetectionService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Detail + /// The SD card inserted into the _CWORD84_ side in this API is formatted in compliance with the SD standard.\n + /// A result of format implementation is notified by SS_DEV_INFO_SD_FORMAT_COMP_EV events.\n + /// String pickled notification content and the result is as follows.\n + /// - SS_DEV_OK : Format success \n + /// - SS_DEV_ERR_BUSY : For unmount unexecuted, format failure \n + /// - SS_DEV_ERR : Format fails for any other factors + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Method x Method + /// \~english @par + /// This API is able to call after the SD card umount completion and the device file close of \n + /// SD card is complete.\n + /// If the SD card umount of has not been completed, SS_DEV_ERR_BUSY is notified.\n + /// If the device file of the SD card has not been close, although it is the format becomes \n + /// the operation completed, there can be no assurance of the operation. + /// \~english @see MountSD, UmountSD, RegisterForDeviceDetectionEvent + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus FormatSD(void); + + private: + HANDLE OpenService(); + UI_8 Crc7Checksum(UI_8 *data, UI_8 sz); + HANDLE m_hApp; + HANDLE m_hService; + HANDLE m_hSession; + BOOL CheckDetectEvent(SS_DeviceDetectionServerEvents f_eDevDetectEvent); +}; + +#endif /* SS_DEVICE_DETECTION_SERVICE_IFC_H_ */ // NOLINT (build/header_guard) + +/** @}*/ // end of device_manager +/** @}*/ // end of device_detection_service +/** @}*/ // end of system_service +/** @}*/ // end of BaseSystem diff --git a/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_local.h b/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_local.h new file mode 100755 index 0000000..c85e6b3 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_local.h @@ -0,0 +1,37 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @brief This is local header file of Device Detection service. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_SystemServicesIf +/// \brief This file supports the Device Detection service. +/// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _SS_DEVICEDETECTION_SERVER_LOCAL_H_ // NOLINT (build/header_guard) +#define _SS_DEVICEDETECTION_SERVER_LOCAL_H_ + + +// Structure for SS_DEV_REMOUNT_PARTITION +typedef struct _RemountPatitionInfo { + unsigned long mountflags; // NOLINT (runtime/int) + CHAR deviceMountpath[FILEPATH_SIZE]; // Mount path +} SS_RemountPatitionInfo; + +#endif /* _SS_DEVICEDETECTION_SERVER_LOCAL_H_ */ // NOLINT (build/header_guard) diff --git a/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_notifications.h b/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_notifications.h new file mode 100755 index 0000000..7de03b9 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_notifications.h @@ -0,0 +1,58 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_devicedetection_service_notifications.h + * @brief This file supports the Device Detection service. + */ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup device_detection_service + * @ingroup system_service + * @{ + */ + +#ifndef SS_DEVICE_DETECTION_SERVICE_NOTIFICATIONS_H_ // NOLINT (build/header_guard) +#define SS_DEVICE_DETECTION_SERVICE_NOTIFICATIONS_H_ + +#include "system_service/ss_services.h" + +/** + * \~english SS_DeviceDetection service availability notification. + */ +#define NTFY_SS_Device_Detection_Service_Availability SS_DEV_DETECT_SRV"/Availability" + +/** + * \~english SS_DeviceDetection service USB error notification. + */ +#define NTFY_SS_Device_Detection_USB_Error SS_DEV_DETECT_SRV"/USBError" + +/** + * \~english SS_DeviceDetection service MMCSD error notification. + */ +#define NTFY_SS_Device_Detection_MMCSD_Error SS_DEV_DETECT_SRV"/MMCSDError" + +#endif /* SS_DEVICE_DETECTION_SERVICE_NOTIFICATIONS_H_ */ // NOLINT (build/header_guard) + +/** @}*/ // end of device_detection_service +/** @}*/ // end of system_service +/** @}*/ // end of BaseSystem diff --git a/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_protocol.h b/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_protocol.h new file mode 100755 index 0000000..cb54ee5 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_protocol.h @@ -0,0 +1,143 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_devicedetection_service_protocol.h + * @brief This file supports the Device Detection service. + */ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup device_detection_service + * @ingroup system_service + * @{ + */ + +#ifndef _SS_DEVICEDETECTION_SERVICE_PROTOCOL_H_ // NOLINT (build/header_guard) +#define _SS_DEVICEDETECTION_SERVICE_PROTOCOL_H_ + +#include <native_service/frameworkunified_types.h> +#include <native_service/frameworkunified_service_protocol.h> +#include "system_service/ss_devicedetection_service.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \~english Event type (USB/SD/...etc event) + */ +typedef enum _DeviceDetectionServerEvents { + /** + * \~english Notify whenever a USB MassStorage device is connected/removed + */ + SS_DEV_DETECT_ANY_USB_EV = 121, + /** + * \~english Notify whenever a SD device is connected/removed + */ + SS_DEV_DETECT_ANY_SD_EV = 122, + /** + * \~english Notify all events for all devices + */ + SS_DEV_DETECT_FILEPATHNAME_EV = 123, + /** + * \~english Notify whenever a Navi Emmc device is connected/removed + */ + SS_DEV_DETECT_ANY_EMMC_NAV_EV = 124, + /** + * \~english Notify whenever a USB device is connected/removed + */ + SS_DEV_INFO_ANY_USB_EV = 125, + /** + * \~english Notify whenever a DISC(block) device is connected/removed + */ + SS_DEV_DETECT_ANY_DISC_EV = 126, + /** + * \~english Notify whenever a USB NCM device is connected/removed + */ + SS_DEV_DETECT_ANY_USB_NCM_EV = 127, + /** + * \~english Notify whenever a USB _CWORD57_ device is connected/removed + */ + SS_DEV_DETECT_ANY_USB__CWORD57__EV = 128, + /** + * \~english Notify whenever a USB ACM device is connected/removed (for DCM) + */ + SS_DEV_DETECT_ANY_USB_ACM_EV = 129, + /** + * \~english Notify whenever a USB Device Management device is connected/removed (for DCM) + */ + SS_DEV_DETECT_ANY_USB_DEV_MNG_EV = 130, + /** + * \~english Notify whenever a USB Vics Control device is connected/removed (for DCM) + */ + SS_DEV_DETECT_ANY_USB_VEHICLE_CTRL_EV = 131, + /** + * \~english Notify whenever a USB DSRC Application device is connected/removed (for DSRC) + */ + SS_DEV_DETECT_ANY_USB_DSRC_APP_EV = 132, + /** + * \~english Notify whenever a USB DSRC Control device is connected/removed (for DSRC) + */ + SS_DEV_DETECT_ANY_USB_DSRC_CTRL_EV = 133, + /** + * \~english Notify whenever a USB IR Vics Data device is connected/removed (for DSRC) + */ + SS_DEV_DETECT_ANY_USB_IR_VICS_DATA_EV = 134, + /** + * \~english Notify whenever USB Over Current is Detected + */ + SS_DEV_ERR_USB_OVER_CURRENT_EV = 135, + /** + * \~english Notify whenever USB MTP Device is Detected + */ + SS_DEV_DETECT_ANY_USB_MTP_EV = 136, + /** + * \~english Notify whenever USB Authentication Error Notify + */ + SS_DEV_INFO_ANY_USB_NOTIFY_EV = 137, + /** + * \~english Notify whenever a USB _CWORD57_ device is connected/removed after RoleSW. + */ + SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV = 138, + /** + * \~english Notify whenever SD is formated. + */ + SS_DEV_INFO_SD_FORMAT_COMP_EV = 139, + /** + * \~english Notify whenever a USB NCM device is connected/removed (for DCM) + */ + SS_DEV_DETECT_ANY_USB_DCM_NCM_EV = 140, + /** + * \~english Notify whenever a DVD-P device is connected/removed + */ + SS_DEV_INFO_ANY_USB_DVDP_EV = 141, +} SS_DeviceDetectionServerEvents; + +#ifdef __cplusplus +} +#endif + +#endif /* _SS_DEVICEDETECTION_SERVICE_PROTOCOL_H_ */ // NOLINT (build/header_guard) + +/** @}*/ // end of device_detection_service +/** @}*/ // end of system_service +/** @}*/ // end of BaseSystem diff --git a/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_protocol_local.h b/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_protocol_local.h new file mode 100755 index 0000000..4b7be37 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_protocol_local.h @@ -0,0 +1,69 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_SystemServicesIf +/// \brief This file supports the Device Detection service. +/// +/////////////////////////////////////////////////////////////////////////////// +/** + * @file + */ +#ifndef _SS_DEVICEDETECTION_SERVICE_PROTOCOL_LOCAL_H_ // NOLINT (build/header_guard) +#define _SS_DEVICEDETECTION_SERVICE_PROTOCOL_LOCAL_H_ + + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum _DeviceDetectionServerProtocol { + SS_DEV_DETECT_GET_APP_INFO = 0x10, /// client to service: not really needed + SS_DEV_DETECT_RETURN_APP_INFO = 0x11, /// service to client: not really needed + SS_UDEV_DEV_DETECT_INFO = 0x12, /// UDEV to service: device detect info sent to service + SS_UDEV_DEV_DETECT_FILEPATHNAME_INFO = 0x13, /// File pathname info cmd + SS_REGISTER_FILEPATHNAME = 0x14, /// Register file pathname cmd + SS_BSP_DEV_DETECT_ERR_INFO = 0x15, /// BSP / MCD device insert/removal/mount error report. + SS_REGISTER_DETECT_EVENT = 0x16, /// Register DeviceDetection Event + SS_UDEV_DEV_DEVICE_INFO = 0x17, /// UDEV to service: device info sent to service + SS_UDEV_DEV_DETECT_NCM_INFO = 0x18, /// UDEV to service: detect ncm sent to service + SS_UDEV_DEV_DETECT__CWORD57__INFO = 0x19, /// UDEV to service: detect _CWORD57_ sent to service + SS_UDEV_DEV_DETECT_ACM_INFO = 0x1a, /// UDEV to service: detect ACM sent to service + SS_UDEV_DEV_DETECT_MNG_INFO = 0x1b, /// UDEV to service: detect DeviceManagementModel sent to service + SS_UDEV_DEV_DETECT_VEHICLE_CTRL_INFO = 0x1c, /// UDEV to service: detect Vehicle Control sent to service + SS_UDEV_DEV_DETECT_DSRCCTL_INFO = 0x1d, /// UDEV to service: detect DSRC Application sent to service + SS_UDEV_DEV_DETECT_DSRCAPP_INFO = 0x1e, /// UDEV to service: detect DSRC Control sent to service + SS_UDEV_DEV_DETECT_IRVICS_DATA_INFO = 0x1f, /// UDEV to service: detect IR-VICS Data sent to service + SS_DETECT_USB_OVC_ERR = 0x20, /// USB Monitor OVC to service: detect OverCurrent Error + SS_UDEV_DEV_DETECT_MTP_INFO = 0x21, /// UDEV to service: detect MTP Device + SS_DEV_MOUNT_SD = 0x22, /// client to service: mount SD partion + SS_DEV_UMOUNT_SD = 0x23, /// client to service: umount SD partion + SS_DEV_REMOUNT_PARTITION = 0x24, /// client to service: Remount partion + SS_UNREGISTER_DETECT_EVENT = 0x25, /// UnRegister DeviceDetection event + SS_USB_VBUS_RESET = 0x26, /// client to service: USB Vbus Reset + SS_UDEV_USB_AUTHENTICATION_ERR_INFO = 0x27, /// USB Monitor to service: USB Authentication Error Notify + SS_UDEV_DEV_DETECT_USB_FUNC_INFO = 0x28, /// USB Monitor to service: detect USB Func to service + SS_DEV_ROLE_SW_STATE_NOTIFY = 0x29, /// client to service: notify RoleSw state + SS_DEV_FORMAT_SD = 0x2a, /// client to service: Format SD + SS_INFO_FORMAT_SD = 0x2b, /// SDDRV to service: Infomation Format SD result +}SS_DeviceDetectionServerProtocol; + +#ifdef __cplusplus +} +#endif + +#endif /* _SS_DEVICEDETECTION_SERVICE_PROTOCOL_LOCAL_H_ */ // NOLINT (build/header_guard) + diff --git a/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_types.h b/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_types.h new file mode 100755 index 0000000..c5ab1c3 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_types.h @@ -0,0 +1,186 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_devicedetection_service_types.h + * @brief This file supports the Device Detection service. + */ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup device_detection_service + * @ingroup system_service + * @{ + */ + +#ifndef SS_DEVDETECT_TYPES_H_ // NOLINT (build/header_guard) +#define SS_DEVDETECT_TYPES_H_ + +/** + * \~english Deive type(eUSB,eSD...) + */ +typedef enum _DeviceType { + /** + * \~english USB + */ + eUSB, + /** + * \~english SD + */ + eSD, + /** + * \~english EMMC + */ + eMMC, + /** + * \~english DISC + */ + eDISC, + /** + * \~english MTP + */ + eMTP +} EDEVICE_TYPE; + +/** + * \~english Action result + */ +typedef enum _SsDevError { + /** + * \~english success + */ + SS_DEV_OK, + /** + * \~english error + */ + SS_DEV_ERR, + /** + * \~english mount error + */ + SS_DEV_ERR_MOUNT, + /** + * \~english device busy + */ + SS_DEV_ERR_BUSY, +} SS_DEV_ERROR; + +/** + * \~english USB port + */ +typedef enum _USBPort { + /** + * \~english USB0(IF-BOX) + */ + SS_DEV_USB_PORT0, // IF-BOX + /** + * \~english USB1(DCM) + */ + SS_DEV_USB_PORT1, // DCM + /** + * \~english USB2(DSRC/ETC) + */ + SS_DEV_USB_PORT2, // DSRC/ETC + /** + * \~english USB3(External deck) + */ + SS_DEV_USB_PORT3, // External DECK + /** + * \~english USB4(Drive recorder) + */ + SS_DEV_USB_PORT4, // Supplies drive recorder + /** + * \~english USB number max. + */ + SS_DEV_USB_MAX // MAX +} SS_DEV_USBPORT; + +/** + * \~english notify code + */ +typedef enum SsNotifyCode { + /** + * \~english Unsupport USB device + */ + SS_DEV_UNSUPPORT_USB, // Un support USB device + /** + * \~english The connected device has no response. + */ + SS_DEV_NON_RESPONSE_USB, // Enemuration Error + /** + * \~english It detects a USB device of current excess that has been connected to the bus power HUB. + */ + SS_DEV_HIGH_POWER_USB, // It detects a USB device of current excess that + // has been connected to the bus power HUB. + /** + * \~english Over support USB(3 or more units) + */ + SS_DEV_OVER_SUPPORT_USB, // Over support USB(3 or more units) + /** + * \~english Over number of USB HUB(2 or more units) + */ + SS_DEV_OVER_NUM_USB_HUB, // Over number of USB HUB(2 or more units) +} SS_NOTIFY_CODE; + +/** + * \~english RoleSw state + */ +typedef enum _SsDevRoleSwState { + /** + * \~english start + */ + SS_DEV_ROLE_SW_START, + /** + * \~english begin end + */ + SS_DEV_ROLE_SW_BEGIN_END, + /** + * \~english end + */ + SS_DEV_ROLE_SW_END, + /** + * \~english restart + */ + SS_DEV_ROLE_SW_RESTART, +} SS_DEV_ROLE_SW_STATE; + +/** + * \~english Disc Type(eCD, eDVD, eBD) + */ +typedef enum _DiscType { + /** + * \~english CD + */ + eCD, + /** + * \~english DVD + */ + eDVD, + /** + * \~english BD + */ + eBD, +} EDISC_TYPE; + +#endif /* SS_DEVDETECT_TYPES_H_ */ // NOLINT (build/header_guard) + +/** @}*/ // end of device_detection_service +/** @}*/ // end of system_service +/** @}*/ // end of BaseSystem diff --git a/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_types_local.h b/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_types_local.h new file mode 100755 index 0000000..dafd4d4 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_devicedetection_service_types_local.h @@ -0,0 +1,44 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_SystemServicesIf +/// \brief This file supports the Device Detection service. +/// +/////////////////////////////////////////////////////////////////////////////// +/** + * @file + */ +#ifndef SS_DEVDETECT_TYPES_LOCAL_H_ // NOLINT (build/header_guard) +#define SS_DEVDETECT_TYPES_LOCAL_H_ + +/** + * \~english Service state. + */ +typedef enum _ServiceStatus { + eInit, //!< \~english Initialize. + ePre, //!< \~english In-vehicle. + eBackground, //!< \~english Background boot. + eStart, //!< \~english Normal boot. + eStop, //!< \~english Stop. +} ESERVICESTATUS; + +typedef enum _USBMount { + SS_DEV_RO, // Read Only + SS_DEV_RW // Read/Write +} SS_DEV_USB_REMOUNT; + +#endif /* SS_DEVDETECT_TYPES_LOCAL_H_ */ // NOLINT (build/header_guard) diff --git a/service/system/interface_unified/library/include/system_service/ss_error_event_common.h b/service/system/interface_unified/library/include/system_service/ss_error_event_common.h new file mode 100755 index 0000000..ce7677f --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_error_event_common.h @@ -0,0 +1,111 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_error_event_common.h + * @brief This file supports SM logging. + */ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ + +#ifndef __SS_ERROR_EVENT_COMMON_H__ // NOLINT (build/header_guard) +#define __SS_ERROR_EVENT_COMMON_H__ + +#include <native_service/frameworkunified_types.h> // added for test build + + +// Do not change enumeration order. +// HMI hard codes error event square +// colors based on expected enum order. +enum EErrorEventType { + eErrorEventTypeProcessCrash = 0, + eErrorEventTypeHeartBeatFailure, + eErrorEventTypeSystemLowMemory, + eErrorEventTypeReserved1, // Formerly SS_SM_EVENT_ERROR_HIGH_CPU_LOAD, now HMI enum place holder. + eErrorEventTypeUserInvokedUserForceReset, + eErrorEventTypeReserved2, + eErrorEventTypeReserved3, + eErrorEventTypeUserInvokedCollectAllLogs, + eErrorEventTypeBootMicroReset, + eErrorEventTypeProcessExit, + eErrorEventTypeUserInvokedCollectScreenShot, + eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs, + eErrorEventTypeEelExport, + eErrorEventTypeInterfaceunifiedEmmcLogs, + eErrorEventTypeDiagEvent, + eErrorEventTypeCanEvent, + eErrorEventTypeDtcEvent, + eErrorEventTypeModConnFailed, + eErrorEventTypeStartRespFailed, + eErrorEventTypeUserInvokedCollectDevLogs, + eErrorEventTypeModuleInvokedResetRequest, + eErrorEventTypeModuleInvokedCollectDebugLogs, + eErrorEventTypeUserInvokedClearLogs, + eErrorEventTypeUserInvokedCollectNaviLog, + eErrorEventTypeGroupRelaunch, + eErrorEventTypeMaxValue +}; + +/* Value range of EArtifactId must be defined within 32, */ +/* because of it's definition is used by 4byte bitmask. */ +enum EArtifactId { + eArtifactIdInterfaceunifiedDebugLog = 0, + eArtifactIdTransmitLog, + eArtifactIdPerformanceLog, + eArtifactIdBootMicroLog, + eArtifactIdSystemDataCsv, + eArtifactIdShowMemTxt, // << ID 5 + eArtifactIdProcessCore, + eArtifactIdDebugDumpLog, + eArtifactIdKernelLog, + eArtifactIdDRInitialLog, + eArtifactIdDRLocationLog, // << ID 10 + eArtifactIdCpuHighLoadMonteCarloLogs, + eArtifactIdMetaCoreLogs, + eArtifactIdCmsLogs, + eArtifactIDInternalDTC, + eArtifactIdComDebugLog, // << ID 15 + eArtifactIdKernelBootLog, + eArtifactIdPstoreLog, + eArtifactIdClearAllLog, + eArtifactIdNaviLog, + eArtifactIdScreenShot, // These three Log entries have to remain + eArtifactIdDebugFolder2Content, // at the end of the list + eArtifactIdDebugFolderContent, + eArtifactIdMaxValue // << 23 +}; + +struct ARTIFACT_RESPONSE { + EArtifactId ArtifactId; + CHAR FilePathAndName[MAX_PATH_LENGTH]; +}; + + +#endif /* __SS_ERROR_EVENT_COMMON_H___ */ // NOLINT (build/header_guard) + +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_error_event_common_local.h b/service/system/interface_unified/library/include/system_service/ss_error_event_common_local.h new file mode 100755 index 0000000..47da0d3 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_error_event_common_local.h @@ -0,0 +1,63 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_error_event_common_local.h + * @brief This file supports SM logging. + */ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ + +#ifndef __SS_ERROR_EVENT_COMMON_LOCAL_H__ // NOLINT (build/header_guard) +#define __SS_ERROR_EVENT_COMMON_LOCAL_H__ + +#define SS_ERROR_EVENT_START_REQ_TO_SEC (5) +#define SS_ERROR_EVENT_DEBUG_DUMP_RSPN_TO_SEC (1) +#define SS_ERROR_EVENT_BOOT_MICRO_LOG_RESPONSE_TO_SEC (2) +#define SS_ERROR_EVENT_CORE_FILE_POLL_TO_MS (100) + +// Do not change enumeration order. +// HMI hard codes error event square +// colors based on expected enum order. +enum EErrorEventPrio { /* Higher number = higher priority. */ + eErrorEventPrioDiagLogRequest = 8, + eErrorEventPrioUserInvokedCollectAllLogs = 7, + eErrorEventPrioUserInvokedCollectScreenShot = 6, + eErrorEventPrioUserInvokedCollectInterfaceunifiedLogs = 5, + eErrorEventPrioModuleInvokedCollectDebugLogs = 4, + eErrorEventPrioUserInvokedUserForceReset = 3, + eErrorEventPrioEelStorageFilePresent = 2, + eErrorEventPrioEmmcLogsFilePresent = 1, + eErrorEventPrioDefault = 0 +}; + + +#endif /* __SS_ERROR_EVENT_COMMON_LOCAL_H__ */ // NOLINT (build/header_guard) + +/** @}*/ +/** @}*/ +/** @}*/ + diff --git a/service/system/interface_unified/library/include/system_service/ss_error_message.h b/service/system/interface_unified/library/include/system_service/ss_error_message.h new file mode 100755 index 0000000..e810d7b --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_error_message.h @@ -0,0 +1,40 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file ss_error_message.h + * @brief \~english This file contains declaration of system error message + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#ifndef _SS_ERROR_MESSAGE_H_ // NOLINT (build/header_guard) +#define _SS_ERROR_MESSAGE_H_ + +#define SS_ERROR_MSG_USB_DISCON "UsbDisconnected" +#define SS_ERROR_MSG__CWORD84__ABNORMAL_SHUTDOWN "_CWORD84_AbnormalShutdown" + +#endif // NOLINT (build/header_guard) +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_heartbeat_if.h b/service/system/interface_unified/library/include/system_service/ss_heartbeat_if.h new file mode 100755 index 0000000..e5a94e5 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_heartbeat_if.h @@ -0,0 +1,165 @@ +/** + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_heartbeat_if.h + * @brief \~english This file supports the System Manager Heartbeat Service. + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#ifndef SS_HEARTBEAT_IF_H_ // NOLINT (build/header_guard) +#define SS_HEARTBEAT_IF_H_ + +#include <string> + +typedef struct { + BOOL fAvailable; + HANDLE hService; + std::string szServiceName; +}THeartBeatSession; + + +class CHeartBeatServiceIf { + public: + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup SS_SystemManager + /// \~english @par Summary + /// Constructor of CHeartBeatServiceIf class. + /// \~english @param [in] avail + /// BOOL avail - default value of HBSession available + /// \~english @param [in] service + /// HANDLE service - set default value of Service handle + /// \~english @param [in] name + /// PSTR name - set application name used by client + /// \~english @retval None + /// \~english @par Preconditions + /// - None. + /// \~english @par Change of the internal state + /// - Change of internal state according to the API does not occur. + /// \~english @par Causes of failures + /// None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// None + /// \~english @par Detail + /// Constructor of CHeartBeatServiceIf class. \n + /// variables (g_tHeartBeatSession) to be initialization. + /// \~english @see ~CHeartBeatServiceIf + //////////////////////////////////////////////////////////////////////////////////// + CHeartBeatServiceIf(BOOL avail, HANDLE service, PCSTR name); + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup SS_SystemManager + /// \~english @par Summary + /// Destructor of CHeartBeatServiceIf class. + /// \~english @param None + /// \~english @retval None + /// \~english @par Preconditions + /// - None. + /// \~english @par Change of the internal state + /// - Change of internal state according to the API does not occur. + /// \~english @par Causes of failures + /// None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// None + /// \~english @par Detail + /// To delete a CHeartBeatServiceIf class. \n + /// pHeartBeatServiceIf is not NULL, to delete it.\n + /// \~english @see CHeartBeatServiceIf + //////////////////////////////////////////////////////////////////////////////////// + virtual ~CHeartBeatServiceIf(); + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup SS_SystemManager + /// \~english @par Summary + /// Subscribe hApp to message queue of the HeartBeat client application. + /// \~english @param [in] f_hApp + /// HANDLE - Handle to message queue of the HeartBeat client application. + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.) + /// \~english @par Preconditions + /// \~english @par Change of the internal state + /// - Change of internal state according to the API does not occur. + /// \~english @par Conditions of processing failure + /// - Pointer (pNtfyHandler) is NULL to the structure of the Notification Handler specified in the argument. + /// [eFrameworkunifiedStatusInvldParam] + /// - Notification Handler number specified in the argument (uiHandlerCount) 0. [eFrameworkunifiedStatusInvldParam] + /// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam] + /// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam] + /// - Notification Handler number specified in the argument (uiHandlerCount) has exceeded the maximum number of + /// Notification. [eFrameworkunifiedStatusFail] + /// - The acquisition of the buffer for storing a plurality of information of Notification Handler specified by + /// the argument has failed. [eFrameworkunifiedStatusInvldParam] + /// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc). + /// [eFrameworkunifiedStatusFail] + /// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam] + /// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid). + /// [eFrameworkunifiedStatusInvldParam] + /// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more + /// than 20byte) [eFrameworkunifiedStatusInvldHandle] + /// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission. + /// [eFrameworkunifiedStatusInvldHndlType] + /// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull] + /// - It is invalid transmission file descriptor of the session message to the NPP Service. + /// [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message for + /// the NPP Service. [eFrameworkunifiedStatusErrNoEINTR] + /// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize] + /// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message for the NPP Service. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// None + /// \~english @par Detail + /// Subscribe hApp to message queue of the HeartBeat client application. \n + /// if service hApp is NULL and hApp is not be Subscribed,return eFrameworkunifiedStatusNullPointer.\n + /// if service hApp is Subscribe to Heartbeat Serivceand hApp is not NULL,then subscribe hApp to message + /// queue of the HeartBeat client application. + /// \~english @see FrameworkunifiedGetAppName FrameworkunifiedSubscribeNotificationsWithCallback + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus OnHeartBeatRequest(HANDLE hApp); + + private: + THeartBeatSession g_tHeartBeatSession; + + + friend EFrameworkunifiedStatus DBG_CloseHeatBeat(HANDLE hApp); +}; + +#endif /* SS_HEARTBEAT_IF_H_ */ // NOLINT (build/header_guard) +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_heartbeat_notifications.h b/service/system/interface_unified/library/include/system_service/ss_heartbeat_notifications.h new file mode 100755 index 0000000..8b25fe1 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_heartbeat_notifications.h @@ -0,0 +1,46 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_heartbeat_notifications.h + * @brief This file supports the System Manager Heartbeat Service. + */ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup system_manager + * @ingroup system_service + * @{ + */ + +#ifndef SS_HEARTBEAT_NOTIFICATIONS_H_ // NOLINT (build/header_guard) +#define SS_HEARTBEAT_NOTIFICATIONS_H_ + +#include "system_service/ss_services.h" + +/// Indicates if HeartBeat is available or unavailable +#define NTFY_HeartBeatAvailability SERVICE_HEARTBEAT"/Availability" + +#endif /* SS_HEARTBEAT_NOTIFICATIONS_H_ */ // NOLINT (build/header_guard) + +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_heartbeat_service_protocol.h b/service/system/interface_unified/library/include/system_service/ss_heartbeat_service_protocol.h new file mode 100755 index 0000000..6d31d04 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_heartbeat_service_protocol.h @@ -0,0 +1,72 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +////////////////////////////////////////////////////////////////////////////////////////////////// +/// Handle HeartBeat Module Start and Stop notifications. +////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * @file ss_heartbeat_service_protocol.h + * @brief API Header for HeartBeat messages used by senders and receivers. + * + * Declares the external Protocol messages to the HeartBeat. + */ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup system_manager + * @ingroup system_service + * @{ + */ + +#ifndef SS_HEARTBEAT_SERVICE_PROTOCOL_H_ // NOLINT (build/header_guard) +#define SS_HEARTBEAT_SERVICE_PROTOCOL_H_ + +#include <native_service/frameworkunified_types.h> +#include <native_service/frameworkunified_service_protocol.h> + + +/// \brief HeatBeat Protocol Command +/// heartbeat service protocol --> define all protocol messages in and out of heart beat thread +/// that are pertinent to the functionality offered by heart beat thread. +typedef enum T_SMHBProtocolMessages { + // Diagnostic Protocol + SS_HEARTBEAT_PRINT_CONNECTIONS = 0x32, ///< client to hb thread + SS_HEARTBEAT_PRINT_STACK = 0x33, ///< client to hb thread + SS_HEARTBEAT_PERIODIC_STATUS_REQ = 0xD0, ///< sysmgr to hb thread + SS_HEARTBEAT_PERIODIC_RESP = 0xD1, ///< hb thread to sysmgr + SS_HEARTBEAT_START = 0xD2, ///< sysmgr to hb thread + SS_HEARTBEAT_STOP = 0xD3, ///< sysmgr to hb thread + SS_HEARTBEAT_DELETE_MODULE_ENTRY = 0xD5, ///< sysmgr to hb thread + SS_HEARTBEAT_MSG_CATEGORY_REPORT = 0xD6, ///< report message + SS_HEARTBEAT_ERROR_DETECTED = 0xD8, ///< hb thread to sysmgr + SS_HEARTBEAT_APPEND_MODULE_ENTRY = 0xD9, ///< sysmgr to hb thread + SS_HEARTBEAT_AVAIL_CHECK_REQ = 0xDA, ///< sysmgr to hb thread + SS_HEARTBEAT_AVAIL_CHECK_RESP = 0xDB, ///< sysmgr to hb thread + SS_HEARTBEAT_RESPONSE = 0xE0, ///< client to hb thread + SS_HEARTBEAT_REQUEST = 0xE1 ///< hb thread to client +}EHBProtocolMessages; + +#endif /* SS_HEARTBEAT_SERVICE_PROTOCOL_H_ */ // NOLINT (build/header_guard) + +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_last_to_order.h b/service/system/interface_unified/library/include/system_service/ss_last_to_order.h new file mode 100755 index 0000000..5a3b8b0 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_last_to_order.h @@ -0,0 +1,58 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file ss_last_to_order.h + * @brief \~english This file contains declaration of enum SS_CONT_CATEGORY_t and api convert lastinfo to order + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#ifndef _SS_CONTID_TO_ORDER_H_ // NOLINT (build/header_guard) +#define _SS_CONTID_TO_ORDER_H_ + +#include <stdint.h> +#include <native_service/frameworkunified_types.h> +#include <map> +#include <string> + +typedef enum { + SS_CCAT_F_VIDEO, + SS_CCAT_F_SUB_VIDEO, + SS_CCAT_F_AUDIO, + SS_CCAT_R_VIDEO, + SS_CCAT_R_AUDIO, + SS_CCAT_MAX, +}SS_CONT_CATEGORY_t; + +typedef std::string SS_CONTENT_NAME_t; + +typedef std::map<SS_CONT_CATEGORY_t, SS_CONTENT_NAME_t> SS_LAST_INFO_t; + +EFrameworkunifiedStatus SS_ConvLastInfoToOrder(SS_LAST_INFO_t &curLastMode, std::string &order, const char* p_cfgPath = NULL); //NOLINT (runtime/references) + + +#endif // NOLINT (build/header_guard) +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_logger_service.h b/service/system/interface_unified/library/include/system_service/ss_logger_service.h new file mode 100755 index 0000000..67ecb08 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_logger_service.h @@ -0,0 +1,255 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_logger_service.h + * @brief \~english This file supports the the Logger Service. + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#ifndef SS_LOGGER_SERVICE_H_ // NOLINT (build/header_guard) +#define SS_LOGGER_SERVICE_H_ + + +#include <native_service/frameworkunified_types.h> + +#define MAX_STATISTICAL_BUFFER 240 + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Shared Memory names +/////////////////////////////////////////////////////////////////////////////// +#define SHMEM_DRLOCATIONLOG "/DRLocationLog" + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Shared Memory names +/////////////////////////////////////////////////////////////////////////////// +#define SHMEM_DRINITIALLOG "/DRInitialLog" + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief VIN numbers +/////////////////////////////////////////////////////////////////////////////// +typedef struct _TVINnumber { + static const UI_8 VIN_LEN = 18; + CHAR VINstr[VIN_LEN]; +} STVIN_NUMBER; + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief CAN Diagnostic status data +/////////////////////////////////////////////////////////////////////////////// +typedef struct _TInterfaceunifiedCANMileageInfo { + UI_8 DidA_ExtTest_Pres; + UI_8 EngRun_Stat; + UI_8 Odo_MSB_H; + UI_8 Odo_MSB_L; + UI_8 Odo_LSB_H; + UI_8 Odo_LSB_L; + UI_8 PN14_SupBat_Volt; +} STLOGGER_CANDIAGSTAT; + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief CAN current date and time +/////////////////////////////////////////////////////////////////////////////// +/** +* @struct __CWORD62_DateAndTime +* @brief \~english CAN current date and time +*/ +typedef struct __CWORD62_DateAndTime { + UI_8 DateTime_Stat; /*!< \~english Date time status*/ + UI_8 DateTimeDay; /*!< \~english Date*/ + UI_8 DateTimeHour; /*!< \~english Hour*/ + UI_8 DateTimeMinute; /*!< \~english Minute*/ + UI_8 DateTimeMonth; /*!< \~english Month*/ + UI_8 DateTimeSecond; /*!< \~english Second*/ + UI_8 DateTimeYear; /*!< \~english Year*/ + UI_8 TimeFormat; /*!< \~english Format*/ +}STCanCurrentDateTime; + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Logger Device Type +/////////////////////////////////////////////////////////////////////////////// +typedef enum _ELoggerDeviceTypes { + eDevUSB1, + eDevUSB2, + eDevSD, + eTotalDevicesTypes, + eInvalid_DevType +}EDEV_TYPE; + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Logger State +/////////////////////////////////////////////////////////////////////////////// +typedef enum _ELoggerState { + eDeactivate, + eActivate, + eInvalid_LoggerState +}ELOGGER_STAT; + +typedef enum _ELoggerErrorCodes { + eSelectedDeviceNotFound = 0x0001, + eWriteToDeviceFailed = 0x0002, + eScreenCaptureFailed = 0x0003, + eScreenCaptureSaveTimeExpired = 0x0004, + eScreenCaptureStoreTimeExpired = 0x0005, + eNoLogToStore = 0x0006, +}ELOGGERERR_CODES; + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Screen Capture Event data +/////////////////////////////////////////////////////////////////////////////// +typedef struct _TInterfaceunifiedScreenCaptureEvt { + static const UI_16 STR_BUFF_LEN = 64; + BOOL fSucessful; + UI_32 uiSceenShotId; + CHAR strNameAndLocation[STR_BUFF_LEN]; + UI_32 uiFaultReasonCode; +}STScreenCaptureEvt; + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief USB source number to store event logs. +/////////////////////////////////////////////////////////////////////////////// +typedef enum _EEventLoggerUSBDeviceNumber { + USB0 = 0, + USB1 = 1, + SD = 2 +}EEvtLogUSBDevNumber; + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief USB source number to store emergency error logs. +/////////////////////////////////////////////////////////////////////////////// +typedef enum _EDevNumber { + eEEL_USB1 = 1, + eEEL_USB2 = 2, + eEEL_SD = 3 +}EDevNumber; + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Counter group ID. +/////////////////////////////////////////////////////////////////////////////// +typedef enum _ECounterGroupID { + STARTUP_SHUTDOWN_COUNTER_GROUP = 0x01, + APP_USAGE_COUNTER_GROUP, + F_BLK_STABILITY_COUNTER_GROUP, + MAX_COUNTER_GROUP +}EStatCounterGroupID; + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Statistical counter. +/////////////////////////////////////////////////////////////////////////////// +typedef struct _SStatisticalCounter { + UI_16 u16StartupCounterLength; ///< No of Counter from startup phase + UI_16 u16NormalCounterLength; ///< No of Counter from Normal phase + UI_16 u16ShutDownCounterLength; ///< No of Counter from Shut down phase + UI_8 StatisticalCountBuffer[MAX_STATISTICAL_BUFFER]; ///< Counter values for startup,normal and shutsown phases +}SStatisticalCounter; + +typedef enum _EEventLoggerSuccessCode { + COPY_EVT_USB_SUCCESS = 0x20, + CLEAR_EVENT_LOG_SUCCESS = 0x21, + STATISTICAL_COUNTER_READ_SUCCESS = 0x22 +}EEvtLoggerSuccessCode; + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Event Logger error code +/////////////////////////////////////////////////////////////////////////////// +typedef enum _EEventLoggerErrorCode { + USB_DEVICE_NOT_AVAILABLE = 0x10, + USB_DEVICE_WRITE_ERROR = 0x11, + CLEAR_EVENT_LOG_FAILED = 0x12, + STATISTICAL_COUNTER_READ_FAILED = 0x13, + NO_ERROR_INFO = 0x14 +}EEvtLoggerErrorCode; + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Emergency Log error code +/////////////////////////////////////////////////////////////////////////////// +typedef enum _EEmergencyLogErrorCode { + eDEVICE_NOT_AVAILABLE = 0x10, + eDEVICE_WRITE_ERROR = 0x11, + eNO_ERROR_INFO = 0x12 +}EELL_ErrorCode; + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Event logger common information +/////////////////////////////////////////////////////////////////////////////// +typedef struct _SEventLoggerCommonInfo { + UI_8 BodyCAN_Stat:4; + UI_8 HeadUnitCAN_Stat:4; + UI_8 HMIInteraction:4; + UI_8 IGN_Status:4; + UI_8 FOT_Temp:2; + UI_8 SystemVoltage:6; +}STEventLoggerCommonInfo; + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Event logger resets counter information +/////////////////////////////////////////////////////////////////////////////// +typedef struct _SEventLoggerResetInfo { + UI_8 _CWORD56__ResetInfo; + UI_8 _CWORD102__ResetInfo; +}STEventLoggerResetInfo; + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Event logger _CWORD56_ events information +/////////////////////////////////////////////////////////////////////////////// +typedef struct _SEventLoggerEventInfo { + UI_8 NumberOfEvents; + UI_8 EventGroup; + UI_8 EventIdentifier; + UI_8 EventData[4]; +}STEventLoggerEventInfo; + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Event logger CAN events information +/////////////////////////////////////////////////////////////////////////////// +typedef struct _SEventCANLoggerEventInfo { + BOOL success; + BOOL valid; + UI_32 triggerNumber; + STCanCurrentDateTime dateAndTime; +}STEventCANLoggerEventInfo; + +#endif /* SS_LOGGER_SERVICE_H_ */ // NOLINT (build/header_guard) +/** @}*/ +/** @}*/ +/** @}*/ + diff --git a/service/system/interface_unified/library/include/system_service/ss_logger_service_ifc.h b/service/system/interface_unified/library/include/system_service/ss_logger_service_ifc.h new file mode 100755 index 0000000..2646c73 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_logger_service_ifc.h @@ -0,0 +1,1865 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_logger_service_ifc.h + * @brief \~english This file supports the the Logger Service. + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup logger_service + * @ingroup system_service + * @{ + */ + +#ifndef SS_LOGGER_SERVICE_IFC_H_ // NOLINT (build/header_guard) +#define SS_LOGGER_SERVICE_IFC_H_ + +#include <native_service/frameworkunified_types.h> +#include <native_service/frameworkunified_framework_types.h> +#include "system_service/ss_logger_service.h" +#include "system_service/ss_logger_service_protocol.h" + +/** + * @class LoggerServiceIf + * \~english @brief logger_service + * \~english @par Brief Introduction + * Class to provide LoggerServiceIf + * + */ +class LoggerServiceIf { + public: + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup LoggerServiceIf + /// \~english @par Summary + /// Constructor of LoggerServiceIf class. + /// \~english @param None + /// \~english @retval None + /// \~english @par Preconditions + /// - None. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// None + /// \~english @par Detail + /// To generate a LoggerServiceIf class, and initialize member variables(m_hApp, m_hService, m_hSession) to be + /// NULL. \n + /// After the constructor, be sure to call the Initialize. + /// \~english @see ~LoggerServiceIf, Initialize + //////////////////////////////////////////////////////////////////////////////////// + LoggerServiceIf(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup ~LoggerServiceIf + /// \~english @par Summary + /// Destructor of LoggerServiceIf class. + /// \~english @param None + /// \~english @retval None + /// \~english @par Preconditions + /// - None. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// None + /// \~english @par Detail + /// To generate a LoggerServiceIf class. \n + /// If the service and the session is started (open) state, causing the end (closed). + /// \~english @see LoggerServiceIf + //////////////////////////////////////////////////////////////////////////////////// + virtual ~LoggerServiceIf(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup Initialize + /// \~english @par Summary + /// API to initialize the LoggerServiceIf class. + /// \~english @param [in] hApp + /// HANDLE - HANDLE for Application + /// \~english @retval TRUE Success + /// \~english @retval FALSE Failure + /// \~english @par Preconditions + /// - None. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLE(hApp) specified in the argument is NULL. [FALSE] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Sync only(None communication) + /// \~english @par Detail + /// Application to use the services of SS_LoggerService is, after generating a LoggerServiceIf class, which is a + /// method to be executed first. \n + /// Member variable(m_hApp) of LoggerServiceIf class initialized with hApp that has been specified by the + /// argument. + /// \~english @see LoggerServiceIf + //////////////////////////////////////////////////////////////////////////////////// + BOOL Initialize(HANDLE hApp); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup NotifyOnLoggerServiceAvailability + /// \~english @par Summary + /// API to set the Callback function for Availability notification of SS_LoggerService. + /// \~english @param [in] f_pCallBackFn + /// CbFuncPtr - Pointer to function callback for SS_LoggerService Availability Notification + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.) + /// \~english @par Preconditions + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been + /// done. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Can not get the App/Thread name from HANDLE in the class member variables (m_hApp). + /// [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldParam] + /// - The acquisition of the buffer that stores the Callback information specified in the argument failed. + /// [eFrameworkunifiedStatusInvldParam] + /// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc). + /// [eFrameworkunifiedStatusFail] + /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hApp). [eFrameworkunifiedStatusInvldParam] + /// - Message queue HANDLE in HANDLE (m_hApp) of the class member variables are not appropriate(which is + /// invalid). [eFrameworkunifiedStatusInvldParam] + /// - It is not appropriate message queue name of HANDLE (m_hApp) in the class member variables(The name is + /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle] + /// - Is not a transmission type message queue type of HANDLE (m_hApp) in the class member variables. + /// [eFrameworkunifiedStatusInvldHndlType] + /// - Session message queue is full to SS_LoggerService. [eFrameworkunifiedStatusMsgQFull] + /// - It is invalid transmission file descriptor of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message for + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - Incorrect size of the transmit buffer of the session message to SS_LoggerService. [eFrameworkunifiedStatusInvldBufSize] + /// - Any errors occur during the transmission of a session message to SS_LoggerService. [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message for SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Pub-Sub x Pub-Sub + /// \~english @par Detail + /// Which is a method to register a Callback function for the initialization of the SS_LoggerService receives + /// the timing at which the start (open) is possible of completed service.\n + /// (Using API:FrameworkunifiedSubscribeNotificationsWithCallback of Native Service, to register a Callback function for + /// Availability notification of SS_LoggerService.) + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus NotifyOnLoggerServiceAvailability(CbFuncPtr f_pCallBackFn); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup NotifyOnOpenSessionAck + /// \~english @par Summary + /// API to set the Callback function for OpenSessionRequest response from SS_LoggerService. + /// \~english @param [in] f_pCallBackFn + /// CbFuncPtr - Callback function pointer for receiving the response of OpenSessionRequest + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @par Preconditions + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been + /// done. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldParam] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Sync only(None communication) + /// \~english @par Detail + /// To register the Callback function for receiving a response of completion of OpenSessionRequest to + /// Dispatcher. \n + /// (Using API:FrameworkunifiedAttachCallbackToDispatcher of Native Service, to register a Callback function for receiving a + /// response of completion of OpenSessionRequest to Dispatcher.) + /// \~english @see NotifyOnCloseSessionAck + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus NotifyOnOpenSessionAck(CbFuncPtr f_pCallBackFn); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup NotifyOnCloseSessionAck + /// \~english @par Summary + /// API to set the Callback function for CloseSessionRequest response from SS_LoggerService. + /// \~english @param [in] f_pCallBackFn + /// CbFuncPtr - Callback function pointer for receiving the response of OpenSessionRequest + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @par Preconditions + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldParam] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Sync only(None communication) + /// \~english @par Detail + /// To register the Callback function for receiving a response of completion of CloseSessionRequest to + /// Dispatcher. \n + /// (Using API:FrameworkunifiedAttachCallbackToDispatcher of Native Service, to register a Callback function for receiving a + /// response of completion of CloseSessionRequest to Dispatcher.) \n + /// \~english @see NotifyOnOpenSessionAck + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus NotifyOnCloseSessionAck(CbFuncPtr f_pCallBackFn); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup OpenSessionRequest + /// \~english @par Summary + /// API to generate service/session of SS_LoggerService. + /// \~english @param None + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Availability of SS_LoggerService is TRUE. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// - Use the NotifyOnOpenSessionAck(), that you register a callback function for receiving a completion + /// response of OpenSessionRequest to Dispatcher + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - SS_LoggerService is not Availability state. [eFrameworkunifiedStatusFail] + /// - SS_LoggerService can not be opened (can not start). [eFrameworkunifiedStatusFail] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Method x Fire and Forget + /// \~english @par Detail + /// Which is a method for generating service/session of SS_LoggerService.\n + /// (To send the command of PROTOCOL_OPEN_SESSION_REQ to SS_LoggerService.)\n + /// If you already service has been created, once to close the service, and to re-open. + /// \~english @see CloseSessionRequest + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus OpenSessionRequest(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup DecodeOpenSessionResponse + /// \~english @par Summary + /// API to hold the session ID in SS_LoggerServiceIf class + /// \~english @param None + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hService/m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Incorrect PROTOCOL_OPEN_SESSION_ACK message length of SS_LoggerService. [eFrameworkunifiedStatusFail] + /// - PROTOCOL_OPEN_SESSION_ACK message of SS_LoggerService can not be acquired. [eFrameworkunifiedStatusFail] + /// - Can not session generation of message transmission to SS_LoggerService. [eFrameworkunifiedStatusFail] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Sync only(None communication) + /// \~english @par Detail + /// Get the session initiation response message(PROTOCOL_OPEN_SESSION_ACK) of SS_LoggerService, and get the + /// session ID from the message. \n + /// Acquired session ID, (after opening the message transmission queue) created after a session of message + /// transmission, hold as the session information in the session HANDLE(m_hSession) of the class member + /// variable. + /// \~english @see OpenSessionRequest, CloseSessionRequest + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus DecodeOpenSessionResponse(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup CloseSessionRequest + /// \~english @par Summary + /// API to discard service/session of SS_LoggerService. + /// \~english @param None + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// - Use the NotifyOnCloseSessionAck(), that you register a callback function for receiving a completion + /// response of CloseSessionRequest to Dispatcher + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Pub-Sub x Pub-Sub + /// \~english @par Detail + /// which is a method for discarding service/session of SS_LoggerService.\n + /// (To send the command of PROTOCOL_CLOSE_SESSION_REQ to SS_LoggerService.) + /// \~english @see OpenSessionRequest + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus CloseSessionRequest(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup RegisterForLoggerEvent + /// \~english @par Summary + /// API to register a Callback function for SS_LoggerService. + /// \~english @param [in] f_eLoggerEvent + /// SS_LoggerServerEvents - Event type + /// \~english @param [in] f_pCallBackFn + /// CbFuncPtr - Pointer to a callback function that corresponds to the event + /// \~english @par + /// SS_LoggerServerEvents enum value + /// \~english @code + /// typedef enum _LoggerServerEvents + /// { + /// SS_LOGGER_SCREENCAPTURE_EVT = 0xA0, /* Event notification of the Screen Capture */ + /// SS_LOGGER_ERRORINFO_EVT, /* Event notification of error log information */ + /// SS_LOGGER_LOGINFO_EVT, /* Event notification of log information */ + /// SS_LOGGER_LOGSTARTED_EVT /* Event notification at the time of log start */ + /// }SS_LoggerServerEvents; + /// @endcode + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldParam] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Sync only(None communication) + /// \~english @par Detail + /// Which is a method to register a callback function for receiving the timing of the occurrence of an event in + /// the SS_LoggerService to the Dispatcher. \n + /// (To send the command of PROTOCOL_REGISTER_EVENTS to SS_LoggerService.) + /// \~english @see UnRegisterForLoggerEvent + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus RegisterForLoggerEvent(SS_LoggerServerEvents f_eLoggerEvent, CbFuncPtr f_pCallBackFn); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup UnRegisterForLoggerEvent + /// \~english @par Summary + /// API to cancel a Callback function for SS_LoggerService. + /// \~english @param [in] f_eLoggerEvent + /// SS_LoggerServerEvents - Event type + /// \~english @par + /// SS_LoggerServerEvents enum value + /// \~english @code + /// typedef enum _LoggerServerEvents + /// { + /// SS_LOGGER_SCREENCAPTURE_EVT = 0xA0, /* Event notification of the Screen Capture */ + /// SS_LOGGER_ERRORINFO_EVT, /* Event notification of error log information */ + /// SS_LOGGER_LOGINFO_EVT, /* Event notification of log information */ + /// SS_LOGGER_LOGSTARTED_EVT /* Event notification at the time of log start */ + /// }SS_LoggerServerEvents; + /// @endcode + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Sync only(None communication) + /// \~english @par Detail + /// Which is a method to cancel a callback function for receiving the timing of the occurrence of an event in + /// the SS_LoggerService. \n + /// \~english @see RegisterForLoggerEvent + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus UnRegisterForLoggerEvent(SS_LoggerServerEvents f_eLoggerEvent); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup SendDiagStat + /// \~english @par Summary + /// API to send CAN Diagnostic status data(it has mileage information) to SS_LoggerService. + /// \~english @param [in] pCanDiagStat_t + /// STLOGGER_CANDIAGSTAT - Pointer to structure of CAN Diagnostic state data + /// \~english @par + /// STLOGGER_CANDIAGSTAT Structure + /// \~english @code + /// typedef struct _TInterfaceunifiedCANMileageInfo + /// { + /// UI_8 DidA_ExtTest_Pres; /* For extended test(unused) */ + /// UI_8 EngRun_Stat; /* Engine run state(unused) */ + /// UI_8 Odo_MSB_H; /* Mileage information(MSB:High) */ + /// UI_8 Odo_MSB_L; /* Mileage information(MSB:Low) */ + /// UI_8 Odo_LSB_H; /* Mileage information(LSB:High) */ + /// UI_8 Odo_LSB_L; /* Mileage information(LSB:Low) */ + /// UI_8 PN14_SupBat_Volt; /* Battery voltage(unused) */ + /// }STLOGGER_CANDIAGSTAT; + /// @endcode + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Fire and Forget x Sync + /// \~english @par Detail + /// Which is a method to send the mileage information in the CAN diagnostic state data to SS_LoggerService. \n + /// Send a message in the command ID of SS_LOGGER_MILEAGE_DATA to SS_LoggerService. \n + /// SS_LoggerService uses the log write thread, to output a log of the mileage information. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus SendDiagStat(STLOGGER_CANDIAGSTAT *pCanDiagStat_t); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup LoggerIf_CANGetCurrentDateAndTime + /// \~english @par Summary + /// API to send the current date and time of the CAN to SS_LoggerService. + /// \~english @param [in] stDateAndTime + /// STCanCurrentDateTime - Structure of CAN current date and time + /// \~english @par + /// STCanCurrentDateTime Structure + /// \~english @code + /// typedef struct __CWORD62_DateAndTime + /// { + /// UI_8 DateTime_Stat; /* Date and Time State */ + /// UI_8 DateTimeDay; /* Day */ + /// UI_8 DateTimeHour; /* Hour */ + /// UI_8 DateTimeMinute; /* Minute */ + /// UI_8 DateTimeMonth; /* Month */ + /// UI_8 DateTimeSecond; /* Second */ + /// UI_8 DateTimeYear; /* Year */ + /// UI_8 TimeFormat; /* Time display format */ + /// }STCanCurrentDateTime; + /// @endcode + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Fire and Forget x Sync + /// \~english @par Detail + /// Which is a method to send current date and time of the CAN to SS_LoggerService. \n + /// Send a message in the command ID of SS_LOGGER_SET_DATETIME to SS_LoggerService. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus LoggerIf_CANGetCurrentDateAndTime(STCanCurrentDateTime stDateAndTime); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup LoggerIf_CANSetVIN + /// \~english @par Summary + /// API to send the Vehicle Identification Number(VIN) to SS_LoggerService. + /// \~english @param [in] stVinNumber + /// STVIN_NUMBER& - Structure of Vehicle Identification Number(VIN) + /// \~english @par + /// STVIN_NUMBER Structure + /// \~english @code + /// typedef struct _TVINnumber + /// { + /// static const UI_8 VIN_LEN = 18; + /// CHAR VINstr[VIN_LEN]; /* Vehicle Identification Number(VIN) */ + /// }STVIN_NUMBER; + /// @endcode + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Fire and Forget x Sync + /// \~english @par Detail + /// Which is a method to send the Vehicle Identification Number(VIN) to SS_LoggerService. \n + /// Send a message in the command ID of SS_LOGGER_SET_VIN to Logger Service. \n + /// SS_LoggerService uses the log write thread, to output a log of the Vehicle Identification Number(VIN). + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus LoggerIf_CANSetVIN(STVIN_NUMBER& stVinNumber); // NOLINT (runtime/references) + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup LoggerIf_SetLoggerParams + /// \~english @par Summary + /// API to send the logging propriety information of the selected device to SS_LoggerService. + /// \~english @param [in] eLoggerStatus + /// ELOGGER_STAT - Logging propriety information + /// \~english @param [in] eDevType + /// EDEV_TYPE - Device type + /// \~english @par + /// ELOGGER_STAT enum value + /// \~english @code + /// typedef enum _ELoggerState + /// { + /// eDeactivate, /* Logging impossible(Deativate) */ + /// eActivate, /* Logging possible(Activate) */ + /// eInvalid_LoggerState /* Invalid logging state */ + /// }ELOGGER_STAT; + /// @endcode + /// \~english @par + /// EDEV_TYPE enum value + /// \~english @code + /// typedef enum _ELoggerDeviceTypes + /// { + /// eDevUSB1, /* USB1 */ + /// eDevUSB2, /* USB2 */ + /// eDevSD, /* SD */ + /// eTotalDevicesTypes, /* Total device types */ + /// eInvalid_DevType /* Invalid device type */ + /// }EDEV_TYPE; + /// @endcode + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Fire and Forget x Sync + /// \~english @par Detail + /// Which is a method to send the logging propriety information of the selected device to SS_LoggerService. \n + /// Send a message in the command ID of SS_LOGGER_SET_PARAMS to SS_LoggerService. \n + /// SS_LoggerService is based on the logging propriety information of the transmission selection device, and + /// update as a member variable of the class. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus LoggerIf_SetLoggerParams(ELOGGER_STAT eLoggerStatus, EDEV_TYPE eDevType); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup LoggerIf_UDPLogging + /// \~english @par Summary + /// API to send the logging propriety information of UDP to SS_LoggerService. + /// \~english @param [in] eLoggerStatus + /// ELOGGER_STAT - Logging propriety information + /// \~english @par + /// ELOGGER_STAT enum value + /// \~english @code + /// typedef enum _ELoggerState + /// { + /// eDeactivate, /* Logging impossible(Deativate) */ + /// eActivate, /* Logging possible(Activate) */ + /// eInvalid_LoggerState /* Invalid logging state */ + /// }ELOGGER_STAT; + /// @endcode + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Fire and Forget x Sync + /// \~english @par Detail + /// Which is a method to send the logging propriety information of UDP to SS_LoggerService. \n + /// Send a message in the command ID of SS_LOGGER_UDP_LOGGING to SS_LoggerService. \n + /// SS_LoggerService is based on the logging propriety information of the transmission UDP, and update as a + /// member variable of the class. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus LoggerIf_UDPLogging(ELOGGER_STAT eLoggerStatus); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup LoggerIf_ScreenCaptureEventACK + /// \~english @par Summary + /// API to send the event response of screen capture to SS_LoggerService. + /// \~english @param [in] stScreenCaptureInfo + /// STScreenCaptureEvt - Structure of event data of screen capture + /// \~english @par + /// STScreenCaptureEvt Structure + /// \~english @code + /// typedef struct _TInterfaceunifiedScreenCaptureEvt + /// { + /// static const UI_16 STR_BUFF_LEN = 64; + /// BOOL fSucessful; /* Success propriety flag */ + /// UI_32 uiSceenShotId; /* Screen capture ID */ + /// CHAR strNameAndLocation[STR_BUFF_LEN]; /* Screen capture save file name */ + /// UI_32 uiFaultReasonCode; /* Failure reason code */ + /// }STScreenCaptureEvt; + /// @endcode + /// \~english @par + /// uiFaultReasonCode : Failure reason code (plm::screen_shot::status List) + /// - ok : Success + /// - invalid_window_handle : Invalid window handle + /// - invalid_context_handle : Invalid context handle + /// - display_count_error : Display count error + /// - rgb_display_not_found : RGB display not found + /// - create_pixmap_error : Create error of PIXMAP + /// - usage_pixmap_property_error : Usage error of PIXMAP property + /// - format_pixmap_property_error : Format error of PIXMAP property + /// - buffer_pixmap_property_error : Buffer error of PIXMAP property + /// - create_pixmap_buffer_error : Create error of PIXMAP buffer + /// - render_pixmap_property_error : Render error of PIXMAP property + /// - pointer_pixmap_property_error : Pointer error of PIXMAP property + /// - stride_pixmap_property_error : Stride error of PIXMAP property + /// - window_read_error : Window read error + /// - write_bitmap_file_error : Writing error of bitmap files + /// - window_post_error : Window post error + /// - window_property_error : Window property error + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Fire and Forget x Sync + /// \~english @par Detail + /// As the data in the event the response of the screen capture to SS_LoggerService, which is a method for + /// transmitting the information of the screen capture ID and screen capture save file name.\n + /// Send a message in the command ID of SS_LOGGER_SCREENCAPTURE_EVT_ACK to SS_LoggerService. \n + /// This API is an API for screen capture in PLM(Physical Layer Management) function support. In PLM + /// non-support, to prohibit the use. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus LoggerIf_ScreenCaptureEventACK(STScreenCaptureEvt stScreenCaptureInfo); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup LoggerIf_EventLoggingCommonInfo + /// \~english @par Summary + /// API to send the event information of the common log in SS_LoggerService. + /// \~english @param [in] stEventCommonInfo + /// STEventLoggerCommonInfo - Event information structure of the common log + /// \~english @par + /// STEventLoggerCommonInfo Structure + /// \~english @code + /// typedef struct _SEventLoggerCommonInfo + /// { + /// UI_8 BodyCAN_Stat:4; /* CAN state of the body */ + /// UI_8 HeadUnitCAN_Stat:4; /* CAN state of the Head Unit */ + /// UI_8 HMIInteraction:4; /* HMI Interaction */ + /// UI_8 IGN_Status:4; /* Ignition state */ + /// UI_8 FOT_Temp:2; /* Field Operation Tests Temporary */ + /// UI_8 SystemVoltage:6; /* System Voltage */ + /// }STEventLoggerCommonInfo; + /// @endcode + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Fire and Forget x Fire and Forget + /// \~english @par Detail + /// It is a method to send the event information of the common log to SS_LoggerService. \n + /// Send a message in the command ID of SS_LOGGER_EVENT_COMMONINFO to SS_LoggerService. \n + /// Using the log write thread, SS_LoggerService outputs the following log information. + /// - CAN state of the body + /// - CAN state of the Head Unit + /// - HMI Interaction + /// - Ignition state + /// - System Voltage + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus LoggerIf_EventLoggingCommonInfo(STEventLoggerCommonInfo stEventCommonInfo); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup LoggerIf_EventLoggingEventInfo + /// \~english @par Summary + /// API to send the event information of the _CWORD56_ log to SS_LoggerService. + /// \~english @param [in] stEventInfo + /// STEventLoggerEventInfo - Event information structure of _CWORD56_ log + /// \~english @par + /// STEventLoggerEventInfo Structure + /// \~english @code + /// typedef struct _SEventLoggerCommonInfo + /// { + /// UI_8 NumberOfEvents; /* Event count */ + /// UI_8 EventGroup; /* Event group */ + /// UI_8 EventIdentifier; /* Event identifier */ + /// UI_8 EventData[4]; /* Event data */ + /// }STEventLoggerEventInfo; + /// @endcode + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Fire and Forget x Fire and Forget + /// \~english @par Detail + /// It is a method to send the event information of _CWORD56_ log to SS_LoggerService. \n + /// Send a message in the command ID of SS_LOGGER__CWORD56__EVENT_INFO to SS_LoggerService.\n + /// Using the log write thread, SS_LoggerService outputs the following log information. + /// - Event count + /// - Event group + /// - Event identifier + /// - Event data + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus LoggerIf_EventLoggingEventInfo(STEventLoggerEventInfo stEventInfo); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup LoggerIf_EventLoggingResetInfo + /// \~english @par Summary + /// API to send the event information of _CWORD56_ reset count to SS_LoggerService. + /// \~english @param [in] stResetInfo + /// STEventLoggerResetInfo - Event information structure of _CWORD56_ reset counter + /// \~english @par + /// STEventLoggerResetInfo Structure + /// \~english @code + /// typedef struct _SEventLoggerResetInfo + /// { + /// UI_8 _CWORD56__ResetInfo; /* Reset counter information of _CWORD56_ */ + /// UI_8 _CWORD102__ResetInfo; /* Reset counter information of _CWORD102_ */ + /// }STEventLoggerResetInfo; + /// @endcode + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Fire and Forget x Fire and Forget + /// \~english @par Detail + /// It is a method to send the event information of _CWORD56_ reset counter to SS_LoggerService. \n + /// Send a message in the command ID of SS_LOGGER__CWORD56__RESET_INFO to SS_LoggerService. \n + /// Using the log write thread, SS_LoggerService outputs the following log information. + /// - Reset counter information of _CWORD56_ + /// - Reset counter information of _CWORD102_ + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus LoggerIf_EventLoggingResetInfo(STEventLoggerResetInfo stResetInfo); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup LoggerIf_PersistEventLogOnActiveDTC + /// \~english @par Summary + /// API to persist the event log on the DTC to SS_LoggerService. + /// \~english @param None + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Fire and Forget x Sync + /// \~english @par Detail + /// Which is a method to send a message of the order to immediately persist the event log on the DTC(Diagnostic + /// Trouble Code) to SS_LoggerService. \n + /// Send a message in the command ID of SS_LOGGER_DIAGDTC_ACTIVE to SS_LoggerService. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus LoggerIf_PersistEventLogOnActiveDTC(void); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup LoggerIf_Shutdown_Complete + /// \~english @par Summary + /// API to send a shutdown completion message to SS_LoggerService. + /// \~english @param None + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Fire and Forget x Fire and Forget + /// \~english @par Detail + /// Which is a method to send a shutdown completion message to SS_LoggerService.\n + /// Send a message in the command ID of SS_LOGGER_SHUTDOWN_COMPLETE to SS_LoggerService.\n + /// SS_LoggerService stops the thread for the log writing, and the Availability of self-service is set to FALSE, + /// to disable the service. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus LoggerIf_Shutdown_Complete(void); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup StoreEventLogsToUSB + /// \~english @par Summary + /// API to request an event log output to USB/SD to SS_LoggerService. + /// \~english @param [in] eUSBDevNumber + /// EEvtLogUSBDevNumber - Event Log output destination USB/SD device number + /// \~english @par + /// EEvtLogUSBDevNumber enum value + /// \~english @code + /// typedef enum _EEventLoggerUSBDeviceNumber + /// { + /// USB0=0, /* USB0 */ + /// USB1=1, /* USB1 */ + /// SD=2 /* SD */ + /// }EEvtLogUSBDevNumber; + /// @endcode + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Method x Fire and Forget + /// \~english @par Detail + /// Which is a method to request the event log output to USB/SD to SS_LoggerService.\n + /// To send a message in the command ID of SS_LOGGERCOPYEVENTUSB against SS_LoggerService. \n + /// Using the event log writing thread, SS_LoggerService output the event log to the specified device (USB/SD). + /// \n + /// As a result of the event output, the message is notified to the caller of the API in the command ID below. + /// - Success: SS_LOGGERCOPYEVENTUSB_SUCCESS_RESP + /// - Failure: SS_LOGGERCOPYEVENTUSB_ERROR_RESP + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus StoreEventLogsToUSB(EEvtLogUSBDevNumber eUSBDevNumber); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup StoreEmergencyErrorLogsToUSB + /// \~english @par Summary + /// API to request the emergency error log output to USB/SD to SS_LoggerService. + /// \~english @param [in] eDevNumber + /// EDevNumber - Emergency error log output destination USB/SD device number + /// \~english @par + /// EDevNumber value of enum + /// \~english @code + /// typedef enum _EDevNumber + /// { + /// eEEL_USB1=1, /* USB0 */ + /// eEEL_USB2=2, /* USB1 */ + /// eEEL_SD=3 /* SD */ + /// }EDevNumber ; + /// @endcode + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Fire and Forget x Fire and Forget + /// \~english @par Detail + /// Which is a method to request the emergency error log output to USB/SD to SS_LoggerService.\n + /// To send a message in the command ID of SS_LOGGERCOPYEMERGENCYLOGS against SS_LoggerService. \n + /// Using the diagnostic log output function of System Manager, SS_LoggerService output the emergency error log + /// to the specified device(USB/SD). \n + /// As a result of the clearing process of the event log, the message is notified to the caller of the API in the + /// command ID below. + /// - Success: SS_LOGGERCOPYEMERGENCYLOGS_SUCCESS_RESP + /// - Failure: SS_LOGGERCOPYEMERGENCYLOGS_ERROR_RESP + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus StoreEmergencyErrorLogsToUSB(EDevNumber eDevNumber); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup StartCANLogging + /// \~english @par Summary + /// API to request the start of CAN logging to SS_LoggerService. + /// \~english @param None + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Fire and Forget x Fire and Forget + /// \~english @par Detail + /// Which is a method to request the start of CAN logging against SS_LoggerService. \n + /// This function is called by CAN to trigger Logging to USB. \n + /// Progress is published by notifications eSSLoggerCANEventStart, eSSLoggerCANEventError and + /// eSSLoggerCANEventFinished. \n + /// To send a message in the command ID of eSSLoggerCANProtocolIDCANTrigger against SS_LoggerService. \n + /// SS_LoggerService requests the logging start of CAN to the System Manager. + /// \~english @see RegisterLoggingStartNotification, RegisterLoggingFinishNotification + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus StartCANLogging(void); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup RegisterLoggingStartNotification + /// \~english @par Summary + /// API to set a callback function for CAN logging start notification. + /// \~english @param [in] f_pCallBackFn + /// CbFuncPtr - Callback function pointer for CAN logging start notification + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been + /// done. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusNullPointer] + /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusNullPointer] + /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldParam] + /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Handle name of the session message queue is NULL to SS_LoggerService. [eFrameworkunifiedStatusInvldHandle] + /// - Message queue HANDLE of the session message to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message queue HANDLE of the session message to SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - It is not appropriate message queue name of the session message to SS_LoggerService(The name is NULL, more + /// than 20byte). [eFrameworkunifiedStatusInvldHandle] + /// - Is not a transmission type message queue type of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldHndlType] + /// - Session message queue is full to SS_LoggerService. [eFrameworkunifiedStatusMsgQFull] + /// - It is invalid transmission file descriptor of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message for + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - Incorrect size of the transmit buffer of the session message to SS_LoggerService. [eFrameworkunifiedStatusInvldBufSize] + /// - Any errors occur during the transmission of a session message to SS_LoggerService. [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message for SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Pub-Sub x Pub-Sub + /// \~english @par Detail + /// Use the StartCANLogging, after the request of the start of the CAN logging operation, which is a method to + /// register a callback function to receive a notification of the start of the logging operation.\n + /// (Using API:FrameworkunifiedSubscribeToSessionEventWithCallback of Native Service, to register a Callback function for CAN + /// logging start notification.) \n + /// SS_LoggerService publish the logging start of CAN in the notification of eSSLoggerCANEventStart to + /// Subscribers. + /// \~english @see StartCANLogging, RegisterLoggingFinishNotification + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus RegisterLoggingStartNotification(CbFuncPtr f_pCallBackFn); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup RegisterLoggingFinishNotification + /// \~english @par Summary + /// API to set a callback function for CAN logging finish notification. + /// \~english @param [in] f_pCallBackFn + /// CbFuncPtr - Callback function pointer for CAN logging finish notification + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been + /// done. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusNullPointer] + /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusNullPointer] + /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldParam] + /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Handle name of the session message queue is NULL to SS_LoggerService. [eFrameworkunifiedStatusInvldHandle] + /// - Message queue HANDLE of the session message to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message queue HANDLE of the session message to SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - It is not appropriate message queue name of the session message to SS_LoggerService(The name is NULL, more + /// than 20byte). [eFrameworkunifiedStatusInvldHandle] + /// - Is not a transmission type message queue type of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldHndlType] + /// - Session message queue is full to SS_LoggerService. [eFrameworkunifiedStatusMsgQFull] + /// - It is invalid transmission file descriptor of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message for + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - Incorrect size of the transmit buffer of the session message to SS_LoggerService. [eFrameworkunifiedStatusInvldBufSize] + /// - Any errors occur during the transmission of a session message to SS_LoggerService. [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message for SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Pub-Sub x Pub-Sub + /// \~english @par Detail + /// Which is a method to register a callback function to receive a notification of the finish of the logging + /// operation.\n + /// (Using API:FrameworkunifiedSubscribeToSessionEventWithCallback of Native Service, to register a Callback function for CAN + /// logging finish notification.) \n + /// SS_LoggerService publish the logging finish of CAN in the notification of eSSLoggerCANEventFinished to + /// Subscribers. + /// \~english @see StartCANLogging, RegisterLoggingStartNotification + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus RegisterLoggingFinishNotification(CbFuncPtr f_pCallBackFn); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup StartDTCLoggingToEmmc + /// \~english @par Summary + /// API to request the start of CAN logging to SS_LoggerService. + /// \~english @param None + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Fire and Forget x Fire and Forget + /// \~english @par Detail + /// Which is a method to request the start of CAN logging to SS_LoggerService. \n + /// This function is called by CAN at the time of the trigger of the error that occurred in the DTC. \n + /// Progress is published by notifications eSSLoggerCANEventStart, eSSLoggerCANEventError and + /// eSSLoggerCANEventFinished. \n + /// To send a message in the command ID of eSSLoggerCANProtocolIDDTCTrigger against SS_LoggerService. \n + /// SS_LoggerService sends a message in the command ID of eThrdCmdImmPersistEvtLog against the event log writing + /// thread. \n + /// Event log writing thread will immediately start with respect to the event log for Persistent. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus StartDTCLoggingToEmmc(UI_32 f_dtc); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup ClearEventLogs + /// \~english @par Summary + /// API to request to clear the event log to SS_LoggerService. + /// \~english @param None + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Fire and Forget x Pub-Sub + /// \~english @par Detail + /// Which is a method to request to clear the event log to SS_LoggerService. \n + /// To send a message in the command ID of SS_LOGGERCLEAREVENT against SS_LoggerService. \n + /// SS_LoggerService sends a message in the command ID of eThrdCmdClearEvntLogs against the event log writing + /// thread. \n + /// Event log write thread, delete all the event logs that are queued in the log write waiting. \n + /// As a result of the clearing process of the event log, the message is notified to the caller of the API in the + /// command ID below. + /// - Success: SS_LOGGERCLEAREVENT_SUCCESS_RESP + /// - Failure: SS_LOGGERCLEAREVENT_ERROR_RESP + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus ClearEventLogs(void); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup ReadStatisticalCounter + /// \~english @par Summary + /// API to request a statistics counter reading of the event log to SS_LoggerService. + /// \~english @param [in] eCounterGroup + /// EStatCounterGroupID - Group ID of the statistics counter + /// \~english @par + /// EStatCounterGroupID enum value + /// \~english @code + /// typedef enum _ECounterGroupID + /// { + /// STARTUP_SHUTDOWN_COUNTER_GROUP =0x01, /* Statistics counter group for StartUp/Shutdown */ + /// APP_USAGE_COUNTER_GROUP, /* Statistics counter group for application usage */ + /// F_BLK_STABILITY_COUNTER_GROUP, /* Do not use : Statistics counter for flash access */ + /// MAX_COUNTER_GROUP /* Max value of statistics counter group */ + /// }EStatCounterGroupID ; + /// @endcode + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Method x Fire and Forget + /// \~english @par Detail + /// Against SS_LoggerService, which is a method that requires a reading of the statistics counter corresponding + /// to the statistics counter groups in the event log. \n + /// To send a message in the command ID of SS_LOGGER_READ_STATL_COUNTER against SS_LoggerService. \n + /// SS_LoggerService sends a message in the command ID of eThrdCmdStatisticalCounter against the event log + /// writing thread. \n + /// Event log write thread read the statistics counter corresponding to the statistics counter groups in the + /// event log. \n + /// As a result of the clearing process of the event log, the message is notified to the caller of the API in the + /// command ID below. + /// - Success: SS_LOGGER_READ_STATL_COUNTER_SUCCESS_RESP + /// - Failure: SS_LOGGER_READ_STATL_COUNTER_ERROR_RESP + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus ReadStatisticalCounter(EStatCounterGroupID eCounterGroup); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup ResetStatisticalCounter + /// \~english @par Summary + /// API to request the reset of statistics counters of the event log to SS_LoggerService. + /// \~english @param [in] eCounterGroup + /// EStatCounterGroupID - Group ID of the statistics counter + /// \~english @par + /// EStatCounterGroupID enum value + /// \~english @code + /// typedef enum _ECounterGroupID + /// { + /// STARTUP_SHUTDOWN_COUNTER_GROUP =0x01, /* Statistics counter group for StartUp/Shutdown */ + /// APP_USAGE_COUNTER_GROUP, /* Statistics counter group for application usage */ + /// F_BLK_STABILITY_COUNTER_GROUP, /* Do not use : Statistics counter for flash access */ + /// MAX_COUNTER_GROUP /* Max value of statistics counter group */ + /// }EStatCounterGroupID ; + /// @endcode + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Fire and Forget x Fire and Forget + /// \~english @par Detail + /// Against SS_LoggerService, which is a method to reset the statistics counters corresponding to the statistics + /// counter groups in the event log. \n + /// To send a message in the command ID of SS_LOGGER_READ_STATL_COUNTER against SS_LoggerService. \n + /// SS_LoggerService sends a message in the command ID of eThrdCmdStatisticalCounter against the event log + /// writing thread. \n + /// Event log write thread reset the statistics counter corresponding to the statistics counter groups in the + /// event log. \n + /// As a result of the clearing process of the event log, the message is notified to the caller of the API in the + /// command ID below. + /// - Success: SS_LOGGER_RESET_STATL_COUNTER_SUCCESS_RESP + /// - Failure: SS_LOGGER_RESET_STATL_COUNTER_ERROR_RESP + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus ResetStatisticalCounter(EStatCounterGroupID eCounterGroup); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup LoggerIf_SetDiagID + /// \~english @par Summary + /// API to send the diagnosis ID to SS_LoggerService. + /// \~english @param [in] f_u16DiagID + /// UI_16 - Diagnosis ID + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusNullPointer] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Fire and Forget x Sync + /// \~english @par Detail + /// It is a method to send the diagnosis ID to SS_LoggerService. \n + /// Send a message in the command ID of SS_LOGGER_SET_DIAGID to SS_LoggerService. \n + /// SS_LoggerService sets the diagnosis ID as a part of the suffix name of the event log storage file name. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus LoggerIf_SetDiagID(UI_16 f_u16DiagID); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup LoggerIf_UploadEventLog + /// \~english @par Summary + /// API to request the upload of the event log to SS_LoggerService. + /// \~english @param None + /// \~english @retval eFrameworkunifiedStatusOK Success + /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle + /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer + /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full + /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor + /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) + /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size + /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred + /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) + /// \~english @par Preconditions + /// - SS_LoggerService process has been started. + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been + /// done, and Availability of SS_LoggerService is TRUE. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusNullPointer] + /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid) + /// [eFrameworkunifiedStatusNullPointer] + /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] + /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid). + /// [eFrameworkunifiedStatusInvldHandle] + /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle] + /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF] + /// - Interruption by the system call (signal) has occurred during the transmission of the session message to + /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR] + /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusInvldBufSize] + /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusFail] + /// - It failed to shared memory access for transmission of the session message to SS_LoggerService. + /// [eFrameworkunifiedStatusErrOther] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Method x Fire and Forget + /// \~english @par Detail + /// Which is a method to request the upload of the event log to SS_LoggerService. \n + /// Send a message in the command ID of SS_LOGGER_UPLOAD_EVENTLOG to SS_LoggerService. \n + /// SS_LoggerService sends a message in the command ID of eThrdCmdUploadEventLog against the event log writing + /// thread. \n + /// Event log write thread upload the event log in the interior of the buffer. \n + /// Upload a result, the message is notified in the command ID of SS_LOGGER_UPLOAD_EVENTLOG_RES to the caller of + /// the API. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus LoggerIf_UploadEventLog(); + + private: + HANDLE OpenService(); + EFrameworkunifiedStatus SendMessage(UI_32 f_cmdID, UI_32 f_size, void* f_pData); + + HANDLE m_hApp; + HANDLE m_hService; + HANDLE m_hSession; +}; + +#endif /* SS_LOGGER_SERVICE_IFC_H_ */ // NOLINT (build/header_guard) + +/** @}*/ // end of logger_service +/** @}*/ // end of SystemService +/** @}*/ // end of BaseSystem diff --git a/service/system/interface_unified/library/include/system_service/ss_logger_service_local.h b/service/system/interface_unified/library/include/system_service/ss_logger_service_local.h new file mode 100755 index 0000000..0261f2e --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_logger_service_local.h @@ -0,0 +1,94 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_logger_service_local.h + * @brief \~english This file supports the the Logger Service. + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup logger_service + * @ingroup system_service + * @{ + */ +#ifndef SS_LOGGER_SERVICE_LOCAL_H_ // NOLINT (build/header_guard) +#define SS_LOGGER_SERVICE_LOCAL_H_ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Screen Capture Event data +/////////////////////////////////////////////////////////////////////////////// +typedef struct _TInterfaceunifiedSetLoggerParams { + ELOGGER_STAT Logger_State; + EDEV_TYPE Device_Type; +}STLoggerSetParams; + +typedef struct _TInterfaceunifiedSetLoggerAllParams { + ELOGGER_STAT Logger_State; + EDEV_TYPE Device_Type; + ELOGGER_STAT Logger_UDPState; + UI_32 Log_FolderCnt; +}STLoggerSetAllParams; + +typedef struct _TErrorLogger_FolderInfo { + static const UI_16 STR_BUFF_LEN = 64; + CHAR FoldernameAndLogname[STR_BUFF_LEN]; + CHAR StorageTarget[STR_BUFF_LEN]; +}STLoggerFolderInfo; + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Event logger resets counter information +/////////////////////////////////////////////////////////////////////////////// +typedef union _uEvtLoggerCommonInfo { + STEventLoggerCommonInfo u_stEvtLoggerCommonInfo; + UI_8 CommonData[4]; +}UEvtLoggerCommonInfo; + +#pragma pack(1) +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Logger Event information +/////////////////////////////////////////////////////////////////////////////// +typedef struct _stLogEventss_ { + UI_32 ts; + UI_8 grp_ID; + UI_8 event_id; + UI_8 data[4]; +}st_LogEvent_ss; +#pragma pack(0) + +/// Macros definition for the Event Logs +#define MAX_EVT_RECORDS 20000 +#define MAX_EVENTLOG_SIZE 10*MAX_EVT_RECORDS ///< Max size for event logging + +typedef struct _TInterfaceunifiedEventLogPersistBuffer { + static const UI_16 EVT_BUFMAXSIZE = MAX_EVT_RECORDS; + st_LogEvent_ss EvtLog_Buffer[EVT_BUFMAXSIZE]; + UI_16 Current_Log_Size; +}STEventLogPersistBuffer; + +#endif /* SS_LOGGER_SERVICE_LOCAL_H_ */ // NOLINT (build/header_guard) +/** @}*/ +/** @}*/ +/** @}*/ + + diff --git a/service/system/interface_unified/library/include/system_service/ss_logger_service_notifications.h b/service/system/interface_unified/library/include/system_service/ss_logger_service_notifications.h new file mode 100755 index 0000000..7a5fc3d --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_logger_service_notifications.h @@ -0,0 +1,47 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_logger_service_notifications.h + * @brief \~english This file supports the the Logger Service. + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup logger_service + * @ingroup system_service + * @{ + */ +#ifndef SS_LOGGER_SERVICE_NOTIFICATIONS_H_ // NOLINT (build/header_guard) +#define SS_LOGGER_SERVICE_NOTIFICATIONS_H_ + +#include "system_service/ss_services.h" + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Logger Service Availability Notification +/////////////////////////////////////////////////////////////////////////////// +#define NTFY_SS_LoggerService_Availability SERVICE_LOGGER"/Availability" + +#endif /* SS_LOGGER_SERVICE_NOTIFICATIONS_H_ */ // NOLINT (build/header_guard) +/** @}*/ +/** @}*/ +/** @}*/ + diff --git a/service/system/interface_unified/library/include/system_service/ss_logger_service_protocol.h b/service/system/interface_unified/library/include/system_service/ss_logger_service_protocol.h new file mode 100755 index 0000000..36c602c --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_logger_service_protocol.h @@ -0,0 +1,146 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_logger_service_protocol.h + * @brief \~english This file supports the the Logger Service. + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#ifndef _SS_LOGGER_SERVICE_PROTOCOL_H_ // NOLINT (build/header_guard) +#define _SS_LOGGER_SERVICE_PROTOCOL_H_ + +#include <native_service/frameworkunified_types.h> +#include <native_service/frameworkunified_service_protocol.h> + + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Logger service event IDs +/////////////////////////////////////////////////////////////////////////////// +typedef enum _LoggerServiceProtocol { + SS_LOGGER_MILEAGE_DATA = 0x60, + SS_LOGGER_SET_PARAMS, + SS_LOGGER_STORE_SCREENCAPTURE_AND_LOG, // CLR+1+3 + SS_LOGGER_STORE_SCREENCAPTURE, // CLR+1+2 + SS_LOGGER_STORE_LOG, // ONHOOK+7+9 + SS_LOGGER_SCREENCAPTURE_EVT_ACK, // Screen shot response (filename) + SS_LOGGER_EVENT_COMMONINFO, + SS_LOGGER__CWORD56__EVENT_INFO, + SS_LOGGER__CWORD56__RESET_INFO, + SS_LOGGER_SET_DATETIME, + SS_LOGGER_SET_VIN, + SS_LOGGER_UDP_LOGGING, + SS_LOGGER_ERROR_EVENT_ARTIFACT_REQ, + SS_LOGGER_ERROR_EVENT_ARTIFACT_RESP, + SS_LOGGER_SHUTDOWN_COMPLETE, + SS_LOGGER_DIAGDTC_ACTIVE, + SS_LOGGER_SET_DIAGID, + // Timer protocol IDs + SS_LOGGER_ERROR_EVENT_TIMER_ID_LOGGING_START_RSPN, + SS_LOGGER_ERROR_EVENT_TIMER_ID_ARTIFACT_RESPONSE, + SS_LOGGER_ERROR_EVENT_TIMER_ID_SCREEN_CAPTURE_RSPN, +}SS_LoggerServiceProtocol; + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Logger service event IDs +/////////////////////////////////////////////////////////////////////////////// +typedef enum _SS_LOGGERSERVICEPROTOCOL { + SS_LOGGERCOPYEVENTUSB = 0x80, // HMI to Dispatcher + SS_LOGGERCOPYEVENTUSB_SUCCESS_RESP, + SS_LOGGERCOPYEVENTUSB_ERROR_RESP, + SS_LOGGERCOPYEMERGENCYLOGS, + SS_LOGGERCOPYEMERGENCYLOGS_SUCCESS_RESP, + SS_LOGGERCOPYEMERGENCYLOGS_ERROR_RESP, + SS_LOGGERCLEAREVENT, // HMI to Dispatcher + SS_LOGGERCLEAREVENT_SUCCESS_RESP, + SS_LOGGERCLEAREVENT_ERROR_RESP, + SS_LOGGER_READ_STATL_COUNTER, + SS_LOGGER_READ_STATL_COUNTER_SUCCESS_RESP, + SS_LOGGER_READ_STATL_COUNTER_ERROR_RESP, + SS_LOGGER_RESET_STATL_COUNTER, + SS_LOGGER_RESET_STATL_COUNTER_SUCCESS_RESP, + SS_LOGGER_RESET_STATL_COUNTER_ERROR_RESP, + SS_LOGGER_ENG_READ_NUMOFEVENTS, + SS_LOGGER_ENG_READ_NUMOFEVENTS_RESP, + SS_LOGGER_ENG_READ_STATISTICAL_COUNTERS, + SS_LOGGER_ENG_READ_STATISTICAL_COUNTERS_RESP, + SS_LOGGER_UPLOAD_EVENTLOG, + SS_LOGGER_UPLOAD_EVENTLOG_RESP +}SS_loggerserviceprotocol; + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// \brief Private events for the following categories of devices +/////////////////////////////////////////////////////////////////////////////// +typedef enum _LoggerServerEvents { + SS_LOGGER_SCREENCAPTURE_EVT = 0xA0, // Screen shot request from PLM. + SS_LOGGER_ERRORINFO_EVT, + SS_LOGGER_LOGINFO_EVT, + SS_LOGGER_LOGSTARTED_EVT +}SS_LoggerServerEvents; + +///////////////////////////////////////////////////////////////////////////////////// +/// \brief eSSLoggerCANProtocolID +/// +/// \note These IDs depict the possible events coming from CAN to logger_service +/// +///////////////////////////////////////////////////////////////////////////////////// +enum eSSLoggerCANProtocolID { + eSSLoggerCANProtocolIDCANTrigger = 0x10000000, /// Start logging to USB + eSSLoggerCANProtocolIDDTCTrigger /// Start logging of DTC to emmc +}; + +///////////////////////////////////////////////////////////////////////////////////// +/// \brief eSSLoggerCANEvent +/// +/// \note Events that are published to CAN for HK and CAN logging. Data structures +/// attached to the single events can be found in below table +/// | EventId | Return type | +/// | :------------------------ | :------------------------ | +/// | eSSLoggerCANEventStart | None | +/// | eSSLoggerCANEventError | STEventCANLoggerEventInfo | +/// | eSSLoggerCANEventFinished | STEventCANLoggerEventInfo | +/// +///////////////////////////////////////////////////////////////////////////////////// +enum eSSLoggerCANEvent { + eSSLoggerCANEventStart = 0x10001000, /// Logging has started for HK and CAN events + eSSLoggerCANEventError, /// Logging has aborted with an error + eSSLoggerCANEventFinished /// Logging has finished succesfully +}; + +#ifdef __cplusplus +} +#endif + +#endif /* _SS_DEVICEDETECTION_SERVICE_PROTOCOL_H_ */ // NOLINT (build/header_guard) +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_logger_store_logs.h b/service/system/interface_unified/library/include/system_service/ss_logger_store_logs.h new file mode 100755 index 0000000..7c68fd9 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_logger_store_logs.h @@ -0,0 +1,81 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_logger_store_logs.h + * @brief This file supports the logger service interface for SystemManager. + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#ifndef SS_LOGGER_STORE_LOGS_H_ // NOLINT (build/header_guard) +#define SS_LOGGER_STORE_LOGS_H_ + +#include <native_service/frameworkunified_types.h> +#include "system_service/interfaceunified_system_types.h" + +#include <string> +#include <vector> + + +#ifdef _cplusplus +extern "C" { +#endif +#define SS_LOGGER_SAVE_INTERFACEUNIFIEDLOG_FLAG "/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/SS_LOGGER_SAVE_INTERFACEUNIFIEDLOG_FLAG" + +typedef enum { + SS_STORELOGS_INTERFACEUNIFIEDLOG = 0, + SS_STORELOGS_ILLEGAL, + SS_STORELOGS_ACCOFFON, + + SS_STORELOGS_SYS_ILLEGAL, + SS_STORELOGS_ACCOFFON_PRESS, + + SS_STORELOGS_MAX +} SS_STORELOGS_OPE_TYPE; +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup logger_service +/// +/// \brief SSLoggerSrvIfWriteDebugLogs +/// +/// \return Status +/// EFrameworkunifiedStatus - success or error +/////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SS_LoggerStoreLogs(SS_STORELOGS_OPE_TYPE type); + +EFrameworkunifiedStatus SS_LoggerStoreLogs_deleteOldLogAbnrm(const std::string& log_path, std::vector<std::string>& l_vector, + const std::string& f_archive_destination, SI_32 max_num, + UI_32 abnrm_total); + +EFrameworkunifiedStatus StartRtUsbLogThread(HANDLE hApp); +EFrameworkunifiedStatus StopRtUsbLogThread(HANDLE hApp); + +#ifdef _cplusplus +} +#endif + +#endif /* SS_LOGGER_STORE_LOGS_H_ */ // NOLINT (build/header_guard) +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_power_service.h b/service/system/interface_unified/library/include/system_service/ss_power_service.h new file mode 100755 index 0000000..15ba033 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_power_service.h @@ -0,0 +1,535 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_power_service.h + * @brief \~english This file supports the Power Service interface. + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup power_service + * @ingroup system_service + * @{ + */ +#ifndef SS_POWER_SERVICE_H_ // NOLINT (build/header_guard) +#define SS_POWER_SERVICE_H_ + +#include <native_service/frameworkunified_types.h> +#include <map> +#include "system_service/ss_system_types.h" + + + +typedef enum _PwLevelTypes { + epspltUNKNOWN, + epspltWAKEUP = 0x99, + epspltNORMAL, + epspltSHUTDOWN, + epspltEMERGENCY, +} PowerSrvLevelType, EPWR_LEVEL_TYPE; + + +typedef enum { + epsstUNKNOWN, + epsstBASIC, + epsstSUPERVISOR, + epsstSYSTEM, +} PowerSrvSessionType, EPWR_SESSION_TYPE; + + +typedef enum { + epscnINVALID = 0xFF, + epscnCANWAKEUP = 0x07, //< All modules up with Display Off and Audio Muted + epscnCANSLEEP = 0x08, //< Communication and all modules shut down +} ePowerSrvCANStates, EPWR_CAN_STATE_TYPE; + + + +// Not in use for PastModel003*1. Can be used for Platform +typedef enum { + epswlINVALID = 0xFF, + epswlFULLRUN = 0x0A, //< Normal ignition on and full wakeup + epswlLOCALWAKEUP = 0x0B, //< Only certain modules are up. +} ePowerSrvWakeupLevels, EPWR_WAKEUP_LEVEL_TYPE; + +typedef EPWR_WAKEUP_LEVEL_TYPE * PEPWR_WAKEUP_LEVEL_TYPE; + +typedef enum { + epswsINVALID = 0xFF, + epswsPWRON = 0x00, //< Enable Display and Audio + epswsPWROFF = 0x01, //< Disable Audio and HMI +} ePowerSrvPowerStates, EPWR_POWER_STATE_TYPE; + + +typedef enum { + epsvsINVALID = 0xFF, + epsvsNORMAL = 0x20, + epsvsLVI1 = 0x22, + epsvsLVI2 = 0x24, +} ePowerSrvVoltageStates, EPWR_VOLTAGE_STATE_TYPE; + +typedef EPWR_VOLTAGE_STATE_TYPE * PEPWR_VOLTAGE_STATE_TYPE; + +typedef enum { + epscsINVALID = 0xFF, + epscsENTRY = 0xA0, + epscsEXIT = 0xA2, +} ePowerSrvCrankStates, EPWR_CRANK_STATE_TYPE; + + +//****************************************************************************** +// Startup Reason / EPWR_WAKEUP_FACTOR_TYPE typedefs * +// * +/** + * \~english + */ +typedef enum { + epswfINVALID = 0xFF, //!< \~english + epswfTESTACC = 0x00, //!< \~english + epswfON_KEY = 0x01, //!< \~english + epswfIGN_ACC = 0x02, //!< \~english + epswfDR_OPEN_CLOSE = 0x03, //!< \~english + epswfDX_ACTIVATION = 0x04, //!< \~english + epswfPASS_ACTIVATION = 0x05, //!< \~english + epswfSPVACTIVATION = 0x06, //!< \~english + epswfUSER_DATA_RESET = 0x07 //!< \~english +// +// Carry-over enums from CCR +// +// epswfPWRBUTTONON = 0x0C, +// epswfIGNON = 0x0D, +// epswfDISCEJECT = 0x0F, +// epswfSHOWTIME = 0x11, +// epswfPHONECALL = 0x12, +// +// End of Carry-over enums from CCR +// +} ePowerSrvWakeupFactors, EPWR_WAKEUP_FACTOR_TYPE; +typedef EPWR_WAKEUP_FACTOR_TYPE * PEPWR_WAKEUP_FACTOR_TYPE; +// * +// End of Startup Reason / EPWR_WAKEUP_FACTOR_TYPE * +//****************************************************************************** + +//**************************************************************************** +// Shutdown Popup Protocol enums & typedefs * +// * +typedef enum { // * + epsspPowerSave1 = 0x00, // * + epsspPowerSave2 = 0x01, // * + epsspPowerSave3 = 0x02, // * + epsspPowerSaveClr = 0x03, // * + epsspLowVoltage1 = 0x04, // * + epsspLowVoltage2 = 0x05, // * + epsspLowVoltage3 = 0x06, // * + epsspLowVoltageClr = 0x07, // * + epsspBattCouplingSW1 = 0x08, // * + epsspBattCouplingSW2 = 0x09, // * + epsspBattCouplingSW3 = 0x0A, // * + epsspBattCouplingSWClr = 0x0B, // * + epsspAbnormalTemp_1st = 0x0C, // * + epsspAbnormalTemp_Clr = 0x0D, // * + epsspLimpHome_1st = 0x0E, // * + epsspLimpHome_2nd = 0x0F, // * + epsspLimpHome_3rd = 0x10, // * + epsspLimpHome_Clr = 0x11, // * + epsspProdMd_1st = 0x12, // * + epsspProdMd_Clr = 0x13, // * + epsspTransMd_1st = 0x14, // * + epsspTransMd_Clr = 0x15, // * + epsspAllClr = 0xFF // * +} ePwrServiceShutdownPopupType, EPWR_SHUTDOWN_POPUP_TYPE; // * + // * +// * +// End of Shutdown Condition Protocol enums & typedefs * +//**************************************************************************** + +//**************************************************************************** +// CPMShowPowerPopup Protocol enums & typedefs * +// * +typedef enum { // * + epssppNormal = 0x00, // * + epssppCritical = 0x01, // * + epssppAppCritical = 0x02, // * + epssppAllClr = 0xFF // * +} ePwrServicePowerPopupType, EPWR_POWER_POPUP_TYPE; // * + // * +// * +// End of CPMShowPowerPopup Protocol enums & typedefs * +//**************************************************************************** + +//**************************************************************************** +// Limp Home Cutoff Protocol enums & typedefs * +// * +typedef enum { // * + epslhcINVALID = 0xFF, // * + epslhcDISABLED = 0x00, // * + epslhcENABLED = 0x01 // * +} ePwrServiceLHCType, EPWR_LHC_TYPE; // * + // * +// * +// End of Limp Home Cutoff Protocol enums & typedefs * +//**************************************************************************** + +//**************************************************************************** +// Production Mode Protocol enums & typedefs * +// * +typedef enum { // * + epspmINVALID = 0xFF, // * + epspmDISABLED = 0x00, // * + epspmENABLED = 0x01 // * +} ePwrServiceProdModeType, EPWR_PROD_MODE_TYPE; // * + // * +// * +// End of Production Mode Protocol enums & typedefs * +//**************************************************************************** + +//**************************************************************************** +// Transport Mode Protocol enums & typedefs * +// * +typedef enum { // * + epstmINVALID = 0xFF, // * + epstmDISABLED = 0x00, // * + epstmENABLED = 0x01 // * +} ePwrServiceTransportModeType, EPWR_TRANSPORT_MODE_TYPE; // * + // * +// * +// End of Transport Mode Protocol enums & typedefs * +//**************************************************************************** + +//**************************************************************************** +// Last User Mode, User Mode , User Mode Change Reason Protocol enums & * +// typedefs * +// * +/** + * \~english + */ +typedef enum { + epsumINVALID = 0xFF, //!< \~english + epsumOFF = 0x00, //!< \~english + epsumON = 0x01 //!< \~english +} ePwrServiceUserModeType, EPWR_USER_MODE_TYPE; + +/** + * \~english State transition reason. + */ +typedef enum { + epsumcrNOT_AVAILABLE = 0x00, //!< \~english Not available. + epsumcrON_KEY = 0x01, //!< \~english + epsumcrPARKING_B, //!< \~english Parking(+B) Power state transition. + epsumcrPRE_BA, //!< \~english Pre-boot(+BA) Power state transition. + epsumcrNORMAL, //!< \~english Normal-boot Power state transition. + epsumcrBACKGROUND_BA, //!< \~english Background-boot(+BA) Power state transition. +} ePwrServiceUserModeChangeReasonType, EPWR_USER_MODE_CHANGE_REASON_TYPE; + // * +// * +// End of Last User Mode, User Mode Protocol enums & typedefs * +//**************************************************************************** + +/** + * \~english + */ +typedef struct _upinfo { + EPWR_WAKEUP_LEVEL_TYPE level; //!< \~english + EPWR_WAKEUP_FACTOR_TYPE factor; //!< \~english + EPWR_USER_MODE_CHANGE_REASON_TYPE userModeChangeReason; //!< \~english State transition reason. +} upInfo; + +/** + * \~english + */ +typedef struct _wakeinfo { + EPWR_POWER_STATE_TYPE powerupType; //!< \~english + upInfo up; //!< \~english +} wakeInfo; + +//**************************************************************************** +// System Mode Info enums & typedefs * +// * +typedef enum { // * + epssinfINVALID = 0xFF, // * + epssinfNORMAL = 0x00, // * + epssinfPROGRAMMING = 0x08, // * +}ePowerSrvSystemModeInfo, EPWR_SYSTEM_MODE_INFO; // * + // * +typedef enum { // * + epssusfINVALID = 0xFF, // * + epssusSYSTEM_SERVICES_STARTED = 0x00, // * + epssusALL_SERVICES_LAUNCHED = 0x01 // * +}ePowerSrvStartupStageType, EPWR_STARTUP_STAGE_TYPE; // * + // * +typedef struct _SystemModeInfo { // * + EPWR_USER_MODE_TYPE lastUserMode; // NOTE: Don't use this. just only remained for backward compatibility. + EPWR_LHC_TYPE limpHomeCutoff; // * + EPWR_PROD_MODE_TYPE productionMode; // * + EPWR_TRANSPORT_MODE_TYPE transportMode; // * + EPWR_SYSTEM_MODE_INFO systemMode; // * + EPWR_STARTUP_STAGE_TYPE startupStage; // * +} SystemModeInfo; // * +// * +// End of System Mode Info enums & typedefs * +//**************************************************************************** + +//**************************************************************************** +// Startup Confirmation enums & typedefs * +// * +typedef enum { // * + eps_CWORD56_bmINVALID = 0xFF, // * + eps_CWORD56_bmAPPLICATION_MODE = 0x00, // * + eps_CWORD56_bmPROGRAMMING_MODE = 0x08 // * +} EPWR_SC__CWORD56__BOOT_MODE_TYPE; // * + // * +typedef enum { // * + epsstINVALID = 0xFF, // * + epsstWARMSTART = 0x00, // * + epsstCOLDSTART = 0x01 // * +} EPWR_SC_WAKEUP_TYPE; // * + // * +typedef enum { // * + epsscrtINVALID = 0xFF, // * + epsscrtNOT_REQUIRED = 0x00, // * + epsscrtREQUIRED = 0x01 // * +} EPWR_SC_COLD_START_REQ_TYPE; // * + // * +typedef enum { // * + epsssINVALID = 0xFF, // * + epsssUNLOCK = 0x00, // * + epsssLOCK = 0x01 // * +} EPWR_SC_SECURITY_STATUS; // * + // * +typedef struct { // * + EPWR_SC__CWORD56__BOOT_MODE_TYPE _CWORD56_BootMode; // * + EPWR_SC_WAKEUP_TYPE wakeupType; // * + EPWR_SC_COLD_START_REQ_TYPE coldStartRequest; // * + EPWR_SC_SECURITY_STATUS securityStatus; // * + UI_32 HWVersion; // * + UI_32 matchedHardwareType; // * + UI_32 softwareType; // * + UI_32 imageType; // * + UI_32 majorVersion; // * + UI_32 minorVersion; // * + UI_32 SWVersionYear; // * + UI_32 SWVersionWeek; // * + UI_32 SWVersionPatchLevel; // * +} StartupConfirmationMsgStrut, EPWR_SC_MSG_STRUCT; // * +// * +// End of Startup Confirmation enums & typedefs * +//**************************************************************************** + +//**************************************************************************** +// Power Request Message enums & typedefs * +// * +/** + * _CWORD102_ Startup Information + */ +typedef enum { + epsprm_CWORD102_siINVALID = 0xFF, //!< \~english + epsprm_CWORD102_si_CWORD102__STARTUP_NORMAL = 0x00, //!< Normal Startup + epsprm_CWORD102_si_CWORD102__STARTUP_AFTER_RESET = 0x01 //!< Startup after Irregular Reset +}ePowerSrv_CWORD102_StartupInfoType, EPWR__CWORD102__STARTUP_INFO_TYPE; +/** + * Opening Type + */ +typedef enum { + epsprmotINVALID = 0xFF, //!< \~english + epsprmotTIMING_TYPE_1 = 0x00, //!< CI/DI Show timing type1 + epsprmotTIMING_TYPE_2 = 0x01 //!< CI/DI Show timing type2 +} ePowerSrvPwrReqMsgCIDIOpeningType, EPWR_OPENING_TYPE; +/** + * Manual Reset Information + */ +typedef enum { + epsprmriINVALID = 0xFF, //!< \~english + epsprmriNORMAL = 0x00, //!< \~english + epsprmriWAKEUP_AFTER_RESET = 0x01 //!< \~english +} ePowerSrvPwrManResetInfoType, EPWR_MAN_RESET_INFO_TYPE; +/** + * Last System Retention Request + */ +typedef enum { + epsprlsrrINVALID = 0xFF, //!< \~english + epsprlsrrLAST_SYSTEM_OFF = 0x00, //!< \~english + epsprlsrrLAST_SYSTEM_ON = 0x01 //!< \~english +} ePowerSrvTypeLastSysRetReq, EPWR_LAST_SYS_RET_REQ_TYPE; + +// * +typedef struct { // * + EPWR__CWORD102__STARTUP_INFO_TYPE startupType; // * + EPWR_OPENING_TYPE openingType; // * + EPWR_WAKEUP_FACTOR_TYPE startupReason; // * + EPWR_USER_MODE_TYPE lastUserMode; // * + EPWR_MAN_RESET_INFO_TYPE manResetInfo; // * + EPWR_LAST_SYS_RET_REQ_TYPE lastSystemRetentionReq; // * + EPWR_USER_MODE_TYPE userMode; // * +} PowerRequestMsgStrut, EPWR_POWER_REQUEST_MSG_STRUCT; // * + +/** + * \~english structure for power request message + */ +typedef struct { + EPWR__CWORD102__STARTUP_INFO_TYPE startupType; //!< \~english + EPWR_OPENING_TYPE openingType; //!< \~english + EPWR_WAKEUP_FACTOR_TYPE startupReason; //!< \~english + EPWR_USER_MODE_TYPE lastUserMode; //!< \~english + EPWR_MAN_RESET_INFO_TYPE manResetInfo; //!< \~english + EPWR_LAST_SYS_RET_REQ_TYPE lastSystemRetentionReq; //!< \~english + EPWR_USER_MODE_TYPE userMode; //!< \~english + EPWR_USER_MODE_CHANGE_REASON_TYPE userModeChangeReason; //!< \~english State transition reason. +} PowerRequestMsgStrutWithUMCR, EPWR_POWER_REQUEST_MSG_STRUCT_WITH_UMCR; +// * +// End of Power Request Message enums & typedefs * +//**************************************************************************** + + + +//**************************************************************************** +// Shutdown Request Message enums & typedefs * +// * +// ONS * +// * +typedef enum { // * + epssdmonsINVALID = 0xFF, // * + epssdmonsNO_ONS = 0x00, // * + epssdmonsONS = 0x01 // * +} ePowerSrvONSType, EPWR_ONS_TYPE; // * +// * +// Shutdown Trigger * +// * +typedef enum { // * + epssdmsdtINVALID = 0xFF, // * + epssdmsdtTESTACC_OFF = 0x00, // * + epssdmsdtON_KEY = 0x01, // * + epssdmsdtIGN_LOCK = 0x02, // * + epssdmsdtPWR_SAVE = 0x03, // * + epssdmsdtTMP_STARTUP = 0x04, // * + epssdmsdtDIAG_DEACTIVATION = 0x05, // * + epssdmsdtABNORMAL_VOLTAGE = 0x06, // * + epssdmsdtABNORMAL_TEMP = 0x07, // * + epssdmsdtBATTERYCUTOFF = 0x08, // * + epssdmsdtLIMPHOME = 0x09, // * + epssdmsdtHU_CAN_ERROR = 0x0A, // * + epssdmsdtBODY_CAN_ERROR = 0x0B, // * + epssdmsdtTRANSPORT_MODE = 0x0C, // * + epssdmsdtPRODUCTION_MODE = 0x0D, // * + epssdmsdtIGN_OFF = 0x0E, // * + epssdmsdtGENERIC_ERROR_RESET = 0x0F, // * + epssdmsdtFATAL_ERROR_RESET = 0x10, // * + epssdmsdtUSER_DATA_RESET = 0x11, // * + epssdmsdtFACTORY_DATA_RESET = 0x12, // * + epssdmsdtFAST_SLEEP_MODE = 0x13, // * + epssdmsdtNORMAL_RESET = 0x14, // * + epssdmsdtPROGUPDATE_RESET = 0x15, // cannot use this + // * + // Note to self: Make sure to update all enum-to-enum and * + // enum-to-string maps when changing these enums ! * +} ePowerSrvPwrShutdownTriggerType, EPWR_SHUTDOWN_TRIGGER_TYPE; // * +// * +typedef struct { // * + EPWR_ONS_TYPE ONS_Type; // * + EPWR_SHUTDOWN_TRIGGER_TYPE shutdownTrigger; // * + EPWR_USER_MODE_TYPE lastUserMode; // * + EPWR_TRANSPORT_MODE_TYPE transportMode; // * + EPWR_PROD_MODE_TYPE productionMode; // * + EPWR_LHC_TYPE limpHomeCutoffRequest; // * +} ShutdownRequestMsgStrut, EPWR_SHUTDOWN_REQUEST_MSG_STRUCT; // * +// * +// End of Shutdown Request Message enums & typedefs * +//**************************************************************************** + +//**************************************************************************** +// HeartBeat enums & typedefs * +// * +// HeartBeat Request Message * +typedef struct { // * + UI_8 IntervalSec; // * +} EPWR_HB_REQ_MSG_STRUCT; // * +// * +// HeartBeat Response Message * +// Zero byte data message returned. * +// End of HeartBeat enums & typedefs * +//**************************************************************************** + +//**************************************************************************** +// CPU Reset Reason enums & typedefs * +typedef enum { // * + epsCpuResetReasonGeneric = 0 // * + , epsCpuResetReasonFatalError // * + , epsCpuResetReasonUserDataReset // * + , epsCpuResetReasonFactoryDataReset // * + , epsCpuResetReasonUserForceReset // * + , epsCpuResetReasonShipmentModeReset // * + , epsCpuResetReasonHeadUnitReset // * + , epsCpuResetReasonNormalReset // * + , epsCpuResetReasonProgupdateReset // cannot use this +} epsCpuResetReason; // * +// +typedef struct { +#define PWR_RESET_MSG_STR_SIZE 32 + epsCpuResetReason resetReason; // * + CHAR messageStr[PWR_RESET_MSG_STR_SIZE]; // * +} SS_Pwr_CpuResetMsgStruct; +// * +// End of CPU Reset Reason enums & typedefs * +//**************************************************************************** + +typedef struct { + union _data { + wakeInfo wake; + + struct _crank { + EPWR_CRANK_STATE_TYPE state; + }crank; + + struct _voltage { + EPWR_VOLTAGE_STATE_TYPE state; + }voltage; + + struct _ws_complete { + EPWR_WAKEUP_LEVEL_TYPE level; + EPWR_WAKEUP_FACTOR_TYPE factor; + }wk_shdwn_complete; + + struct _commwake { + EPWR_CAN_STATE_TYPE state; + }commwake; + + struct _UserMode { + EPWR_USER_MODE_TYPE mode; + } user_mode; + + struct _ShutdownPopup { + EPWR_SHUTDOWN_POPUP_TYPE shutdownPopupEvent; + } shutdownPopup; + + struct _PowerPopup { + EPWR_POWER_POPUP_TYPE powerPopupEvent; + } powerPopup; + + StartupConfirmationMsgStrut startupConfirmationMsg; + PowerRequestMsgStrutWithUMCR powerRequestMsg; + ShutdownRequestMsgStrut shutdownRequestMsg; + }data; +} Pwr_ServiceSetInterface; + +#endif /* SS_POWER_SERVICE_H_ */ // NOLINT (build/header_guard) + +/** @}*/ // end of power_service +/** @}*/ // end of system_service +/** @}*/ // end of BaseSystem diff --git a/service/system/interface_unified/library/include/system_service/ss_power_service_if.h b/service/system/interface_unified/library/include/system_service/ss_power_service_if.h new file mode 100755 index 0000000..d0ace60 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_power_service_if.h @@ -0,0 +1,606 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_power_service_if.h + * @brief \~english This file supports the Power Service client interface. + */ +/** + * @file + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup power_service + * @ingroup system_service + * @{ + */ + +#ifndef POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_IF_H_ // NOLINT (build/header_guard) +#define POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_IF_H_ + +#include "system_service/ss_power_service.h" +#include "system_service/ss_power_service_protocol.h" + + +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup OpenPowerService +/// \~english @par Summary +/// Obtain a handle for using the PowerService. +/// \~english @param [in] f_hApp +/// HANDLE - Application handle +/// \~english @retval Handle Success +/// \~english @retval NULL Failed +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Sync only(None communication) +/// \~english @par Detail +/// - The API creates a communication resource between +/// the user service and the PowerService +/// and returns a handle for using the PowerService.\n +/// \n +/// - Include ss_power_service_ifc.h +/// - Library libSS_PowerServiceIf.so +/// \~english @see +/// None +//////////////////////////////////////////////////////////////////////////////////////////// +HANDLE OpenPowerService(HANDLE f_hApp); + +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup ClosePowerService +/// \~english @par Summary +/// Free a handle for using PowerService. +/// \~english @param [in] f_hApp +/// HANDLE - Application handle +/// \~english @param [in] f_hService +/// HANDLE - PowerService handle +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusFail Failed +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Sync only +/// \~english @par Detail +/// - The API terminates the communication resource between +/// the user service and the PowerServiceand frees the given handle. \n +/// \n +/// - Include ss_power_service_ifc.h +/// - Library libSS_PowerServiceIf.so +/// \~english @see +/// None +//////////////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus ClosePowerService(HANDLE f_hApp, HANDLE f_hService); + +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup PwrServiceOpenSessionRequest +/// \~english @par Summary +/// Make the PowerService available. +/// \~english @param [in] f_hService +/// HANDLE - PowerService handle +/// \~english @param [in] f_eSessionType +/// EPWR_SESSION_TYPE - Session type +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter +/// \~english @retval eFrameworkunifiedStatusFail Failed +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Fire and Forget x Method +/// \~english @par Detail +/// - The API opens a session between the user service +/// and the PowerService and makes the PowerService available. \n +/// \n +/// - Include ss_power_service_ifc.h +/// - Library libSS_PowerServiceIf.so +/// \~english @see +/// None +//////////////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus PwrServiceOpenSessionRequest(HANDLE f_hService, + EPWR_SESSION_TYPE f_eSessionType); + +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup PwrServiceCloseSessionRequest +/// \~english @par Summary +/// End using the PowerService. +/// \~english @param [in] f_hService +/// HANDLE - PowerService handle +/// \~english @param [in] f_hSession +/// HANDLE - Session type +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusFail Failed +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Fire and Forget x Method +/// \~english @par Detail +/// - The API closes the session between the user service +/// and the PowerService and terminatesthe PowerSerivce use. \n +/// \n +/// - Include ss_power_service_ifc.h +/// - Library libSS_PowerServiceIf.so +/// \~english @see +/// None +//////////////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus PwrServiceCloseSessionRequest(HANDLE f_hService, HANDLE f_hSession); + +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup PwrServiceDecodeOpenSessionResponse +/// \~english @par Summary +/// Obtain a handle for OpenSessionRequest response message. +/// \~english @param [in] f_hApp +/// HANDLE - Application handle +/// \~english @param [in] f_hSession +/// HANDLE& - Address of storing session handle +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusNullPointer NULL Pointer +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Sync only(None communication) +/// \~english @par Detail +/// - The API obtains a handle for OpenSessionRequest +/// response message using the given application handle.\n +/// \n +/// - Include ss_power_service_ifc.h +/// - Library libSS_PowerServiceIf.so +/// \~english @see +/// None +//////////////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus PwrServiceDecodeOpenSessionResponse(HANDLE f_hApp, + HANDLE& f_hSession); // NOLINT (runtime/references) + +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup PwrServiceSetVoltageState +/// \~english @par Summary +/// Set power supply state. +/// \~english @param [in] f_hSession +/// HANDLE - Session handle +/// \~english @param [in] f_eVoltage_state +/// EPWR_VOLTAGE_STATE_TYPE - Power supply status value +/// \~english @par +/// - Power supply status value +/// <table> +/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr> +/// <tr><td>epsvsINVALID</td><td>0xFF</td></tr> +/// <tr><td>epsvsNORMAL</td><td>0x20</td></tr> +/// <tr><td>epsvsLVI1</td><td>0x22</td></tr> +/// <tr><td>epsvsLVI2</td><td>0x24</td></tr> +/// </table> +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter +/// \~english @retval eFrameworkunifiedStatusFail Failed +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Method only +/// \~english @par Detail +/// - The API sets power supply state to the PowerService. \n +/// \n +/// - Include ss_power_service_ifc.h +/// - Library libSS_PowerServiceIf.so +/// \~english @see +/// None +//////////////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus PwrServiceSetVoltageState(HANDLE f_hSession, + EPWR_VOLTAGE_STATE_TYPE f_eVoltage_state); + +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup PwrServiceSetCrankState +/// \~english @par Summary +/// Set crank state. +/// \~english @param [in] f_hSession +/// HANDLE - Session handle +/// \~english @param [in] f_eCrank_state +/// EPWR_CRANK_STATE_TYPE - Crank state value +/// \~english @par +/// - Crank state value +/// <table> +/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr> +/// <tr><td>epscsINVALID</td><td>0xFF</td></tr> +/// <tr><td>epscsENTRY</td><td>0xA0</td></tr> +/// <tr><td>epscsEXIT</td><td>0xA2</td></tr> +/// </table> +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter +/// \~english @retval eFrameworkunifiedStatusFail Failed +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Fire and Forget only +/// \~english @par Detail +/// - The API sets crank state to the PowerService.\n +/// \n +/// - Include ss_power_service_ifc.h +/// - Library libSS_PowerServiceIf.so +/// \~english @see +/// None +//////////////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus PwrServiceSetCrankState(HANDLE f_hSession, + EPWR_CRANK_STATE_TYPE f_eCrank_state); + +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup PwrServiceSystemModeInfoRequest +/// \~english @par Summary +/// Request to obtain the system mode information. +/// \~english @param [in] f_hSession +/// HANDLE - Session handle +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusFail Failed +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Method x Method +/// \~english @par Detail +/// - The API requests the PowerService to obtain +/// the system mode information.\n +/// \n +/// - Include ss_power_service_ifc.h +/// - Library libSS_PowerServiceIf.so +/// \~english @see +/// None +//////////////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus PwrServiceSystemModeInfoRequest(HANDLE f_hSession); + +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup PwrServiceSendInitCompReport +/// \~english @par Summary +/// Send an initialize complete response. +/// \~english @param [in] f_hSession +/// HANDLE - Session handle +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusFail Failed +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Fire and Forgeat x Fire and Forget +/// \~english @par Detail +/// - The API sends an initialize complete response to the PowerService.\n +/// \n +/// - Include ss_power_service_ifc.h +/// - Library libSS_PowerServiceIf.so +/// \~english @see +/// None +//////////////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus PwrServiceSendInitCompReport(HANDLE f_hSession); + +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup PwrServiceSendSetShutdownPopupRequest +/// \~english @par Summary +/// Obtain shutdown state. +/// \~english @param [in] f_hSession +/// HANDLE - Session handle +/// \~english @param [in] f_eShutdownPopup +/// EPWR_SHUTDOWN_POPUP_TYPE - Shutdown state +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter +/// \~english @retval eFrameworkunifiedStatusFail Failed +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Method only +/// \~english @par Detail +/// - The API obtains the shutdown state from the PowerService. \n +/// \n +/// - Include ss_power_service_ifc.h +/// - Library libSS_PowerServiceIf.so +/// \~english @see +/// None +//////////////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus PwrServiceSendSetShutdownPopupRequest(HANDLE f_hSession, + EPWR_SHUTDOWN_POPUP_TYPE f_eShutdownPopup); + +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup PwrServiceSendStartupConfirmationMsgRequest +/// \~english @par Summary +/// Send startup confirmation request. +/// \~english @param [in] f_hSession +/// HANDLE - Session handle +/// \~english @param [in] f_eState +/// EPWR_SC_MSG_STRUCT +/// - Address of the structure for startup confirmation request message +/// \~english @par +/// - Structure for startup confirmation request message +/// \~english @code +/// typedef struct { +/// EPWR_SC__CWORD56__BOOT_MODE_TYPE _CWORD56_BootMode; +/// EPWR_SC_WAKEUP_TYPE wakeupType; +/// EPWR_SC_COLD_START_REQ_TYPE coldStartRequest; +/// EPWR_SC_SECURITY_STATUS securityStatus; +/// UI_32 HWVersion; +/// UI_32 matchedHardwareType; +/// UI_32 softwareType; +/// UI_32 imageType; +/// UI_32 majorVersion; +/// UI_32 minorVersion; +/// UI_32 SWVersionYear; +/// UI_32 SWVersionWeek; +/// UI_32 SWVersionPatchLevel; +/// } StartupConfirmationMsgStrut, EPWR_SC_MSG_STRUCT; +/// @endcode\n +/// \n +/// - EPWR_SC__CWORD56__BOOT_MODE_TYPE +/// <table> +/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr> +/// <tr><td>eps_CWORD56_bmINVALID</td><td>0xFF</td></tr> +/// <tr><td>eps_CWORD56_bmAPPLICATION_MODE</td><td>0x00</td></tr> +/// <tr><td>eps_CWORD56_bmPROGRAMMING_MODE</td><td>0x08</td></tr> +/// </table>\n +/// \n +/// - EPWR_SC_WAKEUP_TYPE +/// <table> +/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr> +/// <tr><td>epsstINVALID</td><td>0xFF</td></tr> +/// <tr><td>epsstWARMSTART</td><td>0x00</td></tr> +/// <tr><td>epsstCOLDSTART</td><td>0x01</td></tr> +/// </table>\n +/// \n +/// - EPWR_SC_COLD_START_REQ_TYPE +/// <table> +/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr> +/// <tr><td>epsscrtINVALID</td><td>0xFF</td></tr> +/// <tr><td>epsscrtNOT_REQUIRED</td><td>0x00</td></tr> +/// <tr><td>epsscrtREQUIRED</td><td>0x01</td></tr> +/// </table>\n +/// \n +/// - EPWR_SC_SECURITY_STATUS +/// <table> +/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr> +/// <tr><td>epsssINVALID</td><td>0xFF</td></tr> +/// <tr><td>epsssUNLOCK</td><td>0x00</td></tr> +/// <tr><td>epsssLOCK</td><td>0x01</td></tr> +/// </table>\n +/// \n +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusFail Failed +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Fire and Forget x Fire and Forget +/// \~english @par Detail +/// - The API sends a startup confirmation request to the PowerService.\n +/// \n +/// - Include ss_power_service_ifc.h +/// - Library libSS_PowerServiceIf.so +/// \~english @see +/// None +//////////////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus PwrServiceSendStartupConfirmationMsgRequest(HANDLE f_hSession + , EPWR_SC_MSG_STRUCT f_eState); + +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup PwrServiceSendPowerRequest +/// \~english @par Brief +/// Send power request. +/// \~english @param [in] f_hSession +/// HANDLE - Session handle +/// \~english @param [in] f_eState +/// \ref PowerRequestMsgStrutWithUMCR "EPWR_POWER_REQUEST_MSG_STRUCT_WITH_UMCR&" - Address of the structure for power request message +/// \~english @par +/// \n +/// Of the eight elements of the \ref PowerRequestMsgStrutWithUMCR "EPWR_POWER_REQUEST_MSG_STRUCT_WITH_UMCR" structure, five elements set fixed values.\n +/// startupType = \ref epsprm_CWORD102_si_CWORD102__STARTUP_NORMAL\n +/// openingType = \ref epsprmotTIMING_TYPE_1\n +/// lastUserMode = \ref epsumON\n +/// manResetInfo = \ref epsprmriNORMAL\n +/// lastSystemRetentionReq = \ref epsprlsrrLAST_SYSTEM_OFF\n +/// \n +/// For the following, set different values at system startup and shutdown.\n +/// (Element name) = (Startup settings or Shutdown settings)\n +/// startupReason = (\ref epswfIGN_ACC or \ref epswfINVALID)\n +/// userMode = (\ref epsumON or \ref epsumOFF)\n +/// \n +/// For the following, set different values at power state transition.\n +/// <table> +/// <tr bgcolor="black"><th>Element name</th><th>Power state</th><th>Value</th></tr> +/// <tr><td rowspan=7>userModeChangeReason</td><tr><td>Not Available</td><td>\ref epsumcrNOT_AVAILABLE</td></tr> +/// <tr><td> </td><td>\ref epsumcrON_KEY</td></tr> +/// <tr><td>Parking(+B)</td><td>\ref epsumcrPARKING_B</td></tr> +/// <tr><td>Pre-boot(+BA)</td> <td>\ref epsumcrPRE_BA</td></tr> +/// <tr><td>Normal-boot</td> <td>\ref epsumcrNORMAL</td></tr> +/// <tr><td>Background-boot(+BA)</td> <td>\ref epsumcrBACKGROUND_BA</td></tr> +/// </table> +/// \n +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusFail Failed +/// \~english @par Prerequisite +/// None +/// \~english @par Change of internal state +/// None +/// \~english @par Conditions of processing failure +/// - When the session handle (f_hSession) specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle] +/// - The process fails for some reason. [eFrameworkunifiedStatusFail] +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Method only +/// \~english @par Detail +/// - The API send a power request to the PowerService.\n +/// \n +/// - Include ss_power_service_ifc.h +/// - Library libSS_PowerServiceIf.so +/// \~english @see +/// None +//////////////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus PwrServiceSendPowerRequest(HANDLE f_hSession, + EPWR_POWER_REQUEST_MSG_STRUCT_WITH_UMCR& f_eState); + + +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup PwrServiceSendShutdownRequest +/// \~english @par Summary +/// Send shutdown request. +/// \~english @param [in] f_hSession +/// HANDLE - Session handle +/// \~english @param [in] f_eState +/// EPWR_SHUTDOWN_REQUEST_MSG_STRUCT& +/// - Address of the structure for shutdown request message +/// \~english @par +/// - Structure for shutdown request message +/// \~english @code +/// typedef struct { +/// EPWR_ONS_TYPE ONS_Type; +/// EPWR_SHUTDOWN_TRIGGER_TYPE shutdownTrigger; +/// EPWR_USER_MODE_TYPE lastUserMode; +/// EPWR_TRANSPORT_MODE_TYPE transportMode; +/// EPWR_PROD_MODE_TYPE productionMode; +/// EPWR_LHC_TYPE limpHomeCutoffRequest; +/// } ShutdownRequestMsgStrut, EPWR_SHUTDOWN_REQUEST_MSG_STRUCT +/// @endcode\n +/// \n +/// - EPWR_ONS_TYPE +/// <table> +/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr> +/// <tr><td>epssdmonsINVALID</td><td>0xFF</td></tr> +/// <tr><td>epssdmonsNO_ONS</td><td>0x00</td></tr> +/// <tr><td>epssdmonsONS</td><td>0x01</td></tr> +/// </table>\n +/// \n +/// - EPWR_SHUTDOWN_TRIGGER_TYPE +/// <table> +/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr> +/// <tr><td>epssdmsdtINVALID</td><td>0xFF</td></tr> +/// <tr><td>epssdmsdtTESTACC_OFF</td><td>0x00</td></tr> +/// <tr><td>epssdmsdtON_KEY</td><td>0x01</td></tr> +/// <tr><td>epssdmsdtIGN_LOCK</td><td>0x02</td></tr> +/// <tr><td>epssdmsdtPWR_SAVE</td><td>0x03</td></tr> +/// <tr><td>epssdmsdtTMP_STARTUP</td><td>0x04</td></tr> +/// <tr><td>epssdmsdtDIAG_DEACTIVATION</td><td>0x05</td></tr> +/// <tr><td>epssdmsdtABNORMAL_VOLTAGE</td><td>0x06</td></tr> +/// <tr><td>epssdmsdtABNORMAL_TEMP</td><td>0x07</td></tr> +/// <tr><td>epssdmsdtBATTERYCUTOFF</td><td>0x08</td></tr> +/// <tr><td>epssdmsdtLIMPHOME</td><td>0x09</td></tr> +/// <tr><td>epssdmsdtHU_CAN_ERROR</td><td>0x0A</td></tr> +/// <tr><td>epssdmsdtBODY_CAN_ERROR</td><td>0x0B</td></tr> +/// <tr><td>epssdmsdtTRANSPORT_MODE</td><td>0x0C</td></tr> +/// <tr><td>epssdmsdtPRODUCTION_MODE</td><td>0x0D</td></tr> +/// <tr><td>epssdmsdtIGN_OFF</td><td>0x0E</td></tr> +/// <tr><td>epssdmsdtGENERIC_ERROR_RESET</td><td>0x0F</td></tr> +/// <tr><td>epssdmsdtFATAL_ERROR_RESET</td><td>0x10</td></tr> +/// <tr><td>epssdmsdtUSER_DATA_RESET</td><td>0x11</td></tr> +/// <tr><td>epssdmsdtFACTORY_DATA_RESET</td><td>0x12</td></tr> +/// <tr><td>epssdmsdtFAST_SLEEP_MODE</td><td>0x13</td></tr> +/// <tr><td>epssdmsdtNORMAL_RESET</td><td>0x14</td></tr> +/// <tr><td>epssdmsdtPROGUPDATE_RESET</td><td>0x15</td></tr> +/// </table>\n +/// \n +/// - EPWR_USER_MODE_TYPE +/// <table> +/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr> +/// <tr><td>epsumINVALID</td><td>0xFF</td></tr> +/// <tr><td>epsumOFF</td><td>0x00</td></tr> +/// <tr><td>epsumON</td><td>0x01</td></tr> +/// </table>\n +/// \n +/// - EPWR_TRANSPORT_MODE_TYPE +/// <table> +/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr> +/// <tr><td>epstmINVALID</td><td>0xFF</td></tr> +/// <tr><td>epstmDISABLED</td><td>0x00</td></tr> +/// <tr><td>epstmENABLED</td><td>0x01</td></tr> +/// </table>\n +/// \n +/// - EPWR_PROD_MODE_TYPE +/// <table> +/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr> +/// <tr><td>epspmINVALID</td><td>0xFF</td></tr> +/// <tr><td>epspmDISABLED</td><td>0x00</td></tr> +/// <tr><td>epspmENABLED</td><td>0x01</td></tr> +/// </table>\n +/// \n +/// - EPWR_LHC_TYPE +/// <table> +/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr> +/// <tr><td>epslhcINVALID</td><td>0xFF</td></tr> +/// <tr><td>epslhcDISABLED</td><td>0x00</td></tr> +/// <tr><td>epslhcENABLED</td><td>0x01</td></tr> +/// </table>\n +/// \n +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusFail Failed +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Method x Method +/// \~english @par Detail +/// - The API sends shutdown request to the PowerService.\n +/// \n +/// - Include ss_power_service_ifc.h +/// - Library libSS_PowerServiceIf.so +/// \~english @see +/// None +//////////////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus PwrServiceSendShutdownRequest( + HANDLE f_hSession + , EPWR_SHUTDOWN_REQUEST_MSG_STRUCT &f_eState); // NOLINT (runtime/references) + +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup PwrServiceSendHeartBeatRequest +/// \~english @par Summary +/// Send a request for HeartBeat monitoring start. +/// \~english @param [in] f_hSession +/// HANDLE - Session handle +/// \~english @param [in] f_eHbReqMsg +/// EPWR_HB_REQ_MSG_STRUCT* +/// - Address of the structure for HeartBeat monitoring start request message +/// \~english @par +/// - Structure for HeartBeat monitoring start request message +/// \~english @code +/// typedef struct { +/// UI_8 IntervalSec; +/// } EPWR_HB_REQ_MSG_STRUCT; +/// @endcode\n +/// \n +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusFail Failed +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Method x Method +/// \~english @par Detail +/// - The API sends HeartBeat monitoring start\n +/// request to the PowerService\n +/// - Include ss_power_service_ifc.h +/// - Library libSS_PowerServiceIf.so +/// \~english @see +/// None +//////////////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus PwrServiceSendHeartBeatRequest( + HANDLE f_hSession, + EPWR_HB_REQ_MSG_STRUCT *f_eHbReqMsg); + +#endif // POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_IF_H_ // NOLINT (build/header_guard) + +/** @}*/ // end of PowerService +/** @}*/ // end of SystemService +/** @}*/ // end of BaseSystem diff --git a/service/system/interface_unified/library/include/system_service/ss_power_service_local.h b/service/system/interface_unified/library/include/system_service/ss_power_service_local.h new file mode 100755 index 0000000..51a284a --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_power_service_local.h @@ -0,0 +1,66 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_power_service_local.h + * @brief \~english This file supports the Power Service interface. + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#ifndef SS_POWER_SERVICE_LOCAL_H_ // NOLINT (build/header_guard) +#define SS_POWER_SERVICE_LOCAL_H_ + + +#include <native_service/frameworkunified_types.h> +#include <map> +#include "system_service/ss_system_types.h" + + + + + +const UI_32 MaxTestCaseName = 128; +const UI_32 MaxRespMsg = 2048; + +typedef enum _PwLVIStatus { + ePwSrvLVI_Status_InActive, + ePwSrvLVI_Status_Active +} PowerSrvLVIStatus, EPWER_LVI_STATUS; + +typedef struct _PwCompleteAck { + UI_16 unSessionId; + CHAR szServiceName[MAX_QUEUE_NAME_SIZE]; +} StartCompleteAck; + +typedef struct _SS_PSCurrentState { + CHAR testCaseId[MaxTestCaseName]; + CHAR printRespmsg[MaxRespMsg]; +}SS_PSCurrentState; + + +#endif /* SS_POWER_SERVICE_LOCAL_H_ */ // NOLINT (build/header_guard) +/** @}*/ // end of power_service +/** @}*/ // end of SystemService +/** @}*/ // end of BaseSystem diff --git a/service/system/interface_unified/library/include/system_service/ss_power_service_notifications.h b/service/system/interface_unified/library/include/system_service/ss_power_service_notifications.h new file mode 100755 index 0000000..b25172d --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_power_service_notifications.h @@ -0,0 +1,48 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_power_service_notifications.h + * @brief \~english This file supports the Power Service interface. + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup power_service + * @ingroup system_service + * @{ + */ +#ifndef POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_NOTIFICATIONS_H_ // NOLINT (build/header_guard) +#define POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_NOTIFICATIONS_H_ + +#include "system_service/ss_services.h" + + + + +/// Indicated if Power Service is available or not portion of this message is BOOL +#define szNTFY_PowerAvailability SERVICE_POWER"/Availability" + +/// @} + +#endif // POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_NOTIFICATIONS_H_ // NOLINT (build/header_guard) +/** @}*/ // end of power_service +/** @}*/ // end of SystemService +/** @}*/ // end of BaseSystem diff --git a/service/system/interface_unified/library/include/system_service/ss_power_service_notifications_local.h b/service/system/interface_unified/library/include/system_service/ss_power_service_notifications_local.h new file mode 100755 index 0000000..a06c030 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_power_service_notifications_local.h @@ -0,0 +1,67 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_power_service_notifications_local.h + * @brief \~english This file supports the Power Service interface. + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup system_service + * @{ + */ +#ifndef SS_POWER_SERVICE_NOTIFICATIONS_LOCAL_H_ // NOLINT (build/header_guard) +#define SS_POWER_SERVICE_NOTIFICATIONS_LOCAL_H_ + +#include "system_service/ss_services.h" + + +/// \addtogroup system_manager +/// @{ + +/// Depreciated !! +#define szNTFY_PowerLVI1 SERVICE_POWER"/LVI1" +/// Depreciated !! +#define szNTFY_PowerLVI2 SERVICE_POWER"/LVI2" +/// Indicates the current power level state +#define szNTFY_PowerLevel SERVICE_POWER"/Level" + +/// Notification that Power Service publishes for subscribers ( ie, HMI ) to +/// display a popup indicating the type of shutdown condition. +/// 1. Power Save +/// 2. BatteryCut +/// 3. Low Voltage +#define szNTFY_ShutdownPopup SERVICE_POWER"/ShutdownPopup" + +/// Notification that Power Service publishes for subscribers ( ie, HMI ) to +/// display a popup indicating the type of CPMShowPowerPopup. +/// 1. Normal +/// 2. Critical +/// 3. Application Critical +#define szNTFY_PowerPopup SERVICE_POWER"/PowerPopup" + +/// @} + +#endif /* SS_POWER_SERVICE_NOTIFICATIONS_LOCAL_H_ */ // NOLINT (build/header_guard) +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_power_service_protocol.h b/service/system/interface_unified/library/include/system_service/ss_power_service_protocol.h new file mode 100755 index 0000000..92860e8 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_power_service_protocol.h @@ -0,0 +1,201 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_power_service_protocol.h + * @brief \~english This file supports the Power Service interface. + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#ifndef POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_PROTOCOL_H_ // NOLINT (build/header_guard) +#define POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_PROTOCOL_H_ + + +#include <native_service/frameworkunified_types.h> +#include <native_service/frameworkunified_service_protocol.h> +#include "system_service/ss_power_service.h" + +/// \ingroup PSM_Local +/** + * power service protocol --> define all protocol messages in and out of power that are pertinent to the functionality offered by power. + */ +typedef enum _SS_PowerServiceProtocol { + // Diagnostic Protocol + SS_POWER_PRINT_CONNECTIONS = 0x32, //!< client to service + SS_POWER_PRINT_STACK = 0x33, //!< client to service + + SS_POWER_WAKEUP_COMPLETE = 0x41, //!< service to client // used by power state machine + SS_POWER_SHUTDOWN_COMPLETE = 0x42, //!< service to client // used by power state machine + SS_POWER_VOLTAGE_STATE = 0x43, //!< client to service + SS_POWER_LVI2_SHUTDOWN_COMPLETE = 0x44, //!< service to client + SS_POWER_CRANK_STATE = 0x45, //!< client to service + + + // System Manager commands + SS_POWER_WAKEUP_MODULES_CMPL_RSPN = 0x51, //!< service to shadow + SS_POWER_SYSTEM_LAUNCH_COMPLETE = 0x56, //!< client to service + + + // SSM Service commands + SS_POWER_STATE_CHANGE_REQ = 0x40, //!< client to service : send wakeup to System Manager + SS_POWER_STATE_CHANGE_RESP = 0x46, //!< \~english Response to request of power state transition to power_supply_manager_shadow. + + SS_POWER_COMM_WAKEUP = 0x58, //!< client to service : Power On expected + + SS_POWER_SHUTDOWN_REQ = 0x59, //!< client to service : Comm Sleep from Shadow + SS_POWER_SHUTDOWN_RESP = 0x57, //!< service to shadow : Shutdown complete from System Manager + + SS_POWER_CRNT_STATE_QUERY = 0x60, //!< client to service + SS_POWER_CRNT_STATE_QUERY_RSPN = 0x61, //!< service to client + + SS_POWER_SYSTEM_MODE_INFO_REQ = 0x63, //!< Client (Shadow) to Service (Power Service) + SS_POWER_SYSTEM_MODE_INFO_RESP = 0x64, //!< Service to client ***** + + SS_POWER_INITCOMP_REP = 0x70, //!< Client (Shadow) to Service (Power Service) + + //************************************************************************* + // CPMShowPowerPopup Notification Protocol: * + // * + // Request by the Power Shadow to the Power Service to publish a * + // 'Voltage State' notification. * + // * + // The Request message carries the requested notification. * + // The Response message carries the EFrameworkunifiedStatus of the request. * + SS_POWER_PUBLISH_POWER_POPUP_REQ, //!< Shadow to Pwr Svc + SS_POWER_PUBLISH_POWER_POPUP_RESP, //!< Pwr Svc to Shadow + // * + // End of CPMShowPowerPopup Notification Protocol * + //************************************************************************* + + //************************************************************************* + // Shutdown Condition Notification Protocol: * + // * + // Request by the Power Shadow to the Power Service to publish the * + // 'Shutdown Condition' notification. * + // * + // The Request message carries the requested PowerPopup. * + // The Response message carries the EFrameworkunifiedStatus of the request. * + SS_POWER_PUBLISH_SHUTDOWN_CONDITION_REQ, //!< Shadow to Pwr Svc + SS_POWER_PUBLISH_SHUTDOWN_CONDITION_RESP, //!< Pwr Svc to Shadow + // * + // End of Shutdown Condition Notification Protocol * + //************************************************************************* + + //************************************************************************* + // Startup Confirmation Protocol: * + // * + // Request by the Power Shadow to the Power Service to forward to the * + // System Manager the Startup Confirmation message. * + // * + // The Request message carries the Startup Confirmation message. * + // The Response message carries the EFrameworkunifiedStatus of the request. * + SS_POWER_FWD_START_CONFIRMATION_MSG_REQ, //!< Shadow to Pwr Svc + SS_POWER_FWD_START_CONFIRMATION_MSG_RESP, //!< Pwr Svc to Shadow + // * + // End of Startup Confirmation Protocol * + //************************************************************************* + + //************************************************************************* + // Power Request Protocol: * + // * + // Power Request message from the Power Shadow to the Power Service with * + // _CWORD56_'s "Power_Request" IPC_Command data. * + // * + // The Request message carries the _CWORD56_'s data. * + // The Response message will use the SS_POWER_STATE_CHANGE_RESP protocol * + // ID. * + SS_POWER_POWER_REQUEST_MSG, //!< Shadow to Pwr Svc + // * + // End of Power Request Protocol * + //************************************************************************* + + //************************************************************************* + // Shutdown Request Protocol: * + // * + // Shutdown Request message from the Power Shadow to the Power Service * + // with _CWORD56_'s "Shutdown_Request" IPC_Command data. * + // * + // The Request message carries the _CWORD56_'s data. * + // The Response message will use the SS_POWER_STATE_CHANGE_RESP protocol * + // ID. * + SS_POWER_SHUTDOWN_REQUEST_MSG, //!< Shadow to Pwr Svc + // * + // End of Shutdown Request Protocol * + //************************************************************************* + + //************************************************************************* + // User Mode Protocol: * + // * + // Request by the Power Service to the System Manager, originally from * + // the Power Shadow, to turn on or off the video & audio output of HMI * + // and Audio services. * + // User Mode 'On' => turn video & audio output on * + // User Mode 'Off' => turn video & audio output off * + // * + // The Request message carries the requested User Mode state. * + // The Response message carries the actual User Mode state. * + SS_POWER_USER_MODE_SET_RESP, //!< Power Service to Shadow + // * + // Note: See the corresponding Power Service / System Manager * + // 'SS_SystemManagerProtocol' enums in /SystemServices/inc/ * + // ss_system_manager_protocol.h * + // * + // End of User Mode Protocol * + //************************************************************************* + + //************************************************************************* + // Heartbeat Protocol: * + // * + // Request by the Power Service to the System Manager, originally from * + // the Power Shadow, to support the heartbeat request response system. * + // * + // The Request message carries the expected application processor * + // heartbeat response interval in units of seconds. * + // The Response message has a data length of zero and serves as a * + // periodic heartbeat message to the boot micro. * + SS_POWER_HEARTBEAT_REQ, //!< Shadow to Power Service + SS_POWER_HEARTBEAT_RESP, //!< Power Service to Shadow + // * + // End of Heartbeat Protocol * + //************************************************************************* + + //************************************************************************* + // Hard Reset Request Protocol : * + // * + // Request by the Power Service to the Shadow to support the sending of * + // a reset request with type argument to the boot micro. * + // * + // The Request message carries epsCpuResetReason as data payload. * + SS_POWER_HARD_RESET_REQ, //!< Power Service to Shadow + // * + // End of Hard Reset Request Protocol * + //************************************************************************* +}SS_PowerServiceProtocol; + +#endif /* POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_PROTOCOL_H_ */ // NOLINT (build/header_guard) +/** @}*/ // end of interface_unified +/** @}*/ // end of system_service +/** @}*/ // end of BaseSystem +// EOF diff --git a/service/system/interface_unified/library/include/system_service/ss_services.h b/service/system/interface_unified/library/include/system_service/ss_services.h new file mode 100755 index 0000000..d414670 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_services.h @@ -0,0 +1,63 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_services.h + * @brief \~english This file supports contains the queue names of all System Services processes. + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#ifndef SS_SERVICES_H_ // NOLINT (build/header_guard) +#define SS_SERVICES_H_ + +#include <agl_thread.h> + + +// Caution:ServiceName length mas is 15 +// System_Services domain services 0123456789ABCDE +#define SS_DEV_DETECT_THD "SS_Dev_Detect_Thd" +#define SS_DEV_DETECT_SRV MN_SS_DEVDETECTSRV +#define SS_DEV_DETECT_BSP_THD "SS_DeviceDetectErr" +#define SS_GROUP_LAUNCH_TRIGGER "SS_GroupLaunchTrigger" +#define SERVICE_HEARTBEAT "SS_HeartBeatService" +#define SERVICE_LOGGER MN_SS_LOGGERSRV +#define SS_UDEV_DEV_DETECT_DLL "SS_UDEV_DeviceDetect" +#define SS_PLM_SERVICE "SS_PLMService" +#define SERVICE_POWER MN_SS_POWERSERVICE +#define SS_RESOURCE_MONITOR_SERVICE "SS_ResourceMonitorService" +#define SERVICE_SOFTWAREUPDATE "SS_SofUpdateSrv" +#define SERVICE_SYSMANAGER MN_SS_SYSMANAGER +#define SS_WINSYS MN_SS_WINSYS +#define SS_RESOURCE_MANAGER MN_SS_RESOURCEMGR +#define SS_TASK_MANAGER MN_SS_TASKMANAGER +#define SERVICE_VUP MN_VUPSERVICE +#define SS_UPDATESERVICE MN_SS_UPDATESERVICE + +/// @} + +#endif /* SS_SERVICES_H_ */ // NOLINT (build/header_guard) +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_sm_client_if.h b/service/system/interface_unified/library/include/system_service/ss_sm_client_if.h new file mode 100755 index 0000000..70b9425 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_sm_client_if.h @@ -0,0 +1,1064 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_sm_client_if.h + * @brief \~english This file supports the AGL framework client interface to System manager. + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ + + +#ifndef __SS_SYSTEM_MANAGER_CLIENT_IF_H__ // NOLINT (build/header_guard) +#define __SS_SYSTEM_MANAGER_CLIENT_IF_H__ + +#include <native_service/frameworkunified_framework_types.h> +#include <native_service/ns_logger_if.h> +#include <string> +#include "system_service/ss_power_service.h" +#include "system_service/ss_system_manager_if.h" + + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup RegisterSMSessionAckCallback +/// \~english @par Summary +/// API for setting the FrameworkunifiedOnStop response +/// \~english @param [in] CallbackPtr +/// EFrameworkunifiedStatus - Pointer to a callback function +/// \~english @par +/// - TRUE : Not carried out in the automatic response. +/// - FALSE : Carry out the response in automatic. (Default) +/// \~english @retval VOID None +/// \~english @par Preconditions +/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Sync only(None communication) +/// \~english @par Detail +/// In the case of is_start_required = TURE, Client Services of System Manager, automatically \n +/// System Manager and the session at the same time is building and start-up. \n +/// It is possible to receive a call back at the timing when the session establishment is completed \n +/// by this API. \n +/// is_start_required is, as a Launch Configuration information, have the following meanings. +/// \~english @par +/// is_start_required \n +/// - True: Create a session with the System Manager.(Service to use the Dispatcher.) \n +/// - False: Not create a session with the System Manager.(Do not use the Dispatcher Service.) +/// OnStart/Stop/DebugDump Callback is not called. HeartBeat function does not apply. +/// \~english @see None +//////////////////////////////////////////////////////////////////////////////////// +extern EFrameworkunifiedStatus RegisterSMSessionAckCallback(EFrameworkunifiedStatus (*CallbackPtr)(HANDLE)); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup SetDataResetModeToSystemManager +/// \~english @par Summary +/// API to record the data reset mode of the next boot in a non-volatile area. +/// \~english @param [in] dataResetMode +/// ESMDataResetModeInfo - Data reset mode information +/// \~english @par +/// - e_SS_SM_DATA_RESET_MODE_NONE : Do not initialize +/// - e_SS_SM_DATA_RESET_MODE_USER : User data initialization +/// - e_SS_SM_DATA_RESET_MODE_FACTORY : Factory initialization +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter +/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle +/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full +/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor +/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) +/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size +/// \~english @retval eFrameworkunifiedStatusBadConnection Socket connection error +/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred +/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) +/// \~english @par Preconditions +/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// - Specified log type is invalid(In the case of value which does not correspond to enum eSMUserLogType). +/// [eFrameworkunifiedStatusInvldParam] +/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer] +/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle] +/// - System Manager handle type for the session is not a send and receive type. [eFrameworkunifiedStatusInvldHndlType] +/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] +/// - Send and receive for the file descriptor of System Manager message for the session is invalid. +/// [eFrameworkunifiedStatusErrNoEBADF] +/// - Place to interrupt by the system call (signal) has occurred during the send and receive of the System +/// Manager message for the session. [eFrameworkunifiedStatusErrNoEINTR] +/// - Size of the send and receive buffer of the System Manager message for the session is invalid. +/// [eFrameworkunifiedStatusInvldBufSize] +/// - Send and receive and reception of System Manager message for the session fails to socket connection. +/// [eFrameworkunifiedStatusBadConnection] +/// - Any error has occurred at the time of send and receive of the System Manager message for the session. +/// [eFrameworkunifiedStatusFail] +/// - Send and receive of System Manager message for the session fails to shared memory access. +/// [eFrameworkunifiedStatusErrOther] +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Fire and Forget x Method +/// \~english @par Detail +/// The data reset mode to save in a non-volatile area, the function return.\n +/// System Manager is to expand the resident service data reset mode of the non-volatile area as\n +/// an argument of FrameworkunifiedOnStart.\n +/// Task Manager is Callback data initialization interface of the same information as an argument.\n +/// All of, the completion of the FrameworkunifiedOnStart processing of all resident services (System Manager) \n +/// and, at the timing when the Callback of data initialization interface of all non-resident \n +/// service has been completed (Task Manager), a data reset mode, initialized to e_SS_SM_DATA_RESET_ NONE. \n +/// In other words, when the reset until initialization occurs, the same data reset mode again to \n +/// the argument, FrameworkunifiedOnStart or, Callback of data initialization interface is performed. +/// \~english @see SetProgUpdateStateToSystemManager +//////////////////////////////////////////////////////////////////////////////////// +extern EFrameworkunifiedStatus SetDataResetModeToSystemManager(ESMDataResetModeInfo dataResetMode); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup SetProgUpdateStateToSystemManager +/// \~english @par Summary +/// API to record the program update state in the non-volatile information. +/// \~english @param [in] updateState +/// SMProgUpdateState - Program update status +/// \~english @par +/// - SS_SM_PROG_UPDATE_STATE_UPDATED : Program update +/// - SS_SM_PROG_UPDATE_STATE_MAP_UPDATED : Map update +/// - SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED : Map difference updating +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter +/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle +/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full +/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor +/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) +/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size +/// \~english @retval eFrameworkunifiedStatusBadConnection Socket connection error +/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred +/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) +/// \~english @par Preconditions +/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// - Specified program update status information is invalid (in the case of a value that does not correspond to +/// the enum SMProgUpdateState). [eFrameworkunifiedStatusInvldParam] +/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer] +/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle] +/// - System Manager handle type for the session is not a send and receive type. [eFrameworkunifiedStatusInvldHndlType] +/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] +/// - Send and receive for the file descriptor of System Manager message for the session is invalid. +/// [eFrameworkunifiedStatusErrNoEBADF] +/// - Place to interrupt by the system call (signal) has occurred during the send and receive of the System +/// Manager message for the session. [eFrameworkunifiedStatusErrNoEINTR] +/// - Size of the send and receive buffer of the System Manager message for the session is invalid. +/// [eFrameworkunifiedStatusInvldBufSize] +/// - Send and receive and reception of System Manager message for the session fails to socket connection. +/// [eFrameworkunifiedStatusBadConnection] +/// - Any error has occurred at the time of send and receive of the System Manager message for the session. +/// [eFrameworkunifiedStatusFail] +/// - Send and receive of System Manager message for the session fails to shared memory access. +/// [eFrameworkunifiedStatusErrOther] +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Sync only(None communication) +/// \~english @par Detail +/// The program update state to save in a non-volatile area, the function return.\n +/// updateState is it is possible to specify more than one by setting the OR.\n +/// Based on the setting state, to determine isProgUpdated, isMapUpdated, the value \n +/// of the isMapDiffUpdated provided in GetInterfaceunifiedOnStartExtInfo and GetInterfaceunifiedOnStopExtInfo.\n +/// Task Manager is provided in data initialization interface, the same information to the non-resident service.\n +/// Set state is initialized with the same timing as data reset mode.\n +/// (See SetDataResetModeToSystemManager) +/// \~english @see SetDataResetModeToSystemManager, GetInterfaceunifiedOnStartExtInfo, GetInterfaceunifiedOnStopExtInfo +//////////////////////////////////////////////////////////////////////////////////// +extern EFrameworkunifiedStatus SetProgUpdateStateToSystemManager(SMProgUpdateState progUpdateState); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup SendCpuResetRequestToSystemManager +/// \~english @par Summary +/// API to request LOG saved to the internal non-volatile area +/// \~english @param [in] l_eCpuResetReason +/// ESMCpuResetReason - Reset factor +/// \~english @param [in] f_messageStr +/// std::string - Abnormal message string +/// \~english @param [in] f_suffixStr +/// std::string - Suffix string of abnormal LOG file +/// \~english @par +/// enum ESMCpuResetReason Variable +/// - e_SS_SM_CPU_RESET_REASON_NORMAL : Normal Reset +/// - e_SS_SM_CPU_RESET_REASON_DATA_RESET : Data Reset +/// - e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET : User forced reset +/// - e_SS_SM_CPU_RESET_REASON_GENERIC_ERR : Generic Error reset +/// - e_SS_SM_CPU_RESET_REASON_DSP_ERR : DSP Error +/// - e_SS_SM_CPU_RESET_REASON_IMMRESET_NORMAL : Reset immediately +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle +/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full +/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor +/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) +/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size +/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred +/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) +/// \~english @par Preconditions +/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer] +/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle] +/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType] +/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] +/// - Transmission for the file descriptor of System Manager message for the session is invalid. +/// [eFrameworkunifiedStatusErrNoEBADF] +/// - Place to interrupt by the system call (signal) has occurred during the transmission of the System Manager +/// message for the session. [eFrameworkunifiedStatusErrNoEINTR] +/// - Size of the transmission buffer of the System Manager message for the session is invalid. +/// [eFrameworkunifiedStatusInvldBufSize] +/// - Any error has occurred at the time of transmission of the System Manager message for the session. +/// [eFrameworkunifiedStatusFail] +/// - Transmission of System Manager message for the session fails to shared memory access. [eFrameworkunifiedStatusErrOther] +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Sync only(None communication) +/// \~english @par Detail +/// Collect the LOG information and stores it in the built-in non-volatile area.\n +/// String specified in f_suffixStr is added as a suffix to the end of the abnormal LOG file name. +/// \~english @see +/// None +//////////////////////////////////////////////////////////////////////////////////// +extern EFrameworkunifiedStatus SendCpuResetRequestToSystemManager(ESMCpuResetReason l_eCpuResetReason, + std::string f_messageStr = "", std::string f_suffixStr = ""); + +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup SetNextWakeupTypeToSystemManager +/// \~english @par Summary +/// Set the next wakeup type. +/// \~english @param [in] f_wakeupType +/// ESMNextWakeupType - Wakeup type +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter +/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer +/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred +/// \~english @par Preconditions +/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Sync only +/// \~english @par Detail +/// - The API sets the next wakeup type (COLD/HOT/Not specified). +/// \n +/// - Include ss_sm_client_if.h +/// - Library libSS_SystemIfUnified.so +/// \~english @see +/// None +//////////////////////////////////////////////////////////////////////////////////////////// +extern EFrameworkunifiedStatus SetNextWakeupTypeToSystemManager(ESMNextWakeupType f_wakeupType); + + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup Set_UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc_StateVar +/// \~english @par Summary +/// API for setting the FrameworkunifiedOnStop response +/// \~english @param [in] f_setTrue +/// BOOL - Response presence or absence of specified +/// \~english @par +/// - TRUE : Not carried out in the automatic response. +/// - FALSE : Carry out the response in automatic. (Default) +/// \~english @retval VOID None +/// \~english @par Preconditions +/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Sync only(None communication) +/// \~english @par Detail +/// In case you can not return the response in the synchronized by FrameworkunifiedOnStop, by setting to \n +/// TRUE in this API, it is possible to implement the completion notice to the system_manager \n +/// the service side. +/// At this time, the service is by to Publish the Notification of "service name/StopComp", \n +/// you are possible to notify the STOP completion to system_manager. +/// \~english @see None +//////////////////////////////////////////////////////////////////////////////////// +VOID Set_UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc_StateVar(BOOL f_SetTrue); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup SendUserInvokedLoggingRequestToSystemManager +/// \~english @par Summary +/// API to request LOG saved to the internal non-volatile area +/// \~english @param [in] f_userInvokedLogType +/// \ref eSMUserLogType - User invoked log type. +/// \~english @param [in] f_messageStr +/// std::string - Abnormal message string +/// \~english @param [in] f_suffixStr +/// std::string - Suffix string of abnormal LOG file +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter +/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle +/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full +/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor +/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) +/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size +/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred +/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) +/// \~english @par Preconditions +/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// - Log type is invalid(In the case of value which does not correspond to enum eSMUserLogType). +/// [eFrameworkunifiedStatusInvldParam] +/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer] +/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle] +/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType] +/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] +/// - Transmission for the file descriptor of System Manager message for the session is invalid. +/// [eFrameworkunifiedStatusErrNoEBADF] +/// - Place to interrupt by the system call (signal) has occurred during the transmission of the System Manager +/// message for the session. [eFrameworkunifiedStatusErrNoEINTR] +/// - Size of the transmission buffer of the System Manager message for the session is invalid. +/// [eFrameworkunifiedStatusInvldBufSize] +/// - Any error has occurred at the time of transmission of the System Manager message for the session. +/// [eFrameworkunifiedStatusFail] +/// - Transmission of System Manager message for the session fails to shared memory access. [eFrameworkunifiedStatusErrOther] +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Sync only(None communication) +/// \~english @par Detail +/// Collect the LOG information and stores it in the built-in non-volatile area.\n +/// String specified in f_suffixStr is added as a suffix to the end of the abnormal LOG file name. +/// \~english @see SendClearLogsRequestToSystemManager +//////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendUserInvokedLoggingRequestToSystemManager(eSMUserLogType f_userInvokedLogType, + std::string f_messageStr = "", std::string f_suffixStr = ""); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup SendInterfaceunifiedOnStopResponseToSystemManager +/// \~english @par Summary +/// API to send a FrameworkunifiedOnStop response +/// \~english @param [in] f_eStatus +/// EFrameworkunifiedStatus - End status +/// \~english @par +/// - eFrameworkunifiedStatusOK : End processing completion +/// - eFrameworkunifiedStatusFail : End processing uncompleted +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle +/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full +/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor +/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) +/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size +/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred +/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) +/// \~english @par Preconditions +/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer] +/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle] +/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType] +/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] +/// - Transmission for the file descriptor of System Manager message for the session is invalid. +/// [eFrameworkunifiedStatusErrNoEBADF] +/// - Place to interrupt by the system call (signal) has occurred during the transmission of the System Manager +/// message for the session. [eFrameworkunifiedStatusErrNoEINTR] +/// - Size of the transmission buffer of the System Manager message for the session is invalid. +/// [eFrameworkunifiedStatusInvldBufSize] +/// - Any error has occurred at the time of transmission of the System Manager message for the session. +/// [eFrameworkunifiedStatusFail] +/// - Transmission of System Manager message for the session fails to shared memory access. [eFrameworkunifiedStatusErrOther] +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Fire and Forget only +/// \~english @par Detail +/// In case you can not return the response in the synchronized by FrameworkunifiedOnStop, by setting to \n +/// TRUE in this API, it is possible to implement the completion notice to the system_manager \n +/// the service side. +/// At this time, the service is by to Publish the Notification of "service name/StopComp", \n +/// you are possible to notify the STOP completion to system_manager. +/// \~english @see None +//////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendInterfaceunifiedOnStopResponseToSystemManager(EFrameworkunifiedStatus f_eStatus); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetInterfaceunifiedOnStartExtInfo +/// \~english @par Summary +/// API to get the extended information of the start-up parameters. +/// \~english @param [out] f_info +/// T_SS_SM_START_ExtDataStructType - Startup parameters extended information +/// \~english @par +/// T_SS_SM_START_ExtDataStructType Structure +/// \~english @code +/// typedef struct { +/// { +/// BOOL isProgUpdated; +/// EMRelaunchStatus relaunchStatus; +/// BOOL isMapUpdated; +/// BOOL isMapDiffUpdated; +/// uint8_t reserved[]; +/// }T_SS_SM_START_ExtDataStructType; +/// @endcode +/// \~english @par +/// isProgUpdated:Presence or absence of a program update +/// - TRUE : Yes program update +/// - FALSE : No program update +/// \~english @par +/// relaunchStatus:Relaunch state of self-service +/// - e_SS_SM_RELAUNCH_STATUS_NONE : Relaunch non-occurrence (first start) +/// - e_SS_SM_RELAUNCH_STATUS_SAFE : Normal Relaunch +/// - e_SS_SM_RELAUNCH_STATUS_ERR : Abnormal Relaunch +/// \~english @par +/// isMapUpdated:Presence or absence of a map update +/// - TRUE : Yes map update +/// - FALSE : No map update +/// \~english @par +/// isMapDiffUpdated:The presence or absence of the map difference updating +/// - TRUE : Yes map difference update +/// - FALSE : No map difference update +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle +/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full +/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor +/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) +/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size +/// \~english @retval eFrameworkunifiedStatusBadConnection Failure to socket connection +/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred(Socket Connection/Memory Allocation/Event Control) +/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) +/// \~english @par Preconditions +/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer] +/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle] +/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType] +/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] +/// - Transmission for the file descriptor of System Manager message for the session is invalid. +/// [eFrameworkunifiedStatusErrNoEBADF] +/// - Place to interrupt by the system call (signal) has occurred during the transmission of the System Manager +/// message for the session. [eFrameworkunifiedStatusErrNoEINTR] +/// - Size of the transmission buffer of the System Manager message for the session is invalid. +/// [eFrameworkunifiedStatusInvldBufSize] +/// - Transmission and reception of System Manager message for the session fails to socket connection. +/// [eFrameworkunifiedStatusBadConnection] +/// - In the case of the message queue open error for reception of System Manager message for the session. +/// [eFrameworkunifiedStatusFail] +/// - System Manager message for the session fails to acquire the message buffer for reception. [eFrameworkunifiedStatusFail] +/// - System Manager message for the session fails in the event control for the reception. [eFrameworkunifiedStatusFail] +/// - Any error has occurred at the time of transmission and receive of the System Manager message for the +/// session. [eFrameworkunifiedStatusFail] +/// - Transmission of System Manager message for the session fails to shared memory access. [eFrameworkunifiedStatusErrOther] +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Sync only(None communication) +/// \~english @par Detail +/// Returns the extended information of the parameters of FrameworkunifiedOnStart(). \n +/// It is assumed that that will be called in the FrameworkunifiedOnStart (), return the correct value when it is called prior +/// \n +/// to the issuance FrameworkunifiedOnStart() is not guaranteed.\n +/// System startup to relaunchStatus is e_SS_SM_RELAUNCH_STATUS_NONE, the service is a case that has been Relaunch +/// \n +/// by the exit (SS_SM_EXIT_RELAUNCH) _SS_SM_RELAUNCH_STATUS_SAFE, if the Relaunch due to the abnormality occurs +/// to \n +/// set the e_SS_SM_RELAUNCH_STATUS_ERR. +/// \~english @see GetInterfaceunifiedOnStopExtInfo, FrameworkunifiedOnStart +//////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus GetInterfaceunifiedOnStartExtInfo(T_SS_SM_START_ExtDataStructType &f_info); // NOLINT (runtime/references) + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetInterfaceunifiedOnStopExtInfo +/// \~english @par Summary +/// API to get the extended information of the end parameter. +/// \~english @param [out] f_info +/// T_SS_SM_STOP_ExtDataStructType - Exit extended parameter information +/// \~english @par +/// T_SS_SM_STOP_ExtDataStructType Structure +/// \~english @code +/// typedef struct { +/// { +/// BOOL isProgUpdated; +/// uint8_t reserved[]; +/// }T_SS_SM_START_ExtDataStructType; +/// @endcode +/// \~english @par +/// isProgUpdated:Presence or absence of a program update +/// - TRUE : Yes program update +/// - FALSE : No program update +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle +/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full +/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor +/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) +/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size +/// \~english @retval eFrameworkunifiedStatusBadConnection Failure to socket connection +/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred(Socket Connection/Memory Allocation/Event Control) +/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) +/// \~english @par Preconditions +/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer] +/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle] +/// - System Manager handle type for the session is not a send and receive type. [eFrameworkunifiedStatusInvldHndlType] +/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] +/// - File descriptor not for the transmission and reception of the System Manager of the session message. +/// [eFrameworkunifiedStatusErrNoEBADF] +/// - Interruption by the system call (signal) occurs during the transmission and reception of the System Manager +/// of the session message. [eFrameworkunifiedStatusErrNoEINTR] +/// - The size of the transmit and receive buffer of the System Manager of the session message is invalid. +/// [eFrameworkunifiedStatusInvldBufSize] +/// - It failed to socket connection for transmission and reception of the System Manager of the session message. +/// [eFrameworkunifiedStatusBadConnection] +/// - Open error of the message queue for the reception of the System Manager of the session message. +/// [eFrameworkunifiedStatusFail] +/// - And fail to acquire the message buffer for reception of the System Manager of the session message. +/// [eFrameworkunifiedStatusFail] +/// - It failed in the event control for the reception of the System Manager of the session message. +/// [eFrameworkunifiedStatusFail] +/// - It failed during transmission and reception of the System Manager of the session message. [eFrameworkunifiedStatusFail] +/// - It failed to shared memory access for transmission and reception of the System Manager of the session +/// message. [eFrameworkunifiedStatusErrOther] +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Sync only(None communication) +/// \~english @par Detail +/// Returns the extended information of the parameters of FrameworkunifiedOnStop(). \n +/// It is assumed that that will be called in the FrameworkunifiedOnStop (), return of the correct value in the case \n +/// that has been called before FrameworkunifiedOnStop() entry into force is not guaranteed. +/// \~english @see GetInterfaceunifiedOnStartExtInfo, FrameworkunifiedOnStop +//////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus GetInterfaceunifiedOnStopExtInfo(T_SS_SM_STOP_ExtDataStructType &f_info); // NOLINT (runtime/references) + +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup SendDebugDumpResponseToSystemManager +/// \~english @par Summary +/// Send a debug dump response to system_manager +/// \~english @param [in] f_bFormatStrRequired +/// BOOL - Specify whether to dump the application name or not +/// \~english @param [in] f_cFormat +/// PCSTR - Display format for the dump (the same character strings format as the printf format) +/// \~english @param [in] arg_list +/// ... - Dump data in line with f_cFormat format +/// \~english @par +/// f_bFormatStrRequired +/// - true Dump the application name +/// - false Do not dump the application name +/// \~english @retval None +/// \~english @par Precondition +/// - None +/// \~english @par Change in the internal status +/// - The change in the internal status does not occur by this API. +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Fire and Forget only +/// \~english @par Detail +/// When f_bFormatStrRequired is true, write the application name to the buffer for dump. \n +/// Write the data to the buffer for dump in line with f_cFormat. \n +/// Send OnDebugDumpResponseReceived to the SystemManger in order to request the SystemManger to +/// write the contents in the buffer for dump to the log file for debug. \n +/// The maximum size of the buffer for dump is 4Kbyte and the string size of the application name +/// is deducted when the application name is dumped. \n +/// When dumping a string which exceeds 4Kbyte, drop what exceeds the buffer. +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////////////// +void SendDebugDumpResponseToSystemManager(BOOL f_bFormatStrRequired, PCSTR f_cFormat, ...) +#ifdef __GNUC__ + __attribute__((format(printf, 2, 3))); +#endif + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup SendInterfaceunifiedEmmcLogsRequestToSystemManager +/// \~english @par Summary +/// API to request a copy to the specified path of the LOG file of the built-in non-volatile area. +/// \~english @param [in] f_path +/// std::string - LOG destination file PATH +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldBuf Invalid buffer +/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle +/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full +/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor +/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) +/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size +/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred +/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) +/// \~english @par Preconditions +/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// - LOG destination file PATH is NULL(If f_path.c_str() is NULL). [eFrameworkunifiedStatusInvldBuf] +/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer] +/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle] +/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType] +/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] +/// - Transmission for the file descriptor of System Manager message for the session is invalid. +/// [eFrameworkunifiedStatusErrNoEBADF] +/// - Place to interrupt by the system call (signal) has occurred during the transmission of the System Manager +/// message for the session. [eFrameworkunifiedStatusErrNoEINTR] +/// - Size of the transmission buffer of the System Manager message for the session is invalid. +/// [eFrameworkunifiedStatusInvldBufSize] +/// - Any error has occurred at the time of transmission of the System Manager message for the session. +/// [eFrameworkunifiedStatusFail] +/// - Transmission of System Manager message for the session fails to shared memory access. [eFrameworkunifiedStatusErrOther] +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Method only +/// \~english @par Detail +/// To copy all of the files that exist in LOG storage area of the built-in non-volatile area in \n +/// the path specified in the f_path. \n +/// If you do not have a copy target, asynchronous response command: Returns the eFrameworkunifiedStatusOK as \n +/// the message data of SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_RSPN. +/// \~english @see SendClearLogsRequestToSystemManager +//////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendInterfaceunifiedEmmcLogsRequestToSystemManager(std::string f_path); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup SendClearLogsRequestToSystemManager +/// \~english @par Summary +/// API to clear the stored in the built-in non-volatile area log. +/// \~english @param [in] f_info +/// TSystemManagerClearLogsInfo - A pointer to the LOG clear information +/// \~english @par +/// TSystemManagerClearLogsInfo Structure +/// \~english @code +/// typedef struct T_SystemManagerClearLogsInfo{ +/// { +/// void *rsv; +/// }TSystemManagerClearLogsInfo; +/// @endcode +/// \~english @par +/// rsv : Reserve area +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter +/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle +/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full +/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor +/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal) +/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size +/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred +/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory) +/// \~english @par Preconditions +/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// - Pointer to the LOG clear information (f_info) is NULL [eFrameworkunifiedStatusInvldParam] +/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer] +/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle] +/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType] +/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull] +/// - Transmission for the file descriptor of System Manager message for the session is invalid. +/// [eFrameworkunifiedStatusErrNoEBADF] +/// - Place to interrupt by the system call (signal) has occurred during the transmission of the System Manager +/// message for the session. [eFrameworkunifiedStatusErrNoEINTR] +/// - Size of the transmission buffer of the System Manager message for the session is invalid. +/// [eFrameworkunifiedStatusInvldBufSize] +/// - Any error has occurred at the time of transmission of the System Manager message for the session. +/// [eFrameworkunifiedStatusFail] +/// - Transmission of System Manager message for the session fails to shared memory access. [eFrameworkunifiedStatusErrOther] +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Fire and Forget x Sync +/// \~english @par Detail +/// To delete a LOG stored in the built-in non-volatile area. +/// \~english @see None +//////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendClearLogsRequestToSystemManager(TSystemManagerClearLogsInfo *f_info); + +/** @}*/ // end of SystemIf +/** @}*/ // end of interface_unified +/** @}*/ // end of SystemService +/** @}*/ // end of BaseSystem + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief AttachCallbackToSystemManager +/// +/// \note This function is called by System Manager session clients to attach +/// a callback function to the client application with System Manager +/// configured as the specified sender of the specified protocol message. +/// +/// \param [in] f_hApp +/// HANDLE - Handle to message queue of the System Manager attached client. +/// \param [in] iCmd +/// UI_32 iCmd - Command ID +/// \param [in] fpOnCmd +/// CbFuncPtr fpOnCmd - Function pointer to be called in the form upon +/// the invokation of the specified command ID. The callback function +/// must have the following signature : void (*)(HANDLE). +/// +/// \return Status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////// +extern EFrameworkunifiedStatus AttachCallbackToSystemManager(HANDLE hApp, UI_32 iCmd, CbFuncPtr fpOnCmd); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief Set of complementary detach functions that accept same arguments +/// as the InterfaceunifiedAttach_XYZ_ToDispatcher() functions do. +/// +//////////////////////////////////////////////////////////////////////////////////// +extern EFrameworkunifiedStatus DetachCallbacksFromInterfaceunifiedDispatcher(HANDLE hApp, + PCSTR pServiceName, + const FrameworkunifiedProtocolCallbackHandler* pMsgHandler, + UI_32 uiHandlerCount, + HANDLE hSession = NULL); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// \brief +//////////////////////////////////////////////////////////////////////////////////// +extern EFrameworkunifiedStatus DetachParentCallbacksFromInterfaceunifiedDispatcher(HANDLE hChildApp, + const FrameworkunifiedProtocolCallbackHandler* pMsgHandler, + UI_32 uiHandlerCount); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief GetSystemManagerSessionHandle +/// +/// \note This function returns the session handle with System Manager +/// +/// \return HANDLE - A session handle with System Manager +///////////////////////////////////////////////////////////////////////////////////// +extern HANDLE GetSystemManagerSessionHandle(void); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief SendShutdownToSystemManager +/// +/// \note This function is called to send Shutdown command to System Manager +/// +/// \param [in] pData +/// Pwr_ServiceSetInterface *pData - Pointer to Shutdown Command data +/// +/// \return Status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////// +extern EFrameworkunifiedStatus SendShutdownToSystemManager(Pwr_ServiceSetInterface *pData); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief SendSystemModeRequestToSystemManager +/// +/// \note This function is called to send system mode request to System Manager +/// +/// \return Status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////// +extern EFrameworkunifiedStatus SendSystemModeRequestToSystemManager(void); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief SendInitCompReportToSystemManager +/// +/// \note This function is called to send init comp report to System Manager +/// +/// \return Status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////// +extern EFrameworkunifiedStatus SendInitCompReportToSystemManager(void); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief SendWakeUpToSystemManager +/// +/// \note This function is called to send the Wakeup command to System Manager +/// +/// \param [in] pData +/// wakeInfo *pData - Pointer to Wakeup Command data +/// +/// \return Status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////// +extern EFrameworkunifiedStatus SendWakeUpToSystemManager(wakeInfo *pData); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief SendStartupConfirmationToSystemManager +/// +/// \note This function is called to send the startup confirmation information +/// to System Manager +/// +/// \param [in] l_startupConfirmationMsg +/// StartupConfirmationMsgStrut &l_startupConfirmationMsg - startup confirmation +/// data +/// \return Status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////// +extern EFrameworkunifiedStatus SendStartupConfirmationToSystemManager(StartupConfirmationMsgStrut + &l_startupConfirmationMsg); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief SendSystemErrorToSystemManager +/// +/// \note This function is called by an application via Native Services to send +/// notice of a critical error to System Manager when a non recoverable +/// run-time error is encountered. +/// +/// \param [in] +/// +/// \return Status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendSystemErrorToSystemManager(EFrameworkunifiedSystemError f_systemError); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief Send_CWORD56_HeartBeatRequestToSystemManager +/// +/// \note This function forwards a _CWORD56_ heartbeat request received by power +/// services from the power shadow to System Manager. +/// +/// \param [in] +/// +/// \return Status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus Send_CWORD56_HeartBeatRequestToSystemManager(EPWR_HB_REQ_MSG_STRUCT f_HbReq); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief SendBootMicroResetNotificationToSystemManager +/// +/// \param ResetReason Enumerated boot micro reset reason. +/// +/// This function is called by Logging Shadow to inform System Manager of a +/// boot micro reset condition. +//////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendBootMicroResetNotificationToSystemManager(eSMBootMicroResetReason ResetReason); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief SendDiagLogEventRequestToSystemManager +/// +/// \note This function is called by logger to initiate log artifact collection +/// and storage on behalf of diagnostic services. +/// +/// \param f_copyDestPathStr +/// +/// \return Status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendDiagLoggingRequestToSystemManager(std::string f_copyDestPathStr); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief SendCANLoggingRequestToSystemManager +/// +/// \note This function is called by logger to initiate log artifact collection +/// and storage when signaled via CAN. +/// +/// \return Status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendCANLoggingRequestToSystemManager(void); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief SendDTCLoggingRequestToSystemManager +/// +/// \note This function is called by logger to initiate log artifact collection +/// and storage when signaled via diagnostic command. +/// +/// \param f_dtc Diagnostic trouble code. +/// +/// \return Status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendDTCLoggingRequestToSystemManager(UI_32 f_dtc); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief RegisterBootMicroLogRequestCb +/// +/// This function is called by Logging Shadow to register a callback function for +/// the boot micro log request that may be generated by System Manager when an +/// error event occurs. +/// +/// \param [in] hApp AGL Framework Application Handle +/// +/// \param [in] fpOnCmd Call back function with the signature: +/// EFrameworkunifiedStatus fnct(HANDLE hApp); +/// +/// \return Status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus RegisterBootMicroLogRequestCb(HANDLE hApp, CbFuncPtr fpOnCmd); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief SendBootMicroLogResponseToSystemManager +/// +/// This function is called by Logging Shadow to provide a string representation of +/// the binary boot-micro log data. +/// +/// \return Status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendBootMicroLogResponseToSystemManager(std::string f_logString); + +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// \brief Redirect either formatted, or unformatted response output to System Manager. +/// +/// \see SendDebugDumpResponseToSystemManager +//////////////////////////////////////////////////////////////////////////////////////////// +#define SSDEBUGDUMP(args...) (SendDebugDumpResponseToSystemManager(TRUE, ## args)) + +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup SM_Deletable +//////////////////////////////////////////////////////////////////////////////////////////// +#define SSDEBUGDUMP_RAW(args...) (SendDebugDumpResponseToSystemManager(FALSE, ## args)) + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief SendLogStartRequestToSystemManager +/// +/// \note This function is call by SS_Logger when the logging process has +/// completed and no additional request for artifacts will be generated. +/// +/// \param none. +/// +/// \return Status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendLogStartRequestToSystemManager(EErrorEventType f_errorEventType); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief SendLogArtifactRequestToSystemManager +/// +/// \note This function is call by SS_Logger to request SM to acquire and +// return by reference (filename), the specified logging artifact. +/// +/// \param [in] f_artifactId, enumerated artifact number. +/// +/// \return Status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendLogArtifactRequestToSystemManager(EArtifactId f_artifactId); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief SendLogCompleteRequestToSystemManager +/// +/// \note This function is call by SS_Logger when the logging process has +/// completed and no additional request for artifacts will be generated. +/// +/// \param none. +/// +/// \return Status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendLogCompleteRequestToSystemManager(EFrameworkunifiedStatus f_eStatus = eFrameworkunifiedStatusOK); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief SendEelExportRequestToSystemManager +/// +/// \note This function forwards the Device Detection EEL_export trigger +/// received by SS Logger to System Manager. +/// +/// \param f_path Destination path for the trigger artifacts. +/// +/// \return Status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendEelExportRequestToSystemManager(std::string f_path); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup interface_unified +/// +/// \brief DebugDump request callback function. +/// +/// \note This function is called when System Manager requests the receiving +/// application to generate their debugdump. +/// +/// \param hApp +/// +/// \return Status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus OnSystemManagerDebugDump(HANDLE hApp); + +#endif // __SS_SYSTEM_MANAGER_CLIENT_IF_H__ // NOLINT (build/header_guard) +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_sm_client_if_local.h b/service/system/interface_unified/library/include/system_service/ss_sm_client_if_local.h new file mode 100755 index 0000000..a4d0fa9 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_sm_client_if_local.h @@ -0,0 +1,66 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file ss_sm_client_if_local.h + * @brief \~english This file supports the api of debug dump response to System Manager + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#ifndef __SS_SYSTEM_MANAGER_CLIENT_IF_LOCAL_H__ // NOLINT (build/header_guard) +#define __SS_SYSTEM_MANAGER_CLIENT_IF_LOCAL_H__ + +#include <native_service/frameworkunified_framework_types.h> +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup system_manager +/// \~english @par Summary: +/// Responds to SystemManager that debug dump output has finished +/// \~english @param [in] f_messageStr +/// std::string & - Dump data +/// \~english @retval +/// - None +/// \~english @par Preconditions: +/// - None +/// \~english @par Change of the internal state: +/// - No change of internal state by this API occurs +/// \~english @par Causes of failures: +/// - None +/// \~english @par Detail: +/// Send OnDebugDumpResponseReceived to SystemManager and request +/// to write the contents of dump data to /tmp/systemmanager_debugdump.log.\n +/// The maximum size of the dump buffer is 4KByte.\n +/// When dumping more than 4KBytes, the overflow from the buffer is discarded. +/// +/// \~english @par Classification: +/// - Public +/// \~english @see +/// +//////////////////////////////////////////////////////////////////////////////////////////// + +VOID SendDebugDumpResponseToSystemManager(std::string & f_messageStr); // NOLINT (runtime/references) + +#endif /*__SS_SYSTEM_MANAGER_CLIENT_IF_LOCAL_H__*/ // NOLINT (build/header_guard) +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_sm_thread_names.h b/service/system/interface_unified/library/include/system_service/ss_sm_thread_names.h new file mode 100755 index 0000000..61ee275 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_sm_thread_names.h @@ -0,0 +1,45 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_sm_thread_names.h + * @brief This file supports System Manager thread naming. + */ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ + +#ifndef SS_SM_THREAD_NAMES_H_ // NOLINT (build/header_guard) +#define SS_SM_THREAD_NAMES_H_ + +// thread name max length is 15 +// 0123456789ABCDE +#define SS_SMHeartbeat "SM.Heartbeat" + +#endif /* SS_SM_THREAD_NAMES_H_ */ // NOLINT (build/header_guard) + +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_sm_thread_names_local.h b/service/system/interface_unified/library/include/system_service/ss_sm_thread_names_local.h new file mode 100755 index 0000000..36dda06 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_sm_thread_names_local.h @@ -0,0 +1,46 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_sm_thread_names_local.h + * @brief This file supports System Manager thread naming. + */ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ + +#ifndef SS_SM_THREAD_NAMES_LOCAL_H_ // NOLINT (build/header_guard) +#define SS_SM_THREAD_NAMES_LOCAL_H_ + +// thread name max length is 15 +// 0123456789ABCDE +#define SS_SMLauncher "SM.ProcLaunch" +#define SS_SMLowMemMonitor "SM.LowMemMon" + +#endif /* SS_SM_THREAD_NAMES_LOCAL_H_ */ // NOLINT (build/header_guard) + +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_string_maps.h b/service/system/interface_unified/library/include/system_service/ss_string_maps.h new file mode 100755 index 0000000..4001ed4 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_string_maps.h @@ -0,0 +1,680 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_string_maps.h + * @brief \~english This file supports the a generic std::map<std::string> wrapper. + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#ifndef SS_STRING_MAPS_H_ // NOLINT (build/header_guard) +#define SS_STRING_MAPS_H_ + +#include "system_service/ss_power_service.h" +#include "system_service/ss_system_manager_if.h" +#include "system_service/ss_system_manager_protocol.h" + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetStr +/// \~english @par Summary +/// change member from BOOL type to string +/// \~english @param [in] f_enum +/// BOOL - the member what will convert farm BOOL type to string type +/// \~english @code +/// typedef int BOOL; +/// #define TRUE (1==1) +/// #define true (1==1) +/// #define FALSE (0==1) +/// @endcode +/// \~english @retval SS_String +/// \~english @par Preconditions +/// - None. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// sync only +/// \~english @par Detail +/// change member from BOOL type to string. \n +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////// +extern SS_String GetStr(BOOL f_enum); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetStr +/// \~english @par Summary +/// change member from EErrorEventType type to string +/// \~english @param [in] f_enum +/// EErrorEventType - the member what will convert farm EErrorEventType type to string type.error event type. +/// \~english @code +/// enum EErrorEventType { +/// eErrorEventTypeProcessCrash = 0, +/// eErrorEventTypeHeartBeatFailure, +/// eErrorEventTypeSystemLowMemory, +/// eErrorEventTypeReserved1, // Formerly SS_SM_EVENT_ERROR_HIGH_CPU_LOAD, now HMI enum place holder. +/// eErrorEventTypeUserInvokedUserForceReset, +/// eErrorEventTypeReserved2, +/// eErrorEventTypeReserved3, +/// eErrorEventTypeUserInvokedCollectAllLogs, +/// eErrorEventTypeBootMicroReset, +/// eErrorEventTypeProcessExit, +/// eErrorEventTypeUserInvokedCollectScreenShot, +/// eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs, +/// eErrorEventTypeEelExport, +/// eErrorEventTypeInterfaceunifiedEmmcLogs, +/// eErrorEventTypeDiagEvent, +/// eErrorEventTypeCanEvent, +/// eErrorEventTypeDtcEvent, +/// eErrorEventTypeModConnFailed, +/// eErrorEventTypeStartRespFailed, +/// eErrorEventTypeUserInvokedCollectDevLogs, +/// eErrorEventTypeModuleInvokedResetRequest, +/// eErrorEventTypeModuleInvokedCollectDebugLogs, +/// eErrorEventTypeUserInvokedClearLogs, +/// eErrorEventTypeUserInvokedCollectNaviLog, +/// eErrorEventTypeGroupRelaunch, +/// eErrorEventTypeMaxValue +/// }; +/// @endcode +/// \~english @retval SS_String +/// \~english @par Preconditions +/// - None. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// sync only +/// \~english @par Detail +/// change member from EErrorEventType type to string. \n +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////// +extern SS_String GetStr(EErrorEventType f_enum); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetStr +/// \~english @par Summary +/// change member from EFrameworkunifiedSystemError type to string +/// \~english @param [in] f_enum +/// EFrameworkunifiedSystemError - the member what will convert farm EFrameworkunifiedSystemError type to string type.The type of system +/// error. +/// \~english @codes +/// typedef enum _EFrameworkunifiedSystemError { +/// eFrameworkunifiedSystemErrorNone = 0, +/// eFrameworkunifiedDSPHardwareReset = 1 +/// } EFrameworkunifiedSystemError; +/// @endcode +/// \~english @retval SS_String +/// \~english @par Preconditions +/// - None. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// sync only +/// \~english @par Detail +/// change member from EFrameworkunifiedSystemError type to string. \n +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////// +extern SS_String GetStr(EFrameworkunifiedSystemError f_enum); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetStr +/// \~english @par Summary +/// change member from EPWR_LHC_TYPE type to string +/// \~english @param [in] f_enum +/// EPWR_LHC_TYPE - the member what will convert farm EPWR_LHC_TYPE type to string type.Limp home cutoff +/// protocol type. +/// \~english @codes +/// typedef enum { +/// epslhcINVALID = 0xFF, +/// epslhcDISABLED = 0x00, +/// epslhcENABLED = 0x01 +/// } ePwrServiceLHCType, EPWR_LHC_TYPE; +/// @endcode +/// \~english @retval SS_String +/// \~english @par Preconditions +/// - None. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// sync only +/// \~english @par Detail +/// change member from EPWR_LHC_TYPE type to string. \n +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////// +extern SS_String GetStr(EPWR_LHC_TYPE f_enum); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetStr +/// \~english @par Summary +/// change member from EPWR_PROD_MODE_TYPE type to string +/// \~english @param [in] f_enum +/// EPWR_PROD_MODE_TYPE - the member what will convert farm EPWR_PROD_MODE_TYPE type to string type.The type of +/// production mode protocol. +/// \~english @codes +/// typedef enum { +/// epspmINVALID = 0xFF, +/// epspmDISABLED = 0x00, +/// epspmENABLED = 0x01 +/// } ePwrServiceProdModeType, EPWR_PROD_MODE_TYPE; +/// @endcode +/// \~english @retval SS_String +/// \~english @par Preconditions +/// - None. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// sync only +/// \~english @par Detail +/// change member from EPWR_PROD_MODE_TYPE type to string. \n +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////// +extern SS_String GetStr(EPWR_PROD_MODE_TYPE f_enum); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetStr +/// \~english @par Summary +/// change member from EPWR_SC_COLD_START_REQ_TYPE type to string +/// \~english @param [in] f_enum +/// EPWR_SC_COLD_START_REQ_TYPE - the member what will convert farm EFrameworkunifiedSystemError type to string type.The type +/// of cold start. +/// \~english @codes +/// typedef enum { +/// epsscrtINVALID = 0xFF, +/// epsscrtNOT_REQUIRED = 0x00, +/// epsscrtREQUIRED = 0x01 +/// } EPWR_SC_COLD_START_REQ_TYPE; +/// @endcode +/// \~english @retval SS_String +/// \~english @par Preconditions +/// - None. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// sync only +/// \~english @par Detail +/// change member from EPWR_SC_COLD_START_REQ_TYPE type to string. \n +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////// +extern SS_String GetStr(EPWR_SC_COLD_START_REQ_TYPE f_enum); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetStr +/// \~english @par Summary +/// change member from EPWR_SC__CWORD56__BOOT_MODE_TYPE type to string +/// \~english @param [in] f_enum +/// EPWR_SC__CWORD56__BOOT_MODE_TYPE - the member what will convert farm EPWR_SC__CWORD56__BOOT_MODE_TYPE type to string +/// type.The type of startup confirmation. +/// \~english @codes +/// typedef enum { +/// eps_CWORD56_bmINVALID = 0xFF, +/// eps_CWORD56_bmAPPLICATION_MODE = 0x00, +/// eps_CWORD56_bmPROGRAMMING_MODE = 0x08 +/// } EPWR_SC__CWORD56__BOOT_MODE_TYPE; +/// @endcode +/// \~english @retval SS_String +/// \~english @par Preconditions +/// - None. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// sync only +/// \~english @par Detail +/// change member from EPWR_SC__CWORD56__BOOT_MODE_TYPE type to string. \n +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////// +extern SS_String GetStr(EPWR_SC__CWORD56__BOOT_MODE_TYPE f_enum); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetStr +/// \~english @par Summary +/// change member from EPWR_SHUTDOWN_TRIGGER_TYPE type to string +/// \~english @param [in] f_enum +/// EPWR_SHUTDOWN_TRIGGER_TYPE - the member what will convert farm EPWR_SHUTDOWN_TRIGGER_TYPE type to string +/// type.The type of shutdown trigger. +/// \~english @codes +/// typedef enum { +/// epssdmsdtINVALID = 0xFF, +/// epssdmsdtTESTACC_OFF = 0x00, +/// epssdmsdtON_KEY = 0x01, +/// epssdmsdtIGN_LOCK = 0x02, +/// epssdmsdtPWR_SAVE = 0x03, +/// epssdmsdtTMP_STARTUP = 0x04, +/// epssdmsdtDIAG_DEACTIVATION = 0x05, +/// epssdmsdtABNORMAL_VOLTAGE = 0x06, +/// epssdmsdtABNORMAL_TEMP = 0x07, +/// epssdmsdtBATTERYCUTOFF = 0x08, +/// epssdmsdtLIMPHOME = 0x09, +/// epssdmsdtHU_CAN_ERROR = 0x0A, +/// epssdmsdtBODY_CAN_ERROR = 0x0B, +/// epssdmsdtTRANSPORT_MODE = 0x0C, +/// epssdmsdtPRODUCTION_MODE = 0x0D, +/// epssdmsdtIGN_OFF = 0x0E, +/// epssdmsdtGENERIC_ERROR_RESET = 0x0F, +/// epssdmsdtFATAL_ERROR_RESET = 0x10, +/// epssdmsdtUSER_DATA_RESET = 0x11, +/// epssdmsdtFACTORY_DATA_RESET = 0x12, +/// epssdmsdtFAST_SLEEP_MODE = 0x13, +/// epssdmsdtNORMAL_RESET = 0x14, +/// epssdmsdtPROGUPDATE_RESET = 0x15, +/// } ePowerSrvPwrShutdownTriggerType, EPWR_SHUTDOWN_TRIGGER_TYPE; +/// @endcode +/// \~english @retval SS_String +/// \~english @par Preconditions +/// - None. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// sync only +/// \~english @par Detail +/// change member from EPWR_SHUTDOWN_TRIGGER_TYPE type to string. \n +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////// +extern SS_String GetStr(EPWR_SHUTDOWN_TRIGGER_TYPE f_enum); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetStr +/// \~english @par Summary +/// change member from EPWR_STARTUP_STAGE_TYPE type to string +/// \~english @param [in] f_enum +/// EPWR_STARTUP_STAGE_TYPE - the member what will convert farm EPWR_STARTUP_STAGE_TYPE type to string type.The +/// type of startup stage. +/// \~english @codes +/// typedef enum { +/// epssusfINVALID = 0xFF, +/// epssusSYSTEM_SERVICES_STARTED = 0x00, +/// epssusALL_SERVICES_LAUNCHED = 0x01 +/// }ePowerSrvStartupStageType, EPWR_STARTUP_STAGE_TYPE; +/// @endcode +/// \~english @retval SS_String +/// \~english @par Preconditions +/// - None. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// sync only +/// \~english @par Detail +/// change member from EPWR_STARTUP_STAGE_TYPE type to string. \n +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////// +extern SS_String GetStr(EPWR_STARTUP_STAGE_TYPE f_enum); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetStr +/// \~english @par Summary +/// change member from EPWR_SYSTEM_MODE_INFO type to string +/// \~english @param [in] f_enum +/// EPWR_SYSTEM_MODE_INFO - the member what will convert farm EPWR_SYSTEM_MODE_INFO type to string type.The type +/// of system mode info. +/// \~english @codes +/// typedef enum { +/// epssinfINVALID = 0xFF, +/// epssinfNORMAL = 0x00, +/// epssinfPROGRAMMING = 0x08, +/// }ePowerSrvSystemModeInfo, EPWR_SYSTEM_MODE_INFO; +/// @endcode +/// \~english @retval SS_String +/// \~english @par Preconditions +/// - None. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// sync only +/// \~english @par Detail +/// change member from EPWR_SYSTEM_MODE_INFO type to string. \n +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////// +extern SS_String GetStr(EPWR_SYSTEM_MODE_INFO f_enum); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetStr +/// \~english @par Summary +/// change member from EPWR_TRANSPORT_MODE_TYPE type to string +/// \~english @param [in] f_enum +/// EPWR_TRANSPORT_MODE_TYPE - the member what will convert farm EPWR_TRANSPORT_MODE_TYPE type to string +/// type.The type of transport mode protocol. +/// \~english @codes +/// typedef enum { +/// epstmINVALID = 0xFF, +/// epstmDISABLED = 0x00, +/// epstmENABLED = 0x01 +/// } ePwrServiceTransportModeType, EPWR_TRANSPORT_MODE_TYPE; +/// @endcode +/// \~english @retval SS_String +/// \~english @par Preconditions +/// - None. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// sync only +/// \~english @par Detail +/// change member from EPWR_TRANSPORT_MODE_TYPE type to string. \n +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////// +extern SS_String GetStr(EPWR_TRANSPORT_MODE_TYPE f_enum); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetStr +/// \~english @par Summary +/// change member from \ref ePwrServiceUserModeChangeReasonType "EPWR_USER_MODE_CHANGE_REASON_TYPE" type to string +/// \~english @param [in] f_enum +/// \ref ePwrServiceUserModeChangeReasonType "EPWR_USER_MODE_CHANGE_REASON_TYPE" - the member what will convert farm \ref ePwrServiceUserModeChangeReasonType "EPWR_USER_MODE_CHANGE_REASON_TYPE" type +/// to string type.The type of user mode change reason. +/// \~english @retval SS_String +/// \~english @par Preconditions +/// - None. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// sync only +/// \~english @par Detail +/// change member from type \ref ePwrServiceUserModeChangeReasonType "EPWR_USER_MODE_CHANGE_REASON_TYPE" to string. \n +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////// +extern SS_String GetStr(EPWR_USER_MODE_CHANGE_REASON_TYPE f_enum); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetStr +/// \~english @par Summary +/// change member from EPWR_USER_MODE_TYPE type to string +/// \~english @param [in] f_enum +/// EPWR_USER_MODE_TYPE - the member what will convert farm EPWR_USER_MODE_TYPE type to string type.The type of +/// user mode. +/// \~english @codes +/// typedef enum { +/// epsumINVALID = 0xFF, +/// epsumOFF = 0x00, +/// epsumON = 0x01, +/// } ePwrServiceUserModeType, EPWR_USER_MODE_TYPE; +/// @endcode +/// \~english @retval SS_String +/// \~english @par Preconditions +/// - None. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// sync only +/// \~english @par Detail +/// change member from EPWR_USER_MODE_TYPE type to string. \n +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////// +extern SS_String GetStr(EPWR_USER_MODE_TYPE f_enum); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetStr +/// \~english @par Summary +/// change member from EPWR_WAKEUP_FACTOR_TYPE type to string +/// \~english @param [in] f_enum +/// EPWR_WAKEUP_FACTOR_TYPE - the member what will convert farm EPWR_WAKEUP_FACTOR_TYPE type to string type.The +/// type of startup reason. +/// \~english @codes +/// typedef enum { +/// epswfINVALID = 0xFF, +/// epswfTESTACC = 0x00, +/// epswfON_KEY = 0x01, +/// epswfIGN_ACC = 0x02, +/// epswfDR_OPEN_CLOSE = 0x03, +/// epswfDX_ACTIVATION = 0x04, +/// epswfPASS_ACTIVATION = 0x05, +/// epswfSPVACTIVATION = 0x06, +/// epswfUSER_DATA_RESET = 0x07 +/// } ePowerSrvWakeupFactors, EPWR_WAKEUP_FACTOR_TYPE; +/// @endcode +/// \~english @retval SS_String +/// \~english @par Preconditions +/// - None. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// sync only +/// \~english @par Detail +/// change member from EPWR_WAKEUP_FACTOR_TYPE type to string. \n +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////// +extern SS_String GetStr(EPWR_WAKEUP_FACTOR_TYPE f_enum); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetStr JP_ZPT +/// \~english @par Summary +/// change member from EFrameworkunifiedStatus type to string +/// \~english @param [in] f_enum +/// EFrameworkunifiedStatus - the member what will convert farm EFrameworkunifiedStatus type to string type.Status and return types. +/// \~english @codes +/// typedef enum eFrameworkunifiedStatus { +/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list +/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached +/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found +/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error +/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail +/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed +/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed +/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed +/// eFrameworkunifiedStatusFail = -2, ///< Failed +/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error +/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK +/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer +/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle +/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type +/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name +/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full +/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present +/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter +/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small +/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID +/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource +/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource +/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination +/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature +/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined +/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself +/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed +/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist +/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call +/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir +/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request +/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress +/// eFrameworkunifiedStatusNullPointer = 22, +/// eFrameworkunifiedStatusMsgNotProcessed = 23, +/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success +/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error +/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource +/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry +/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty +/// eFrameworkunifiedStatusThreadAlreadyRunning = 29, +/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor +/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again +/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call +/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling +/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt +/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found +/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus; +/// @endcode +/// \~english @retval SS_String +/// \~english @par Preconditions +/// - None. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// sync only +/// \~english @par Detail +/// change member from EFrameworkunifiedStatus type to string. \n +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////// +extern SS_String GetStr(EFrameworkunifiedStatus f_enum); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetStr +/// \~english @par Summary +/// change member from ESMBootModeInfo type to string +/// \~english @param [in] f_enum +/// ESMBootModeInfo - the member what will convert farm ESMBootModeInfo type to string type.The type of boot +/// mode information. +/// \~english @codes +/// typedef enum { +/// e_SS_SM_BOOT_MODE_INVALID = -1 +/// , e_SS_SM_BOOT_MODE_APPLICATION +/// , e_SS_SM_BOOT_MODE_PROGRAMMING +/// }ESMBootModeInfo; +/// @endcode +/// \~english @retval SS_String +/// \~english @par Preconditions +/// - None. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// sync only +/// \~english @par Detail +/// change member from ESMBootModeInfo type to string. \n +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////// +extern SS_String GetStr(ESMBootModeInfo f_enum); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetStr +/// \~english @par Summary +/// change member from ESMCpuResetReason type to string +/// \~english @param [in] f_enum +/// ESMCpuResetReason - the member what will convert farm ESMCpuResetReason type to string type.The type of CPU +/// reset reason. +/// \~english @codes +/// typedef enum { +/// e_SS_SM_CPU_RESET_REASON_INVALID = -1 +/// , e_SS_SM_CPU_RESET_REASON_NORMAL = 0 +/// , e_SS_SM_CPU_RESET_REASON_DATA_RESET +/// , e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET +/// , e_SS_SM_CPU_RESET_REASON_GENERIC +/// , e_SS_SM_CPU_RESET_REASON_GENERIC_ERR = e_SS_SM_CPU_RESET_REASON_GENERIC +/// , e_SS_SM_CPU_RESET_REASON_DSP_ERR +/// , e_SS_SM_CPU_RESET_REASON_IMMRESET_NORMAL +/// , e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR +/// }ESMCpuResetReason; +/// @endcode +/// \~english @retval SS_String +/// \~english @par Preconditions +/// - None. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// sync only +/// \~english @par Detail +/// change member from ESMCpuResetReason type to string. \n +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////// +extern SS_String GetStr(ESMCpuResetReason f_enum); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetStr +/// \~english @par Summary +/// change member from \ref _SS_SystemManagerProtocol "SS_SystemManagerProtocol" type to string +/// \~english @param [in] f_enum +/// \ref _SS_SystemManagerProtocol "SS_SystemManagerProtocol" - the member what will convert farm \ref SS_SystemManagerProtocol "SS_SystemManagerProtocol" type to string +/// type.The type of system manager protocol. +/// \~english @retval SS_String +/// \~english @par Preconditions +/// - None. +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// sync only +/// \~english @par Detail +/// change member from \ref _SS_SystemManagerProtocol) "SS_SystemManagerProtocol" type to string. \n +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////// +extern SS_String GetStr(SS_SystemManagerProtocol f_enum); + +#endif /* SS_STRING_MAPS_H_ */ // NOLINT (build/header_guard) +// EOF ss_string_maps.h +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_sys_boot_area_map.h b/service/system/interface_unified/library/include/system_service/ss_sys_boot_area_map.h new file mode 100755 index 0000000..7df0c88 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_sys_boot_area_map.h @@ -0,0 +1,39 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file ss_sys_boot_area_map.h + * @brief \~english This file supports system area type definitions + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#ifndef __SS_SYS_BOOT_AREA_MAP_H__ // NOLINT (build/header_guard) +#define __SS_SYS_BOOT_AREA_MAP_H__ + +#include <system_service/ss_sm_boot_access.h> + +#endif /* __SS_SYS_BOOT_AREA_MAP_H__ */ // NOLINT (build/header_guard) +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_system_if.h b/service/system/interface_unified/library/include/system_service/ss_system_if.h new file mode 100755 index 0000000..1e3ef14 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_system_if.h @@ -0,0 +1,119 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_system_if.h + * @brief \~english This file contains api build the session of heartbeat observation system manager + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#ifndef SS_SYSTEM_IF_H_ // NOLINT (build/header_guard) +#define SS_SYSTEM_IF_H_ + +#include <native_service/frameworkunified_types.h> +#include <native_service/frameworkunified_application.h> +#include <native_service/frameworkunified_framework_types.h> +#include <native_service/frameworkunified_sm_framework_if.h> + +//////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup system_manager +/// \~english @par Summary: +/// Establish SystemManger and HeartBeat monitoring session +/// \~english @param [in] hApp +/// HANDLE - Handle for application +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusNullPointer Handle error +/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue error +/// \~english @retval eFrameworkunifiedStatusErrNoEBADF File descriptor error +/// \~english @retval eFrameworkunifiedStatusErrNoEINTR System call error +/// \~english @retval eFrameworkunifiedStatusInvldBufSize Message buffer error +/// \~english @retval eFrameworkunifiedStatusErrOther Session establishment failure +/// \~english @retval eFrameworkunifiedStatusFail Message sharing memory error + +/// \~english @par Preconditions: +/// - Dispather for application is created / initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.) +/// \~english @par Change of the internal state: +/// - No change of internal state by this API occurs +/// \~english @par Causes of failures: +/// - Handle(hApp) specified in the argument is not appropriate(invalid) [eFrameworkunifiedStatusNullPointer] +/// - Management information area acquisition(malloc) failed [eFrameworkunifiedStatusNullPointer] +/// - Message queue for session for service is full [eFrameworkunifiedStatusMsgQFull] +/// - Invalid file descriptor for sending session messages for service [eFrameworkunifiedStatusErrNoEBADF] +/// - System call(signal) interrupt occurs +/// while sending a session message for a service [eFrameworkunifiedStatusErrNoEINTR] +/// - The size of the message transmission buffer for service is incorrect [eFrameworkunifiedStatusInvldBufSize] +/// - Some error occurred when sending session message for service [eFrameworkunifiedStatusFail] +/// - Failed to access shared memory for sending session messages for service [eFrameworkunifiedStatusErrOther] +/// \~english @par Detail: +/// Establish HeartBeat monitoring and SystemManager session.\n +/// +/// \~english @par Classification: +/// Public +/// \~english @see FrameworkunifiedMcOpenSender, FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedSendMsg +/// +//////////////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp); + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(IMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND) +#define FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(x) \ + x.onInitilization = FrameworkunifiedOnInitialization; \ + x.onDestroy = FrameworkunifiedOnDestroy; \ + x.onStart = FrameworkunifiedOnStart; \ + x.onStop = FrameworkunifiedOnStop; \ + x.onDebugDump = FrameworkunifiedOnDebugDump; \ + x.createStateMachine = FrameworkunifiedCreateStateMachine; \ + x.ssFrameworkInterface = FrameworkunifiedSSFrameworkInterface; \ + x.onPreStart = FrameworkunifiedOnDummy; \ + x.onPreStop = FrameworkunifiedOnDummy; \ + x.onBackgroundStart = FrameworkunifiedOnDummy; \ + x.onBackgroundStop = FrameworkunifiedOnDummy; +#else +#define FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(x) \ + x.onInitilization = FrameworkunifiedOnInitialization; \ + x.onDestroy = FrameworkunifiedOnDestroy; \ + x.onStart = FrameworkunifiedOnStart; \ + x.onStop = FrameworkunifiedOnStop; \ + x.onDebugDump = FrameworkunifiedOnDebugDump; \ + x.createStateMachine = FrameworkunifiedCreateStateMachine; \ + x.ssFrameworkInterface = FrameworkunifiedSSFrameworkInterface; \ + x.onPreStart = FrameworkunifiedOnPreStart; \ + x.onPreStop = FrameworkunifiedOnPreStop; \ + x.onBackgroundStart = FrameworkunifiedOnBackgroundStart; \ + x.onBackgroundStop = FrameworkunifiedOnBackgroundStop; +#endif + +#ifdef __cplusplus +} +#endif + + +#endif /* SS_SYSTEM_IF_H_ */ // NOLINT (build/header_guard) +/** @}*/ // end of interface_unified +/** @}*/ // end of system_service +/** @}*/ // end of BaseSystem diff --git a/service/system/interface_unified/library/include/system_service/ss_system_manager_if.h b/service/system/interface_unified/library/include/system_service/ss_system_manager_if.h new file mode 100755 index 0000000..e6b4f8d --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_system_manager_if.h @@ -0,0 +1,335 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup system_manager +/// \file ss_system_manager_if.h +/// \brief This file supports the System Manager client interface. +/// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef SS_SYSTEM_MANAGER_IF_H_ // NOLINT (build/header_guard) +#define SS_SYSTEM_MANAGER_IF_H_ + +#include <native_service/frameworkunified_types.h> +#include <system_service/ss_sm_ram_access.h> +#include "system_service/ss_system_if.h" +#include "system_service/ss_error_event_common.h" +#include "system_service/ss_power_service.h" + +/// \ingroup system_manager +/// \brief Boot mode information +typedef enum { + e_SS_SM_BOOT_MODE_INVALID = -1 + , e_SS_SM_BOOT_MODE_APPLICATION + , e_SS_SM_BOOT_MODE_PROGRAMMING +}ESMBootModeInfo; + +/// \ingroup system_manager +/// \brief Data reset mode information +typedef enum { + e_SS_SM_DATA_RESET_MODE_NONE + , e_SS_SM_DATA_RESET_MODE_USER + , e_SS_SM_DATA_RESET_MODE_FACTORY + , e_SS_SM_DATA_RESET_MODE_PROGUPDATE // cannot use this +}ESMDataResetModeInfo; + +/// \ingroup system_manager +/// \brief Program update status +typedef UI_32 SMProgUpdateState; +#define SS_SM_PROG_UPDATE_STATE_NONE 0x0000 +#define SS_SM_PROG_UPDATE_STATE_UPDATED 0x0001 +#define SS_SM_PROG_UPDATE_STATE_MAP_UPDATED 0x0002 +#define SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED 0x0004 + +/// Set Next Wakeup type information +typedef enum { + e_SS_SM_NEXT_WAKEUP_TYPE_NONE = 0 + , e_SS_SM_NEXT_WAKEUP_TYPE_COLD + , e_SS_SM_NEXT_WAKEUP_TYPE_HOT +}ESMNextWakeupType; + +/// \ingroup system_manager +/// \brief DRAM backup status +typedef enum { + e_SS_SM_DRAM_BACKUP_UNSET = -1 + , e_SS_SM_DRAM_BACKUP_OK + , e_SS_SM_DRAM_BACKUP_NG +}ESMDramBackupStatus; + +/// \ingroup system_manager +/// \brief Reset status +typedef enum { + e_SS_SM_RESET_STATUS_UNSET = -1 + , e_SS_SM_RESET_STATUS_NONE + , e_SS_SM_RESET_STATUS_NG + , e_SS_SM_RESET_STATUS_IMMEDIATE +}ESMResetStatus; + +/// \ingroup system_manager +/// \brief Relaunch status +typedef enum { + e_SS_SM_RELAUNCH_STATUS_NONE + , e_SS_SM_RELAUNCH_STATUS_SAFE + , e_SS_SM_RELAUNCH_STATUS_ERR +}EMRelaunchStatus; + + +/// \ingroup system_manager +/// \brief CPU Reset Reason +typedef enum { + e_SS_SM_CPU_RESET_REASON_INVALID = -1 + , e_SS_SM_CPU_RESET_REASON_NORMAL = 0 + , e_SS_SM_CPU_RESET_REASON_DATA_RESET + , e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET + , e_SS_SM_CPU_RESET_REASON_GENERIC + , e_SS_SM_CPU_RESET_REASON_GENERIC_ERR = e_SS_SM_CPU_RESET_REASON_GENERIC + , e_SS_SM_CPU_RESET_REASON_DSP_ERR + , e_SS_SM_CPU_RESET_REASON_IMMRESET_NORMAL + , e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR // DRAM backup will be discarded after reset +}ESMCpuResetReason; + +/// \ingroup system_manager +/// \brief CPU Reset Info +typedef struct T_SystemManagerCpuResetInfo { +#define SS_SM_RESET_MSG_STR_SIZE 64 +#define SS_SM_SUFFIX_STR_SIZE 32 + ESMCpuResetReason resetReason; + CHAR messageStr[SS_SM_RESET_MSG_STR_SIZE]; + CHAR suffixStr[SS_SM_SUFFIX_STR_SIZE]; + T_SystemManagerCpuResetInfo + () : resetReason(e_SS_SM_CPU_RESET_REASON_INVALID) { + } +}TSystemManagerCpuResetInfo; + + +/// \ingroup system_manager +/// \brief Data Reset Reason +typedef enum { + e_SS_SM_DATA_RESET_TYPE_USER = 0 + , e_SS_SM_DATA_RESET_TYPE_FACTORY // AKA Shipment Mode + , e_SS_SM_DATA_RESET_TYPE_CONFIGURATION + , e_SS_SM_DATA_RESET_TYPE_PROGUPDATE // cannot use this +}ESMDataResetType; + +typedef enum { + e_SS_SM_SVC_WAKEUP_STATUS_COMPLETE = 0x01 +}ESMServiceWakeupStatus; + +/// \ingroup system_manager +/// \brief Data Reset Reason +typedef struct T_SS_BootModeListStruct { + ESMBootModeInfo hostBootMode; + EPWR_SC__CWORD56__BOOT_MODE_TYPE _CWORD56_BootMode; +} TSS_BootModeListStruct; + +//**************************************************************************** +/// \ingroup system_manager * +/// Data passed in the NTFY_SSSystemMgrPowerOnOff and * +/// NTFY_SSSystemMgrUserMode notification messages * + +/// \ingroup system_manager +typedef struct T_SS_SM_UserModeOnOffNotification_Struct { // * + BOOL isUserModeOn; // * + EPWR_WAKEUP_FACTOR_TYPE startupReason; // * + EPWR_USER_MODE_CHANGE_REASON_TYPE userModeChangeReason; // * + T_SS_SM_UserModeOnOffNotification_Struct // * + () : isUserModeOn(FALSE), // * + startupReason(epswfINVALID), // * + userModeChangeReason(epsumcrNOT_AVAILABLE) { // * + } // * + T_SS_SM_UserModeOnOffNotification_Struct // * + (BOOL f_bUserMode, // * + EPWR_WAKEUP_FACTOR_TYPE f_startupReason, // * + EPWR_USER_MODE_CHANGE_REASON_TYPE f_changeReason) // * + : isUserModeOn(f_bUserMode), // * + startupReason(f_startupReason), // * + userModeChangeReason(f_changeReason) { // * + } // * + // * +} T_SS_SM_UserModeOnOffNotification_StructType; // * +// * +// End of Data passed as part of NTFY_SSSystemMgrPowerOnOff notification ... * +//**************************************************************************** + + +//**************************************************************************** +/// \ingroup system_manager +/** + * \~english Parameters of the following message. \n + * SS_SM_START 'FrameworkunifiedOnStart'/'evStart' \n + * SS_SM_PRE_START 'FrameworkunifiedOnPreStart'/'evPreStart' \n + * SS_SM_BACKGROUND_START 'FrameworkunifiedOnBackgroundStart'/'evBackgroundStart' \n + */ +typedef struct T_SS_SM_START_DataStruct { + EPWR_WAKEUP_FACTOR_TYPE startupReason; //!< \~english + BOOL isUserModeOn; //!< \~english + ESMDataResetModeInfo dataResetMode; //!< \~english + EPWR_SC_SECURITY_STATUS securityStatus; //!< \~english + EPWR_SC_WAKEUP_TYPE wakeupType; //!< \~english + ESMDramBackupStatus dramBackupStatus; //!< \~english + ESMResetStatus resetStatus; //!< \~english + UI_32 errResetCount; //!< \~english + /** + * \~english Constructor + */ + T_SS_SM_START_DataStruct + () : startupReason(epswfINVALID), + isUserModeOn(FALSE), + dataResetMode(e_SS_SM_DATA_RESET_MODE_NONE), + securityStatus(epsssINVALID), + wakeupType(epsstINVALID), + dramBackupStatus(e_SS_SM_DRAM_BACKUP_UNSET), + resetStatus(e_SS_SM_RESET_STATUS_UNSET), + errResetCount(0) {} + /** + * \~english Constructor + */ + T_SS_SM_START_DataStruct + (EPWR_WAKEUP_FACTOR_TYPE f_startupReason, + BOOL f_isUserModeOn, + ESMDataResetModeInfo f_dataResetMode, + EPWR_SC_SECURITY_STATUS f_securityStatus, + EPWR_SC_WAKEUP_TYPE f_wakeupType, + ESMDramBackupStatus f_dramBackupStatus, + ESMResetStatus f_resetStatus, + UI_32 f_resetCount) + : startupReason(f_startupReason), + isUserModeOn(f_isUserModeOn), + dataResetMode(f_dataResetMode), + securityStatus(f_securityStatus), + wakeupType(f_wakeupType), + dramBackupStatus(f_dramBackupStatus), + resetStatus(f_resetStatus), + errResetCount(f_resetCount) {} +} T_SS_SM_START_DataStructType; +// * +// End of Data passed as part of SS_SM_START 'FrameworkunifiedOnStart'/'evStart' message * +//**************************************************************************** + +//**************************************************************************** +/// \ingroup system_manager +/// Data passed as part of SS_SM_STOP 'FrameworkunifiedOnStop'/'evStop' message * +typedef struct T_SS_SM_STOP_DataStruct { // * + EPWR_SHUTDOWN_TRIGGER_TYPE shutdownTrigger; // * + EPWR_USER_MODE_TYPE lastUserMode; // * +} T_SS_SM_STOP_DataStructType; // * +// * +// End of Data passed as part of SS_SM_STOP 'FrameworkunifiedOnStop'/'evStop' message // * +//**************************************************************************** + +//**************************************************************************** +/// \ingroup system_manager +/// Extended Parameter for FrameworkunifiedOnStart * +typedef struct { // * +#define SS_SM_START_EXT_INFO_SIZE 64 // * +#define SS_SM_START_EXT_BODY_SIZE ( sizeof(BOOL) \ + + sizeof(EMRelaunchStatus) \ + + sizeof(BOOL) \ + + sizeof(BOOL) \ + ) + +#define SS_SM_START_EXT_RSV_SIZE SS_SM_START_EXT_INFO_SIZE \ + - SS_SM_START_EXT_BODY_SIZE // * + BOOL isProgUpdated; // * + EMRelaunchStatus relaunchStatus; // * + BOOL isMapUpdated; // * + BOOL isMapDiffUpdated; // * + uint8_t reserved[SS_SM_START_EXT_RSV_SIZE]; // * +} T_SS_SM_START_ExtDataStructType; // * +// * +// End of Extended Parameter for FrameworkunifiedOnStart * +//**************************************************************************** + +//**************************************************************************** +/// \ingroup system_manager +/// Extended Parameter for FrameworkunifiedOnStop * +typedef struct { // * +#define SS_SM_STOP_EXT_INFO_SIZE 64 // * +#define SS_SM_STOP_EXT_BODY_SIZE (sizeof(BOOL)) // * +#define SS_SM_STOP_EXT_RSV_SIZE SS_SM_STOP_EXT_INFO_SIZE \ + - SS_SM_STOP_EXT_BODY_SIZE // * + BOOL isProgUpdated; // * + uint8_t reserved[SS_SM_STOP_EXT_RSV_SIZE]; // * +}T_SS_SM_STOP_ExtDataStructType; // * +// * +// End of Extended Parameter for FrameworkunifiedOnStop * +//**************************************************************************** + +struct SMErrorEventNtfData { +#define SM_MODULE_NAME_SIZE 64 + EErrorEventType EventType; + CHAR ModuleName[SM_MODULE_NAME_SIZE]; + BOOL isNeedReboot; +}; + +//************************************************************************* +// Boot Micro Logging Protocol * +// * +enum eSMBootMicroResetReason { + SS_SM_BOOT_MICRO_RESET_REASON_SELF_RESET = 0, + SS_SM_BOOT_MICRO_RESET_REASON_USER_FORCE_RESET, + SS_SM_BOOT_MICRO_RESET_REASON_DSP_RESET, + SS_SM_BOOT_MICRO_RESET_REASON_HB_TIMEOUT +}; +// * +// End of Boot Micro Logging Protocol * +//************************************************************************* + + +//**************************************************************************** +/// \ingroup system_manager * +/// Error Event Logging enumerations * +/// +enum eSMUserLogType { + e_SS_SM_CAPTURE_ALL_LOGS = 1, //!< \~english Capture all logs + e_SS_SM_SCREEN_CAPTURE, //!< \~english Capture screenshot + e_SS_SM_CAPTURE_INTERFACEUNIFIED_LOGS, //!< \~english Capture application log + e_SS_SM_USER_FORCE_RESET, //!< \~english Capture logs are forcibily reset + e_SS_SM_CAPTURE_DEV_LOGS, //!< \~english Capture device log + e_SS_SM_CAPTURE_MODULE_LOGS, //!< \~english Capture debug log + e_SS_SM_CAPTURE_DTC_LOGS, //!< \~english Capture DTC event log + e_SS_SM_CAPTURE_NAVI_LOGS, //!< \~english Capture Navi event log + e_SS_SM_CAPTURE_GROUP_RELAUNCH //!< \~english Capture log by Group Relaunch +}; +// * +// Error Event Logging enumerations * +//**************************************************************************** + +//**************************************************************************** +/// \ingroup system_manager * +/// \brief Error Event Logging Info * +typedef struct T_SystemManagerLoggingRequestInfo { +#define SS_SM_LOG_MSG_STR_SIZE 64 + eSMUserLogType logType; + CHAR messageStr[SS_SM_LOG_MSG_STR_SIZE]; + CHAR suffixStr[SS_SM_SUFFIX_STR_SIZE]; +}TSystemManagerLoggingRequestInfo; +// +// Error Event Logging Info * +//**************************************************************************** + +//**************************************************************************** +/// \ingroup system_manager * +/// \brief Error Event Clear Logs Info * +typedef struct T_SystemManagerClearLogsInfo { + void *rsv; +}TSystemManagerClearLogsInfo; +// +// Error Event Clear Logs Info * +//**************************************************************************** + +#endif /* SS_SYSTEM_MANAGER_IF_H_ */ // NOLINT (build/header_guard) diff --git a/service/system/interface_unified/library/include/system_service/ss_system_manager_if_local.h b/service/system/interface_unified/library/include/system_service/ss_system_manager_if_local.h new file mode 100755 index 0000000..5c67aa6 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_system_manager_if_local.h @@ -0,0 +1,40 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup system_manager +/// \file ss_system_manager_if_local.h +/// \brief This file supports the System Manager client interface. +/// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef SS_SYSTEM_MANAGER_IF_LOCAL_H_ // NOLINT (build/header_guard) +#define SS_SYSTEM_MANAGER_IF_LOCAL_H_ + +#define SS_MAX_NUM_MODULES (128) + +// EXIT_SUCCESS exit succeccfully +// EXIT_FAILURE exit with failure +// SS_SM_EXIT_RELAUNCH exit for relaunch request +#define SS_SM_EXIT_RELAUNCH (2) + +/// \ingroup system_manager +/// Message data payload structure from system manager to heartbeat +typedef struct T_SMRequestMsg { + CHAR pstModuleName[MAX_QUEUE_NAME_SIZE]; +}TSMRequestMessage; + +#endif /* SS_SYSTEM_MANAGER_IF_LOCAL_H_ */ // NOLINT (build/header_guard) diff --git a/service/system/interface_unified/library/include/system_service/ss_system_manager_notifications.h b/service/system/interface_unified/library/include/system_service/ss_system_manager_notifications.h new file mode 100755 index 0000000..008d4f3 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_system_manager_notifications.h @@ -0,0 +1,49 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup system_manager +/// \file ss_system_manager_notifications.h +/// \brief This file supports the System Manager client interface. +/// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef SS_SYSTEM_MANAGER_NOTIFICATIONS_H_ // NOLINT (build/header_guard) +#define SS_SYSTEM_MANAGER_NOTIFICATIONS_H_ + +#include "system_service/ss_services.h" + +/// \addtogroup system_manager +/// @{ + +#define NTFY_SSSystemMgrAvailability SERVICE_SYSMANAGER"/Availability" ///< System Manager availability - + // eFrameworkunifiedServiceAvailable or eInterfaceunifiedServiceUnavailable +#define NTFY_SSSystemMgrState SERVICE_SYSMANAGER"/State" ///< System Manager state - Init, + // Connecting, Disconnecting and Ready +#define NTFY_SSSystemMgrPowerOnOff SERVICE_SYSMANAGER"/PowerOnOffState" ///< Power ON notification for + // Audio & Display +#define NTFY_SSSystemMgrStartUpType SERVICE_SYSMANAGER"/StartUpType" ///< Notification for start up type +#define NTFY_SSServiceWakeupStatus SERVICE_SYSMANAGER"/ServiceWakeupStatus" ///< Service Wakeup state +#define NTFY_SSNeedAplRestart SERVICE_SYSMANAGER"/NeedAplRestart" ///< Notification for Need APL Restart + + +/// Notification used by HMI to know when a Shutdown Request has been received +/// from the _CWORD56_ +#define NTFY_SSSystemMgrShutdownStarted SERVICE_SYSMANAGER"/ShutdownStarted" + +/// @} + +#endif /* SS_SYSTEM_MANAGER_NOTIFICATIONS_H_ */ // NOLINT (build/header_guard) diff --git a/service/system/interface_unified/library/include/system_service/ss_system_manager_notifications_local.h b/service/system/interface_unified/library/include/system_service/ss_system_manager_notifications_local.h new file mode 100755 index 0000000..cbb743f --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_system_manager_notifications_local.h @@ -0,0 +1,51 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ss_system_manager_notifications_local.h + * @brief \~english This file supports the System Manager client interface. + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#ifndef SS_SYSTEM_MANAGER_NOTIFICATIONS_LOCAL_H_ // NOLINT (build/header_guard) +#define SS_SYSTEM_MANAGER_NOTIFICATIONS_LOCAL_H_ + + +/// TRUE : UserMode is UserOn +/// FALSE : UserMode is UserOff +/// Notification for User Mode +#define NTFY_SSSystemMgrUserMode SERVICE_SYSMANAGER"/UserMode" + +/// Notification for data reset +#define NTFY_SSSystemMgrDataReset SERVICE_SYSMANAGER"/DataReset" + +/// Notification used by Audio and System Services for Dynamic Launch +#define NTFY_SSLastSourceType SERVICE_SYSMANAGER"/LastSourceType" + + +#endif /* SS_SYSTEM_MANAGER_NOTIFICATIONS_LOCAL_H_ */ // NOLINT (build/header_guard) +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_system_manager_protocol.h b/service/system/interface_unified/library/include/system_service/ss_system_manager_protocol.h new file mode 100755 index 0000000..99d7e13 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_system_manager_protocol.h @@ -0,0 +1,329 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup system_manager +/// \file ss_system_manager_protocol.h +/// \brief This file supports the System Manager client interface. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef __SS_SYSTEM_MANAGER_PROTOCOL_H__ // NOLINT (build/header_guard) +#define __SS_SYSTEM_MANAGER_PROTOCOL_H__ + +#include <native_service/frameworkunified_types.h> +#include <native_service/frameworkunified_service_protocol.h> + +/// \addtogroup system_manager +/// @{ + +#define SS_SM_MAX_MODULE_NAME_LENGTH (256) +#define SS_SM_MAX_TEST_CASE_NAME_SIZE (128) +#define SS_SM_MAX_RESP_MSG_SIZE (2048) + +// system manager protocol --> define all protocol messages in and out of system manager +// that are pertinent to the functionality offered by system manager. +/** + * \~english System control protocol type. + */ +typedef enum _SS_SystemManagerProtocol { + // System Manager - command Protocol + SS_SYSTEM_MANAGER_PROTOCOL_BEGINNING_INDEX = 0x800, //!< \~english + SS_SM_NOTIFY_SYSTEM_LAUNCH_COMPLETE = SS_SYSTEM_MANAGER_PROTOCOL_BEGINNING_INDEX //!< System Manager to Power manager + , SS_SM_PROTOCOL_INTERFACE_END //!< \~english + + // SystemManager-command Protocol + , SS_SM_START //!< \~english Normal-boot start request. + , SS_SM_START_COMPL_RSPN //!< \~english Normal-boot start completion notification. + , SS_SM_STOP //!< \~english Shutdown request. + , SS_SM_STOP_COMPL_RSPN //!< \~english Shutdown completion notification. + // SystemManager-command Protocol + , SS_SM_WAKEUP_MODULES_CMPL_RSPN //!< \~english Response to request of power state transition to power_service.(message format to use: \ref _wakeinfo "wakeInfo") + , SS_SM_SHUTDOWN_MODULES_CMPL_RSPN //!< SM to power + + , SS_SM_WAKEUP_MODULES //!< client to service + , SS_SM_POWER_OFF_MODULES //!< client to service + , SS_SM_SHUTDOWN_MODULES //!< client to service + + , SS_SM_CRNT_STATE_QUERY //!< client to service + , SS_SM_CRNT_STATE_QUERY_RSPN //!< service to client + , SS_SM_SYSTEM_MODE_INFO_REQ //!< client to service + , SS_SM_SYSTEM_MODE_INFO_RSPN //!< service to client + , SS_SM_INITCOMP_REP //!< client to service + + , SS_SM_PROTOCOL_OPEN_SESSION_REQ //!< \~english + , SS_SM_PROTOCOL_OPEN_SESSION_ACK //!< \~english + + //************************************************************************* + // Get Extended Parameter Protocol * + // * + // Protocol between applications and SM * + , SS_SM_GET_START_EXT_INFO //!< FrameworkunifiedOnStart Extended Parameter + , SS_SM_GET_STOP_EXT_INFO //!< FrameworkunifiedOnStop Extended Parameter + // End of Get Extended Parameter Protocol * + //************************************************************************* + + //************************************************************************* + // Reset Mode Protocol: * + // * + // Request by Privileged clients to set the data reset mode: * + // None, UserData Reset or * + // Factory Reset * + // * + // The Set Request message carries the requested reset Mode. * + // Set Result message is not defined, because the Set Request is send by * + // FrameworkunifiedInvokeSync() * + , SS_SM_DATA_RESET_MODE_SET_REQ //!< Client to Service (Sys Mgr) + // * + // End of Reset Mode Protocol * + //************************************************************************* + + //************************************************************************* + // Program Update Status Protocol: * + // * + // Request by Privileged clients to set the program update status: * + // None or Program Updated * + // * + // The Set Request message carries the requested program update status. * + // Set Result message is not defined, because the Set Request is send by * + // FrameworkunifiedInvokeSync() * + , SS_SM_PROG_UPDATE_STATE_SET_REQ //!< Client to Service (Sys Mgr) + // * + // End of Reset Mode Protocol * + //************************************************************************* + + //************************************************************************* + // 'CPU Reset' Protocol: * + // * + // CPU Reset request from applications to SM and SM to PS * + // /// < Client to Service when * + // /// message originating from * + // /// Application to SS\SM. * + // /// < Service to Client when * + // /// message originating from * + // /// SS\SM to SS\PS. * + , SS_SM_CPU_RESET_REQ //!< \~english + // * + // End of CPU Reset Protocol * + //************************************************************************* + + //************************************************************************* + // 'Local Data Reset' Protocol: * + // * + // Local Data Reset request from applications to SM. * + // /// < Client to Service when * + // /// message originating from * + // /// Application to SS\SM. * + , SS_SM_LOCAL_DATA_RESET_REQ //!< \~english + // * + // End of Local Data Reset Protocol * + //************************************************************************* + + //************************************************************************* + // 'Remote Data Reset' Protocol: * + // * + // Remote Data Reset request from SM to PS * + // /// < Service to Client when * + // /// message originating from * + // /// SS\SM to SS\PS. * + , SS_SM_REMOTE_DATA_RESET_REQ //!< \~english + // * + // End of Remote Data Reset Protocol * + //************************************************************************* + + + //************************************************************************* + // Startup Confirmation Protocol: * + // * + // Request by the Power Shadow to the Power Service to forward to the * + // System Manager the Startup Confirmation message. * + // * + // The Request message carries the Startup Confirmation message. * + // The Response message carries the EFrameworkunifiedStatus of the request. * + , SS_SM_FWD_STARTUP_CONFIRMATION_MSG_REQ //!< Pwr Svc to Sys Mgr + , SS_SM_FWD_START_CONFIRMATION_MSG_RESP //!< Sys Mgr to Pwr Svc + // * + // End of Startup Confirmation Protocol * + //************************************************************************* + + //************************************************************************* + // Power Request Protocol: * + // * + // Power Request message from the Power Shadow to the System Manager with * + // _CWORD56_'s "Power_Request" IPC_Command data. * + // * + // The Request message carries the _CWORD56_'s data. * + // The Response message carries the EFrameworkunifiedStatus of the request. * + , SS_SM_POWER_REQUEST_MSG //!< \~english Startup process start request from power_service. + , SS_SM_POWER_REQUEST_MSG_RESP //!< Sys Mgr to Pwr Svc + // * + // End of Power Request Protocol * + //************************************************************************* + + //************************************************************************* + // User Mode Protocol: * + // * + // Request from the Power Service to the System Manager, originally from * + // the Power Shadow, to turn on or off the video & audio output of HMI * + // and Audio services. * + // User Mode 'On' => turn video & audio output on * + // User Mode 'Off' => turn video & audio output off * + // * + // The Request message carries the requested User Mode state. * + // The Response message carries the actual User Mode state. * + , SS_SM_USER_MODE_SET_RESP //!< Service (Sys Mgr) to Client (Pwr Svc) + // * + // Note: See the corresponding Power Shadow / Power Service * + // 'SS_PowerServiceProtocol' enums in * + // /SystemServices/inc/ss_power_service_protocol.h * + // End of User Mode Protocol * + //************************************************************************* + + , SS_SM_NEXT_WAKEUP_TYPE_SET_REQ //!< \~english + + //************************************************************************* + // Error Event Protocol * + // + , SS_SM_EVENT_ERROR //!< SM to HMI(_CWORD77_) + , SS_SM_EVENT_ERROR_TO_SSL //!< SM to SSL + , SS_SM_ERROR_EVENT_LOGGING_START_REQ //!< SSL to SM + , SS_SM_ERROR_EVENT_LOGGING_START_RSPN //!< SM to SSL + , SS_SM_ERROR_EVENT_ARTIFACT_REQ //!< SSL to SM + , SS_SM_ERROR_EVENT_ARTIFACT_RSPN //!< SM to SSL + , SS_SM_ERROR_EVENT_LOGGING_COMPLETE //!< SSL to SM + , SS_SM_ERROR_EVENT_LOGGING_COMPLETE_RSPN //!< SM to SSL + + , SS_SM_ERROR_EVENT_TIMER_ID_LOGGER_START_REQ //!< \~english + , SS_SM_ERROR_EVENT_TIMER_ID_DEBUG_DUMP_RSPN //!< \~english + , SS_SM_ERROR_EVENT_TIMER_ID_BOOT_MICRO_LOG_RSPN //!< \~english + , SS_SM_ERROR_EVENT_TIMER_ID_CORE_FILE_POLL //!< \~english + + , SS_SM_USER_INVOKED_LOG_REQ //!< Key Shadow to SM + + , SS_SM_ERROR_EVENT_EEL_EXPORT_REQ //!< SSL to SM + , SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_REQ //!< SSL to SM + , SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_RSPN //!< SM to SVC + , SS_SM_ERROR_EVENT_CLR_LOGS_REQ //!< SVC to SM + , SS_SM_ERROR_EVENT_PROCESS_EXIT //!< SM\CD to SM + , SS_SM_ERROR_EVENT_DIAG_LOG_REQ //!< SSL to SM + , SS_SM_ERROR_EVENT_CAN_LOG_REQ //!< SSL to SM + , SS_SM_ERROR_EVENT_DTC_LOG_REQ //!< SSL to SM + // + // End of Error Event Protocol * + //************************************************************************* + + , SS_SM_GROUP_LAUNCH_TRIGGER //!< \~english + + //************************************************************************* + // Debug Dump Protocol * + // * + // Protocol between applications and SM * + , SS_SM_DEBUG_DUMP //!< SM to client + , SS_SM_DEBUG_DUMP_RSPN //!< client to SM + // * + // End of Debug Dump Protocol * + //************************************************************************* + + //************************************************************************* + // IAT Propagate Error (Module Relaunch Request) * + // * + // Protocol between applications and SM * + , SS_SM_MODULE_RELAUNCH_REQ //!< client to SM + // * + // End of IAT Propagate Error (Module Relaunch Request) * + //************************************************************************* + + //************************************************************************* + // CPU High Load * + // * + // Protocol between SS_CPU_Monitor and SM * + , SS_SM_CPU_HIGH_LOAD_DETECTED //!< client to SM + // * + // End of CPU High Load * + //************************************************************************* + + //************************************************************************* + // IAT Propagate Error (System Error) * + // * + // Protocol between application and SM * + , SS_SM_PROPAGATE_SYSTEM_ERROR //!< client to SM + // * + // End of IAT Propagate Error (System Error) * + //************************************************************************* + + //************************************************************************* + // _CWORD56_ HeartBeat Request Protocol * + // * + // Protocol between Power Services and SM * + , SS_SM__CWORD56__HEARTBEAT_REQ //!< PS to SM + , SS_SM__CWORD56__HEARTBEAT_RSPN //!< SM to PS + // * + // End of _CWORD56_ HeartBeat Request Protocol * + //************************************************************************* + + //************************************************************************* + // User Data Reset Event Protocol * + // * + // Protocol between SM and Service * + , SS_SM_EVENT_USER_DATA_RESET //!< SM to MS + // * + // End of User Data Reset Event Protocol * + //************************************************************************* + + //************************************************************************* + // Boot Micro Logging Protocol * + // * + // Protocol between SS_Logger and SM. * + , SS_SM_BOOT_MICRO_RESET_NTF //!< Logging Shadow to SM + , SS_SM_BOOT_MICRO_LOG_REQ //!< SM to Logging Shadow + , SS_SM_BOOT_MICRO_LOG_RSP //!< Logging Shadow to SM aka ENDING_INDEX + // * + // End Boot Micro Logging Protocol * + //************************************************************************* + + // SystemManager-command Protocol + , SS_SM_PRE_START //!< \~english Pre-boot(+BA) start request. + , SS_SM_PRE_START_COMPL_RSPN //!< \~english Pre-boot(+BA) start completion notification. + , SS_SM_PRE_STOP //!< \~english Pre-boot(+BA) stop request. + , SS_SM_PRE_STOP_COMPL_RSPN //!< \~english Pre-boot(+BA) stop completion notification. + , SS_SM_BACKGROUND_START //!< \~english Background-boot(+BA) start request. + , SS_SM_BACKGROUND_START_COMPL_RSPN //!< \~english Background-boot(+BA) start completion notification. + , SS_SM_BACKGROUND_STOP //!< \~english Background-boot(+BA) stop request. + , SS_SM_BACKGROUND_STOP_COMPL_RSPN //!< \~english Background-boot(+BA) stop completion notification. + + // UPDATE IF ANOTHER 'LAST' ENUMERATION IS ADDED ! + , SS_SYSTEM_MANAGER_PROTOCOL_ENDING_INDEX = SS_SM_BACKGROUND_STOP_COMPL_RSPN //!< \~english +} SS_SystemManagerProtocol; + +typedef struct _SS_SMCurrentState { + CHAR testCaseIdString[SS_SM_MAX_TEST_CASE_NAME_SIZE]; + CHAR respMsgString[SS_SM_MAX_RESP_MSG_SIZE]; +}SS_SMCurrentState; + +typedef struct _SMCompleteAck { + UI_16 unSessionId; + CHAR szServiceName[MAX_QUEUE_NAME_SIZE]; +} SMStopCompleteAck; + +typedef struct _SMGroupLaunchTrigger { + UI_32 NextGroupId; +}SMGroupLaunchTrigger; +//************************************************************************* + + +/// @} + +#endif /* __SS_SYSTEM_MANAGER_PROTOCOL_H__ */ // NOLINT (build/header_guard) +// EOF diff --git a/service/system/interface_unified/library/include/system_service/ss_system_manager_protocol_local.h b/service/system/interface_unified/library/include/system_service/ss_system_manager_protocol_local.h new file mode 100755 index 0000000..5f86820 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_system_manager_protocol_local.h @@ -0,0 +1,45 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup system_manager +/// \file ss_system_manager_protocol_local.h +/// \brief This file supports the System Manager client interface. +/////////////////////////////////////////////////////////////////////////////// + +#ifndef __SS_SYSTEM_MANAGER_PROTOCOL_LOCAL_H__ // NOLINT (build/header_guard) +#define __SS_SYSTEM_MANAGER_PROTOCOL_LOCAL_H__ + +#include <native_service/frameworkunified_types.h> +#include <native_service/frameworkunified_service_protocol.h> + +/// \addtogroup system_manager +/// @{ + +#define SS_SM_MAX_MODULE_LOG_MASK_LENGTH (50) +#define SS_SM_MAX_MODULE_PATH_LENGTH (256) +#define SS_SM_MAX_MODULE_ARGS_LENGTH (512) + +//************************************************************************* +// Version Number Structure Specification: * +typedef UI_64 SS_VersionNumberType; +// End of Version Number Structure Specification * +//************************************************************************* + +/// @} + +#endif /* __SS_SYSTEM_MANAGER_PROTOCOL_LOCAL_H__ */ // NOLINT (build/header_guard) +// EOF diff --git a/service/system/interface_unified/library/include/system_service/ss_system_process.h b/service/system/interface_unified/library/include/system_service/ss_system_process.h new file mode 100755 index 0000000..a4ae743 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_system_process.h @@ -0,0 +1,1118 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_SystemServicesIf +/// \brief This file supports the System Manager OS process abstraction. +/// +/////////////////////////////////////////////////////////////////////////////// +/** + * @file ss_system_process.h + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup interface_unified + * @ingroup system_service + * @{ + */ +#ifndef __Process_H__ // NOLINT (build/header_guard) +#define __Process_H__ + +#include <spawn.h> +#include <native_service/frameworkunified_types.h> +#include <native_service/cl_process.h> +#include <system_service/ss_system_types.h> +#include <signal.h> +#include <vector> +#include <string> +#include <map> + +const long lProcess_VALIDATION_VALUE = 2198645; // NOLINT (runtime/int) +// Used to define a unique value that represents this class. +// This value is stored in the object when the object is created, +// and cleared when the object is destroyed. + +const int iProcess_DEFAULT_PROCESS_PRIORITY = 10; +// This is the default process priority that all new processes will use. + +const int iProcess_MAXIMUM_PROCESS_PRIORITY = 60; +// This is the maximum priority a process can have + +const long iProcess_DEFAULT_PROCESS_FLAGS = POSIX_SPAWN_SETSCHEDULER // NOLINT (runtime/int) + | POSIX_SPAWN_SETSCHEDPARAM; + +// This flag field is a bit wise OR of spawning options to use when a process +// is created. + +const int iProcess_MAXIMUM_NUMBER_OF_PROCESS_ARGUMENTS = 25; +// This is the maximum number of command line (i.e. argv[]) arguments we can +// send to a process. This includes; exectuable file name + process arguments + NULL + +const int iProcess_MAXIMUM_PROCESS_NAME_LENGTH = 32; +// This is the maximum number of characters that a process name can be in bytes. + +class Process; + +typedef std::map<SS_String, Process *> ProcessMap; + +/** + * @class TimerCtrl + * \~english @brief OS process + * \~english @par Brief Introduction + * This class is the System Manager OS process abstraction. + * + */ +class Process { + public: + enum eProcessLoadMode { + WAIT, // The invoked program is loaded into available memory, is executed, + // and then the original program resumes execution. + NOWAIT, // Causes the current program to execute concurrently with the new child process. + }; + + enum eProcessSchedulingPolicy { + FIFO, // A fixed priority scheduler in which the highest ready process runs until it + // blocks or is preempted by a higher priority process. + ROUND_ROBIN, // The same as FIFO, except processes at the same priority level time-slice. + OTHER // A general time sharing scheduler in which a process decays in priority if it + // consumes too much processor before blocking. It reverts to its default priority + // when it blocks. Should it fail to run over a 2 second period and it has decayed + // then it's boosted one priority level up to a maximum of its default priority. + }; + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup Process + /// \~english @par Summary + /// - Default Constructor, called when the class is instantiated. + /// \~english @param [in] - cpu_assign + /// - Assignment information of CPU. + /// \~english @retval None + /// \~english @par Preconditions + /// -no preconditions + /// \~english @par Change of the internal state + /// - initialize all var + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// - initialize all var in class as default value + /// \~english @see ~Process + //////////////////////////////////////////////////////////////////////////////////// + Process(int cpu_assign = 0x0); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup Process + /// \~english @par Summary + /// - Copy Constructor + /// \~english @param [in] - p_rhs_i + /// - Process - Reference to a Process that you want to copy. + /// \~english @retval None + /// \~english @par Preconditions + /// -no preconditions + /// \~english @par Change of the internal state + /// - None + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// - Used to create an object and copy another object to the new object. + /// \~english @see ~Process + //////////////////////////////////////////////////////////////////////////////////// + Process(const Process& p_rhs_i); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup ~Process + /// \~english @par Summary + /// - Destructor function + /// \~english @param None + /// \~english @retval None + /// \~english @par Preconditions + /// -no preconditions + /// \~english @par Change of the internal state + /// - set m_lValidationTag with 0 + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// - Destructor, called when the object is destroyed.\n + /// set m_lValidationTag with 0 and kill process. + /// \~english @see Process + //////////////////////////////////////////////////////////////////////////////////// + virtual ~Process(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup operator= + /// \~english @par Summary + /// - Assignment Operator + /// \~english @param [in] + /// \~english @retval Process - New Process object + /// \~english @par Preconditions + /// -no preconditions + /// \~english @par Change of the internal state + /// - None + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// - Assignment Operator, called when one object is assigned to another object. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + Process& operator=(const Process& p_rhs_i); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup GetProcessId + /// \~english @par Summary + /// - get process id + /// \~english @param None + /// \~english @retval process pid - the process pid of the process running. + /// \~english @par Preconditions + /// -no preconditions + /// \~english @par Change of the internal state + /// - None + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// - This method will return to the caller the PosixBasedOS001 Specific Process ID. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + int const GetProcessId(void) { + return static_cast<int>(m_tProcessId); + } + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup SetCallingArgumentList + /// \~english @par Summary + /// - This method will set the calling argument list that this object represents + /// \~english @param [in] p_pcArgv_i + /// - const char *[] - Pointer to array of null terminated parameter list. + /// \~english @param [in] p_iArgc_i + /// - const int - - Number of arguments in the array passed. + /// \~english @retval None + /// \~english @par Preconditions + /// -no preconditions + /// \~english @par Change of the internal state + /// - put the new arguments into m_strlstArgv + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// - Set the executable filename first. This is always the 1st argument + /// - in the argument list. Then set the argument list for the process + /// - which is held in m_strlstArgv. + /// - First make sure that the argument list is empty. + /// - Once empty, put the new arguments into the list + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + void SetCallingArgumentList(const char *p_pcArgv_i[], const int p_iArgc_i); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup SetCallingArgumentList + /// \~english @par Summary + /// - This method will set the calling argument list that this object represents. + /// \~english @param [in] p_strlstParameters_i + /// - const StringList& - String list of arguments that will be used to start. + /// \~english @retval None. + /// \~english @par Preconditions + /// - no preconditions. + /// \~english @par Change of the internal state + /// - set m_strlstArgv with p_strlstParameters_i. + /// \~english @par Causes of failures + /// - None. + /// \~english @par Classification + /// - Public. + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// - if p_strlstParameters_i is not empty,then clear m_strlstArgv \n + /// - and set m_strlstArgv with p_strlstParameters_i. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + void SetCallingArgumentList(const StringList& p_strlstParameters_i); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetExecutableFileName +/// \~english @par Summary +/// - Get executable file name +/// \~english @param None +/// \~english @retval Pointer +/// - Points to SS_String object that holds the path and executable file name for this process +/// \~english @par Preconditions +/// -no preconditions +/// \~english @par Change of the internal state +/// - None +/// \~english @par Causes of failures +/// - None +/// \~english @par Classification +/// - Public +/// \~english @par Type +/// - sync only +/// \~english @par Detail +/// - This method will return a pointer to the executable filename that this object represents +/// \~english @see None +//////////////////////////////////////////////////////////////////////////////////// + const char * const GetExecutableFileName() { + return m_strFile.c_str(); + } + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup GetProcessReturnCode + /// \~english @par Summary + /// - This function will return the processes exit/return code. + /// \~english @param None + /// \~english @retval process exit code - Code for the last process to execute + /// \~english @par Preconditions + /// -no preconditions + /// \~english @par Change of the internal state + /// - set m_iReturnCode with WEXITSTATUS(iProcessReturn) + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// - This function will return the processes exit/return code.\n + /// This is not the value of ERRNO as returned by GetLastPosixBasedOS001ErrorCode(). + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + int GetProcessReturnCode(void); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup SetSchedulingPolicy + /// \~english @par Summary + /// - This method will change the scheduling policy for the process this object represents. + /// \~english @param [in] p_eSchedulingPolicy_i + /// - const eProcessSchedulingPolicy - Scheduling Policy for this process + /// \~english @par + /// - eProcessSchedulingPolicy + /// \~english @code + /// - enum eProcessSchedulingPolicy { + /// FIFO, A fixed priority scheduler in which the highest ready process runs until it\n + /// blocks or is preempted by a higher priority process. + /// ROUND_ROBIN, The same as FIFO, except processes at the same priority level time-slice. + /// OTHER A general time sharing scheduler in which a process decays in priority if it\n + /// consumes too much processor before blocking. It reverts to its default priority\n + /// when it blocks. Should it fail to run over a 2 second period and it has decayed\n + /// then it's boosted one priority level up to a maximum of its default priority. + /// }; + /// @endcode + /// \~english @retval None + /// \~english @par Preconditions + /// -no preconditions + /// \~english @par Change of the internal state + /// -If the result of function is not 0,then set m_iErrorCode with errno + /// - else set m_iErrorCode with 0. + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// - Attempt to change the scheduling policy for the process that this object + /// represents. If the change fails, restore the previous settings. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + void SetSchedulingPolicy( + const eProcessSchedulingPolicy p_eSchedulingPolicy_i); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup GetSchedulingPolicy +/// \~english @par Summary +/// - Get currently configured scheduling policy +/// \~english @param None +/// \~english @retval FIFO - A fixed priority scheduler in which the highest ready process runs until it\n +/// blocks or is preempted by a higher priority process. +/// \~english @retval ROUND_ROBIN - The same as FIFO, except processes at the same priority level time-slice. +/// \~english @retval OTHER - A general time sharing scheduler in which a process decays in priority if it\n +/// consumes too much processor before blocking. It reverts to its default priority\n +/// when it blocks. Should it fail to run over a 2 second period and it has decayed\n +/// then it's boosted one priority level up to a maximum of its default priority. +/// \~english @par Preconditions +/// -no preconditions +/// \~english @par Change of the internal state +/// - If the result of calling function sched_getscheduler(m_tProcessId) is -1 +/// then set m_iErrorCode with errno +/// \~english @par Causes of failures +/// - None +/// \~english @par Classification +/// - Public +/// \~english @par Type +/// - sync only +/// \~english @par Detail +/// - This method will return to the caller the currently configured process scheduling policy. +/// If the result of calling function sched_getscheduler(m_tProcessId) is -1, +/// then return ROUND_ROBIN. +/// \~english @see None +//////////////////////////////////////////////////////////////////////////////////// + eProcessSchedulingPolicy const GetSchedulingPolicy(void); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup SetPriority + /// \~english @par Summary + /// - This method will change the priority for the process this object represents. + /// \~english @param [in] p_iPriority_i + /// - int - Priority of the process + /// \~english @retval None + /// \~english @par Preconditions + /// -no preconditions + /// \~english @par Change of the internal state + /// - If the result of function sched_setparam(m_tProcessId, &cur_sch_params)\n + /// is -1,then set m_iErrorCode with errno, else set m_iErrorCode with 0. + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// - Using p_iPriority_i to change the priority for the process\n + /// this object represents,if the result of function \n + /// sched_setparam(m_tProcessId, &cur_sch_params) is -1 + /// m_iErrorCode will be seted with errno,else be seted with 0 + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + void SetPriority(const int p_iPriority_i); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup SetPriority Notice:Can't find the body of this function + /// \~english @par Summary + /// - This method will change the priority for the specified process ID. + /// \~english @param [in] p_iPid_i + /// - pid_t - PID of the process to change the priority + /// \~english @param [in] p_iPriority_i + /// - int - Priority of the process + /// \~english @retval None + /// \~english @par Preconditions + /// -no preconditions + /// \~english @par Change of the internal state + /// - + /// \~english @par Causes of failures + /// - + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// -none + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + void SetPriority(const pid_t p_iPid_i, const int p_iPriority_i); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup IncreasePriorityByOne + /// \~english @par Summary + /// - This method will increase the priority for the process this\n + /// object represents by one. + /// \~english @param None + /// \~english @retval None + /// \~english @par Preconditions + /// -no preconditions + /// \~english @par Change of the internal state + /// - None + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// - Retrieve the current priority of the process. Check to see if already at max.\n + /// If so just return. Otherwise increase by one and set the priority... + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + void IncreasePriorityByOne(void); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup DecreasePriorityByOne + /// \~english @par Summary + /// - This method will decrease the priority for the process this object represents by one. + /// \~english @param None + /// \~english @retval None + /// \~english @par Preconditions + /// -no precondition + /// \~english @par Change of the internal state + /// - None + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// - Retrieve the current priority of the process. Check to see if already at minimum. + /// If so just return. Otherwise decrease by one and set the priority... + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + void DecreasePriorityByOne(void); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup GetPriority + /// \~english @par Summary + /// - This method will return to the caller the currently configured process priority. + /// \~english @param None + /// \~english @retval int priority - process priority + /// \~english @par Preconditions + /// -no preconditions + /// \~english @par Change of the internal state + /// - If the result of function sched_getparam(m_tProcessId, &cur_sch_params) is less than -1,\n + /// then m_iErrorCode will be seted with errno. + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// - If the result of function sched_getparam(m_tProcessId, &cur_sch_params)\n + /// is less than -1,will be return -1,else return Currently configured process priority. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + int const GetPriority(void); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup SetProcessName + /// \~english @par Summary + /// - This method will set this objects process name member variable to the provided string value. + /// \~english @param [in] p_strProcessName_i + /// - SS_String - Process Name to set the m_strProcessName member variable to + /// \~english @retval None + /// \~english @par Preconditions + /// -no preconditions + /// \~english @par Change of the internal state + /// - Using p_strProcessName_i to set m_strProcessName + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// - This method will set this objects process name member variable to the provided string value.\n + /// If the user of this object wishes to register the name with PosixBasedOS001 OS,\n + /// the AttachName() method should be called. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + void SetProcessName(const SS_String& p_strProcessName_i); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup GetProcessName + /// \~english @par Summary + /// - Get process name + /// \~english @param None + /// \~english @retval SS_String - Process Name + /// \~english @par Preconditions + /// -no preconditions + /// \~english @par Change of the internal state + /// - None + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// - This method will return to the caller the registered name of this process.\n + /// been registered with the OS, a NULL string will be returned. If a name has not + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + SS_String GetProcessName(void) const { + return m_strProcessName; + } + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup CreateProcess + /// \~english @par Summary + /// - This method will create a process with the executable provided and \n + /// mode as a calling parameter.The caller can also provide a list of arguments \n + /// that will be provided to the executable at startup. + /// \~english @param [in] p_strFile_i + /// - SS_String - Path and Filename of executable to create process for + /// \~english @param [in] p_strlstArgv_i + /// - StringList - List of ARGV values for new process + /// \~english @param [in] p_eMode_i + /// - eProcessLoadMode - Mode to create and load new process + /// \~english @param [in] p_strProcessName_i + /// - SS_String - This is the name that will be registered to the OS for this process + /// \~english @param [in] p_eSchedulingPolicy_i + /// - eProcessSchedulingPolicy + /// \~english @param [in] p_iPriority_i + /// - int - Priority for this process + /// \~english @param [in] unix_user_name + /// - char* - unix user name + /// \~english @param [in] p_lSpawnFlags_i + /// - long - Spawning flags. These are PosixBasedOS001 specific.... + /// \~english @par + /// eProcessLoadMode enum + /// \~english @code + /// - enum eProcessLoadMode { + /// WAIT, //The invoked program is loaded into available memory, is executed, + /// //and then the original program resumes execution. + /// NOWAIT, // Causes the current program to execute concurrently with the new child process. + /// }; + /// @endcode + /// \~english @par + /// eProcessSchedulingPolicy enum + /// \~english @code + /// - enum eProcessSchedulingPolicy { + /// FIFO, // A fixed priority scheduler in which the highest ready process runs until it + /// // blocks or is preempted by a higher priority process. + /// ROUND_ROBIN, // The same as FIFO, except processes at the same priority level time-slice. + /// OTHER // A general time sharing scheduler in which a process decays in priority if it + /// // consumes too much processor before blocking. It reverts to its default priority + /// // when it blocks. Should it fail to run over a 2 second period and it has decayed + /// // then it's boosted one priority level up to a maximum of its default priority. + /// }; + /// @endcode + /// \~english @retval None + /// \~english @par Preconditions + /// -no preconditions + /// \~english @par Change of the internal state + /// - set m_iErrorCode with 0 + /// set m_iReturnCode with 0 + /// set m_eProcessLoadMode with p_eMode_i; + /// set m_strFile with p_strFile_i; + /// set m_strProcessName with p_strProcessName_i; + /// use the result of function CL_ProcessCreate() to set m_tProcessId + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// -This method will create a PosixBasedOS001 process with the executable provided\n + /// and mode as a calling parameter.The caller can also provide a list of arguments\n + /// that will be provided to the executable at startup.The calling p_strProcessName \m + /// parameter is a textual name that will be associated with the newly created process\n + /// by the OS. The process state information will be maintained by this object.\n + /// Upon successful creation of the process, the scheduling policy and priority\n + /// of the process will be set to the provided values. The user can change these\n + /// values through the SetSchedulingPolicy() and SetPriority() method calls.\n + /// Using unix_user_name to get uid and gid,set uid and gid when calling\n + /// CL_ProcessCreateAttrSetUid() and CL_ProcessCreateAttrSetGid\n + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + void CreateProcess(const SS_String& p_strFile_i, // Path and Filename of executable to create process for + const StringList& p_strlstArgv_i, // List of ARGV values for new process + const eProcessLoadMode p_eMode_i, // Mode to create and load new process + const SS_String& p_strProcessName_i, // This is the name that will be registered to the OS for this process + const eProcessSchedulingPolicy p_eSchedulingPolicy_i, // Scheduling Policy for this process + const int p_iPriority_i, // Priority for this process + const char* unix_user_name, const long p_lSpawnFlags_i); // Spawning flags. These are PosixBasedOS001 specific.... // NOLINT (runtime/int) + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup CreateProcess + /// \~english @par Summary + /// - This method will create a PosixBasedOS001 process with the executable\n + /// provided and mode as a calling parameter. + /// \~english @param [in] p_strFile_i + /// - SS_String - Path and Filename of executable to create process for + /// \~english @param [in] p_strProcessName_i + /// - SS_String - This is the name that will be registered to the OS for this process + /// \~english @param [in] unix_user_name + /// - char* - unix user name + /// \~english @param [in] p_lSpawnFlags_i + /// - long - Posix Spawning flags. These are PosixBasedOS001 specific + /// \~english @retval None + /// \~english @par Preconditions + /// -no preconditions + /// \~english @par Change of the internal state + /// - None + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// - The caller can also provide a list of arguments that will be provided\n + /// to the executable at startup.The calling p_strProcessName parameter is a textual name\n + /// that will be associated with the newly created process by the OS.\n + /// The process state information will be maintained by this object. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + void CreateProcess(const SS_String& p_strFile_i, // Path and Filename of executable to create process for + const SS_String& p_strProcessName_i, // This is the name that will be registered to the OS for this process + const char* unix_user_name = NULL, const long p_lSpawnFlags_i = // NOLINT (runtime/int) + iProcess_DEFAULT_PROCESS_FLAGS); // Spawning flags. + // These are PosixBasedOS001 specific.... + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup CreateProcess + /// \~english @par Summary + /// - This method will create a process with the executable + /// provided and mode as a calling parameter. + /// \~english @param [in] p_strFile_i + /// - SS_String - Path and Filename of executable to create + /// process for + /// \~english @param [in] p_strProcessName_i + /// - SS_String - This is the name that will be registered to the + /// OS for this process + /// \~english @param [in] p_iPriority_i + /// - int - Priority of process + /// \~english @param [in] unix_user_name + /// - char* - unix user name + /// \~english @param [in] p_lSpawnFlags_i + /// - long - Posix Spawning flags. These are PosixBasedOS001 + /// specific + /// \~english @retval None + /// \~english @par Preconditions + /// -no preconditions + /// \~english @par Change of the internal state + /// - None + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// - The caller can also provide a list of arguments that will be + /// provided\n + /// to the executable at startup.The calling p_strProcessName + /// parameter is a textual name\n + /// that will be associated with the newly created process by + /// the OS.\n + /// The process state information will be maintained by this + /// object. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + void CreateProcess(const SS_String& p_strFile_i, // Path and Filename of executable to create process for + const SS_String& p_strProcessName_i, // This is the name that will be registered to the OS for this process + const int p_iPriority_i, // Priority of this process + const char* unix_user_name = NULL, const long p_lSpawnFlags_i = // NOLINT (runtime/int) + iProcess_DEFAULT_PROCESS_FLAGS); // Spawning flags. + // These are PosixBasedOS001 specific.... + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup CreateProcess +/// \~english @par Summary +/// - This method will create a process with the executable provided and mode as a calling parameter. +/// \~english @param [in] p_strFile_i +/// - SS_String - p_strFile_i Path and Filename of executable to create process for +/// \~english @param [in] unix_user_name +/// - char* - unix user name +/// \~english @param [in] p_lSpawnFlags_i +/// - long - Spawning flags. These are PosixBasedOS001 specific. +/// \~english @retval None +/// \~english @par Preconditions +/// - +/// \~english @par Change of the internal state +/// - None +/// \~english @par Causes of failures +/// - None +/// \~english @par Classification +/// - Public +/// \~english @par Type +/// - sync only +/// \~english @par Detail +/// - The caller can also provide a list of arguments that will be provided\n +/// to the executable at startup.The calling p_strProcessName parameter is a textual name\n +/// that will be associated with the newly created process by the OS.\n +/// The process state information will be maintained by this object. +/// \~english @see None +//////////////////////////////////////////////////////////////////////////////////// + void CreateProcess(const SS_String& p_strFile_i, // Path and Filename of executable to create process for + const char* unix_user_name = NULL, const long p_lSpawnFlags_i = // NOLINT (runtime/int) + iProcess_DEFAULT_PROCESS_FLAGS); // Spawning flags. + // These are PosixBasedOS001 specific.... + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup CreateProcess +/// \~english @par Summary +/// - This method will create a process with the executable provided and mode as a calling parameter. +/// \~english @param [in] p_strFile_i +/// - SS_String - p_strFile_i Path and Filename of executable to create process for +/// \~english @param [in] p_strProcessName_i +/// - SS_String - This is the name that will be registered to the OS for this process +/// \~english @param [in] p_strlstArgv_i +/// - StringList - List of ARGV values for new process +/// \~english @param [in] unix_user_name +/// - char* - unix user name +/// \~english @param [in] p_lSpawnFlags_i +/// - long - Spawning flags. These are PosixBasedOS001 specific. +/// \~english @retval None +/// \~english @par Preconditions +/// -no preconditions +/// \~english @par Change of the internal state +/// - None +/// \~english @par Causes of failures +/// - None +/// \~english @par Classification +/// - Public +/// \~english @par Type +/// - sync only +/// \~english @par Detail +/// - The caller can also provide a list of arguments that will be provided\n +/// to the executable at startup.The calling p_strProcessName parameter is a textual name\n +/// that will be associated with the newly created process by the OS.\n +/// The process state information will be maintained by this object. +/// \~english @see None +//////////////////////////////////////////////////////////////////////////////////// + void CreateProcess(const SS_String& p_strFile_i, // Path and Filename of executable to create process for + const SS_String& p_strProcessName_i, // This is the name that will be registered to the OS for this process + const StringList& p_strlstArgv_i, // List of ARGV values for new process + const char* unix_user_name = NULL, const long p_lSpawnFlags_i = // NOLINT (runtime/int) + iProcess_DEFAULT_PROCESS_FLAGS); // Spawning flags. + // These are PosixBasedOS001 specific.... + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup CreateProcess +/// \~english @par Summary +/// - This method will create a process with the executable provided and mode as a calling parameter. +/// \~english @param [in] p_strFile_i +/// - SS_String - Path and Filename of executable to create process for +/// \~english @param [in] p_strProcessName_i +/// - SS_String - This is the name that will be registered to the OS for this process +/// \~english @param [in] p_iPriority_i +/// - int - Priority for this process +/// \~english @param [in] p_strlstArgv_i +/// - StringList - List of ARGV values for new process +/// \~english @param [in] unix_user_name +/// - char* - unix user name +/// \~english @param [in] p_lSpawnFlags_i +/// - long - Spawning flags.These are PosixBasedOS001 specific. +/// \~english @retval None +/// \~english @par Preconditions +/// -no preconditions +/// \~english @par Change of the internal state +/// - None +/// \~english @par Causes of failures +/// - None +/// \~english @par Classification +/// - Public +/// \~english @par Type +/// - sync only +/// \~english @par Detail +/// - The caller can also provide a list of arguments that will be provided\n +/// to the executable at startup.The calling p_strProcessName parameter is a textual name\n +/// that will be associated with the newly created process by the OS.\n +/// The process state information will be maintained by this object. +/// \~english @see None +//////////////////////////////////////////////////////////////////////////////////// + void CreateProcess(const SS_String& p_strFile_i, // Path and Filename of executable to create process for + const SS_String& p_strProcessName_i, // This is the name that will be registered to the OS for this process + const int p_iPriority_i, // Priority for this process + const StringList& p_strlstArgv_i, // List of ARGV values for new process + const char* unix_user_name = NULL, const long p_lSpawnFlags_i = // NOLINT (runtime/int) + iProcess_DEFAULT_PROCESS_FLAGS); // Spawning flags. + // These are PosixBasedOS001 specific.... + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup CreateProcess + /// \~english @par Summary + /// - This method will create a process with the executable provided and mode as a calling parameter. + /// \~english @param [in] p_strFile_i + /// - SS_String - Path and Filename of executable to create process for + /// \~english @param [in] c_argv + /// - char - This is the argument that will be registered to the OS for this process + /// \~english @param [in] environment_string + /// - char - enviroment for this process + /// \~english @param [in] cl_attr + /// - CL_ProcessAttr_t - List of ARGV values for new process + /// \~english @retval None + /// \~english @par Preconditions + /// -no preconditions + /// \~english @par Change of the internal state + /// - None + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// - The caller can also provide a list of arguments that will be provided\n + /// that will be associated with the newly created process by the OS.\n + /// The process state information will be maintained by this object. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + void CreateProcess(const SS_String* p_str_file, char* const * c_argv, + char* environment_string, const CL_ProcessAttr_t *cl_attr); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup CreateProcessWait +/// \~english @par Summary +/// - This method will create a process with the executable provided. +/// \~english @param [in] p_strFile_i +/// - SS_String - Path and Filename of executable to create process for +/// \~english @retval None +/// \~english @par Preconditions +/// -no preconditions +/// \~english @par Change of the internal state +/// - None +/// \~english @par Causes of failures +/// - None +/// \~english @par Classification +/// - Public +/// \~english @par Type +/// - sync only +/// \~english @par Detail +/// - This method will create a process with the executable provided.\n +/// The process state information will be maintained by this object. +/// \~english @see None +//////////////////////////////////////////////////////////////////////////////////// + void CreateProcessWait(const SS_String& p_strFile_i); // Path and Filename of executable to create process for + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup CreateProcessWait +/// \~english @par Summary +/// - This method will create a PosixBasedOS001 process with the executable provided. +/// \~english @param [in] p_strFile_i +/// - SS_String - Path and Filename of executable to create process for +/// \~english @param [in] p_strlstArguments_i +/// - StringList - List of process calling arguments +/// \~english @retval None +/// \~english @par Preconditions +/// -no preconditions +/// \~english @par Change of the internal state +/// - None +/// \~english @par Causes of failures +/// - None +/// \~english @par Classification +/// - Public +/// \~english @par Type +/// - sync only +/// \~english @par Detail +/// - This method will create a PosixBasedOS001 process with the executable provided.\n +/// The process state information will be maintained by this object. +/// \~english @see None +//////////////////////////////////////////////////////////////////////////////////// + void CreateProcessWait(const SS_String& p_strFile_i, // Path and Filename of executable to create process for + const StringList& p_strlstArguments_i); // List of process calling arguments + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup KillProcess +/// \~english @par Summary +/// - This method will send the specified signal to the process represented by this object +/// \~english @param [in] signal +/// - int - signal +/// \~english @retval None +/// \~english @par Preconditions +/// -no preconditions +/// \~english @par Change of the internal state +/// - Intialize the objects m_iErrorCode member variable to 0 +/// \~english @par Causes of failures +/// - None +/// \~english @par Classification +/// - Public +/// \~english @par Type +/// - sync only +/// \~english @par Detail +/// - This method will send the specified signal to the process represented by this object.\n +/// All variables associated with this object will be initialized to a know value.\n +/// If this process has a name registered with the OS, that name will be removed. +/// \~english @see None +//////////////////////////////////////////////////////////////////////////////////// + void KillProcess(int signal = SIGKILL); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup DoesProcessExist +/// \~english @par Summary +/// -Check if the process existed +/// \~english @param None +/// \~english @retval TRUE - Process Exists +/// \~english @retval FALSE - Process does not exist +/// \~english @par Preconditions +/// -no preconditions +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// -None +/// \~english @par Classification +/// - Public +/// \~english @par Type +/// - sync only +/// \~english @par Detail +/// - This method will return a BOOLean indicating whether this process exists. +/// \~english @see +//////////////////////////////////////////////////////////////////////////////////// + BOOL DoesProcessExist(void); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup DisableAutoKill +/// \~english @par Summary +/// -none +/// \~english @param None +/// \~english @retval None +/// \~english @par Preconditions +/// -no preconditions +/// \~english @par Change of the internal state +/// - set m_fAutoKill as FALSE +/// \~english @par Causes of failures +/// - None +/// \~english @par Classification +/// - Public +/// \~english @par Type +/// - sync only +/// \~english @par Detail +/// - This method will disable the Auto Kill function in the destructor,\n +/// thus letting the process whom this object represents continue running. +/// \~english @see None +//////////////////////////////////////////////////////////////////////////////////// + void DisableAutoKill(void) { + m_fAutoKill = FALSE; + } + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup EnableAutoKill +/// \~english @par Summary +/// - Enable the Auto Kill +/// \~english @param None +/// \~english @retval None +/// \~english @par Preconditions +/// -no preconditions +/// \~english @par Change of the internal state +/// - set m_fAutoKill as TRUE +/// \~english @par Causes of failures +/// - None +/// \~english @par Classification +/// - Public +/// \~english @par Type +/// - sync only +/// \~english @par Detail +/// - This method will Enable the Auto Kill function in the destructor,\n +/// thus killing the process whom this object represents. +/// \~english @see None +//////////////////////////////////////////////////////////////////////////////////// + void EnableAutoKill(void) { + m_fAutoKill = TRUE; + } + + private: + // Class Data Members + //--------------------------------------------- + + long m_lValidationTag; // Used to check if this is a valid // NOLINT (runtime/int) + // object or not. + + int m_cpu_assign; + pid_t m_tProcessId; // This is the process ID for this process. All command, control, + // and status gathering will use this ID. + eProcessLoadMode m_eProcessLoadMode; // This is the process load mode provided by the caller when this + // process was created. + SS_String m_strFile; // This is the executable path and file name of this process + StringList m_strlstArgv; // This is the calling parameter Argv list provided by the caller. + SS_String m_strProcessName; // This is the name that was registered to the OS for process identification + + int m_iErrorCode; // This was the returned PosixBasedOS001 error code for the last call. The programmer + // can look at this error code if an error was detected and an + // exception was thrown. + BOOL m_fAutoKill; // Used to indicate to destructor to kill the process whom this object + // represents on exit. + int m_iReturnCode; + + ////////////////////////////////////////////////////////////////////// + /// Copy + /// + /// Copies data members from the specified object to this object. + /// No attempt is made to free dynamically allocated objects within + /// this object (you must do that before calling this function). + /// + /////////////////////////////////////////////////////////////////////// + void Copy(const Process& p_rhs_i); + + //////////////////////////////////////////////////////////////////////////////////////////////////// + /// ConvertToPosixBasedOS001SchedularPolicy + /// This method will return to the caller the equivalent PosixBasedOS001 schedular policy for the process + /// that this object represents + /// + /// + /// Calling Arguments: + /// Scheduling Policy + /// + /// \return policy + /// FIFO, A fixed priority scheduler in which the highest ready process runs until it + /// blocks or is preempted by a higher priority process. + /// ROUND_ROBIN, The same as FIFO, except processes at the same priority level time-slice. + /// OTHER A general time sharing scheduler in which a process decays in priority if it + /// consumes too much processor before blocking. It reverts to its default priority + /// when it blocks. Should it fail to run over a 2 second period and it has decayed + /// then it's boosted one priority level up to a maximum of its default priority. + ////////////////////////////////////////////////////////////////////////////////////////////////////////// + int const ConvertToPosixBasedOS001SchedularPolicy( + const eProcessSchedulingPolicy p_eSchedulingPolicy_i); + + //////////////////////////////////////////////////////////////////////////////////////////////////// + /// ConvertFromPosixBasedOS001SchedularPolicy + /// + /// This method will return to the caller the eProcessSchedulingPolicy based on the PosixBasedOS001 schedular + /// policy for the process that this object represents + /// + /// + /// Calling Arguments: + /// PosixBasedOS001 Scheduling Policy + /// + /// \return policy + /// FIFO, A fixed priority scheduler in which the highest ready process runs until it + /// blocks or is preempted by a higher priority process. + /// ROUND_ROBIN, The same as FIFO, except processes at the same priority level time-slice. + /// OTHER A general time sharing scheduler in which a process decays in priority if it + /// consumes too much processor before blocking. It reverts to its default priority + /// when it blocks. Should it fail to run over a 2 second period and it has decayed + /// then it's boosted one priority level up to a maximum of its default priority. + /////////////////////////////////////////////////////////////////////////////////////////////////////// + eProcessSchedulingPolicy const ConvertFromPosixBasedOS001SchedularPolicy( + const int p_iPosixBasedOS001chedulingPolicy_i); + + //////////////////////////////////////////////////////////////////////////////////////////////////// + /// \ingroup SS_SystemServicesIf + //////////////////////////////////////////////////////////////////////////////////////////////////// + /// \brief Check environment variable MOCK_LIBRARY where Mock Library Name to set in LD_PRELOAD is set + /// and output character string to set in LD_PRELOAD if there is setting. + /// \return + //////////////////////////////////////////////////////////////////////////////////////////////////// + void CheckLdPreLoad(SS_String *process_path, char *environment_string); + + //////////////////////////////////////////////////////////////////////////////////////////////////// + /// \ingroup SS_SystemServicesIf + //////////////////////////////////////////////////////////////////////////////////////////////////// + /// \brief Acquire the character string of the environment variable and set it in String Vector + /// and return in a pointer of Vector. + /// \return vector<SS_String> pointer + //////////////////////////////////////////////////////////////////////////////////////////////////// + std::vector<SS_String> *GetEnvironVector(void); +// ---------------------------------------- +// ---------------- End ------------------- +}; +#endif // NOLINT (build/header_guard) + +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/interface_unified/library/include/system_service/ss_system_timer.h b/service/system/interface_unified/library/include/system_service/ss_system_timer.h new file mode 100755 index 0000000..f95d1f9 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_system_timer.h @@ -0,0 +1,670 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// brief This file supports a generic timer abstraction. +/////////////////////////////////////////////////////////////////////////////// + +/** + * @file ss_system_timer.h + */ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup system_manager + * @ingroup system_service + * @{ + */ + + +#ifndef SS_SYSTEM_TIMER_H_ // NOLINT (build/header_guard) +#define SS_SYSTEM_TIMER_H_ + +#include <native_service/frameworkunified_types.h> +#include <native_service/frameworkunified_framework_if.h> +#include <list> +#include <map> + + +const PCSTR TIMER_SERVICE_NAME = "TIMER"; + + +/** + * @class Timer + * \~english @brief Timer + * \~english @par Brief Introduction + * Class to provide Timer function + * + */ +class Timer { + public: + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup Timer + /// \~english @par Summary + /// Default constructor of Timer class. + /// \~english @param None + /// \~english @retval None + /// \~english @par Preconditions + /// - None. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// sync only + /// \~english @par Detail + /// To generate a Timer class, and initialize member variables. \n + /// After the constructor, be sure to call the Initialize. \n + /// \~english @see ~Timer, Initialize + //////////////////////////////////////////////////////////////////////////////////// + Timer(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup Timer + /// \~english @par Summary + /// Constructor of Timer class. + /// \~english @param [in] hdl + /// HANDLE - HANDLE for Application + /// \~english @param [in] id + /// UI_32 - Timer ID corresponding to the callback function + /// \~english @param [in] CbFn + /// CbFuncPtr - Pointer to a callback function to be called when the timer expires + /// \~english @retval None + /// \~english @par Preconditions + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) has been + /// done. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// None + /// \~english @par Detail + /// To generate a Timer class. \n + /// To initialize timer information structure of the member variables. \n + /// To initialize the member variables of the class with an argument. Therefore, there is no need to call the + /// Initialize() function when using this constructor. + /// \~english @see ~Timer, Initialize + //////////////////////////////////////////////////////////////////////////////////// + Timer(HANDLE hdl, UI_32 id, CbFuncPtr CbFn); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup ~Timer + /// \~english @par Summary + /// Destructor of Timer class. + /// \~english @param None + /// \~english @retval None + /// \~english @par Preconditions + /// - None. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// None + /// \~english @par Detail + /// To delete a Timer class. \n + /// If the initialization is complete state, to end by calling the Shutdown(). + /// \~english @see Timer + //////////////////////////////////////////////////////////////////////////////////// + virtual ~Timer(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup Initialize + /// \~english @par Summary + /// Initialization of the Timer class. + /// \~english @param [in] hApp + /// HANDLE - HANDLE for Application + /// \~english @param [in] id + /// UI_32 - Timer ID corresponding to the callback function + /// \~english @param [in] CbFn + /// CbFuncPtr - Pointer to a callback function to be called when the timer expires + /// \~english @retval TRUE Initialization success + /// \~english @retval FALSE Initialization failed + /// \~english @par Preconditions + /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) has been + /// done. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - Handle(hApp) that has been specified by the argument is NULL. [FALSE] + /// - Timer ID(id) that has been specified by the argument is 0. [FALSE] + /// - Pointer to a callback function that has been specified by the argument is NULL. [FALSE] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Sync only(None communication) + /// \~english @par Detail + /// To initialize the member variables of the following. + /// - HANDLE for Application + /// - Timer information structure + /// - Pointer to a callback function + /// - HANDLE of message queue + /// - Timer Object + /// \~english @par + /// A timer class to initialization completion state. + /// \~english @see ~Timer, Shutdown + //////////////////////////////////////////////////////////////////////////////////// + BOOL Initialize(HANDLE hApp, UI_32 id, CbFuncPtr CbFn); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup Reinitialize + /// \~english @par Summary + /// - Reinitialize the timer by specifying a timer value information + /// \~english @param [in] id + /// UI_32 - timer id that you want to reinitialize + /// \~english @retval None + /// \~english @par Preconditions + /// - That has been initialized in the Initialize(). + /// \~english @par Change of the internal state + /// - set m_tTi.iCmd with id + /// - using the result of function McOpenSender(FrameworkunifiedGetAppName(m_hApp)) to set m_hSnd + /// - create a timer and give the handle to m_hTmr + /// - set m_bInit with TRUE + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// - Public + /// \~english @par Type + /// - Method only + /// \~english @par Detail + /// Reinitialize the timer by specifying a timer value information, \n + /// create a new timer if it is not initialize. + /// \~english @see Initialize + //////////////////////////////////////////////////////////////////////////////////// + void Reinitialize(UI_32 id); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup Shutdown + /// \~english @par Summary + /// The end of the Timer class. + /// \~english @param None + /// \~english @retval None + /// \~english @par Preconditions + /// - That has been initialized in the Initialize(). + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Sync only(None communication) + /// \~english @par Detail + /// In the case of initialization completion state, it is completed by the following process.\n + /// - Stop the Timer + /// - Delete Timer Object + /// - Set NULL to a timer object variable + /// - Close message queue + /// - Set NULL to a message queue HANDLE variable + /// - The timer class to uninitialized. + /// \~english @par + /// \nIf you want to re-use this timer, call again Initialize() function. + /// \~english @see Timer, Initialize + //////////////////////////////////////////////////////////////////////////////////// + void Shutdown(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup SetTime + /// \~english @par Summary + /// Set the timer value information. + /// \~english @param [in] ss + /// UI_32 - Timeout expiration time(sec) + /// \~english @param [in] sms + /// UI_32 - Timeout expiration time(nano sec) + /// \~english @param [in] rs + /// UI_32 - Timeout expiration time at the time of repeat(sec) + /// \~english @param [in] rms + /// UI_32 - Timeout expiration time at the time of repeat(nano sec) + /// \~english @retval TRUE Setting success + /// \~english @retval FALSE Setting failed + /// \~english @par Preconditions + /// - That has been initialized in the Initialize(). + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - Not been initialized. [FALSE] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Sync only(None communication) + /// \~english @par Detail + /// Set a timer value information specified by the argument to the timer information structure. + /// \~english @see Timer + //////////////////////////////////////////////////////////////////////////////////// + BOOL SetTime(UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup Start + /// \~english @par Summary + /// The start of the timer by specifying a timer value information. + /// \~english @param [in] ss + /// UI_32 - Timeout expiration time(sec) + /// \~english @param [in] sms + /// UI_32 - Timeout expiration time(nano sec) + /// \~english @param [in] rs + /// UI_32 - Timeout expiration time at the time of repeat(sec) + /// \~english @param [in] rms + /// UI_32 - Timeout expiration time at the time of repeat(nano sec) + /// \~english @retval TRUE Stop success + /// \~english @retval FALSE Stop failed + /// \~english @par Preconditions + /// - That has been initialized in the Initialize(). + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - Not been initialized. [FALSE] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Method only + /// \~english @par Detail + /// In the case of initialization completion state, start the timer. \n + /// After timer start, again, if you start the timer, it does not work guarantee. + /// \~english @see Stop + //////////////////////////////////////////////////////////////////////////////////// + BOOL Start(UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup Start + /// \~english @par Summary + /// Stop the timer. + /// \~english @param None + /// \~english @retval TRUE Stop success + /// \~english @retval FALSE Stop failed + /// \~english @par Preconditions + /// - That has been initialized in the Initialize(). + /// - Set the timeout value in SetTime(). + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - Not been initialized. [FALSE] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Method only + /// \~english @par Detail + /// In the case of initialization completion state, start the timer. \n + /// After timer start, again, if you start the timer, it does not work guarantee. + /// \~english @see SetTime, Stop + //////////////////////////////////////////////////////////////////////////////////// + BOOL Start(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup Stop + /// \~english @par Summary + /// Stop the timer. + /// \~english @param None + /// \~english @retval TRUE Stop success + /// \~english @retval FALSE Stop failed + /// \~english @par Preconditions + /// - That has been initialized in the Initialize(). + /// - The timer has been started + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - Not been initialized. [FALSE] + /// \~english @par Classification + /// Public + /// \~english @par Type + /// Method only + /// \~english @par Detail + /// In the case of initialization completion state, stop the timer. \n + /// After the timer has stopped, again, if you stop the timer, it does not do anything to just processing + /// Internal error occurs. + /// \~english @see Start + //////////////////////////////////////////////////////////////////////////////////// + BOOL Stop(); + + private: + BOOL m_bInit; /// flag that indicated if the class has been initialized or not + HANDLE m_hApp; /// refs to an applications hApp handle + HANDLE m_hSnd; /// refs to applications message queue + HANDLE m_hTmr; /// refs to a timer handle + NSTimerInfo m_tTi; /// timer parameters + CbFuncPtr m_CbFn; /// pointer to the callback method +}; + +/** @}*/ // end of Timer +/** @}*/ // end of system_manager +/** @}*/ // end of SystemService +/** @}*/ // end of BaseSystem + +/** + * @class TimerCtrl + * \~english @brief TimerCtrl + * \~english @par Brief Introduction + * Class to provide TimerCtrl function + * + */ +class TimerCtrl { + public: + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup TimerCtrl + /// \~english @par Summary + /// Default Constructor, called when the class is instantiated. + /// \~english @param None + /// \~english @retval None + /// \~english @par Preconditions + /// + /// \~english @par Change of the internal state + /// - set m_hApp as NULL,m_nTimersMax as DEFAULT_NTIMERS + /// \~english @par Causes of failures + /// None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// sync only + /// \~english @par Detail + /// To generate a TimerCtrl class. \n + /// After the constructor, be sure to call the Initialize. \n + /// \~english @see ~TimerCtrl, Initialize + //////////////////////////////////////////////////////////////////////////////////// + TimerCtrl(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup TimerCtrl + /// \~english @par Summary + /// Constructor, called when the class is instantiated. + /// \~english @param [in] ntimers + /// UI_32 - number of timers objects in the pool + /// \~english @retval None + /// \~english @par Preconditions + /// + /// \~english @par Change of the internal state + /// - initialize var m_hApp and m_nTimersMax + /// \~english @par Causes of failures + /// None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// sync only + /// \~english @par Detail + /// To generate a TimerCtrl class. \n + /// After the constructor, be sure to call the Initialize. \n + /// \~english @see ~TimerCtrl, Initialize + //////////////////////////////////////////////////////////////////////////////////// + TimerCtrl(UI_32 ntimers); // NOLINT (runtime/explicit) + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup Initialize + /// \~english @par Summary + /// Initialize the class after instantiation. + /// \~english @param [in] hApp + /// HANDLE - HANDLE to you applications hApp. + /// \~english @retval None + /// \~english @par Preconditions + /// + /// \~english @par Change of the internal state + /// - initialize var m_hApp and m_aTimers + /// \~english @par Causes of failures + /// None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// sync only + /// \~english @par Detail + /// The function is to initialize the member val of the class with param hApp,\n + /// if hApp is not null, then set m_hApp with hApp and initialize m_aTimers. + /// \~english @see ~TimerCtrl, Initialize + //////////////////////////////////////////////////////////////////////////////////// + VOID Initialize(HANDLE hApp); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup Shutdown + /// \~english @par Summary + /// handle something when shut down timer control. + /// \~english @param None + /// \~english @retval None + /// \~english @par Preconditions + /// - That has been initialized in the Initialize().. + /// \~english @par Change of the internal state + /// - Clear m_aTimer,shut down timer in m_rTimer and delete it.clear m_rTimer. + /// \~english @par Causes of failures + /// None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// sync only + /// \~english @par Detail + /// Completely shuts down the timer control, this method calls Stop, cleans up. You must call + /// Initialize again if you want reuse this class. + /// \~english @see ~TimerCtrl, Initialize + //////////////////////////////////////////////////////////////////////////////////// + VOID Shutdown(); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup CreateTimer + /// \~english @par Summary + /// get a timer control from pool + /// \~english @param [in] CbFn + /// CbFn - Pointer to a callback function to be called when the timer expires + /// \~english @retval Timer id - If id is in m_aTimers + /// \~english @retval 0 - If id is not in m_aTimers + /// \~english @par Preconditions + /// - That has been initialized in the Initialize(). + /// \~english @par Change of the internal state + /// - insert one Timer to m_rTimers + /// \~english @par Causes of failures + /// None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// sync only + /// \~english @par Detail + /// gets a the first id from m_aTimers if m_aTimer is not empty, using this id to create a timer,\n + /// put this timer into m_rTimers,and return the id. + /// \~english @see DeleteTimer + //////////////////////////////////////////////////////////////////////////////////// + UI_32 CreateTimer(CbFuncPtr CbFn); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup DeleteTimer + /// \~english @par Summary + /// delete a timer from m_rTimers using the param. + /// \~english @param [in] id + /// UI_32 - timer id that you want to delete + /// \~english @retval Timer id -If id is in m_aTimers + /// \~english @retval 0 - If id is not in m_aTimers + /// \~english @par Preconditions + /// - That has been initialized in the Initialize(). + /// \~english @par Change of the internal state + /// - delete one Timer to m_rTimers that id is the param.\n + /// and put id of the timer into m_aTimers. + /// \~english @par Causes of failures + /// None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// sync only + /// \~english @par Detail + /// delete your timer and returns it's id to the pool of timers. + /// \~english @see CreateTimer + //////////////////////////////////////////////////////////////////////////////////// + UI_32 DeleteTimer(UI_32 id); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup SetTimer + /// \~english @par Summary + /// Sets the timer timeout values + /// \~english @param [in] id + /// UI_32 - timer id that you want to set + /// \~english @param [in] ss + /// UI_32 - Start time in seconds + /// \~english @param [in] sms + /// UI_32 - Start time in milliseconds + /// \~english @param [in] rs + /// UI_32 - Repeat time in seconds + /// \~english @param [in] rms + /// UI_32 - Repeat time in milliseconds + /// \~english @retval Timer id - If id is in m_aTimers + /// \~english @retval 0 - If id is not in m_aTimers + /// \~english @par Preconditions + /// - That has been initialized in the Initialize(). + /// \~english @par Change of the internal state + /// - set the timer infomation in m_rTimers with ss, sms, rs, rms + /// \~english @par Causes of failures + /// None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// sync only + /// \~english @par Detail + /// using ss, sms, rs, rms to set the timer infomation, timer'is is param. + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// + UI_32 SetTimer(UI_32 id, UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup StartTimer + /// \~english @par Summary + /// Sets the timer timeout values and starts the timer. + /// \~english @param [in] id + /// UI_32 - timer id that you want to start + /// \~english @param [in] ss + /// UI_32 - Timeout expiration time(sec) + /// \~english @param [in] sms + /// UI_32 - Timeout expiration time(nano sec) + /// \~english @param [in] rs + /// UI_32 - Timeout expiration time at the time of repeat(sec) + /// \~english @param [in] rms + /// UI_32 - Timeout expiration time at the time of repeat(nano sec) + /// \~english @retval Timer id - If id is in m_aTimers + /// \~english @retval 0 - If id is not in m_aTimers + /// \~english @par Preconditions + /// - That has been initialized in the Initialize(). + /// \~english @par Change of the internal state + /// - None + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// sync only + /// \~english @par Detail + /// In the case of initialization completion state, start the timer that id is the first param. \n + /// After timer start, again, if you start the timer, it does not work guarantee. + /// \~english @see Stop + //////////////////////////////////////////////////////////////////////////////////// + UI_32 StartTimer(UI_32 id, UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup StartTimerMulti + /// \~english @par Summary + /// The start of the timer by specifying a timer value information and reinitialize timer id. + /// \~english @param [in] id + /// UI_32 - timer id that you want to start + /// \~english @param [in] ss + /// UI_32 - Timeout expiration time(sec) + /// \~english @param [in] sms + /// UI_32 - Timeout expiration time(nano sec) + /// \~english @param [in] rs + /// UI_32 - Timeout expiration time at the time of repeat(sec) + /// \~english @param [in] rms + /// UI_32 - Timeout expiration time at the time of repeat(nano sec) + /// \~english @param [in] subId + /// UI_32 - using subId to reinitialize timer id + /// \~english @retval Timer id - If id is in m_aTimers + /// \~english @retval 0 - If id is not in m_aTimers + /// \~english @par Preconditions + /// - That has been initialized in the Initialize(). + /// \~english @par Change of the internal state + /// - None + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// sync only + /// \~english @par Detail + /// Finds the timer by specifying, shut down the timer, \n + /// and reinitialize it using new id of this timer and starts the timer + /// \~english @see Stop + //////////////////////////////////////////////////////////////////////////////////// + UI_32 StartTimerMulti(UI_32 id, UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms, UI_32 subId); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup StartTimer + /// \~english @par Summary + /// Start the timer. + /// \~english @param [in] id + /// UI_32 - timer id that you want to start + /// \~english @retval Timer id - If id is in m_aTimers + /// \~english @retval 0 - If id is in not m_aTimers + /// \~english @par Preconditions + /// - That has been initialized in the Initialize(). + /// - Set the timeout value in SetTimer(). + /// \~english @par Change of the internal state + /// - None + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// sync only + /// \~english @par Detail + /// In the case of initialization completion state, \n + /// start of the timer by specifying a timer value information. + /// \~english @see SetTime, Stop + //////////////////////////////////////////////////////////////////////////////////// + UI_32 StartTimer(UI_32 id); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup StopTimer + /// \~english @par Summary + /// Stop the timer. + /// \~english @param [in] id + /// UI_32 - timer id that you want to stop + /// \~english @retval Timer id - If id is in m_aTimers + /// \~english @retval 0 - If id is not in m_aTimers + /// \~english @par Preconditions + /// - That has been initialized in the Initialize(). + /// - Set the timeout value in SetTimer(). + /// \~english @par Change of the internal state + /// - None + /// \~english @par Causes of failures + /// - None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// sync only + /// \~english @par Detail + /// In the case of start completion state, \n + /// stop of the timer by specifying a timer value information + /// \~english @see SetTimer, StartTimer + //////////////////////////////////////////////////////////////////////////////////// + UI_32 StopTimer(UI_32 id); + + private: + HANDLE m_hApp; /// + UI_32 m_nTimersMax; /// + std::list<UI_32> m_aTimers; /// + std::map<UI_32, Timer*> m_rTimers; /// +}; + + +#endif /* SS_SYSTEM_TIMER_H_ */ // NOLINT (build/header_guard) diff --git a/service/system/interface_unified/library/include/system_service/ss_system_types.h b/service/system/interface_unified/library/include/system_service/ss_system_types.h new file mode 100755 index 0000000..adcaf2b --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_system_types.h @@ -0,0 +1,36 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_SystemServicesIf +/// \brief This file supports string vector type definitions. +/// +/////////////////////////////////////////////////////////////////////////////// +/** + * @file + */ +#ifndef SS_SYSTEM_TYPES_H_ // NOLINT (build/header_guard) +#define SS_SYSTEM_TYPES_H_ + +#include <vector> +#include <string> + + +typedef std::string SS_String; +typedef std::vector< std::string > StringList; +typedef std::vector< std::string >::iterator StringListIter; + +#endif /* SS_SYSTEM_TYPES_H_ */ // NOLINT (build/header_guard) diff --git a/service/system/interface_unified/library/include/system_service/ss_templates.h b/service/system/interface_unified/library/include/system_service/ss_templates.h new file mode 100755 index 0000000..581e616 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_templates.h @@ -0,0 +1,303 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// This file supports templates for high use common tasks. +/////////////////////////////////////////////////////////////////////////////// +/** + * @file ss_templates.h + */ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup system_manager + * @ingroup system_service + * @{ + */ +#ifndef __SS_TEMPLATES_H__ // NOLINT (build/header_guard) +#define __SS_TEMPLATES_H__ + +#include <stdio.h> +#include <errno.h> +#include <native_service/frameworkunified_types.h> +#include <native_service/ns_logger_if.h> +#include <native_service/frameworkunified_framework_if.h> +#include <map> +#include "system_service/ss_system_types.h" +#include "system_service/ss_string_maps.h" + +#ifndef ZONE_ERR +#define ZONE_ERR ZONEMASK(31) +#endif + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup ReadMsg +/// \~english @par Summary +/// check the data information of msg. +/// \~english @param [in] hApp +/// HANDLE - HANDLE Application +/// \~english @param [in] Data +/// T - The reference to the Data memory location +/// \~english @param [in] f_eRetrieveMethod +/// ESMRetrieveTypes - The msg retrieval method ( release or retain ) +/// \~english @par +/// T template type +/// \~english @retval eFrameworkunifiedStatusOK Success +/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle +/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter +/// \~english @par Preconditions +/// - +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle] +/// - data'size is not corruct. [eFrameworkunifiedStatusInvldParam] +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Method only +/// \~english @par Detail +/// Check hApp ptr, msg size, msg reception, read msg if all ok +/// \~english @par +/// eFrameworkunifiedStatus:Result +/// - eFrameworkunifiedStatusOK:Success +/// - Except eFrameworkunifiedStatusOK:Fail +/// \~english @see None +//////////////////////////////////////////////////////////////////////////////////// +template <typename T> EFrameworkunifiedStatus ReadMsg( + HANDLE hApp, + T &Data, // NOLINT (runtime/references) + ESMRetrieveTypes f_eRetrieveMethod = eSMRRelease) { + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + if ( NULL == hApp ) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: NULL = hApp"); + l_eStatus = eFrameworkunifiedStatusInvldHandle; + } else if (sizeof(Data) != FrameworkunifiedGetMsgLength(hApp)) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__ + , " Error: message buffer sizes mismatch: expected %ld, received %d" + , sizeof(Data), FrameworkunifiedGetMsgLength(hApp)); + l_eStatus = eFrameworkunifiedStatusInvldParam; + } else if ( eFrameworkunifiedStatusOK != (l_eStatus = + FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID)&Data, sizeof(Data), f_eRetrieveMethod))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__ + , " Error: FrameworkunifiedGetMsgDataOfSize() errored: 0x%x", l_eStatus); + } + return l_eStatus; +} // End of template <typename T> EFrameworkunifiedStatus ReadMsg () + /* Copy & paste easy-to-use little 't' template + // ReadMsg(): * + // Check hApp ptr, msg size, msg reception, read msg if all ok. * + // Report any errors found. * + // * + if ( eFrameworkunifiedStatusOK != ( l_eStatus = ReadMsg<T> + ( hApp + , Data ))) + { + LOG_ERROR("ReadMsg()"); + } + else + */ + +//**************************************************************************** +/*! + \def LOG_ERROR(pStr) + Log pStr and l_eStatus + */ +#define LOG_ERROR(pStr) \ + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__ \ + , " Error: %s errored: %d/'%s'" \ + , pStr \ + , l_eStatus \ + , GetStr(static_cast<EFrameworkunifiedStatus>(l_eStatus)).c_str()); + +//**************************************************************************** +/*! + \def LOG_ERROR(pStr) + Log pStr and l_eStatus + */ +#define LOG_SUCCESS(pStr) \ + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s successful", pStr); + +//**************************************************************************** +/*! + \def LOG_STATUS(l_eStatus,pStr) + Log pStr and success or failure. Include l_eStatus when not successful. + */ +#define LOG_STATUS(l_eStatus, pStr) \ + if ( eFrameworkunifiedStatusOK != l_eStatus ) \ + { \ + LOG_ERROR(pStr); \ + } \ + else \ + { \ + LOG_SUCCESS(pStr); \ + } // End of #define LOG_STATUS(l_eStatus,pStr) + +//**************************************************************************** +/*! + \def CALL_AND_LOG_STATUS(fnc) + Call the function and log the returned EFrameworkunifiedStatus. + */ +#define CALL_AND_LOG_STATUS(fnc) \ + l_eStatus = (fnc); \ + LOG_STATUS(l_eStatus, #fnc) + // End of #define CALL_AND_LOG_STATUS(fnc) + +//**************************************************************************** +/*! + \def LOG_STATUS_IF_ERRORED(l_eStatus, pStr) + Log pStr on failure, including EFrameworkunifiedStatus. + */ +#define LOG_STATUS_IF_ERRORED(l_eStatus, pStr) \ + if ( eFrameworkunifiedStatusOK != l_eStatus ) \ + { \ + LOG_ERROR(pStr); \ + } // End of #define LOG_STATUS_IF_ERRORED(l_eStatus,pStr) + +//**************************************************************************** +/*! + \def CALL_AND_LOG_STATUS_IF_ERRORED(fnc) + Call the function and log the returned EFrameworkunifiedStatus on failure. + */ +#define CALL_AND_LOG_STATUS_IF_ERRORED(fnc) \ + l_eStatus = (fnc); \ + LOG_STATUS_IF_ERRORED(l_eStatus, #fnc) + // End of #define CALL_AND_LOG_STATUS_IF_ERRORED(fnc) + +//**************************************************************************** +/*! + \def MAP_ENTRY( f_map, f_enum ) + Simplify initializing string map entry. + + Use to set a map entry's key and value to the specified enum and the enum's + literal text ( i.e., stringified ) equivalent. + */ +#define MAP_ENTRY(f_map, f_enum) \ + f_map[ f_enum ] = #f_enum + +//**************************************************************************** +/*! + \def INTERFACEUNIFIEDLOG_RECEIVED_FROM + Log whom we received message or notification from. + + Use this macro to ensure that the string "Received from" is uniformly + logged; this string can be grepped on to find when/where callback functions + were invoked. + */ +#define INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp) \ + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Received from %s", FrameworkunifiedGetMsgSrc(hApp)) + +//**************************************************************************** +/*! + \def INTERFACEUNIFIEDLOG_WHEN_COMPILED + Log when this file was compiled. + + Useful when overlaying a delivered object file ( from an official build ) with + a debug-built obj file - verifies that the debug file did indeed get loaded. + */ +#define INTERFACEUNIFIEDLOG_WHEN_COMPILED \ + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s was compiled at %s @ %s", \ + __FILE__, __DATE__, __TIME__); + + +#define SS_ASERT(x) \ + if (!(x)) { \ + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SS_ASSERT"); \ + } + +#define SS_ASERT_ERRNO(x) \ + if (!(x)) { \ + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SS_ASSERT %d:%s", errno, strerror(errno)); \ + } + +#define SS_ASERT_LOG(x, fmt, ...) \ + if (!(x)) { \ + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SS_ASSERT " fmt, ## __VA_ARGS__); \ + } + +#define SS_STATIC_ASERT(expr) \ + { \ + char STATIC_ASSERTION_FAILED[(expr) ? 1 : -1]; \ + (void)STATIC_ASSERTION_FAILED; \ + } + +/** + * @class EnumStringMap + * \~english @brief EnumStringMap + * \~english @par Brief Introduction + * Class to provide EnumStringMap template function + * + */ +template <typename enumT, void(*fp)(std::map<enumT, SS_String> & m_strMap)> class EnumStringMap { // NOLINT (runtime/references) +public: + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup EnumStringMap + /// \~english @par Summary + /// Default constructor of EnumStringMap class. + /// \~english @param None + /// \~english @retval None + /// \~english @par Preconditions + /// - None. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// None + /// \~english @par Detail + /// To generate a EnumStringMap class, and initialize member variables. \n + /// After the constructor, be sure to call the Initialize. \n + /// \~english @see ~EnumStringMap, Initialize + //////////////////////////////////////////////////////////////////////////////////// + EnumStringMap() { + (*fp)(m_strMap); + } + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup ~EnumStringMap + /// \~english @par Summary + /// + /// \~english @param None + /// \~english @retval None + /// \~english @par Preconditions + /// - None. + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// None + /// \~english @par Classification + /// Public + /// \~english @par Type + /// None + /// \~english @par Detail + /// To delete a EnumStringMap object. \n + /// \~english @see EnumStringMap + //////////////////////////////////////////////////////////////////////////////////// + ~EnumStringMap() {} + SS_String GetStr( enumT f_enum) { return m_strMap[ f_enum ];} +private: + std::map<enumT, SS_String> m_strMap; +}; +// End of template <typename enumT, void(*fp)(std::map<enumT, SS_String> & m_strMap)> class EnumStringMap + +#endif /* __SS_TEMPLATES_H__ */ // NOLINT (build/header_guard) + diff --git a/service/system/interface_unified/library/include/system_service/ss_test_clients.h b/service/system/interface_unified/library/include/system_service/ss_test_clients.h new file mode 100755 index 0000000..a50e61f --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_test_clients.h @@ -0,0 +1,31 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup system_manager +/// \file ss_test_clients.h +/// \brief This file supports test client queue names. +/// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef SS_TC_SERVICES_H_ // NOLINT (build/header_guard) +#define SS_TC_SERVICES_H_ + + +#define TC_Power "PwrTestClient" +#define TC_SysManager "SMTestClient" + +#endif /* SS_TC_SERVICES_H_ */ // NOLINT (build/header_guard) diff --git a/service/system/interface_unified/library/include/system_service/ss_version.h b/service/system/interface_unified/library/include/system_service/ss_version.h new file mode 100755 index 0000000..856f334 --- /dev/null +++ b/service/system/interface_unified/library/include/system_service/ss_version.h @@ -0,0 +1,33 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup sys_resource +/// \file ss_version.h +/// \brief This file supports System Manager version number management. +/// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef SS_VERSION_H__ // NOLINT (build/header_guard) +#define SS_VERSION_H__ + +#define MAJORNO 0x01 +#define MINORNO 0x00 +#define REVISION 0x01 + +#endif // SS_VERSION_H__ // NOLINT (build/header_guard) + + diff --git a/service/system/interface_unified/library/src/libSS_SystemIfUnified.ver b/service/system/interface_unified/library/src/libSS_SystemIfUnified.ver new file mode 100755 index 0000000..7a646f2 --- /dev/null +++ b/service/system/interface_unified/library/src/libSS_SystemIfUnified.ver @@ -0,0 +1,78 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +# +# libNS_FrameworkUnified version script +# +{ + global: + ### .text section ### + extern "C++" { + AttachCallbackToSystemManager*; + DetachCallbacksFromInterfaceunifiedDispatcher*; + DetachParentCallbacksFromInterfaceunifiedDispatcher*; + GetStr*; + GetSystemManagerSessionHandle*; + SendInterfaceunifiedOnStopResponseToSystemManager*; + GetInterfaceunifiedOnStartExtInfo*; + GetInterfaceunifiedOnStopExtInfo*; + OnSystemManagerDebugDump*; + FrameworkunifiedSSFrameworkInterface*; + RegisterSMSessionAckCallback*; + RemountPartition*; + SendBootModeSetRequestToSystemManager*; + SetDataResetModeToSystemManager*; + SetProgUpdateStateToSystemManager*; + SendCANLoggingRequestToSystemManager*; + SendCpuResetRequestToSystemManager*; + SendDTCLoggingRequestToSystemManager*; + SendDebugDumpResponseToSystemManager*; + SendDiagLoggingRequestToSystemManager*; + SendEelExportRequestToSystemManager*; + SendLogArtifactRequestToSystemManager*; + SendLogCompleteRequestToSystemManager*; + SendLogStartRequestToSystemManager*; + SendInterfaceunifiedEmmcLogsRequestToSystemManager*; + SendClearLogsRequestToSystemManager*; + SendShutdownToSystemManager*; + SendStartupConfirmationToSystemManager*; + SendSystemModeRequestToSystemManager*; + SendInitCompReportToSystemManager*; + Send_CWORD56_HeartBeatRequestToSystemManager*; + SendVarCodeDataToSystemManager*; + SendWakeUpToSystemManager*; + SetBootLoaderInfoRequestToSystemManager*; + + GetBootLoaderInfoRequestToSystemManager*; + + SetWakeupOrderToSystemManager*; + SetNextWakeupTypeToSystemManager*; + Set_UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc_StateVar*; + SendUserInvokedLoggingRequestToSystemManager*; + RegisterBootMicroLogRequestCb*; + SendBootMicroResetNotificationToSystemManager*; + SendBootMicroLogResponseToSystemManager*; + SS_ConvLastInfoToOrder*; + DeviceDetectionServiceIf::*; + LoggerServiceIf::*; + Process::*; + Timer::*; + TimerCtrl::*; + }; + local: + *; +}; + diff --git a/service/system/interface_unified/library/src/makefile_PosixBasedOS001 b/service/system/interface_unified/library/src/makefile_PosixBasedOS001 new file mode 100755 index 0000000..68fa52e --- /dev/null +++ b/service/system/interface_unified/library/src/makefile_PosixBasedOS001 @@ -0,0 +1,180 @@ +# +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Standard Module Makefile version 2.0 +# + +# Name of the componet (team/domain prefix '_' component name) +COMPONENT_NAME = SS_PowerServiceIf + +ifndef PRJ_ROOT +export PRJ_ROOT = $(CURDIR)/../ +endif +include $(PRJ_ROOT)cfg/depends.mk + +# Additive Compile Flags (Flags from initiating make process will still apply) +DEFS += + +# Set local includes and then the reference includes (priority order determines search path) +# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories, +# dependencies includes (other teams) +# Local (current component references should be in the form of +# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory +# Example your public include directory would be +# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc +# Team references should only be to other's public includes such as +# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc +# Global (non-team) references should be only to other's public includes such +# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable +INCLUDES = \ + $(CFG_INCS) \ + $(CC_IFLAG)./ \ + $(DEPENDS_INCLUDES) \ + $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc + + +# Define binary outputs. These can be libraries or executables. +# Name a variable for each deliverable. Suffixes should be +# EXEC - For Executables -> output to the bin directory +#TIME_EXEC = $(BIN_PATH)time +# LIB - For Static Libraries -> output to lib directory with specific naming +#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT) +# SLIB - For Shared Objects +#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT) +# LIB - Define the static library for Message Queue +# +# +##COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT) +ifdef DYNAMIC_OFF + COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT) +else + COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT) +endif + +## Sources Section +# Define Library & Executable Sources (on a per deliverable basis) +# This includes sources located in subdirectories. +# Define generic line that pulls all c, cc, cpp files +# since your in the src folder is pull only files from there +COMPONENT_SRCS = \ + $(wildcard *.c) \ + $(wildcard *.cpp) + +# Define sources that my not be local to your component +# here, you can define indivial files or wildcard from +# a different folder. +NON_LOCAL_SRCS = \ + + +# List of all sources to be built. Can be assembled from the other defintitions. +# This only defines sources for the current directory, so if there are subdirectories +# those are not included. (Those are found in simple subdirectory makefiles that only +# direct the building of sources, but no linking into a binary) +SOURCES = \ + $(COMPONENT_SRCS) \ + $(NON_LOCAL_SRCS) \ + + + +# +# Convert the source files to object files with correct folder location. +# +# +C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) ) +CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) ) + + +# List of all sources to be generated. Can be assembled from the other defintitions. +OBJECTS = \ + $(C_LANG_OBJECTS) \ + $(CPP_LANG_OBJECTS) + + + +# All headers that are dependencies. Wildcard is easy to pickup local headers. +# This is only to automate the rebuilding, all builds on the servers are cleans +# So this is not a huge deal when building on a component level. +HEADERS = \ + $(wildcard *.h) \ + $(wildcard $(PRJ_ROOT)../$(COMPONENT_NAME)/inc/*.h) \ + + +LIBRARIES = \ + $(COMPONENT_LIB) \ + + +# Make targets +# Standard +all: banner module_dirs subdirs local library binary + +debug: + $(MAKE) TARGET=arm DEBUG=TRUE all + +base: banner module_dirs subdirs local + +# Standard Building of Source Files (Default builds for all objects defined above) +$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS) + $(CC_CMD) + +$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS) + $(CPP_CMD) + +local: $(OBJECTS) + +# Defines specific for each deliverable + +# For a static library +$(COMPONENT_LIB): $(OBJECTS) +ifdef DYNAMIC_OFF +# For a dynamic library + $(SLIB_CMD) +else +# For a static library + $(AR_CMD) +endif + +# Standard set of derived targets +library: base \ + $(LIBRARIES) + @echo "***** `date` Done building library: $(COMPONENT_NAME) ******" + +binary: base \ + $(BINARIES) + +# Subdirs should be to jump to subdirectories +# standard form is of +# $(MAKE) -C subdirectory_name $(MAKECMDGOALS) +subdirs: + +clean: + -rm -f $(BINARIES) + -rm -f $(LIBRARIES) + -rm -f $(OBJECTS) + -rm -f $(COMPONENT_LIB).map + -rm -f $(COMPONENT_LIB).debug + +-v: + @echo "objs: --> $(OBJECTS)" + @echo "sources: --> $(SOURCES)" + @echo "headers: --> $(HEADERS)" + @echo "includes: --> $(INCLUDES)" + @echo "lib: --> $(LIBRARIES)" + @echo "bin: --> $(BINARIES)" + + +module_dirs: build_dirs + diff --git a/service/system/interface_unified/library/src/ss_devicedetection_service_ifc.cpp b/service/system/interface_unified/library/src/ss_devicedetection_service_ifc.cpp new file mode 100755 index 0000000..1f68df6 --- /dev/null +++ b/service/system/interface_unified/library/src/ss_devicedetection_service_ifc.cpp @@ -0,0 +1,673 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_SystemServices_DeviceDetection +/// \brief This file contains service interface functions. +/// +/////////////////////////////////////////////////////////////////////////////// +#include "system_service/ss_devicedetection_service_ifc.h" +#include <native_service/frameworkunified_application.h> +#include <native_service/frameworkunified_framework_if.h> +#include <native_service/frameworkunified_types.h> +#include <native_service/frameworkunified_framework_types.h> +#include <string.h> + +#ifdef AGL_STUB +#else +#include "dcmd_sim_mmcsd.h" +#endif +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <stdio.h> +#ifdef AGL_STUB +#else +#include <sys/dcmd_cam.h> +#endif +#include <errno.h> +#include <sys/ioctl.h> +#include <linux/cdrom.h> +#include <asm-generic/param.h> + +#include "system_service/ss_services.h" +#include "system_service/ss_devicedetection_service_protocol.h" +#include "system_service/ss_devicedetection_service_protocol_local.h" +#include "system_service/ss_devicedetection_service_notifications.h" +#include "system_service/ss_devicedetection_service_local.h" +#include "system_service/ss_devicedetection_service_types_local.h" +#include "ss_devicedetection_service_if_interfaceunifiedlog.h" + +DeviceDetectionServiceIf::DeviceDetectionServiceIf() + : m_hApp(NULL), + m_hService(NULL), + m_hSession(NULL) { +} + +DeviceDetectionServiceIf::~DeviceDetectionServiceIf() { + CloseSessionRequest(); // if the session is still connected + if ((NULL != m_hApp) && (NULL != m_hService)) { + FrameworkunifiedCloseService(m_hApp, m_hService); + } + m_hService = NULL; + m_hSession = NULL; + m_hApp = NULL; +} // LCOV_EXCL_BR_LINE 10:Because destructor + +EFrameworkunifiedStatus DeviceDetectionServiceIf::NotifyOnDeviceDetectionAvailability( + CbFuncPtr f_pCallBackFn) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle; + if (NULL != m_hApp && NULL != f_pCallBackFn) { + // Subscriptions + FrameworkunifiedNotificationCallbackHandler + g_aryDeviceDetect_Notif_Cbs[] = { + // Notifications name, Call back function + { NTFY_SS_Device_Detection_Service_Availability, f_pCallBackFn}, + }; + + if (0 != strcmp(SS_DEV_DETECT_SRV, FrameworkunifiedGetAppName(m_hApp))) { + // Subscribe and attach call backs to notifications + if (eFrameworkunifiedStatusOK + != (eStatus = FrameworkunifiedSubscribeNotificationsWithCallback( + m_hApp, g_aryDeviceDetect_Notif_Cbs, + _countof(g_aryDeviceDetect_Notif_Cbs)))) { + FRAMEWORKUNIFIEDLOG( + ZONE_ERR, + __FUNCTION__, + "Error: FrameworkunifiedAttachNotificationCallbacksToDispatcher Failed Status:0x%x ", + eStatus); + } + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eStatus; +} + +EFrameworkunifiedStatus DeviceDetectionServiceIf::DetachDeviceDetectionAvailabilityCb() { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle; + if (NULL != m_hApp) { + if (0 != strcmp(SS_DEV_DETECT_SRV, FrameworkunifiedGetAppName(m_hApp))) { + // Unsubscribe and detach call backs to notifications + if (eFrameworkunifiedStatusOK != (eStatus = + FrameworkunifiedUnsubscribeNotificationWithCallback(m_hApp, NTFY_SS_Device_Detection_Service_Availability))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Error: InterfaceunifiedDetachNotificationCallback Failed Status:0x%x ", + eStatus); + } + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eStatus; +} + +EFrameworkunifiedStatus DeviceDetectionServiceIf::NotifyOnOpenSessionAck( + CbFuncPtr f_pCallBackFn) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle; + if (NULL != m_hApp && NULL != f_pCallBackFn) { + if (eFrameworkunifiedStatusOK + != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp, + SS_DEV_DETECT_SRV, + PROTOCOL_OPEN_SESSION_ACK, + f_pCallBackFn))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Error: FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ", + eStatus); + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eStatus; +} + +EFrameworkunifiedStatus DeviceDetectionServiceIf::DetachOpenSessionAckCb() { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle; + if (NULL != m_hApp) { + if (eFrameworkunifiedStatusOK + != (eStatus = FrameworkunifiedDetachCallbackFromDispatcher(m_hApp, + SS_DEV_DETECT_SRV, + PROTOCOL_OPEN_SESSION_ACK))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Error: FrameworkunifiedDetachCallbackFromDispatcher Failed Status:0x%x ", + eStatus); + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eStatus; +} + +EFrameworkunifiedStatus DeviceDetectionServiceIf::NotifyOnCloseSessionAck( + CbFuncPtr f_pCallBackFn) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle; + + if (NULL != m_hApp && NULL != f_pCallBackFn) { + if (eFrameworkunifiedStatusOK + != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp, + SS_DEV_DETECT_SRV, + PROTOCOL_CLOSE_SESSION_ACK, + f_pCallBackFn))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Error: FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ", + eStatus); + } + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eStatus; +} + +EFrameworkunifiedStatus DeviceDetectionServiceIf::DetachCloseSessionAckCb() { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle; + + if (NULL != m_hApp) { + if (eFrameworkunifiedStatusOK + != (eStatus = FrameworkunifiedDetachCallbackFromDispatcher( + m_hApp, + SS_DEV_DETECT_SRV, + PROTOCOL_CLOSE_SESSION_ACK))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Error: FrameworkunifiedDetachCallbackFromDispatcher Failed Status:0x%x ", + eStatus); + } + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eStatus; +} + +EFrameworkunifiedStatus DeviceDetectionServiceIf::RegisterForDeviceDetectionEvent( + SS_DeviceDetectionServerEvents f_eDevDetectEvent, CbFuncPtr f_pCallBackFn, + PCSTR pFilepath) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle; + char l_filepathname[FILEPATH_SIZE] = { '\0' }; + int len = 0; + + if (NULL != pFilepath) { + len = strlen(pFilepath); + strcpy(l_filepathname, pFilepath); // NOLINT (runtime/printf) + } + + if (NULL != m_hSession && NULL != f_pCallBackFn) { + if (CheckDetectEvent(f_eDevDetectEvent)) { + if (eFrameworkunifiedStatusOK + != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp, + SS_DEV_DETECT_SRV, + f_eDevDetectEvent, + f_pCallBackFn, m_hSession))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Error: FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ", + eStatus); + } + + eStatus = FrameworkunifiedSendMsg(m_hSession, SS_REGISTER_DETECT_EVENT, + sizeof(SS_DeviceDetectionServerEvents), + &f_eDevDetectEvent); + } else { + if (eFrameworkunifiedStatusOK + != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp, + SS_DEV_DETECT_SRV, + f_eDevDetectEvent, + f_pCallBackFn, m_hSession))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Error: FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ", + eStatus); + } + + // client registers for the event + if (eFrameworkunifiedStatusOK + != (eStatus = FrameworkunifiedRegisterEvent(m_hSession, f_eDevDetectEvent))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Error: FrameworkunifiedRegisterEvents Failed Status:0x%x", eStatus); + } + + if (NULL != pFilepath) { + eStatus = FrameworkunifiedSendMsg(m_hSession, SS_REGISTER_FILEPATHNAME, len, + l_filepathname); + } + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eStatus; +} + +EFrameworkunifiedStatus DeviceDetectionServiceIf::UnRegisterForDeviceDetectionEvent( + SS_DeviceDetectionServerEvents f_eDevDetectEvent) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle; + + if (NULL != m_hSession) { + if (eFrameworkunifiedStatusOK + != (eStatus = FrameworkunifiedDetachCallbackFromDispatcher(m_hApp, + SS_DEV_DETECT_SRV, + f_eDevDetectEvent, + m_hSession))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Error: InterfaceunifiedDetachCallbackToDispatcher Failed Status:0x%x ", eStatus); + } + + // client registers for the event + if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedUnRegisterEvent(m_hSession, f_eDevDetectEvent))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Error: FrameworkunifiedUnRegisterEvents Failed Status:0x%x", eStatus); + } + + if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedSendMsg(m_hSession, SS_UNREGISTER_DETECT_EVENT, + sizeof(SS_DeviceDetectionServerEvents), + &f_eDevDetectEvent))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "UnRegister Detect Event[0x%x] Send Error[0x%x]", f_eDevDetectEvent, eStatus); + } + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eStatus; +} + +BOOL DeviceDetectionServiceIf::Initialize(HANDLE hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + BOOL l_eStatus = TRUE; + + if (NULL != hApp) { + m_hApp = hApp; + } else { + l_eStatus = FALSE; // eFrameworkunifiedStatusInvldHandle; + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +EFrameworkunifiedStatus DeviceDetectionServiceIf::OpenSessionRequest() { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + if (NULL != m_hApp) { + // if the session is there then we need to close it first! + if (NULL != m_hService) { + CloseSessionRequest(); + FrameworkunifiedCloseService(m_hApp, m_hService); + m_hService = NULL; + } + BOOL l_bServiceAvailable = FrameworkunifiedIsServiceAvailable(m_hApp); + if (FALSE == l_bServiceAvailable) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, + "DeviceError: Service is unavailable"); + l_eStatus = eFrameworkunifiedStatusFail; + } else { + // Now open the service. + if (l_bServiceAvailable + && (NULL != (m_hService = OpenService()))) { // LCOV_EXCL_BR_LINE 8:Because l_bServiceAvailable is always TRUE + // [DM: TODO] Check if we need to open a session with some data sent to Server. + UI_32 l_pTestData = 1; + if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedOpenSessionWithData(m_hService, + (PVOID) &l_pTestData, + sizeof(UI_32)))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error: FrameworkunifiedOpenSessionWithData Failed"); + } + } else { + l_eStatus = eFrameworkunifiedStatusFail; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error: FrameworkunifiedOpenService Failed"); + } + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: OpenSessionRequest Failed %X", + l_eStatus); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +HANDLE DeviceDetectionServiceIf::OpenService() { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + HANDLE l_hService = NULL; + + if (NULL == (l_hService = FrameworkunifiedOpenService(m_hApp, SS_DEV_DETECT_SRV))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error: FrameworkunifiedOpenService : Failed to open Device Detection Service"); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_hService; +} + +EFrameworkunifiedStatus DeviceDetectionServiceIf::DecodeOpenSessionResponse() { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + + if (NULL != m_hService && NULL != m_hApp) { // LCOV_EXCL_BR_LINE 8:Because when m_hApp is NULL, m_hService is NULL + if (NULL == (m_hSession = FrameworkunifiedGetOpenSessionHandle(m_hApp))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error: Error in extracting OpenSessionAck response."); + l_eStatus = eFrameworkunifiedStatusFail; + } else { + l_eStatus = eFrameworkunifiedStatusOK; + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Logger Session Name: %s, Session Id: %d", + FrameworkunifiedGetSessionName(m_hSession), FrameworkunifiedGetSessionId(m_hSession)); + } + } else { + FRAMEWORKUNIFIEDLOG( + ZONE_ERR, + __FUNCTION__, + "Error. m_hService: %p, m_hApp: %p is NULL. Open session handle not acquired," + " l_eStatus: eFrameworkunifiedStatusInvldHandle.", m_hService, m_hApp); + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +EFrameworkunifiedStatus DeviceDetectionServiceIf::CloseSessionRequest() { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + + if (NULL != m_hService && NULL != m_hSession) { + if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedCloseSession(m_hService, m_hSession))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedCloseSession Failed"); + } + m_hSession = NULL; // clear our session handle + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +BOOL DeviceDetectionServiceIf::CheckDetectEvent( + SS_DeviceDetectionServerEvents f_eDevDetectEvent) { + BOOL chkevt = FALSE; + + switch (f_eDevDetectEvent) { + case SS_DEV_INFO_ANY_USB_EV: + case SS_DEV_DETECT_ANY_USB_EV: + case SS_DEV_DETECT_ANY_SD_EV: + case SS_DEV_DETECT_ANY_DISC_EV: + case SS_DEV_DETECT_ANY_USB_NCM_EV: + + case SS_DEV_DETECT_ANY_USB_DCM_NCM_EV: + case SS_DEV_DETECT_ANY_USB__CWORD57__EV: + case SS_DEV_DETECT_ANY_USB_ACM_EV: + case SS_DEV_DETECT_ANY_USB_DEV_MNG_EV: + case SS_DEV_DETECT_ANY_USB_VEHICLE_CTRL_EV: + case SS_DEV_DETECT_ANY_USB_DSRC_APP_EV: + case SS_DEV_DETECT_ANY_USB_DSRC_CTRL_EV: + case SS_DEV_DETECT_ANY_USB_IR_VICS_DATA_EV: + case SS_DEV_ERR_USB_OVER_CURRENT_EV: + case SS_DEV_DETECT_ANY_USB_MTP_EV: + case SS_DEV_INFO_ANY_USB_NOTIFY_EV: + case SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV: + case SS_DEV_INFO_SD_FORMAT_COMP_EV: + case SS_DEV_INFO_ANY_USB_DVDP_EV: + chkevt = TRUE; + break; + default: + break; + } + return chkevt; +} + +static void ReadString(const char *file, char *buf, int len) { + int fd; + ssize_t r; + char *tmp; + + if (file == NULL) { // LCOV_EXCL_BR_LINE 8:Because file is not NULL + // LCOV_EXCL_START 8:Because file is not NULL + buf[0] = '\0'; + return; + // LCOV_EXCL_STOP + } + + fd = open(file, O_RDONLY); + if (fd < 0) { // LCOV_EXCL_BR_LINE 6:Because the sequence at the time of open failure cannot be passed + // LCOV_EXCL_START 6:Because the sequence at the time of open failure cannot be passed + buf[0] = '\0'; + return; + // LCOV_EXCL_STOP + } + + r = read(fd, buf, len); + close(fd); + if (r > 0 && r < len) { + buf[r] = '\0'; + r--; + /* If there is a line feed code'\n' at the end of the acquired data, replace it with '\0' */ + while (buf[r] == '\n') { + buf[r] = '\0'; + if (r == 0) + break; + r--; + } + /* If there is a line feed code'\n' in the middle of the acquired data, replace with '\0' */ + tmp = buf; + while ((tmp = strchr(tmp, '\n')) != NULL) { + *tmp = ' '; + tmp++; + } + return; + } else { + buf[0] = '\0'; + } +} + +static bool isMounttedDir(char* pMountDir) { + char buf[4096]; + + if (!pMountDir) { // LCOV_EXCL_BR_LINE 8:Because pMountDir is not NULL + // LCOV_EXCL_START 8:Because pMountDir is not NULL + return false; + // LCOV_EXCL_STOP + } + + ReadString("/proc/mounts", buf, sizeof(buf)); + if (strstr(buf, pMountDir)) { // The mount folder is already in use as a mount point + return true; + } + + return false; +} + +EFrameworkunifiedStatus DeviceDetectionServiceIf::MountSD(uint8_t part_num, + BOOL *already_mounted) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle; + + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "part_num %d", part_num); + + if (NULL == m_hSession) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "m_hSession is NULL"); + return eFrameworkunifiedStatusInvldHandle; + } + + if (part_num > 3) { + return eFrameworkunifiedStatusInvldParam; + } + + char mount_dir[256]; + if (part_num != 0) { + sprintf(mount_dir, "/mnt/mmcblk1p%d", part_num); // NOLINT (runtime/printf) + } else { + sprintf(mount_dir, "/mnt/mmcblk1"); // NOLINT (runtime/printf) + } + if (isMounttedDir(mount_dir)) { + *already_mounted = TRUE; + return eFrameworkunifiedStatusOK; + } else { + *already_mounted = FALSE; + } + + char filename[256]; + struct stat st; + if (part_num != 0) { + sprintf(filename, "/dev/mmcblk1p%d", part_num); // NOLINT (runtime/printf) + } else { + sprintf(filename, "/dev/mmcblk1"); // NOLINT (runtime/printf) + } + if (stat(filename, &st) != 0) { + return eFrameworkunifiedStatusAccessError; + } + + if (eFrameworkunifiedStatusOK + == (eStatus = FrameworkunifiedSendMsg(m_hSession, SS_DEV_MOUNT_SD, sizeof(uint8_t), + &part_num))) { + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Send MountSD msg Sucessfully"); + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + + return eStatus; +} + +EFrameworkunifiedStatus DeviceDetectionServiceIf::UmountSD(uint8_t part_num, + BOOL *already_umounted) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle; + + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "part_num %d", part_num); + + if (NULL == m_hSession) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "m_hSession is NULL"); + return eFrameworkunifiedStatusInvldHandle; + } + + if (part_num > 3) { + return eFrameworkunifiedStatusInvldParam; + } + + char mount_dir[256]; + if (part_num != 0) { + sprintf(mount_dir, "/mnt/mmcblk1p%d", part_num); // NOLINT (runtime/printf) + } else { + sprintf(mount_dir, "/mnt/mmcblk1"); // NOLINT (runtime/printf) + } + + if (isMounttedDir(mount_dir)) { + *already_umounted = FALSE; + } else { + *already_umounted = TRUE; + return eFrameworkunifiedStatusOK; + } + + char filename[256]; + struct stat st; + + if (part_num != 0) { + sprintf(filename, "/dev/mmcblk1p%d", part_num); // NOLINT (runtime/printf) + } else { + sprintf(filename, "/dev/mmcblk1"); // NOLINT (runtime/printf) + } + if (stat(filename, &st) != 0) { + return eFrameworkunifiedStatusAccessError; + } + + if (eFrameworkunifiedStatusOK + == (eStatus = FrameworkunifiedSendMsg(m_hSession, SS_DEV_UMOUNT_SD, sizeof(uint8_t), + &part_num))) { + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Send UmountSD msg Sucessfully"); + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + + return eStatus; +} + +static const uint8_t VBUS_RESET_INTERVAL_MIN = 11; + +static EFrameworkunifiedStatus SendUsbVBusResetMsg(HANDLE handle, int8_t port, uint8_t interval) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK; + + if (NULL == handle) { + FRAMEWORKUNIFIEDLOG(ZONE_WARN, __func__, "Invalid Handle."); + return eFrameworkunifiedStatusInvldHandle; + } + + int16_t data[] = {port, interval}; + eStatus = FrameworkunifiedSendMsg(handle, SS_USB_VBUS_RESET, sizeof(data), data); + + if (eFrameworkunifiedStatusOK != eStatus) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSendMsg Send Error[0x%x]", eStatus); + return eStatus; + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "-"); + return eStatus; +} + +EFrameworkunifiedStatus DeviceDetectionServiceIf::UsbVBusReset(int8_t port, uint8_t interval) { + return SendUsbVBusResetMsg(m_hSession, port, interval); +} + +EFrameworkunifiedStatus DeviceDetectionServiceIf::UsbVBusReset(int8_t port) { + return SendUsbVBusResetMsg(m_hSession, port, VBUS_RESET_INTERVAL_MIN); +} + +EFrameworkunifiedStatus DeviceDetectionServiceIf::RoleSwStateNotify( + SS_DEV_ROLE_SW_STATE state) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail; + EFrameworkunifiedStatus result = eFrameworkunifiedStatusFail; + UI_32 rcvlength = 0; + UI_32 bufflength; + + if (NULL == m_hSession) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "No Session"); + return eFrameworkunifiedStatusInvldHandle; + } + + bufflength = sizeof(EFrameworkunifiedStatus); + eStatus = FrameworkunifiedInvokeSync(m_hSession, SS_DEV_ROLE_SW_STATE_NOTIFY, + sizeof(SS_DEV_ROLE_SW_STATE), &state, bufflength, + &result, &rcvlength); + + if (eFrameworkunifiedStatusOK != eStatus) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Send Error[0x%x]", eStatus); + return eStatus; + } + + if (bufflength != rcvlength) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "FrameworkunifiedInvokeSync Response Error. bufflen[%d], rcvlen[%d]", bufflength, + rcvlength); + return eStatus; + } + + eStatus = result; + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eStatus; +} + +EFrameworkunifiedStatus DeviceDetectionServiceIf::FormatSD(void) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK; + + if (NULL == m_hSession) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid Handle."); + return eFrameworkunifiedStatusInvldHandle; + } + + if (access("/dev/mmcblk1", F_OK) != 0) { + return eFrameworkunifiedStatusAccessError; + } + + eStatus = FrameworkunifiedSendMsg(m_hSession, SS_DEV_FORMAT_SD, 0, NULL); + + if (eFrameworkunifiedStatusOK != eStatus) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Send Error[0x%x]", eStatus); + return eStatus; + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eStatus; +} // LCOV_EXCL_BR_LINE 10:Because the last line + diff --git a/service/system/interface_unified/library/src/ss_framework_if.cpp b/service/system/interface_unified/library/src/ss_framework_if.cpp new file mode 100755 index 0000000..91d323a --- /dev/null +++ b/service/system/interface_unified/library/src/ss_framework_if.cpp @@ -0,0 +1,55 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_SystemManagerIf +/// \brief This file provides support for the System Manager AGL framework +/// interface. +/// +/////////////////////////////////////////////////////////////////////////////// + +#include <native_service/frameworkunified_types.h> +#include <native_service/frameworkunified_framework_if.h> +#include <string.h> +#include "system_service/ss_system_if.h" +#include "system_service/interfaceunified_system_application.h" +#include "system_service/ss_services.h" +#include "system_service/ss_test_clients.h" +#include "system_service/ss_templates.h" +#include "ss_system_if_interfaceunifiedlog.h" + +HANDLE g_SystemIf_hApp = NULL; + +EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp) { + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + g_SystemIf_hApp = hApp; + PCSTR pAppNameStr = FrameworkunifiedGetAppName(hApp); + + if (0 != strcmp(SERVICE_SYSMANAGER, pAppNameStr) && + 0 != strcmp(TC_Power, pAppNameStr)) { + l_eStatus = InterfaceunifiedSystemConnectToSystemManagerService(hApp); + LOG_STATUS(l_eStatus, "InterfaceunifiedSystemConnectToSystemManagerService()"); + + if (0 != strcmp(TC_SysManager, pAppNameStr)) { + l_eStatus = InterfaceunifiedSystemConnectToHeartBeatService(hApp); + LOG_STATUS(l_eStatus, "InterfaceunifiedSystemConnectToHeartBeatService()"); + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // LCOV_EXCL_BR_LINE 10:Because the last line diff --git a/service/system/interface_unified/library/src/ss_heartbeat_client.cpp b/service/system/interface_unified/library/src/ss_heartbeat_client.cpp new file mode 100755 index 0000000..a080e9a --- /dev/null +++ b/service/system/interface_unified/library/src/ss_heartbeat_client.cpp @@ -0,0 +1,156 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_SystemManagerIf +/// \brief This file provides support for the System Manager client +/// heartbeat service interface. +/// +/////////////////////////////////////////////////////////////////////////////// +#include <string.h> +#include <native_service/frameworkunified_application.h> +#include <native_service/frameworkunified_framework_if.h> +#include <native_service/frameworkunified_types.h> +#include <native_service/frameworkunified_framework_types.h> +#include <new> +#include "system_service/ss_heartbeat_service_protocol.h" +#include "system_service/ss_heartbeat_notifications.h" +#include "system_service/ss_heartbeat_if.h" +#include "system_service/ss_services.h" +#include "system_service/ss_sm_thread_names.h" +#include "system_service/ss_templates.h" +#include "ss_system_if_interfaceunifiedlog.h" + +CHeartBeatServiceIf * pHeartBeatServiceIf = NULL; + +template <typename C, eFrameworkunifiedStatus(C::*M)(HANDLE)> + +// LCOV_EXCL_START 6:Because process initialization +EFrameworkunifiedStatus HeartBeatIfCallback(HANDLE hApp) { + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusNullPointer; + C * pObj = static_cast<C *>(pHeartBeatServiceIf); + if (pObj) { + l_eStatus = (pObj->*M)(hApp); + } + return l_eStatus; +} +// LCOV_EXCL_STOP + +/***************************************************************************** + @ingroup: SS_SystemManager + @brief: InterfaceunifiedSystemConnectToHeartBeatService + @note: . Called from framework for every app to start connection to HeartBeat + @param HANDLE - Handle to message queue of HeartBeat Service. + @return EFrameworkunifiedStatus OK or Fail +*****************************************************************************/ +EFrameworkunifiedStatus InterfaceunifiedSystemConnectToHeartBeatService(HANDLE hApp) { + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + /// Avoid opening a session to the HeartBeat + /// service Since it uses the framework as well + /// Avoid opening a session to System Manager For testing + // TODO(my_username): Remove system manager check + if ((0 != strcmp(SERVICE_SYSMANAGER, FrameworkunifiedGetAppName(hApp)))) { + FrameworkunifiedProtocolCallbackHandler g_aryHeartBeat_Protocol_Cbs[] = { + // Command ID, Call back functions + { SS_HEARTBEAT_REQUEST, HeartBeatIfCallback<CHeartBeatServiceIf, &CHeartBeatServiceIf::OnHeartBeatRequest>} + }; // LCOV_EXCL_BR_LINE 11:Unexpected branch + + /// Attach the valid callback for this service + if ( eFrameworkunifiedStatusOK != // LCOV_EXCL_BR_LINE 6:Because process initialization + (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher( + hApp, + SS_SMHeartbeat, + g_aryHeartBeat_Protocol_Cbs, + _countof(g_aryHeartBeat_Protocol_Cbs)))) { + LOG_ERROR("FrameworkunifiedAttachCallbacksToDispatcher()"); + } else { + // LCOV_EXCL_BR_LINE 5:Because constructor + pHeartBeatServiceIf = + new(std::nothrow) CHeartBeatServiceIf(FALSE, NULL, FrameworkunifiedGetAppName(hApp)); + } // LCOV_EXCL_BR_LINE 11:Unexpected branch + + } else { + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Heartbeat service name duplicated."); + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + + return l_eStatus; // LCOV_EXCL_BR_LINE 11:Unexpected branch +} + +/***************************************************************************** + @ingroup: SS_SystemManager + @brief: CHeartBeatServiceIf constructor + @param - +*****************************************************************************/ +CHeartBeatServiceIf::CHeartBeatServiceIf(BOOL avail, HANDLE service, PCSTR name) { + g_tHeartBeatSession.szServiceName = name; // LCOV_EXCL_BR_LINE 11:Unexpected branch + g_tHeartBeatSession.fAvailable = avail; + g_tHeartBeatSession.hService = service; +} + +// LCOV_EXCL_START 10:Because destructor +/***************************************************************************** + @ingroup: SS_SystemManager + @brief: CHeartBeatServiceIf destructor +*****************************************************************************/ +CHeartBeatServiceIf::~CHeartBeatServiceIf() { + if (pHeartBeatServiceIf != NULL) { + delete pHeartBeatServiceIf; + pHeartBeatServiceIf = NULL; + } +} +// LCOV_EXCL_STOP + +// LCOV_EXCL_START 6:Because process initialization +/***************************************************************************** + @ingroup: SS_SystemManager + @brief: OnHeartBeatRequest + @note: . + @param HANDLE - Handle to message queue of HeartBeat Service. + @return EFrameworkunifiedStatus OK or Fail +*****************************************************************************/ +EFrameworkunifiedStatus CHeartBeatServiceIf::OnHeartBeatRequest(HANDLE hApp) { + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + BOOL l_availability; + + if (g_tHeartBeatSession.hService == NULL) { + if ( NULL == (g_tHeartBeatSession.hService = FrameworkunifiedMcOpenSender(hApp, SS_SMHeartbeat)) ) { + l_eStatus = eFrameworkunifiedStatusNullPointer; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + " Error: FrameworkunifiedMcOpenSender(%s) returned NULL", + SS_SMHeartbeat); + return l_eStatus; + } + } + + if ( (0 == strcmp(SS_SMHeartbeat, FrameworkunifiedGetMsgSrc(hApp))) ) { + if (NULL != g_tHeartBeatSession.hService) { + l_availability = FrameworkunifiedGetSelfAvailability(hApp); + + if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendMsg(g_tHeartBeatSession.hService, SS_HEARTBEAT_RESPONSE, + sizeof(l_availability), &l_availability))) { + LOG_ERROR("FrameworkunifiedSendMsg"); + } + } else { + l_eStatus = eFrameworkunifiedStatusInvldHandle; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid handle[_g_hHeartBeatSessionHandle = :NULL]"); + } + } + return l_eStatus; +} +// LCOV_EXCL_STOP diff --git a/service/system/interface_unified/library/src/ss_last_to_order.cpp b/service/system/interface_unified/library/src/ss_last_to_order.cpp new file mode 100755 index 0000000..140101f --- /dev/null +++ b/service/system/interface_unified/library/src/ss_last_to_order.cpp @@ -0,0 +1,186 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <stdint.h> +#include <stdio.h> +#include <string.h> +#include <agl_wakeup_order.h> +#include <list> +#include <fstream> +#include <iostream> +#include <stdexcept> +#include <string> +#include "system_service/ss_last_to_order.h" +#include "ss_last_to_order_local.h" + +#include "system_service/ss_templates.h" +#include "ss_system_if_interfaceunifiedlog.h" +#define SCO_STATE_LOG(...) FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, __VA_ARGS__); +#define SCO_ERROR_LOG(...) FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, __VA_ARGS__); +#define SCO_ASSERT(x) SS_ASERT(x); + +//************* CONFIG FILE Format **************** +#define ORDERNAME_MAX 64 +#define CONTENT_NAME_MAX 128 +#pragma pack(push, 1) +typedef struct { + char lastinfo[SS_CCAT_MAX][CONTENT_NAME_MAX]; + char orderName[ORDERNAME_MAX]; +}SS_LASTINFO_TO_OEDER_PACKED_t; +#pragma pack(pop) +//************************************************* + + +typedef struct { + SS_LAST_INFO_t lastinfo; + std::string orderName; +}SS_LASTINFO_TO_OEDER_t; + + + +//**************************** +// load configuration file +//**************************** +static int +loadConfig(std::string &cfgPath, std::list<SS_LASTINFO_TO_OEDER_t> *p_cfgList) throw() { // NOLINT (runtime/references) + int ret = 0; + + try { + std::ifstream fin(cfgPath.c_str(), std::ios::in | std::ios::binary); + if (!fin) { + SCO_ERROR_LOG("cfg file error %s", cfgPath.c_str()); + throw std::domain_error("open error"); + } + char magic[4]; + + fin.read(reinterpret_cast<char*>(&magic), sizeof(magic)); + if (fin.fail()) { + throw std::domain_error("read magic"); + } + + if (memcmp(magic, "CTOO", sizeof(magic)) != 0) { + throw std::domain_error("magic error"); + } + + uint32_t numOfElement = 0; + fin.read(reinterpret_cast<char*>(&numOfElement), sizeof(numOfElement)); + if ( fin.fail() ) { + throw std::domain_error("read numOfElement"); + } + + for (uint32_t ii = 0; ii < numOfElement; ii++) { + SS_LASTINFO_TO_OEDER_PACKED_t element; + fin.read(reinterpret_cast<char*>(&element), sizeof(element)); + if ( fin.fail() ) { + throw std::domain_error("read element"); + } + SS_LASTINFO_TO_OEDER_t tmp; + tmp.lastinfo[SS_CCAT_F_VIDEO] = element.lastinfo[SS_CCAT_F_VIDEO]; + tmp.lastinfo[SS_CCAT_F_SUB_VIDEO] = element.lastinfo[SS_CCAT_F_SUB_VIDEO]; + tmp.lastinfo[SS_CCAT_F_AUDIO] = element.lastinfo[SS_CCAT_F_AUDIO]; + tmp.lastinfo[SS_CCAT_R_VIDEO] = element.lastinfo[SS_CCAT_R_VIDEO]; + tmp.lastinfo[SS_CCAT_R_AUDIO] = element.lastinfo[SS_CCAT_R_AUDIO]; + tmp.orderName = element.orderName; + p_cfgList->push_back(tmp); + } + SCO_STATE_LOG("%s is loaded", cfgPath.c_str()); + } catch (std::exception &e) { + if (ret == 0) ret = -1; + SCO_ERROR_LOG("%s", e.what()); + SCO_ASSERT(0); + } catch (...) { + SCO_ASSERT(0); + ret = -1; + } + return ret; +} + + + +static +bool +isPassCondition(SS_CONT_CATEGORY_t cat, SS_LAST_INFO_t &lastInfo, SS_LASTINFO_TO_OEDER_t &tblElement) { // NOLINT (runtime/references) + std::string &tblStr = tblElement.lastinfo[cat]; + + if (tblStr != "EMPTY") { + //Category with content specification + SS_LAST_INFO_t::iterator iteCont = lastInfo.find(cat); + if (iteCont == lastInfo.end() || iteCont->second != tblStr) { + return false; + } + } + return true; +} + + + +//**************************** +// SS_ConvLastInfoToOrder +//**************************** +EFrameworkunifiedStatus +SS_ConvLastInfoToOrder(SS_LAST_INFO_t &curInfo, std::string &order, const char* p_cfgPath/* = NULL*/) { // NOLINT (runtime/references) + std::string cfgPath = (p_cfgPath) ? p_cfgPath : SS_LAST_TO_ORDER_CONF_PATH; + + static std::list<SS_LASTINFO_TO_OEDER_t> s_convList; + static std::string s_readCfgPath = "__default__"; + bool isHit = false; + + // If the same CONFIG, do not READ after the second. + if (s_readCfgPath != cfgPath) { + int ret; + s_convList.clear(); + + ret = loadConfig(cfgPath, &s_convList); + if (ret != 0) { goto ERROR; } + s_readCfgPath = cfgPath; + +#if 0 // DEBUG + for (std::list<SS_LASTINFO_TO_OEDER_PACKED_t>::iterator tblElt = s_convList.begin(); + tblElt != s_convList.end(); + tblElt++) { + SCO_STATE_LOG("FV:%s FSV:%s FA:%s RV:%s RA:%s O:%s", + tblElt->lastinfo[SS_CCAT_F_VIDEO], tblElt->lastinfo[SS_CCAT_F_SUB_VIDEO], tblElt->lastinfo[SS_CCAT_F_AUDIO], + tblElt->lastinfo[SS_CCAT_R_VIDEO], tblElt->lastinfo[SS_CCAT_R_AUDIO], tblElt->orderName); + } +#endif + } + + for (std::list<SS_LASTINFO_TO_OEDER_t>::iterator tblElt = s_convList.begin(); + tblElt != s_convList.end(); + tblElt++) { + if (isPassCondition(SS_CCAT_F_VIDEO , curInfo, *tblElt) == false) { + continue; + } else if (isPassCondition(SS_CCAT_F_SUB_VIDEO, curInfo, *tblElt) == false) { + continue; + } else if (isPassCondition(SS_CCAT_F_AUDIO , curInfo, *tblElt) == false) { + continue; + } else if (isPassCondition(SS_CCAT_R_VIDEO , curInfo, *tblElt) == false) { + continue; + } else if (isPassCondition(SS_CCAT_R_AUDIO , curInfo, *tblElt) == false) { + continue; + } + + isHit = true; + order = tblElt->orderName; + break; + } + if (!isHit) { + order = WON_DEFAULT; + } + return eFrameworkunifiedStatusOK; +ERROR: + return eFrameworkunifiedStatusFail; +} diff --git a/service/system/interface_unified/library/src/ss_logger_service_ifc.cpp b/service/system/interface_unified/library/src/ss_logger_service_ifc.cpp new file mode 100755 index 0000000..1766bfa --- /dev/null +++ b/service/system/interface_unified/library/src/ss_logger_service_ifc.cpp @@ -0,0 +1,781 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_SystemServices_Logger +/// \brief This file supports the _CWORD77_ logger service. +/// +/////////////////////////////////////////////////////////////////////////////// +#include "system_service/ss_logger_service_ifc.h" +#include <string.h> +#include <native_service/frameworkunified_application.h> +#include <native_service/frameworkunified_framework_if.h> +#include <native_service/frameworkunified_types.h> +#include <native_service/frameworkunified_framework_types.h> +#include <string> +#include "system_service/ss_logger_service_protocol.h" +#include "system_service/ss_logger_service_notifications.h" +#include "system_service/ss_logger_service.h" +#include "system_service/ss_logger_service_local.h" +#include "system_service/ss_services.h" +#include "ss_logger_service_if_interfaceunifiedlog.h" + +LoggerServiceIf::LoggerServiceIf() + : m_hApp(NULL), + m_hService(NULL), + m_hSession(NULL) { +} + +LoggerServiceIf::~LoggerServiceIf() { + CloseSessionRequest(); // if the session is still connected + + m_hService = NULL; + m_hSession = NULL; + m_hApp = NULL; +} // LCOV_EXCL_BR_LINE 10:Because destructor + +EFrameworkunifiedStatus LoggerServiceIf::NotifyOnLoggerServiceAvailability( + CbFuncPtr f_pCallBackFn) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle; + if (NULL != m_hApp && NULL != f_pCallBackFn) { + // Subscriptions + FrameworkunifiedNotificationCallbackHandler g_aryLogger_Notif_Cbs[] = { + // Notifications name, Call back function + { NTFY_SS_LoggerService_Availability, f_pCallBackFn }, }; + + if (0 != strcmp(SERVICE_LOGGER, FrameworkunifiedGetAppName(m_hApp))) { + // Subscribe and attach call backs to notifications + if (eFrameworkunifiedStatusOK + != (eStatus = FrameworkunifiedSubscribeNotificationsWithCallback( + m_hApp, g_aryLogger_Notif_Cbs, _countof(g_aryLogger_Notif_Cbs)))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "FrameworkunifiedAttachNotificationCallbacksToDispatcher Failed Status:0x%x ", + eStatus); + } + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eStatus; +} + +EFrameworkunifiedStatus LoggerServiceIf::NotifyOnOpenSessionAck(CbFuncPtr f_pCallBackFn) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle; + if (NULL != m_hApp && NULL != f_pCallBackFn) { + if (eFrameworkunifiedStatusOK + != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp, + SERVICE_LOGGER, + PROTOCOL_OPEN_SESSION_ACK, + f_pCallBackFn))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ", eStatus); + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eStatus; +} + +EFrameworkunifiedStatus LoggerServiceIf::NotifyOnCloseSessionAck(CbFuncPtr f_pCallBackFn) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle; + + if (NULL != m_hApp && NULL != f_pCallBackFn) { + if (eFrameworkunifiedStatusOK + != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp, + SERVICE_LOGGER, + PROTOCOL_CLOSE_SESSION_ACK, + f_pCallBackFn))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ", eStatus); + } + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eStatus; +} + +BOOL LoggerServiceIf::Initialize(HANDLE hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + BOOL l_eStatus = TRUE; + + if (NULL != hApp) { + m_hApp = hApp; + } else { + l_eStatus = FALSE; // eFrameworkunifiedStatusInvldHandle; + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +EFrameworkunifiedStatus LoggerServiceIf::OpenSessionRequest() { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + if (NULL != m_hApp) { + // if the session is there then we need to close it first! + if (NULL != m_hService) { + CloseSessionRequest(); + m_hService = NULL; + } + BOOL l_bServiceAvailable = FrameworkunifiedIsServiceAvailable(m_hApp); + if (FALSE == l_bServiceAvailable) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Service is unavailable"); + l_eStatus = eFrameworkunifiedStatusFail; + } else { + // Now open the service. + if (l_bServiceAvailable + && (NULL != (m_hService = OpenService()))) { // LCOV_EXCL_BR_LINE 8:Because bServiceAvailable is always TRUE + // [DM: TODO] Check if we need to open a session with some data sent to Server. + UI_32 l_pTestData = 1; + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedOpenSessionWithData(m_hService, + (PVOID) &l_pTestData, + sizeof(UI_32)))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, + "FrameworkunifiedOpenSessionWithData Failed, errval :%d", l_eStatus); + } + } else { + l_eStatus = eFrameworkunifiedStatusFail; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, + "FrameworkunifiedOpenService Failed, errval :%d", l_eStatus); + } + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +HANDLE LoggerServiceIf::OpenService() { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + HANDLE l_hService = NULL; + + if (NULL == (l_hService = FrameworkunifiedOpenService(m_hApp, SERVICE_LOGGER))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, + "FrameworkunifiedOpenService : Failed to open Logger Service"); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_hService; +} + +EFrameworkunifiedStatus LoggerServiceIf::DecodeOpenSessionResponse() { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + std::string l_strSessionName; + if (NULL != m_hService + && NULL != m_hApp) { // LCOV_EXCL_BR_LINE 8:Because there is no case where m_hApp is NULL and m_hService is not NULL + if (NULL == (m_hSession = FrameworkunifiedGetOpenSessionHandle(m_hApp))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, + "Error in extracting OpenSessionAck response."); + l_eStatus = eFrameworkunifiedStatusFail; + } else { + l_eStatus = eFrameworkunifiedStatusOK; + l_strSessionName = FrameworkunifiedGetSessionName(m_hSession); + if (l_strSessionName.empty()) { + l_eStatus = eFrameworkunifiedStatusFail; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SessionName is empty"); + } else { + if (eFrameworkunifiedStatusOK + != (FrameworkunifiedSetSessionHandle(m_hApp, l_strSessionName.c_str(), m_hSession))) { + l_eStatus = eFrameworkunifiedStatusFail; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSetSessionHandle() failed"); + } + } + } + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +EFrameworkunifiedStatus LoggerServiceIf::CloseSessionRequest() { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + + if (NULL != m_hService && NULL != m_hSession) { + if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedCloseSession(m_hService, m_hSession))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedCloseSession Failed"); + } + m_hSession = NULL; // clear our session handle + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +EFrameworkunifiedStatus LoggerServiceIf::RegisterForLoggerEvent( + SS_LoggerServerEvents f_eLoggerEvent, CbFuncPtr f_pCallBackFn) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle; + + if (NULL != m_hSession && NULL != f_pCallBackFn) { + if (eFrameworkunifiedStatusOK + != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp, + SERVICE_LOGGER, + f_eLoggerEvent, + f_pCallBackFn, m_hSession))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ", eStatus); + } + + // client registers for the event + if (eFrameworkunifiedStatusOK + != (eStatus = FrameworkunifiedRegisterEvent(m_hSession, f_eLoggerEvent))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedRegisterEvents Failed Status:0x%x", + eStatus); + } + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedRegisterEvents Status:0x%x", eStatus); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eStatus; +} + +EFrameworkunifiedStatus LoggerServiceIf::UnRegisterForLoggerEvent( + SS_LoggerServerEvents f_eLoggerEvent) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle; + + if (NULL != m_hSession) { + eStatus = eFrameworkunifiedStatusOK; + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eStatus; +} + +//////////////////////////////////////////////////////////////////////////////////////////// +/// SendDiagStat +/// API to send CAN Diagnostic status data(it has mileage info) to Logger Service +/// (Command: SS_LOGGER_MILEAGE_DATA) +/// +/// \return status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////////////// + +EFrameworkunifiedStatus LoggerServiceIf::SendDiagStat(STLOGGER_CANDIAGSTAT *pCanDiagStat_t) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + STLOGGER_CANDIAGSTAT l_candiagstat; + + memcpy(&l_candiagstat, pCanDiagStat_t, sizeof(STLOGGER_CANDIAGSTAT)); + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Before Valid Session"); + if (NULL != m_hService && NULL != m_hSession) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Entered Valid Session"); + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_MILEAGE_DATA, + sizeof(STLOGGER_CANDIAGSTAT), &l_candiagstat))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed"); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Msg Send Successfully"); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////////////////// +/// Function :LoggerIf_CANGetCurrentDateAndTime +/////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_CANGetCurrentDateAndTime( + STCanCurrentDateTime stDateAndTime) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + + if (NULL != m_hService && NULL != m_hSession) { + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SET_DATETIME, + sizeof(stDateAndTime), &stDateAndTime))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed"); + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////////////////// +/// Function :LoggerIf_CANSetVIN +/////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_CANSetVIN(STVIN_NUMBER& stVinNumber) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + + stVinNumber.VINstr[stVinNumber.VIN_LEN - 1] = '\0'; + + if (NULL != m_hService && NULL != m_hSession) { + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SET_VIN, + sizeof(STVIN_NUMBER), &stVinNumber))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg() Failed with error: %X", + l_eStatus); + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Service or Session Handle NULL"); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +//////////////////////////////////////////////////////////////////////////////////////////// +/// LoggerIf_SetLoggerParams +/// API is to inform Logger Service about the device selected to store the logs +/// and about Enable/Disable Logging. +/// (Command: SS_LOGGER_SET_PARAMS) +/// +/// \return status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_SetLoggerParams(ELOGGER_STAT eLoggerStatus, + EDEV_TYPE eDevType) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + STLoggerSetParams l_stLoggerParams; + + l_stLoggerParams.Logger_State = eLoggerStatus; + l_stLoggerParams.Device_Type = eDevType; + + if (NULL != m_hService && NULL != m_hSession) { + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SET_PARAMS, + sizeof(STLoggerSetParams), &l_stLoggerParams))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed"); + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +//////////////////////////////////////////////////////////////////////////////////////////// +/// LoggerIf_UDPLogging +/// API is to inform Logger Service about UDP logging +/// and about Enable/Disable Logging. +/// (Command: SS_LOGGER_UDP_LOGGING) +/// +/// \return status +/// EFrameworkunifiedStatus - success or error +//////////////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_UDPLogging(ELOGGER_STAT eLoggerStatus) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + + if (NULL != m_hService && NULL != m_hSession) { + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_UDP_LOGGING, + sizeof(ELOGGER_STAT), &eLoggerStatus))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed"); + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_ScreenCaptureEventACK( + STScreenCaptureEvt stScreenCaptureInfo) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + + if (NULL != m_hSession) { + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SCREENCAPTURE_EVT_ACK, + sizeof(stScreenCaptureInfo), + &stScreenCaptureInfo))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed"); + } else { + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Screen shot ACK sent successfully."); + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Error. m_hSession is NULL. Screen shot capture ACK not sent."); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////////////////// +/// Function :LoggerIf_EventLoggingCommonInfo +/////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_EventLoggingCommonInfo( + STEventLoggerCommonInfo stEventCommonInfo) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + + if (NULL != m_hService && NULL != m_hSession) { + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_EVENT_COMMONINFO, + sizeof(stEventCommonInfo), + &stEventCommonInfo))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed"); + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////////////////// +/// Function :LoggerIf_EventLoggingEventInfo +/////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_EventLoggingEventInfo( + STEventLoggerEventInfo stEventInfo) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + + if (NULL != m_hService && NULL != m_hSession) { + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER__CWORD56__EVENT_INFO, + sizeof(stEventInfo), &stEventInfo))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed"); + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////////////////// +/// Function :LoggerIf_EventLoggingResetInfo +/// (Command: SS_LOGGER__CWORD56__RESET_INFO) +/////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_EventLoggingResetInfo( + STEventLoggerResetInfo stResetInfo) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + + if (NULL != m_hService && NULL != m_hSession) { + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER__CWORD56__RESET_INFO, + sizeof(stResetInfo), &stResetInfo))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed"); + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////////////////// +/// Function :LoggerIf_EventLoggingResetInfo +/// (Command: SS_LOGGER_DIAGDTC_ACTIVE) +/////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_PersistEventLogOnActiveDTC(void) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + + if (NULL != m_hService && NULL != m_hSession) { + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_DIAGDTC_ACTIVE, 0x00, + NULL))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed"); + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////////////////// +/// Function :LoggerIf_EventLoggingResetInfo +/// (Command: SS_LOGGER_SHUTDOWN_COMPLETE) +/////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_Shutdown_Complete(void) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + + if (NULL != m_hService && NULL != m_hSession) { + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SHUTDOWN_COMPLETE, + 0x00, NULL))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed"); + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////////////////// +/// Function :StoreEventLogsToUSB +/////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::StoreEventLogsToUSB( + EEvtLogUSBDevNumber eUSBDevNumber) { + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, + "Copy the Event logs in to USB command received:%X", eUSBDevNumber); + + if (NULL != m_hSession) { + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGERCOPYEVENTUSB, + sizeof(EEvtLogUSBDevNumber), &eUSBDevNumber))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed"); + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed"); + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////////////////// +/// Function :StoreEmergencyErrorLogsToUSB +/////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::StoreEmergencyErrorLogsToUSB( + EDevNumber eDevNumber) { + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + + FRAMEWORKUNIFIEDLOG( + ZONE_INFO, __FUNCTION__, + "Copy the Emergency Error logs in to External Device command received:%X", + eDevNumber); + + if (NULL != m_hSession) { + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGERCOPYEMERGENCYLOGS, + sizeof(EDevNumber), &eDevNumber))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed"); + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed"); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////////////////// +/// Function :ClearEventLogs +/////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::ClearEventLogs(void) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Request for clearing the event logs"); + + if (NULL != m_hSession) { + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGERCLEAREVENT, 0, NULL))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed"); + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed"); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////////////////// +/// Function :ReadStatisticalCounter +/////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::ReadStatisticalCounter( + EStatCounterGroupID eCounterGroup) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, + "Request to read the statistical counter for group ID:%X", + eCounterGroup); + + if (NULL != m_hSession) { + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_READ_STATL_COUNTER, + sizeof(EStatCounterGroupID), &eCounterGroup))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed"); + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed"); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////////////////// +/// Function :ReadStatisticalCounter +/////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::ResetStatisticalCounter( + EStatCounterGroupID eCounterGroup) { + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, + "Request to reset the statistical counter for group ID:%X", + eCounterGroup); + + if (NULL != m_hSession) { + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_RESET_STATL_COUNTER, + sizeof(EStatCounterGroupID), &eCounterGroup))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed"); + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed"); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////////////////// +/// Function LoggerServiceIf::StartDTCLoggingToEmmc +/////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::StartDTCLoggingToEmmc(UI_32 f_dtc) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Request to start logging for DTC:0x%4X", + f_dtc); + l_eStatus = this->SendMessage(eSSLoggerCANProtocolIDDTCTrigger, + (UI_32) sizeof(f_dtc), &f_dtc); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////////////////// +/// Function LoggerServiceIf::StartCANLogging +/////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::StartCANLogging(void) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Request to start CAN logging."); + l_eStatus = this->SendMessage(eSSLoggerCANProtocolIDCANTrigger, 0, NULL); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////////////////// +/// Function LoggerServiceIf::RegisterLoggingStartNotification +/////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::RegisterLoggingStartNotification( + CbFuncPtr f_pCallBackFn) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + + if (NULL == this->m_hApp) { + l_eStatus = eFrameworkunifiedStatusNullPointer; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "(NULL == this->m_hApp)"); + } else if (NULL == f_pCallBackFn) { + l_eStatus = eFrameworkunifiedStatusNullPointer; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "(NULL == f_pCallBackFn)"); + } else { + l_eStatus = FrameworkunifiedSubscribeToSessionEventWithCallback(this->m_hApp, + eSSLoggerCANEventStart, + f_pCallBackFn, + this->m_hSession); + if (eFrameworkunifiedStatusOK != l_eStatus) { + FRAMEWORKUNIFIEDLOG( + ZONE_ERR, + __FUNCTION__, + "FrameworkunifiedSubscribeToSessionEventWithCallback(eSSLoggerCANEventStart) returned %X", + l_eStatus); + } + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return (l_eStatus); +} + +/////////////////////////////////////////////////////////////////////// +/// Function LoggerServiceIf::RegisterLoggingStartNotification +/////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::RegisterLoggingFinishNotification( + CbFuncPtr f_pCallBackFn) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + + if (NULL == this->m_hApp) { + l_eStatus = eFrameworkunifiedStatusNullPointer; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "(NULL == this->m_hApp)"); + } else if (NULL == f_pCallBackFn) { + l_eStatus = eFrameworkunifiedStatusNullPointer; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "(NULL == f_pCallBackFn)"); + } else { + l_eStatus = FrameworkunifiedSubscribeToSessionEventWithCallback( + this->m_hApp, eSSLoggerCANEventFinished, f_pCallBackFn, + this->m_hSession); + + if (eFrameworkunifiedStatusOK != l_eStatus) { + FRAMEWORKUNIFIEDLOG( + ZONE_ERR, + __FUNCTION__, + "FrameworkunifiedSubscribeToSessionEventWithCallback(eSSLoggerCANEventFinished) returned %X", + l_eStatus); + } + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return (l_eStatus); +} + +/////////////////////////////////////////////////////////////////////// +/// Function :SendMessage +/////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::SendMessage(UI_32 f_cmdID, UI_32 f_size, + void* f_pData) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle; + + if ((NULL != m_hSession) + && ((f_pData != NULL) || (f_size == 0))) { // LCOV_EXCL_BR_LINE 8:Because there is no case where f_pData is NULL and f_size is not 0 + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, f_cmdID, f_size, f_pData))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed"); + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed"); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////////////////// +/// Function :LoggerIf_SetDiagID +/////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_SetDiagID(UI_16 f_u16DiagID) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + + if (NULL != m_hSession) { + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SET_DIAGID, + sizeof(UI_16), &f_u16DiagID))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed %d", l_eStatus); + } + } else { + l_eStatus = eFrameworkunifiedStatusNullPointer; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed"); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////////////////// +/// Function :LoggerIf_UploadEventLog +/////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_UploadEventLog() { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + + if (NULL != m_hSession) { + if (eFrameworkunifiedStatusOK + != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_UPLOAD_EVENTLOG, 0x00, + NULL))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed %d", l_eStatus); + } + } else { + l_eStatus = eFrameworkunifiedStatusNullPointer; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed"); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // LCOV_EXCL_BR_LINE 10:Because the last line diff --git a/service/system/interface_unified/library/src/ss_power_client.cpp b/service/system/interface_unified/library/src/ss_power_client.cpp new file mode 100755 index 0000000..30bdbaa --- /dev/null +++ b/service/system/interface_unified/library/src/ss_power_client.cpp @@ -0,0 +1,254 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_PowerServiceIf +/// \brief This file supports Power Service client management. +/// +/////////////////////////////////////////////////////////////////////////////// + +#include <inttypes.h> +#include <string.h> +#include <native_service/frameworkunified_application.h> +#include <native_service/frameworkunified_framework_if.h> +#include <native_service/frameworkunified_types.h> +#include <native_service/frameworkunified_framework_types.h> +#include <string> +#include "system_service/ss_power_service.h" +#include "system_service/ss_power_service_protocol.h" +#include "system_service/ss_power_service_notifications.h" +#include "system_service/ss_services.h" +#include "system_service/ss_system_if.h" +#include "system_service/ss_templates.h" +#include "ss_power_if_interfaceunifiedlog.h" + +typedef struct { + BOOL fAvailable; + HANDLE hSession; + HANDLE hService; + std::string szServiceName; +} TPowerSession; + +static EFrameworkunifiedStatus OnPowerCloseSesionAck(HANDLE hApp); +static EFrameworkunifiedStatus OnPowerOpenSessionAck(HANDLE hApp); +static EFrameworkunifiedStatus OnPowerAvailability(HANDLE hApp); +static EFrameworkunifiedStatus OnPowerAvailable(HANDLE hApp); +static EFrameworkunifiedStatus OnPowerUnavailable(HANDLE hApp); +static TPowerSession g_tPowerSession = { }; + +/// Base on the a user group affiliation we will call there start and stop methods +/// Note: there group and subgroup strings are empty we will call start on the every +/// first case of +EFrameworkunifiedStatus InterfaceunifiedSystemConnectToPowerSerivce(HANDLE hApp) { + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK; + FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+"); + + // Subscriptions + FrameworkunifiedNotificationCallbackHandler g_aryPower_Notif_Cbs[] = { + // Notifications name, Call back function + { szNTFY_PowerAvailability, OnPowerAvailability }, }; + + /// Avoid opening a session to the Power + /// service Since it uses the framework as well + if (0 != strcmp(SERVICE_POWER, FrameworkunifiedGetAppName(hApp))) { + // Subscribe and attach call backs to notifications, to Notification Service! + if (eFrameworkunifiedStatusOK + != (eStatus = FrameworkunifiedSubscribeNotificationsWithCallback( + hApp, g_aryPower_Notif_Cbs, _countof(g_aryPower_Notif_Cbs)))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "FrameworkunifiedAttachNotificationCallbacksToDispatcher Failed Status:0x%x ", + eStatus); + } else { + /// Need to save the Group and Subgroup values + g_tPowerSession.szServiceName = FrameworkunifiedGetAppName(hApp); + + /// Cleanup any other data members + g_tPowerSession.fAvailable = FALSE; + g_tPowerSession.hService = NULL; + g_tPowerSession.hSession = NULL; + } + } + + FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-"); + + return eStatus; +} + +EFrameworkunifiedStatus OnPowerAvailability(HANDLE hApp) { + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail; + FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+"); + + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, + "Power Service Availability notification received ****"); + + if (sizeof(BOOL) == FrameworkunifiedGetMsgLength(hApp)) { + BOOL avalibility = FALSE; + if (eFrameworkunifiedStatusOK + == (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &avalibility, sizeof(BOOL)))) { + if (TRUE == avalibility) { + eStatus = OnPowerAvailable(hApp); + } else { + eStatus = OnPowerUnavailable(hApp); + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "FrameworkunifiedAttachNotificationCallbacksToDispatcher Failed Status:0x%x ", + eStatus); + } + } + + FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-"); + return eStatus; +} + +EFrameworkunifiedStatus OnPowerAvailable(HANDLE hApp) { + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail; + + FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+"); + + // if the service is available before the close happens then close the session and service first. + if (NULL != g_tPowerSession.hService && NULL != g_tPowerSession.hSession) { + EFrameworkunifiedStatus interfaceunifiedRet = FrameworkunifiedCloseSession(g_tPowerSession.hService, + g_tPowerSession.hSession); + SS_ASERT(interfaceunifiedRet == eFrameworkunifiedStatusOK); + g_tPowerSession.hSession = NULL; + g_tPowerSession.hService = NULL; + } + + PCSTR power_name = FrameworkunifiedGetMsgSrc(hApp); + + // opening the service + if (NULL == (g_tPowerSession.hService = FrameworkunifiedOpenService(hApp, power_name))) { + FRAMEWORKUNIFIEDLOG0(ZONE_ERR, __FUNCTION__, "Power: Failed to open service"); + } else { + FrameworkunifiedProtocolCallbackHandler g_aryPower_Protocol_Cbs[] = { + // Command ID, Call back functions + { PROTOCOL_OPEN_SESSION_ACK, OnPowerOpenSessionAck }, + { PROTOCOL_CLOSE_SESSION_ACK, OnPowerCloseSesionAck }, }; + + /// Attach the valid callback for this service + if (eFrameworkunifiedStatusOK + == (eStatus = FrameworkunifiedAttachCallbacksToDispatcher( + hApp, power_name, g_aryPower_Protocol_Cbs, + _countof(g_aryPower_Protocol_Cbs)))) { + EPWR_SESSION_TYPE tOpenSessionReq = epsstBASIC; + /// opening the session with service + if (eFrameworkunifiedStatusOK + != (eStatus = FrameworkunifiedOpenSessionWithData(g_tPowerSession.hService, + &tOpenSessionReq, + sizeof(tOpenSessionReq)))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedOpenSession Failed Status:0x%x ", + eStatus); + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "%s has received PowerService Available.", + FrameworkunifiedGetAppName(hApp)); + } else { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "FrameworkunifiedAttachCallbacksToDispatcher Failed Status:0x%x ", eStatus); + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eStatus; +} + +EFrameworkunifiedStatus OnPowerUnavailable(HANDLE hApp) { + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK; + + FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+"); + if (0 == strcmp(SERVICE_POWER, FrameworkunifiedGetAppName(hApp))) { + if ((g_tPowerSession.hSession != NULL) + && (g_tPowerSession.hService != NULL)) { + if (eFrameworkunifiedStatusOK + != (eStatus = FrameworkunifiedCloseSession(g_tPowerSession.hService, + g_tPowerSession.hSession))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedCloseSession Failed Status:0x%x", + eStatus); + } + g_tPowerSession.hSession = NULL; + g_tPowerSession.hService = NULL; + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, + "%s has received PowerService Unavailable.", FrameworkunifiedGetAppName(hApp)); + } else { + FRAMEWORKUNIFIEDLOG( + ZONE_ERR, + __FUNCTION__, + "Error INVALID HANDLE [g_tPowerSession.hSession :0x%" PRIxPTR "]; [g_tPowerSession.hService :0x%" PRIxPTR "] ", // NOLINT (whitespace/line_length) + (uintptr_t) g_tPowerSession.hSession, (uintptr_t) g_tPowerSession.hService); + } + } else { + eStatus = eFrameworkunifiedStatusOK; + } + FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-"); + + return eStatus; +} + +/////////////////////////////////////////////////////////// +/// Function: OnHeartBeatClientOpenSessionAck +/// HeartBeat Service OpenSession callback +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus OnPowerOpenSessionAck(HANDLE hApp) { + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail; + FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+"); + + g_tPowerSession.hSession = FrameworkunifiedGetOpenSessionHandle(hApp); + if (NULL != g_tPowerSession.hSession) { + g_tPowerSession.fAvailable = TRUE; + eStatus = eFrameworkunifiedStatusOK; + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, + "%s Session to PowerService has been successfully opened.", + FrameworkunifiedGetAppName(hApp)); + } else { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetOpenSessionHandle returned : %" PRIxPTR "", + (uintptr_t) g_tPowerSession.hSession); + g_tPowerSession.hSession = NULL; + } + + FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-"); + + return eStatus; +} + +/////////////////////////////////////////////////////////// +/// Function: OnHeartBeatClientCloseSessionAck +/// HeartBeat Service CloseSession callback +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus OnPowerCloseSesionAck(HANDLE hApp) { + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK; + + FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+"); + + // Close Service + if (NULL != g_tPowerSession.hService) { + eStatus = FrameworkunifiedCloseService(hApp, g_tPowerSession.hService); + if (eFrameworkunifiedStatusOK != eStatus) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: FrameworkunifiedCloseService() errored %d/'%s", + eStatus, GetStr(eStatus).c_str()); + } + g_tPowerSession.hService = NULL; + g_tPowerSession.hSession = NULL; + } + g_tPowerSession.fAvailable = FALSE; + eStatus = eFrameworkunifiedStatusOK; + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, + "%s Session to PowerService has been successfully closed.", + FrameworkunifiedGetAppName(hApp)); + + FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-"); + + return eStatus; +} diff --git a/service/system/interface_unified/library/src/ss_pwrsvc_if.cpp b/service/system/interface_unified/library/src/ss_pwrsvc_if.cpp new file mode 100755 index 0000000..86d8ebb --- /dev/null +++ b/service/system/interface_unified/library/src/ss_pwrsvc_if.cpp @@ -0,0 +1,343 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_PowerServiceIf +/// \brief This file supports the Power Service module interface. +/// +/////////////////////////////////////////////////////////////////////////////// +#include "system_service/ss_power_service_if.h" +#include <string.h> +#include <native_service/frameworkunified_application.h> +#include <native_service/frameworkunified_framework_if.h> +#include <native_service/frameworkunified_types.h> +#include <native_service/frameworkunified_framework_types.h> +#include "system_service/ss_power_service.h" +#include "system_service/ss_power_service_protocol.h" +#include "system_service/ss_power_service_notifications.h" +#include "system_service/ss_system_if.h" +#include "system_service/ss_services.h" +#include "system_service/ss_string_maps.h" +#include "system_service/ss_templates.h" +#include "ss_power_if_interfaceunifiedlog.h" + +HANDLE OpenPowerService(HANDLE f_hApp) { + EFrameworkunifiedStatus l_eStatus; + HANDLE l_hService = NULL; + if (NULL == f_hApp) { + l_eStatus = eFrameworkunifiedStatusInvldHandle; + LOG_ERROR("NULL == f_App"); + } else if (NULL == (l_hService = FrameworkunifiedOpenService(f_hApp, SERVICE_POWER))) { + l_eStatus = eFrameworkunifiedStatusNullPointer; + LOG_ERROR("FrameworkunifiedOpenService(f_hApp, SERVICE_POWER)"); + } + return l_hService; +} + +EFrameworkunifiedStatus ClosePowerService(HANDLE f_hApp, HANDLE f_hService) { + EFrameworkunifiedStatus l_eStatus; + if (NULL == f_hApp) { + l_eStatus = eFrameworkunifiedStatusInvldHandle; + LOG_ERROR("NULL == f_App"); + } else if (NULL == f_hService) { + l_eStatus = eFrameworkunifiedStatusInvldHandle; + LOG_ERROR("NULL == f_hService"); + } else { + l_eStatus = FrameworkunifiedCloseService(f_hApp, f_hService); + LOG_STATUS(l_eStatus, "FrameworkunifiedCloseService(f_hApp, f_hService)"); + f_hService = NULL; + } + return l_eStatus; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////// +/// Session Related Requests +/// Any client can also use FrameworkunifiedOpenSession and FrameworkunifiedOpenSessionWithData. +/// In that case, the PVOID data passed as a parameter should be MM_OpenSessionRequestIf +/// to open a session with the Power Service. +/// The client can also use the below API for Opening a session with Power Service. +/////////////////////////////////////////////////////////////////////////////////////////////////// + +EFrameworkunifiedStatus PwrServiceOpenSessionRequest(HANDLE f_hService, + EPWR_SESSION_TYPE f_eSessionType) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + + if (NULL == f_hService) { + l_eStatus = eFrameworkunifiedStatusInvldHandle; + LOG_ERROR("NULL == f_hService"); + } else if (epsstUNKNOWN == f_eSessionType) { + l_eStatus = eFrameworkunifiedStatusInvldParam; + LOG_ERROR("epsstUNKNOWN == f_eSessionType"); + } else { + l_eStatus = FrameworkunifiedOpenSessionWithData(f_hService, &f_eSessionType, + sizeof(f_eSessionType)); + LOG_STATUS(l_eStatus, "FrameworkunifiedOpenSessionWithData()"); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +EFrameworkunifiedStatus PwrServiceCloseSessionRequest(HANDLE f_hService, HANDLE f_hSession) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + + if (NULL == f_hService) { + l_eStatus = eFrameworkunifiedStatusInvldHandle; + LOG_ERROR("NULL == f_hService"); + } else if (NULL == f_hSession) { + l_eStatus = eFrameworkunifiedStatusInvldHandle; + LOG_ERROR("NULL == f_hSession"); + } else { + CALL_AND_LOG_STATUS(FrameworkunifiedCloseSession(f_hService, f_hSession)); + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +EFrameworkunifiedStatus PwrServiceDecodeOpenSessionResponse(HANDLE f_hApp, + HANDLE& f_hSession) { // NOLINT (runtime/references) + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + + if (NULL == f_hApp) { + l_eStatus = eFrameworkunifiedStatusInvldHandle; + LOG_ERROR("NULL == f_App"); + } else { + if (NULL == (f_hSession = FrameworkunifiedGetOpenSessionHandle(f_hApp))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + " Error: FrameworkunifiedGetOpenSessionHandle('%s') returned NULL", + FrameworkunifiedGetAppName(f_hApp)); + l_eStatus = eFrameworkunifiedStatusNullPointer; + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +EFrameworkunifiedStatus PwrServiceSetVoltageState(HANDLE f_hSession, + EPWR_VOLTAGE_STATE_TYPE f_eVoltage_state) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + if (NULL == f_hSession) { + l_eStatus = eFrameworkunifiedStatusInvldHandle; + LOG_ERROR("NULL == f_hSession"); + } else if (epsvsINVALID == f_eVoltage_state) { + l_eStatus = eFrameworkunifiedStatusInvldParam; + LOG_ERROR("epsvsINVALID == f_eVoltage_state"); + } else { + Pwr_ServiceSetInterface l_tServiceSetIf; + std::memset(&l_tServiceSetIf, 0, sizeof(l_tServiceSetIf)); + l_tServiceSetIf.data.voltage.state = f_eVoltage_state; + l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_VOLTAGE_STATE, + sizeof(l_tServiceSetIf), (PVOID) &l_tServiceSetIf); + LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_VOLTAGE_STATE)"); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +EFrameworkunifiedStatus PwrServiceSetCrankState(HANDLE f_hSession, + EPWR_CRANK_STATE_TYPE f_eCrank_state) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + + if (NULL == f_hSession) { + l_eStatus = eFrameworkunifiedStatusInvldHandle; + LOG_ERROR("NULL == f_hSession"); + } else if (epscsINVALID == f_eCrank_state) { + l_eStatus = eFrameworkunifiedStatusInvldParam; + LOG_ERROR("epsvsINVALID == f_eCrank_state"); + } else { + Pwr_ServiceSetInterface l_tServiceSetIf; + std::memset(&l_tServiceSetIf, 0, sizeof(l_tServiceSetIf)); + l_tServiceSetIf.data.crank.state = f_eCrank_state; + l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_CRANK_STATE, + sizeof(l_tServiceSetIf), (PVOID) &l_tServiceSetIf); + LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_CRANK_STATE)"); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +EFrameworkunifiedStatus PwrServiceSendShutdownRequest( + HANDLE f_hSession, EPWR_SHUTDOWN_REQUEST_MSG_STRUCT &f_eState) { // NOLINT (runtime/references) + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + if (NULL == f_hSession) { + l_eStatus = eFrameworkunifiedStatusInvldHandle; + LOG_ERROR("NULL == f_hSession"); + } else { + Pwr_ServiceSetInterface l_tServiceSetIf; + std::memset(&l_tServiceSetIf, 0, sizeof(l_tServiceSetIf)); + l_tServiceSetIf.data.shutdownRequestMsg = f_eState; + l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_SHUTDOWN_REQUEST_MSG, + sizeof(l_tServiceSetIf), &l_tServiceSetIf); + + LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_SHUTDOWN_REQUEST_MSG)"); + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of EFrameworkunifiedStatus PwrServiceSendShutdownRequest( + +EFrameworkunifiedStatus PwrServiceSendSetShutdownPopupRequest( + HANDLE f_hSession, EPWR_SHUTDOWN_POPUP_TYPE f_eShutdownPopup) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + if (NULL == f_hSession) { + l_eStatus = eFrameworkunifiedStatusInvldHandle; + LOG_ERROR("NULL == f_hSession"); + } else { + Pwr_ServiceSetInterface l_tServiceSetIf; + std::memset(&l_tServiceSetIf, 0, sizeof(l_tServiceSetIf)); + switch (f_eShutdownPopup) { + case epsspPowerSave1: + case epsspPowerSave2: + case epsspPowerSave3: + case epsspPowerSaveClr: + case epsspLowVoltage1: + case epsspLowVoltage2: + case epsspLowVoltage3: + case epsspLowVoltageClr: + case epsspBattCouplingSW1: + case epsspBattCouplingSW2: + case epsspBattCouplingSW3: + case epsspBattCouplingSWClr: + case epsspAbnormalTemp_1st: + case epsspAbnormalTemp_Clr: + case epsspLimpHome_1st: + case epsspLimpHome_2nd: + case epsspLimpHome_3rd: + case epsspLimpHome_Clr: + case epsspProdMd_1st: + case epsspProdMd_Clr: + case epsspTransMd_1st: + case epsspTransMd_Clr: + case epsspAllClr: + l_tServiceSetIf.data.shutdownPopup.shutdownPopupEvent = + f_eShutdownPopup; + l_eStatus = FrameworkunifiedSendMsg(f_hSession, + SS_POWER_PUBLISH_SHUTDOWN_CONDITION_REQ, + sizeof(l_tServiceSetIf), &l_tServiceSetIf); + LOG_STATUS(l_eStatus, + "FrameworkunifiedSendMsg(SS_POWER_PUBLISH_SHUTDOWN_CONDITION_REQ)"); + break; + + default: + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + " Error: Unknown 'ShutdownPopup' value: 0x%X/%d", + f_eShutdownPopup, f_eShutdownPopup); + l_eStatus = eFrameworkunifiedStatusInvldParam; + break; + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of EFrameworkunifiedStatus PwrServiceSendSetShutdownPopupRequest( HANDLE f_hSession, + +EFrameworkunifiedStatus PwrServiceSendStartupConfirmationMsgRequest( + HANDLE f_hSession, EPWR_SC_MSG_STRUCT f_eState) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + if (NULL == f_hSession) { + l_eStatus = eFrameworkunifiedStatusInvldHandle; + LOG_ERROR("NULL == f_hSession"); + } else { + Pwr_ServiceSetInterface l_tServiceSetIf; + std::memset(&l_tServiceSetIf, 0, sizeof(l_tServiceSetIf)); + l_tServiceSetIf.data.startupConfirmationMsg = f_eState; + l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_FWD_START_CONFIRMATION_MSG_REQ, + sizeof(l_tServiceSetIf), &l_tServiceSetIf); + + LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_FWD_START_CONFIRMATION_MSG_REQ)"); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of EFrameworkunifiedStatus PwrServiceSendStartupConfirmationMsgRequest ( HANDLE f_hSession, + +EFrameworkunifiedStatus PwrServiceSystemModeInfoRequest(HANDLE f_hSession) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + if (NULL == f_hSession) { + l_eStatus = eFrameworkunifiedStatusInvldHandle; + LOG_ERROR("NULL == f_hSession"); + } else { + l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_SYSTEM_MODE_INFO_REQ, 0, NULL); + LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_SYSTEM_MODE_INFO_REQ)"); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +EFrameworkunifiedStatus PwrServiceSendInitCompReport(HANDLE f_hSession) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + if (NULL == f_hSession) { + l_eStatus = eFrameworkunifiedStatusInvldHandle; + LOG_ERROR("NULL == f_hSession"); + } else { + l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_INITCOMP_REP, 0, NULL); + LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_INITCOMP_REP)"); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +EFrameworkunifiedStatus PwrServiceSendPowerRequest( + HANDLE f_hSession, EPWR_POWER_REQUEST_MSG_STRUCT_WITH_UMCR &f_eState) { // NOLINT (runtime/references) + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + if (NULL == f_hSession) { + l_eStatus = eFrameworkunifiedStatusInvldHandle; + LOG_ERROR("NULL == f_hSession"); + } else { + Pwr_ServiceSetInterface l_tServiceSetIf; + std::memset(&l_tServiceSetIf, 0, sizeof(l_tServiceSetIf)); + l_tServiceSetIf.data.powerRequestMsg = f_eState; + l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_POWER_REQUEST_MSG, + sizeof(l_tServiceSetIf), (PVOID) &l_tServiceSetIf); + + char l_cBuf[200] = { 0 }; + snprintf( + l_cBuf, + sizeof(l_cBuf), + "FrameworkunifiedSendMsg(SS_POWER_POWER_REQUEST_MSG(%s, %s))", + GetStr(l_tServiceSetIf.data.powerRequestMsg.userMode).c_str(), + GetStr(l_tServiceSetIf.data.powerRequestMsg.userModeChangeReason).c_str()); + LOG_STATUS(l_eStatus, l_cBuf); + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of EFrameworkunifiedStatus PwrServiceSendPowerRequest( HANDLE f_hSession + +EFrameworkunifiedStatus PwrServiceSendHeartBeatRequest(HANDLE f_hSession, + EPWR_HB_REQ_MSG_STRUCT *f_eHbReqMsg) { + FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + if (NULL == f_hSession) { + l_eStatus = eFrameworkunifiedStatusInvldHandle; + LOG_ERROR("NULL == f_hSession"); + } else { + l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_HEARTBEAT_REQ, + sizeof(EPWR_HB_REQ_MSG_STRUCT), + reinterpret_cast<void *>(f_eHbReqMsg)); + LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_HEARTBEAT_REQ)"); + } + FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // LCOV_EXCL_BR_LINE 10:Because the last line diff --git a/service/system/interface_unified/library/src/ss_sm_client.cpp b/service/system/interface_unified/library/src/ss_sm_client.cpp new file mode 100755 index 0000000..664a98d --- /dev/null +++ b/service/system/interface_unified/library/src/ss_sm_client.cpp @@ -0,0 +1,1509 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_SystemManagerIf +/// \brief This file provides support for the System Manager client interface. +/// +/////////////////////////////////////////////////////////////////////////////// +#include "system_service/ss_sm_client_if.h" +#include <sys/mount.h> +#include <errno.h> +#include <string.h> +#include <fcntl.h> + +#include <native_service/frameworkunified_application.h> +#include <native_service/frameworkunified_framework_if.h> +#include <native_service/frameworkunified_types.h> +#include <native_service/frameworkunified_framework_types.h> +#include <native_service/frameworkunified_dispatcher.h> +#include <native_service/frameworkunified_sm_framework_dispatch.h> +#include <native_service/frameworkunified_sm_hsmframework.h> + +#include <string> + +#include "system_service/ss_system_manager_if.h" +#include "system_service/ss_system_manager_protocol.h" +#include "system_service/ss_system_manager_notifications.h" +#include "system_service/ss_system_if.h" +#include "system_service/ss_services.h" +#include "system_service/ss_power_service_protocol.h" +#include "system_service/ss_templates.h" +#include "system_service/ss_string_maps.h" +#include "system_service/ss_error_message.h" +#include "system_service/ss_sm_client_if_local.h" + +#include "system_service/ss_boot_map.h" +#include "ss_system_if_interfaceunifiedlog.h" + +typedef struct { + BOOL fAvailable; + HANDLE hService; + std::string szServiceName; + std::string strIAm; +} TSystemManagerSession; // LCOV_EXCL_BR_LINE 11:Unexpected branch + +typedef enum { + MODULE_STATE_INVALID = 0, /// Initial state of all modules + MODULE_STATE_CONNECTING, /// Attempting to established a session connection + MODULE_STATE_CONNECTED, /// A session connection has been established + MODULE_STATE_STARTING, /// Received a START from System Manager, + /// called FrameworkunifiedOnStart or enqueued evStart + MODULE_STATE_START_FAILED, /// Application returned error from FrameworkunifiedOnStart + MODULE_STATE_STARTED, /// Sent Start Response to System Manager + MODULE_STATE_STOPPING, /// Received a Stop Request from System Manager, + /// called FrameworkunifiedOnStop or enqueued evStop + MODULE_STATE_STOP_FAILED, /// Application returned error from FrameworkunifiedOnStop + MODULE_STATE_STOPPED, /// Sent Start Response to System Manager + MODULE_STATE_DEBUG_DUMPING, + MODULE_STATE_STARTED_PRE, //!< Sent Pre-Start Response to System Manager + MODULE_STATE_START_PRE_FAILED, //!< Application returned error from FrameworkunifiedOnPreStart + MODULE_STATE_STOPPED_PRE, //!< Sent Pre-Stop Response to System Manager + MODULE_STATE_STOP_PRE_FAILED, //!< Application returned error from FrameworkunifiedOnPreStop + MODULE_STATE_STARTED_BACKGROUND, //!< Sent Background-Start Response to System Manager + MODULE_STATE_START_BACKGROUND_FAILED, //!< Application returned error from FrameworkunifiedOnBackgroundStart + MODULE_STATE_STOPPED_BACKGROUND, //!< Sent Background-Stop Response to System Manager + MODULE_STATE_STOP_BACKGROUND_FAILED //!< Application returned error from FrameworkunifiedOnBackgroundStop +} ModuleStateType; + +static SMStopCompleteAck g_responseCompleteAck; + +static EFrameworkunifiedStatus OnSystemManagerStart(HANDLE hApp); +static EFrameworkunifiedStatus OnSystemManagerStop(HANDLE hApp); +static EFrameworkunifiedStatus OnSystemManagerPreStart(HANDLE hApp); +static EFrameworkunifiedStatus OnSystemManagerPreStop(HANDLE hApp); +static EFrameworkunifiedStatus OnSystemManagerBackgroundStart(HANDLE hApp); +static EFrameworkunifiedStatus OnSystemManagerBackgroundStop(HANDLE hApp); +static EFrameworkunifiedStatus OnSystemManagerOpenSessionAck(HANDLE hApp); +static EFrameworkunifiedStatus DebugDumpAppCbStatistics(HANDLE hApp); +static EFrameworkunifiedStatus DebugDumpMemoryMap(HANDLE hApp); +static EFrameworkunifiedStatus SystemManagerOpenSender(HANDLE hApp); + +static TSystemManagerSession g_tSystemManagerSession = { }; // LCOV_EXCL_BR_LINE 11:Unexpected branch +static pthread_mutex_t gMutexObj = PTHREAD_MUTEX_INITIALIZER; + +static EFrameworkunifiedStatus SendMsgToSystemManager(UI_32 uiCmd, UI_32 uiLength, + PCVOID pData); +static EFrameworkunifiedStatus SendMsgToSystemManager(UI_32 uiCmd, PCSTR f_pCmdName, + UI_32 uiLength, PCVOID pData); + +static EFrameworkunifiedStatus InvokeSyncRequestToSystemManager(UI_32 uiCmd, + PCSTR f_pCmdName, + UI_32 uiLength, PCVOID pData, + UI_32 uiResLength, + PVOID pResData); + +static EFrameworkunifiedStatus CommonSystemManagerStartStopCallbackProcessing( + HANDLE hApp, UI_32 f_InterfaceunifiedEvID, SS_String f_pInterfaceunifiedEvName, CbFuncPtr f_InterfaceunifiedFncCb, + PCSTR f_pInterfaceunifiedFncName, ModuleStateType f_moduleSuccessState, + ModuleStateType f_moduleFailureState, BOOL f_bUseNotificationVsFncFlag, + PCSTR f_pUseNotificationText, SS_SystemManagerProtocol f_ProtocolId, + PCSTR f_pProtocolName); + +static EFrameworkunifiedStatus SendInterfaceunifiedOnResponseToSystemManager( + SS_SystemManagerProtocol f_ProtocolID, PCSTR f_pProtocolName, + PCSTR f_InterfaceunifiedOnFncName, ModuleStateType f_moduleSuccessState, + ModuleStateType f_moduleFailureState, EFrameworkunifiedStatus f_eStatus); + +// Pointer of function which is called when SM OpenSession Ack is received. +// client can register this function pointer using RegisterSMSessionAckCallback() API +static CbFuncPtr CallbackFnPtr = NULL; + +static BOOL UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc = FALSE; + +static VOID LoadCbHandlerCmdIDsIntoDetachCbIDsArray( + const FrameworkunifiedProtocolCallbackHandler* pMsgHandler, UI_32 * puiCmdIdArray, + UI_32 uiHandlerCount); + +static VOID SetModuleState(ModuleStateType f_moduleState, BOOL f_bLog = TRUE); + +static ModuleStateType g_moduleState = MODULE_STATE_INVALID; +extern HANDLE g_SystemIf_hApp; + +//****************************************************************************** +void Init_SS_IF_ModuleState_StrMap( + std::map<ModuleStateType, SS_String> & m_strMap) { // NOLINT (runtime/references) +// LCOV_EXCL_BR_START 11:Unexpected branch + MAP_ENTRY(m_strMap, MODULE_STATE_INVALID); + MAP_ENTRY(m_strMap, MODULE_STATE_CONNECTING); + MAP_ENTRY(m_strMap, MODULE_STATE_CONNECTED); + MAP_ENTRY(m_strMap, MODULE_STATE_STARTING); + MAP_ENTRY(m_strMap, MODULE_STATE_START_FAILED); + MAP_ENTRY(m_strMap, MODULE_STATE_STARTED); + MAP_ENTRY(m_strMap, MODULE_STATE_STOPPING); + MAP_ENTRY(m_strMap, MODULE_STATE_STOP_FAILED); + MAP_ENTRY(m_strMap, MODULE_STATE_STOPPED); + MAP_ENTRY(m_strMap, MODULE_STATE_STARTED_PRE); + MAP_ENTRY(m_strMap, MODULE_STATE_START_PRE_FAILED); + MAP_ENTRY(m_strMap, MODULE_STATE_STOPPED_PRE); + MAP_ENTRY(m_strMap, MODULE_STATE_STOP_PRE_FAILED); + MAP_ENTRY(m_strMap, MODULE_STATE_STARTED_BACKGROUND); + MAP_ENTRY(m_strMap, MODULE_STATE_START_BACKGROUND_FAILED); + MAP_ENTRY(m_strMap, MODULE_STATE_STOPPED_BACKGROUND); + MAP_ENTRY(m_strMap, MODULE_STATE_STOP_BACKGROUND_FAILED); + MAP_ENTRY(m_strMap, MODULE_STATE_DEBUG_DUMPING); +// LCOV_EXCL_BR_STOP +} // End of void Init_SS_IF_ModuleState_StrMap(std::map<ModuleStateType, SS_String> & m_strMap) + +class EnumStringMap<ModuleStateType, Init_SS_IF_ModuleState_StrMap> g_oSS_IF_ModuleStateStrMap; + +// LCOV_EXCL_START 6:Because the condition cannot be set +SS_String GetStr(ModuleStateType f_enum) { + return g_oSS_IF_ModuleStateStrMap.GetStr(f_enum); +} + +HANDLE GetSystemManagerSessionHandle(void) { + return g_tSystemManagerSession.hService; +} // End of HANDLE GetSystemManagerSessionHandle(void) +// LCOV_EXCL_STOP + +EFrameworkunifiedStatus InterfaceunifiedSystemConnectToSystemManagerService(HANDLE hApp) { + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + CallbackFnPtr = NULL; + + /// Avoid opening a session to the SystemManager + /// service Since it uses the framework as well + if (0 != strcmp(SERVICE_SYSMANAGER, FrameworkunifiedGetAppName(hApp))) { + // LCOV_EXCL_BR_LINE 6:Duplicate check(AppName has been checked by the caller) + memset(&g_responseCompleteAck, 0, sizeof(g_responseCompleteAck)); + g_responseCompleteAck.unSessionId = 0; + strcpy(g_responseCompleteAck.szServiceName, SERVICE_SYSMANAGER); // NOLINT (runtime/printf) + + pthread_mutex_lock(&gMutexObj); + + /// Need to save the Group and Subgroup values + g_tSystemManagerSession.szServiceName = SERVICE_SYSMANAGER; + g_tSystemManagerSession.strIAm = FrameworkunifiedGetAppName(hApp); + + /// Cleanup any other data members + g_tSystemManagerSession.fAvailable = FALSE; + g_tSystemManagerSession.hService = NULL; + + pthread_mutex_unlock(&gMutexObj); + + l_eStatus = SystemManagerOpenSender(hApp); + + LOG_STATUS_IF_ERRORED(l_eStatus, "SystemManagerOpenSender()"); + } else { + // LCOV_EXCL_START 6:Duplicate check(AppName has been checked by the caller) + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, + " I am SystemManager ! Not registering for '%s' notification", + NTFY_SSSystemMgrAvailability); + // LCOV_EXCL_STOP + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////// +/// Function: SystemManagerOpenSender +/// +/////////////////////////////////////////////////////////// + +EFrameworkunifiedStatus SystemManagerOpenSender(HANDLE hApp) { + EFrameworkunifiedStatus l_eStatus; + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + pthread_mutex_lock(&gMutexObj); + + // LCOV_EXCL_START 6:Duplicate check(hService is NULL only) + if (g_tSystemManagerSession.hService != NULL) { + FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Warn: hService != NULL"); + pthread_mutex_unlock(&gMutexObj); + return eFrameworkunifiedStatusFail; + } + // LCOV_EXCL_STOP + + // opening the service + if (NULL + == (g_tSystemManagerSession.hService = FrameworkunifiedMcOpenSender(hApp, + SERVICE_SYSMANAGER))) { + l_eStatus = eFrameworkunifiedStatusNullPointer; + LOG_ERROR("FrameworkunifiedMcOpenSender(SERVICE_SYSMANAGER)"); + } else { + FrameworkunifiedProtocolCallbackHandler l_SystemManager_Protocol_Cbs[] = { + // Command ID, Call back functions + { SS_SM_PROTOCOL_OPEN_SESSION_ACK, OnSystemManagerOpenSessionAck }, + { SS_SM_START, OnSystemManagerStart }, + { SS_SM_STOP, OnSystemManagerStop }, + { SS_SM_PRE_START, OnSystemManagerPreStart }, + { SS_SM_PRE_STOP, OnSystemManagerPreStop }, + { SS_SM_BACKGROUND_START, OnSystemManagerBackgroundStart }, + { SS_SM_BACKGROUND_STOP, OnSystemManagerBackgroundStop }, + { SS_SM_DEBUG_DUMP, OnSystemManagerDebugDump }, + }; // LCOV_EXCL_BR_LINE 11:Unexpected branch + + /// Attach the valid callback for this service + if (eFrameworkunifiedStatusOK != // LCOV_EXCL_BR_LINE 11:Unexpected branch + (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher( + hApp, SERVICE_SYSMANAGER, l_SystemManager_Protocol_Cbs, + _countof(l_SystemManager_Protocol_Cbs)))) { + LOG_ERROR("FrameworkunifiedAttachCallbacksToDispatcher()"); + } else if (eFrameworkunifiedStatusOK != // LCOV_EXCL_BR_LINE 11:Unexpected branch + (l_eStatus = FrameworkunifiedSendMsg(g_tSystemManagerSession.hService, + SS_SM_PROTOCOL_OPEN_SESSION_REQ, 0, NULL))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: FrameworkunifiedSendMsg(%s) errored: 0x%X/%s", + g_tSystemManagerSession.szServiceName.c_str(), l_eStatus, + GetStr(l_eStatus).c_str()); + } // LCOV_EXCL_BR_LINE 11:Unexpected branch + } + pthread_mutex_unlock(&gMutexObj); + + if (eFrameworkunifiedStatusOK == l_eStatus) { + g_moduleState = MODULE_STATE_CONNECTING; + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; // LCOV_EXCL_BR_LINE 11:Unexpected branch +} + +// LCOV_EXCL_START 6:Because the condition cannot be set +/////////////////////////////////////////////////////////// +/// Function: OnSystemManagerOpenSessionAck +/// Service Manager OpenSession callback +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus OnSystemManagerOpenSessionAck(HANDLE hApp) { + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + if (NULL == hApp) { + l_eStatus = eFrameworkunifiedStatusNullPointer; + LOG_ERROR("NULL == hApp"); + } else { + pthread_mutex_lock(&gMutexObj); + if (NULL == g_tSystemManagerSession.hService) { + l_eStatus = eFrameworkunifiedStatusNullPointer; + LOG_ERROR("FrameworkunifiedGetOpenSessionHandle()"); + g_tSystemManagerSession.fAvailable = FALSE; + } else { + LOG_SUCCESS("FrameworkunifiedGetOpenSessionHandle(hApp)"); + g_tSystemManagerSession.fAvailable = TRUE; + g_moduleState = MODULE_STATE_CONNECTED; + } + pthread_mutex_unlock(&gMutexObj); + + if ((eFrameworkunifiedStatusOK == l_eStatus) && (CallbackFnPtr != NULL)) { + // Call the RegisterSMSessionAckCallback()-registered function + if (eFrameworkunifiedStatusOK != (l_eStatus = (CallbackFnPtr)(hApp))) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + " Error: The 'CallbackFnPtr' function as set by " + "the RegisterSMSessionAckCallback() function " + "errored: 0x%x/%s", + l_eStatus, GetStr(l_eStatus).c_str()); + } + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // EFrameworkunifiedStatus OnSystemManagerOpenSessionAck( HANDLE hApp ) +// LCOV_EXCL_STOP + +/////////////////////////////////////////////////////////// +/// Macro: +/// +/////////////////////////////////////////////////////////// +#define SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING( \ + hApp, evInterfaceunifiedId, InterfaceunifiedFnc, ModStateSuccess, ModStateFailure, \ + NotifFlag, NotifText, ProtocolId) \ + l_eStatus = CommonSystemManagerStartStopCallbackProcessing( \ + hApp, \ + evInterfaceunifiedId, \ + #evInterfaceunifiedId, \ + InterfaceunifiedFnc, \ + #InterfaceunifiedFnc "()", \ + ModStateSuccess, \ + ModStateFailure, \ + NotifFlag, \ + NotifText, \ + ProtocolId, \ + #ProtocolId); \ + LOG_STATUS(l_eStatus, \ + "CommonSystemManagerStartStopCallbackProcessing(" #InterfaceunifiedFnc "())"); + +// LCOV_EXCL_START 6:Because the condition cannot be set +/////////////////////////////////////////////////////////// +/// Function: OnSystemManagerStart +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus OnSystemManagerStart(HANDLE hApp) { + EFrameworkunifiedStatus l_eStatus; + FrameworkunifiedDefaultCallbackHandler cbFuncs; + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs); + LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()"); + + // Call CommonSystemManagerStartStopCallbackProcessing(), & log status + SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING( + hApp, FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStart), cbFuncs.onStart, MODULE_STATE_STARTED, + MODULE_STATE_START_FAILED, FALSE, "", SS_SM_START_COMPL_RSPN); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of EFrameworkunifiedStatus OnSystemManagerStart( HANDLE hApp ) + +/////////////////////////////////////////////////////////// +/// Function: OnSystemManagerStop +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus OnSystemManagerStop(HANDLE hApp) { + EFrameworkunifiedStatus l_eStatus; + FrameworkunifiedDefaultCallbackHandler cbFuncs; + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs); + LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()"); + + // Call CommonSystemManagerStartStopCallbackProcessing(), & log status + SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING( + hApp, FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStop), cbFuncs.onStop, MODULE_STATE_STOPPED, + MODULE_STATE_STOP_FAILED, UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc, + " 'UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc' is 'True': " + "setting 'l_eStatus' to 'eFrameworkunifiedStatusFail'", + SS_SM_STOP_COMPL_RSPN); + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of EFrameworkunifiedStatus OnSystemManagerStop( HANDLE hApp ) + +/////////////////////////////////////////////////////////// +/// Function: OnSystemManagerPreStart +/// +/////////////////////////////////////////////////////////// +static EFrameworkunifiedStatus OnSystemManagerPreStart(HANDLE hApp) { + EFrameworkunifiedStatus l_eStatus; + FrameworkunifiedDefaultCallbackHandler cbFuncs; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others) + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs); // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others) + LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()"); + + // Call CommonSystemManagerStartStopCallbackProcessing(), & log status + SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING( + hApp, + FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedPreStart), + cbFuncs.onPreStart, + MODULE_STATE_STARTED_PRE, + MODULE_STATE_START_PRE_FAILED, + FALSE, + "", + SS_SM_PRE_START_COMPL_RSPN); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:Excluded for function that are expanded inline + return l_eStatus; +} // End of EFrameworkunifiedStatus OnSystemManagerPreStart( HANDLE hApp ) + +/////////////////////////////////////////////////////////// +/// Function: OnSystemManagerPreStop +/// +/////////////////////////////////////////////////////////// +static EFrameworkunifiedStatus OnSystemManagerPreStop(HANDLE hApp) { + EFrameworkunifiedStatus l_eStatus; + FrameworkunifiedDefaultCallbackHandler cbFuncs; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others) + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs); // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others) + LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()"); + + // Call CommonSystemManagerStartStopCallbackProcessing(), & log status + SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING( + hApp, + FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedPreStop), + cbFuncs.onPreStop, + MODULE_STATE_STOPPED_PRE, + MODULE_STATE_STOP_PRE_FAILED, + FALSE, + "", + SS_SM_PRE_STOP_COMPL_RSPN); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:Excluded for function that are expanded inline + return l_eStatus; +} // End of EFrameworkunifiedStatus OnSystemManagerPreStop( HANDLE hApp ) + +/////////////////////////////////////////////////////////// +/// Function: OnSystemManagerBackgroundStart +/// +/////////////////////////////////////////////////////////// +static EFrameworkunifiedStatus OnSystemManagerBackgroundStart(HANDLE hApp) { + EFrameworkunifiedStatus l_eStatus; + FrameworkunifiedDefaultCallbackHandler cbFuncs; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others) + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs); // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others) + LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()"); + + // Call CommonSystemManagerStartStopCallbackProcessing(), & log status + SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING( + hApp, + FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedBackgroundStart), + cbFuncs.onBackgroundStart, + MODULE_STATE_STARTED_BACKGROUND, + MODULE_STATE_START_BACKGROUND_FAILED, + FALSE, + "", + SS_SM_BACKGROUND_START_COMPL_RSPN); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:Excluded for function that are expanded inline + return l_eStatus; +} // End of EFrameworkunifiedStatus OnSystemManagerBackgroundStart( HANDLE hApp ) + +/////////////////////////////////////////////////////////// +/// Function: OnSystemManagerBackgroundStop +/// +/////////////////////////////////////////////////////////// +static EFrameworkunifiedStatus OnSystemManagerBackgroundStop(HANDLE hApp) { + EFrameworkunifiedStatus l_eStatus; + FrameworkunifiedDefaultCallbackHandler cbFuncs; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others) + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs); // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others) + LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()"); + + // Call CommonSystemManagerStartStopCallbackProcessing(), & log status + SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING( + hApp, + FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedBackgroundStop), + cbFuncs.onBackgroundStop, + MODULE_STATE_STOPPED_BACKGROUND, + MODULE_STATE_STOP_BACKGROUND_FAILED, + FALSE, + "", + SS_SM_BACKGROUND_STOP_COMPL_RSPN); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:Excluded for function that are expanded inline + return l_eStatus; +} // End of EFrameworkunifiedStatus OnSystemManagerBackgroundStop( HANDLE hApp ) + +/////////////////////////////////////////////////////////// +/// Function: CommonSystemManagerStartStopCallbackProcessing +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus CommonSystemManagerStartStopCallbackProcessing( + HANDLE hApp, UI_32 f_InterfaceunifiedEvID, SS_String f_pInterfaceunifiedEvName, CbFuncPtr f_InterfaceunifiedFncCb, + PCSTR f_pInterfaceunifiedFncName, ModuleStateType f_moduleSuccessState, + ModuleStateType f_moduleFailureState, BOOL f_bUseNotificationVsFncFlag, + PCSTR f_pUseNotificationText, SS_SystemManagerProtocol f_ProtocolId, + PCSTR f_pProtocolName) { + EFrameworkunifiedStatus l_eStatus; + EFrameworkunifiedStatus l_StatusFncReturned; + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + SS_String l_pInterfaceunifiedFncName; + + if (f_moduleSuccessState == g_moduleState) { + FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, + " Warning: Module state already is '%s', just " + "returning '%s' to System Manager", + GetStr(g_moduleState).c_str(), f_pProtocolName); + l_eStatus = eFrameworkunifiedStatusOK; + l_StatusFncReturned = l_eStatus; + } else { + // If client application is a state machine, post an Event instead of calling + // InterfaceunifiedOnXYZ() + if (FrameworkunifiedIsStateMachineApp(hApp)) { + l_pInterfaceunifiedFncName = "FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(" + f_pInterfaceunifiedEvName + " ))"; + CFrameworkunifiedHSMFramework* l_pStateMachine = FrameworkunifiedGetStateMachine(hApp); + if (NULL == l_pStateMachine) { + l_eStatus = eFrameworkunifiedStatusNullPointer; + LOG_ERROR("FrameworkunifiedGetStateMachine()"); + l_StatusFncReturned = l_eStatus; + } else { + l_eStatus = l_pStateMachine->FrameworkunifiedPostEvent(f_InterfaceunifiedEvID); + if (eFrameworkunifiedStatusOK != l_eStatus) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + " Error: l_pStateMachine->FrameworkunifiedPostEvent(%s) " + "errored: %d/'%s'", + f_pInterfaceunifiedEvName.c_str(), l_eStatus, GetStr(l_eStatus).c_str()); + l_StatusFncReturned = l_eStatus; + } else { + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, + " f_bUseNotificationVsFncFlag is '%s'", + GetStr(f_bUseNotificationVsFncFlag).c_str()); + if (f_bUseNotificationVsFncFlag) { + // + // DON'T send an 'Ok' back to the SendInterfaceunifiedOnResponse function: if + // it detects a 'Ok' it will send a SS_SM_<protocol>_RSPN back + // to System Manager, telling System Manager that the request + // has been completely serviced. + l_StatusFncReturned = eFrameworkunifiedStatusFail; + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", f_pUseNotificationText); + } else { + // + // Always send an 'Ok' back for the evInterfaceunified<protocol> version + // of InterfaceunifiedOn<protocol>; the l_eStatus applies to the + // FrameworkunifiedPostEvent() function, not the actual <protocol> event + // handler. + l_StatusFncReturned = eFrameworkunifiedStatusOK; + } + } // End else successful FrameworkunifiedPostEvent() + } // End else valid FrameworkunifiedGetStateMachine() + } else { // End if FrameworkunifiedIsStateMachineApp() is TRUE + l_pInterfaceunifiedFncName = f_pInterfaceunifiedFncName; + if (f_InterfaceunifiedFncCb) { + l_eStatus = (f_InterfaceunifiedFncCb)(hApp); + LOG_STATUS(l_eStatus, f_pInterfaceunifiedFncName); + l_StatusFncReturned = l_eStatus; + } else { + SS_ASERT(0); + l_StatusFncReturned = eFrameworkunifiedStatusOK; + } + } + } + + l_eStatus = SendInterfaceunifiedOnResponseToSystemManager(f_ProtocolId, f_pProtocolName, + l_pInterfaceunifiedFncName.c_str(), + f_moduleSuccessState, + f_moduleFailureState, + l_StatusFncReturned); + const char l_cFormat[] = "SendInterfaceunifiedOnResponseToSystemManager(%s)"; + char l_cBuf[sizeof(l_cFormat) + strlen(f_pProtocolName) + 1]; // NOLINT (runtime/arrays) + snprintf(l_cBuf, sizeof(l_cBuf), l_cFormat, f_pProtocolName); + LOG_STATUS_IF_ERRORED(l_eStatus, l_cBuf); + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of CommonSystemManagerStartStopCallbackProcessing( + + +/////////////////////////////////////////////////////////// +/// Function: SendInterfaceunifiedOnStopResponseToSystemManager() +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendInterfaceunifiedOnStopResponseToSystemManager(EFrameworkunifiedStatus f_eStatus) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = SendInterfaceunifiedOnResponseToSystemManager( + SS_SM_STOP_COMPL_RSPN, "SS_SM_STOP_COMPL_RSPN", "FrameworkunifiedOnStop()", + MODULE_STATE_STOPPED, MODULE_STATE_STOP_FAILED, f_eStatus); + LOG_STATUS_IF_ERRORED(l_eStatus, "SendInterfaceunifiedOnResponseToSystemManager(" + "SS_SM_STOP_COMPL_RSPN"); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of EFrameworkunifiedStatus SendInterfaceunifiedOnStopResponseToSystemManager(EFrameworkunifiedStatus f_eStatus) + +/////////////////////////////////////////////////////////// +/// Function: GetInterfaceunifiedOnStartExtInfo() +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus GetInterfaceunifiedOnStartExtInfo(T_SS_SM_START_ExtDataStructType &f_info) { // NOLINT (runtime/references) + EFrameworkunifiedStatus l_eStatus; + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + l_eStatus = InvokeSyncRequestToSystemManager( + SS_SM_GET_START_EXT_INFO, "SS_SM_GET_START_EXT_INFO", 0, NULL, + sizeof(T_SS_SM_START_ExtDataStructType), (PVOID) & f_info); + LOG_STATUS_IF_ERRORED(l_eStatus, "InvokeSyncRequestToSystemManager()"); + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////// +/// Function: GetInterfaceunifiedOnStopExtInfo() +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus GetInterfaceunifiedOnStopExtInfo(T_SS_SM_STOP_ExtDataStructType &f_info) { // NOLINT (runtime/references) + EFrameworkunifiedStatus l_eStatus; + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + l_eStatus = InvokeSyncRequestToSystemManager( + SS_SM_GET_STOP_EXT_INFO, "SS_SM_GET_STOP_EXT_INFO", 0, NULL, + sizeof(T_SS_SM_STOP_ExtDataStructType), (PVOID) & f_info); + LOG_STATUS_IF_ERRORED(l_eStatus, "InvokeSyncRequestToSystemManager()"); + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +// LCOV_EXCL_START 6:Because the condition cannot be set +/////////////////////////////////////////////////////////// +/// Function: OnSystemManagerDebugDump +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus OnSystemManagerDebugDump(HANDLE hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + FrameworkunifiedDefaultCallbackHandler cbFuncs; + + g_moduleState = MODULE_STATE_DEBUG_DUMPING; + l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs); + LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()"); + + if (cbFuncs.onDebugDump) { + l_eStatus = cbFuncs.onDebugDump(hApp); + LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedOnDebugDump()"); + } else { + SS_ASERT(0); + } + + l_eStatus = DebugDumpAppCbStatistics(hApp); + LOG_STATUS_IF_ERRORED(l_eStatus, "DebugDumpAppCbStatistics()"); + + l_eStatus = DebugDumpMemoryMap(hApp); + LOG_STATUS_IF_ERRORED(l_eStatus, "DebugDumpMemoryMap()"); + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of EFrameworkunifiedStatus OnSystemManagerDebugDump( HANDLE hApp ) + +/////////////////////////////////////////////////////////// +/// Function: DebugDumpAppCbStatistics +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus DebugDumpAppCbStatistics(HANDLE hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; +l_eStatus = eFrameworkunifiedStatusOK; + +FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); +return l_eStatus; +} + +/////////////////////////////////////////////////////////// +/// Function: DebugDumpMemoryMap +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus DebugDumpMemoryMap(HANDLE hApp) { +#define MEM_MAP_READ_SIZE 4096 +#define DUMP_MAX_SIZE 131072 // 128KB + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail; + char buf[MEM_MAP_READ_SIZE]; + std::string bufString; + int fd, ret; + + fd = open("/proc/self/maps", O_RDONLY); + if (fd != -1) { + while ((ret = read(fd, buf, MEM_MAP_READ_SIZE)) > 0) { + if ((bufString.size() + ret) > DUMP_MAX_SIZE) { + // If read it again, it will break because it overflows + break; + } + bufString.append(buf, ret); + } + close(fd); + if (ret >= 0) { + l_eStatus = eFrameworkunifiedStatusOK; + SendDebugDumpResponseToSystemManager(bufString); + } + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} +// LCOV_EXCL_STOP + +////////////////////////////////////////// +// SendDebugDumpResponseToSystemManager +////////////////////////////////////////// +VOID SendDebugDumpResponseToSystemManager(BOOL f_bFormatStrRequired, + PCSTR f_cFormat, ...) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + va_list l_argList; + const UI_32 l_maxDebugDumpMsgSize = (1024 * 4); + CHAR l_cMsg[l_maxDebugDumpMsgSize] = { 0 }; + PCSTR l_pAppName; + + pthread_mutex_lock(&gMutexObj); + + l_pAppName = FrameworkunifiedGetAppName(g_SystemIf_hApp); // LCOV_EXCL_BR_LINE 11:Unexpected branch + if (f_bFormatStrRequired) { + // build a format string + // Format: AppName/debugdump_data + snprintf(l_cMsg, l_maxDebugDumpMsgSize, "%s/", l_pAppName); + } + + va_start(l_argList, f_cFormat); + vsnprintf(&l_cMsg[strlen(l_cMsg)], l_maxDebugDumpMsgSize - strlen(l_cMsg), + f_cFormat, l_argList); + va_end(l_argList); + + if (0 == strcmp(SERVICE_SYSMANAGER, l_pAppName)) { + l_eStatus = FrameworkunifiedSendSelf(g_SystemIf_hApp, SS_SM_DEBUG_DUMP_RSPN, + strlen(l_cMsg) + 1, l_cMsg); // LCOV_EXCL_BR_LINE 11:Unexpected branch + LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSendSelf(SS_SM_DEBUG_DUMP_RSPN)"); + } else if (NULL != g_tSystemManagerSession.hService) { + l_eStatus = FrameworkunifiedSendMsg(g_tSystemManagerSession.hService, + SS_SM_DEBUG_DUMP_RSPN, strlen(l_cMsg) + 1, l_cMsg); // LCOV_EXCL_BR_LINE 11:Unexpected branch + LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSendMsg(SS_SM_DEBUG_DUMP_RSPN)"); + } else { + l_eStatus = eFrameworkunifiedStatusNullPointer; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + " Error: Invalid handle[g_tSystemManagerSession.hService == NULL]"); + } + + pthread_mutex_unlock(&gMutexObj); + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); +} // End of EFrameworkunifiedStatus SendDebugDumpResponseToSystemManager( HANDLE hApp ) + +// LCOV_EXCL_START 6:Because the condition cannot be set +////////////////////////////////////////// +// SendDebugDumpResponseToSystemManager +////////////////////////////////////////// +VOID SendDebugDumpResponseToSystemManager(std::string & f_messageStr) { // NOLINT (runtime/references) + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + + pthread_mutex_lock(&gMutexObj); + + if (0 == strcmp(SERVICE_SYSMANAGER, FrameworkunifiedGetAppName(g_SystemIf_hApp))) { + l_eStatus = FrameworkunifiedSendSelf(g_SystemIf_hApp, SS_SM_DEBUG_DUMP_RSPN, + f_messageStr.size() + 1, f_messageStr.c_str()); + LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSendSelf(SS_SM_DEBUG_DUMP_RSPN)"); + } else if (NULL != g_tSystemManagerSession.hService) { + l_eStatus = FrameworkunifiedSendMsg(g_tSystemManagerSession.hService, + SS_SM_DEBUG_DUMP_RSPN, f_messageStr.size() + 1, + f_messageStr.c_str()); + LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSendMsg(SS_SM_DEBUG_DUMP_RSPN)"); + } else { + l_eStatus = eFrameworkunifiedStatusNullPointer; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: hService = NULL"); + } + + pthread_mutex_unlock(&gMutexObj); + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); +} // End of EFrameworkunifiedStatus SendDebugDumpResponseToSystemManager(std::string & f_messageStr) +// LCOV_EXCL_STOP + +/////////////////////////////////////////////////////////// +/// Function: SendInterfaceunifiedOnResponseToSystemManager() +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendInterfaceunifiedOnResponseToSystemManager( + SS_SystemManagerProtocol f_ProtocolID, PCSTR f_pProtocolName, + PCSTR f_InterfaceunifiedOnFncName, ModuleStateType f_moduleSuccessState, + ModuleStateType f_moduleFailureState, EFrameworkunifiedStatus f_eStatus) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + + if (eFrameworkunifiedStatusOK != f_eStatus) { + FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, + " Warning: '%s' returned %d/%s, NOT sending '%s' to System Manager", + f_InterfaceunifiedOnFncName, f_eStatus, GetStr(f_eStatus).c_str(), + f_pProtocolName); + l_eStatus = f_eStatus; + SetModuleState(f_moduleFailureState); + } else { + if (f_moduleSuccessState == g_moduleState) { + FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, + " Warning: Module state already is '%s', just " + "returning '%s' to System Manager", + GetStr(g_moduleState).c_str(), f_pProtocolName); + } + + l_eStatus = SendMsgToSystemManager(static_cast<UI_32>(f_ProtocolID), + f_pProtocolName, + sizeof(g_responseCompleteAck), + &g_responseCompleteAck); // LCOV_EXCL_BR_LINE 11:Unexpected branch + const char l_cFormat[] = "SendMsgToSystemManager(%s)"; + char l_cBuf[sizeof(l_cFormat) + strlen(f_pProtocolName) + 1]; // NOLINT (runtime/arrays) + snprintf(l_cBuf, sizeof(l_cBuf), l_cFormat, f_pProtocolName); + LOG_STATUS(l_eStatus, l_cBuf); + SetModuleState(f_moduleSuccessState); + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of SendInterfaceunifiedOnResponseToSystemManager( + +/////////////////////////////////////////////////////////// +/// Function: SendMsgToSystemManager +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendMsgToSystemManager(UI_32 uiCmd, PCSTR f_pCmdName, UI_32 uiLength, + PCVOID pData) { + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Sending %s", f_pCmdName); + + return SendMsgToSystemManager(uiCmd, uiLength, pData); +} // End of EFrameworkunifiedStatus SendMsgToSystemManager(UI_32 uiCmd, PCSTR f_pCmdName, UI_32 uiLength, PCVOID pData) + +/////////////////////////////////////////////////////////// +/// Function: SendMsgToSystemManager +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendMsgToSystemManager(UI_32 uiCmd, UI_32 uiLength, PCVOID pData) { + EFrameworkunifiedStatus l_eStatus; + if (NULL == g_tSystemManagerSession.hService) { + l_eStatus = eFrameworkunifiedStatusNullPointer; + LOG_ERROR("NULL == g_tSystemManagerSession.hService"); + } else { + pthread_mutex_lock(&gMutexObj); + l_eStatus = FrameworkunifiedSendMsg(g_tSystemManagerSession.hService, uiCmd, uiLength, + pData); + pthread_mutex_unlock(&gMutexObj); + LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSendMsg()"); + } + return l_eStatus; +} // End of EFrameworkunifiedStatus SendMsgToSystemManager(UI_32 uiCmd, UI_32 uiLength, PCVOID pData) + +/////////////////////////////////////////////////////////// +/// Function: InvokeSyncRequestToSystemManager +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus InvokeSyncRequestToSystemManager(UI_32 uiCmd, PCSTR f_pCmdName, + UI_32 uiLength, PCVOID pData, + UI_32 uiResLength, PVOID pResData) { + EFrameworkunifiedStatus l_eStatus; + UI_32 uiRcvLength = 0; + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Sending %s", f_pCmdName); + + if (NULL == g_tSystemManagerSession.hService) { + l_eStatus = eFrameworkunifiedStatusNullPointer; + LOG_ERROR("NULL == g_tSystemManagerSession.hService"); + } else { + pthread_mutex_lock(&gMutexObj); + l_eStatus = FrameworkunifiedInvokeSync(g_tSystemManagerSession.hService, uiCmd, uiLength, + pData, uiResLength, pResData, &uiRcvLength); // LCOV_EXCL_BR_LINE 11:Unexpected branch + if (eFrameworkunifiedStatusOK == l_eStatus) { + if (uiResLength != uiRcvLength) { + LOG_ERROR("uiResLength != uiRcvLength"); + l_eStatus = eFrameworkunifiedStatusFail; + } + } + pthread_mutex_unlock(&gMutexObj); + LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedInvokeSync()"); + } + return l_eStatus; +} // End of Function + +// LCOV_EXCL_START 6:Because the condition cannot be set +/////////////////////////////////////////////////////////// +/// Function: SendWakeUpToSystemManager +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendWakeUpToSystemManager(wakeInfo *pData) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = SendMsgToSystemManager(SS_SM_WAKEUP_MODULES, + "SS_SM_WAKEUP_MODULES", + sizeof(wakeInfo), + (PCVOID) pData); + LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()"); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of EFrameworkunifiedStatus SendWakeUpToSystemManager(wakeInfo *pData) +// LCOV_EXCL_STOP + +// LCOV_EXCL_START 6:Because the condition cannot be set +/////////////////////////////////////////////////////////// +/// Function: SendShutdownToSystemManager +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendShutdownToSystemManager(Pwr_ServiceSetInterface *pData) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = SendMsgToSystemManager(SS_SM_SHUTDOWN_MODULES, + "SS_SM_SHUTDOWN_MODULES", + sizeof(Pwr_ServiceSetInterface), + (PCVOID) pData); + LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()"); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of EFrameworkunifiedStatus SendShutdownToSystemManager(Pwr_ServiceSetInterface *pData) +// LCOV_EXCL_STOP + +/////////////////////////////////////////////////////////// +/// Function: RegisterSMSessionAckCallback +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus RegisterSMSessionAckCallback(EFrameworkunifiedStatus (*CallbackPtr)(HANDLE)) { + CallbackFnPtr = CallbackPtr; + return eFrameworkunifiedStatusOK; +} // End of EFrameworkunifiedStatus RegisterSMSessionAckCallback(EFrameworkunifiedStatus (*CallbackPtr)(HANDLE)) + +// LCOV_EXCL_START 6:Because the condition cannot be set +/////////////////////////////////////////////////////////// +/// Function: SendSystemModeRequestToSystemManager +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendSystemModeRequestToSystemManager(void) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = SendMsgToSystemManager(SS_SM_SYSTEM_MODE_INFO_REQ, + "SS_SM_SYSTEM_MODE_INFO_REQ", 0, + NULL); + LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()"); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of EFrameworkunifiedStatus SendSystemModeRequestToSystemManager(void) + +/////////////////////////////////////////////////////////// +/// Function: SendInitCompReportToSystemManager +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendInitCompReportToSystemManager(void) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = SendMsgToSystemManager(SS_SM_INITCOMP_REP, + "SS_SM_INITCOMP_REP", 0, NULL); + LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()"); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of EFrameworkunifiedStatus SendInitCompReportToSystemManager(void) + + +/////////////////////////////////////////////////////////// +/// Function: AttachCallbackToSystemManager +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus AttachCallbackToSystemManager(HANDLE hApp, UI_32 iCmd, + CbFuncPtr fpOnCmd) { + return FrameworkunifiedAttachCallbackToDispatcher( + hApp, g_tSystemManagerSession.szServiceName.c_str(), iCmd, fpOnCmd); +} // End of EFrameworkunifiedStatus AttachCallbackToSystemManager( HANDLE hApp, UI_32 iCmd, CbFuncPtr fpOnCmd ) +// LCOV_EXCL_STOP + +/////////////////////////////////////////////////////////// +/// Function: SetDataResetModeToSystemManager +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SetDataResetModeToSystemManager(ESMDataResetModeInfo dataResetMode) { + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + EFrameworkunifiedStatus l_resData; + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + switch (dataResetMode) { + case e_SS_SM_DATA_RESET_MODE_NONE: + case e_SS_SM_DATA_RESET_MODE_USER: + case e_SS_SM_DATA_RESET_MODE_FACTORY: + break; + default: + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "dataResetMode %d", dataResetMode); + return eFrameworkunifiedStatusInvldParam; + } + + l_eStatus = InvokeSyncRequestToSystemManager(SS_SM_DATA_RESET_MODE_SET_REQ, + "SS_SM_DATA_RESET_MODE_SET_REQ", + sizeof(dataResetMode), + (PVOID) & dataResetMode, + sizeof(l_resData), + (PVOID) & l_resData); // LCOV_EXCL_BR_LINE 11:Unexpected branch + LOG_STATUS_IF_ERRORED(l_eStatus, "InvokeSyncRequestToSystemManager()"); + + if (eFrameworkunifiedStatusOK == l_eStatus) { + if (eFrameworkunifiedStatusOK != l_resData) { + l_eStatus = l_resData; + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " l_eStatus %d", l_eStatus); + } + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of EFrameworkunifiedStatus SetDataResetModeToSystemManager(ESMDataResetModeInfo dataResetMode) + +/////////////////////////////////////////////////////////// +/// Function: SetProgUpdateStateToSystemManager +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SetProgUpdateStateToSystemManager( + SMProgUpdateState progUpdateState) { + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + EFrameworkunifiedStatus l_resData; + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + if (progUpdateState & SS_SM_PROG_UPDATE_STATE_UPDATED) { + } else if (progUpdateState & SS_SM_PROG_UPDATE_STATE_MAP_UPDATED) { + } else if (progUpdateState & SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED) { + } else { + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "unknown %#x", progUpdateState); + return eFrameworkunifiedStatusInvldParam; + } + + l_eStatus = InvokeSyncRequestToSystemManager( + SS_SM_PROG_UPDATE_STATE_SET_REQ, "SS_SM_PROG_UPDATE_STATE_SET_REQ", + sizeof(progUpdateState), (PVOID) & progUpdateState, sizeof(l_resData), + (PVOID) & l_resData); // LCOV_EXCL_BR_LINE 11:Unexpected branch + LOG_STATUS_IF_ERRORED(l_eStatus, "InvokeSyncRequestToSystemManager()"); + + if ((eFrameworkunifiedStatusOK == l_eStatus) && (eFrameworkunifiedStatusOK != l_resData)) { + l_eStatus = l_resData; + LOG_ERROR("SM RESP"); + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of EFrameworkunifiedStatus SetProgUpdateStateToSystemManager(SMProgUpdateState progUpdateState) + +/////////////////////////////////////////////////////////// +/// Function: SetNextWakeupTypeToSystemManager +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SetNextWakeupTypeToSystemManager(ESMNextWakeupType f_wakeupType) { + EFrameworkunifiedStatus l_eStatus; + EFrameworkunifiedStatus l_resData; + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + switch (f_wakeupType) { + case e_SS_SM_NEXT_WAKEUP_TYPE_NONE: + case e_SS_SM_NEXT_WAKEUP_TYPE_COLD: + case e_SS_SM_NEXT_WAKEUP_TYPE_HOT: + break; + default: + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "unknown type(%d)", f_wakeupType); + return eFrameworkunifiedStatusInvldParam; + } + + l_eStatus = InvokeSyncRequestToSystemManager(SS_SM_NEXT_WAKEUP_TYPE_SET_REQ, + "SS_SM_NEXT_WAKEUP_TYPE_SET_REQ", + sizeof(f_wakeupType), + (PVOID) & f_wakeupType, + sizeof(l_resData), + (PVOID) & l_resData); // LCOV_EXCL_BR_LINE 11:Unexpected branch + LOG_STATUS_IF_ERRORED(l_eStatus, "InvokeSyncRequestToSystemManager()"); + + if (eFrameworkunifiedStatusOK == l_eStatus) { + if (eFrameworkunifiedStatusOK != l_resData) { + l_eStatus = l_resData; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " l_eStatus %d", l_eStatus); + } + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +/////////////////////////////////////////////////////////// +/// Function: SendCpuResetRequestToSystemManager +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendCpuResetRequestToSystemManager( + ESMCpuResetReason l_eCpuResetReason, std::string f_messageStr/* = "" */, + std::string f_suffixStr/* = "" */) { + TSystemManagerCpuResetInfo l_resetInfo; // LCOV_EXCL_BR_LINE 11:Unexpected branch + EFrameworkunifiedStatus l_eStatus; + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + + l_resetInfo.resetReason = l_eCpuResetReason; + snprintf(l_resetInfo.messageStr, SS_SM_RESET_MSG_STR_SIZE, "%s", + f_messageStr.c_str()); // LCOV_EXCL_BR_LINE 11:Unexpected branch + snprintf(l_resetInfo.suffixStr, SS_SM_SUFFIX_STR_SIZE, "%s", + f_suffixStr.c_str()); // LCOV_EXCL_BR_LINE 11:Unexpected branch + + l_eStatus = SendMsgToSystemManager(SS_SM_CPU_RESET_REQ, "SS_SM_CPU_RESET_REQ", + sizeof(l_resetInfo), + (PVOID) & l_resetInfo); // LCOV_EXCL_BR_LINE 11:Unexpected branch + + LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()"); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of SendCpuResetRequestToSystemManager + +/////////////////////////////////////////////////////////// +/// Function: SendStartupConfirmationToSystemManager +/// +/////////////////////////////////////////////////////////// +// LCOV_EXCL_START 6:Because the condition cannot be set +EFrameworkunifiedStatus SendStartupConfirmationToSystemManager( + StartupConfirmationMsgStrut &f_startupConfirmationMsg) { //NOLINT (runtime/references) + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + + Pwr_ServiceSetInterface tServiceSetIf; + tServiceSetIf.data.startupConfirmationMsg = f_startupConfirmationMsg; + + l_eStatus = SendMsgToSystemManager(SS_SM_FWD_STARTUP_CONFIRMATION_MSG_REQ, + "SS_SM_FWD_STARTUP_CONFIRMATION_MSG_REQ", + sizeof(Pwr_ServiceSetInterface), + (PCVOID) & tServiceSetIf); + LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()"); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of EFrameworkunifiedStatus SendStartupConfirmationToSystemManager( +// LCOV_EXCL_STOP + +// LCOV_EXCL_START 6:Because the condition cannot be set +EFrameworkunifiedStatus SendSystemErrorToSystemManager(EFrameworkunifiedSystemError f_systemError) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = SendMsgToSystemManager(SS_SM_PROPAGATE_SYSTEM_ERROR, + sizeof(f_systemError), + reinterpret_cast<void*>(&f_systemError)); + LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()"); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +EFrameworkunifiedStatus Send_CWORD56_HeartBeatRequestToSystemManager( + EPWR_HB_REQ_MSG_STRUCT f_HbReq) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = SendMsgToSystemManager(SS_SM__CWORD56__HEARTBEAT_REQ, + sizeof(f_HbReq), + reinterpret_cast<void*>(&f_HbReq)); + LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()"); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} +// LCOV_EXCL_STOP + +VOID Set_UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc_StateVar(BOOL f_SetTrue) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc = f_SetTrue; + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, + " UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc set '%s'", + UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc ? "True" : "False"); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); +} + +EFrameworkunifiedStatus SendBootMicroResetNotificationToSystemManager( + eSMBootMicroResetReason f_ResetReason) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + + l_eStatus = SendMsgToSystemManager(SS_SM_BOOT_MICRO_RESET_NTF, + "SS_SM_BOOT_MICRO_RESET_NTF", + sizeof(f_ResetReason), &f_ResetReason); + + LOG_STATUS_IF_ERRORED(l_eStatus, + "SendMsgToSystemManager(SS_SM_BOOT_MICRO_RESET_NTF)"); + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +EFrameworkunifiedStatus SendUserInvokedLoggingRequestToSystemManager( + eSMUserLogType f_userInvokedLogType, std::string f_messageStr/* = "" */, + std::string f_suffixStr/* = "" */) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + + try { + switch (f_userInvokedLogType) { + case e_SS_SM_CAPTURE_ALL_LOGS: + case e_SS_SM_SCREEN_CAPTURE: + case e_SS_SM_CAPTURE_INTERFACEUNIFIED_LOGS: + case e_SS_SM_CAPTURE_DEV_LOGS: + case e_SS_SM_CAPTURE_MODULE_LOGS: + case e_SS_SM_CAPTURE_DTC_LOGS: + case e_SS_SM_CAPTURE_NAVI_LOGS: + case e_SS_SM_CAPTURE_GROUP_RELAUNCH: + break; + default: + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: Unknown key ID '%d'", + f_userInvokedLogType); + throw eFrameworkunifiedStatusInvldParam; + break; + } + + TSystemManagerLoggingRequestInfo l_logInfo = { }; + + snprintf(l_logInfo.messageStr, SS_SM_LOG_MSG_STR_SIZE, "%s", + f_messageStr.c_str()); // LCOV_EXCL_BR_LINE 11:Unexpected branch + snprintf(l_logInfo.suffixStr, SS_SM_SUFFIX_STR_SIZE, "%s", + f_suffixStr.c_str()); // LCOV_EXCL_BR_LINE 11:Unexpected branch + + l_logInfo.logType = f_userInvokedLogType; + l_eStatus = SendMsgToSystemManager(SS_SM_USER_INVOKED_LOG_REQ, + "SS_SM_USER_INVOKED_LOG_REQ", + sizeof(l_logInfo), &l_logInfo); // LCOV_EXCL_BR_LINE 11:Unexpected branch + LOG_STATUS_IF_ERRORED(l_eStatus, + "SendMsgToSystemManager(SS_SM_USER_INVOKED_LOG_REQ)"); + } catch (EFrameworkunifiedStatus e) { + l_eStatus = e; + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return (l_eStatus); // LCOV_EXCL_BR_LINE 11:Unexpected branch +} + +// LCOV_EXCL_START 6:Because the condition cannot be set +EFrameworkunifiedStatus SendDiagLoggingRequestToSystemManager( + std::string f_copyDestPathStr) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + + l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_DIAG_LOG_REQ, + "SS_SM_ERROR_EVENT_DIAG_LOG_REQ", + f_copyDestPathStr.length() + 1, + f_copyDestPathStr.c_str()); + LOG_STATUS_IF_ERRORED( + l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_DIAG_LOG_REQ)"); + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return (l_eStatus); +} + +EFrameworkunifiedStatus SendCANLoggingRequestToSystemManager(void) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + + l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_CAN_LOG_REQ, + "SS_SM_ERROR_EVENT_CAN_LOG_REQ", 0, NULL); + + LOG_STATUS_IF_ERRORED( + l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_CAN_LOG_REQ)"); + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return (l_eStatus); +} + +EFrameworkunifiedStatus SendDTCLoggingRequestToSystemManager(UI_32 f_dtc) { + SS_ASERT(0); + return eFrameworkunifiedStatusOK; +} +// LCOV_EXCL_STOP + +EFrameworkunifiedStatus RegisterBootMicroLogRequestCb(HANDLE hApp, CbFuncPtr fpOnCmd) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + + if (NULL == hApp) { + l_eStatus = eFrameworkunifiedStatusNullPointer; + LOG_ERROR("(NULL == hApp)"); + } else if (NULL == fpOnCmd) { + l_eStatus = eFrameworkunifiedStatusNullPointer; + LOG_ERROR("(NULL == fpOnCmd)"); + } else { + l_eStatus = FrameworkunifiedSubscribeToSessionEventWithCallback( + hApp, SS_SM_BOOT_MICRO_LOG_REQ, fpOnCmd, + g_tSystemManagerSession.hService); // LCOV_EXCL_BR_LINE 11:Unexpected branch + + LOG_STATUS_IF_ERRORED( + l_eStatus, + "FrameworkunifiedSubscribeToSessionEventWithCallback(SS_SM_BOOT_MICRO_LOG_REQ)"); + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return (l_eStatus); +} + +EFrameworkunifiedStatus SendBootMicroLogResponseToSystemManager(std::string f_logString) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + + l_eStatus = SendMsgToSystemManager(SS_SM_BOOT_MICRO_LOG_RSP, + "SS_SM_BOOT_MICRO_LOG_RSP", + f_logString.size() + 1, + f_logString.c_str()); + + LOG_STATUS_IF_ERRORED(l_eStatus, + "SendMsgToSystemManager(SS_SM_BOOT_MICRO_LOG_RSP)"); + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} + +// LCOV_EXCL_START 6:Because the condition cannot be set +EFrameworkunifiedStatus DetachCallbacksFromInterfaceunifiedDispatcher( + HANDLE hApp, PCSTR pServiceName, + const FrameworkunifiedProtocolCallbackHandler* pMsgHandler, UI_32 uiHandlerCount, + HANDLE hSession) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + PUI_32 l_puiCmdIdArray; + + if (NULL == pServiceName) { + l_eStatus = eFrameworkunifiedStatusInvldParam; + LOG_ERROR("NULL == pServiceName"); + } else if (NULL == pMsgHandler) { + l_eStatus = eFrameworkunifiedStatusInvldParam; + LOG_ERROR("NULL == pMsgHandler"); + } else if (0 == uiHandlerCount) { + l_eStatus = eFrameworkunifiedStatusInvldParam; + LOG_ERROR("0 == uiHandlerCount"); + } else if (NULL == hSession) { + l_eStatus = eFrameworkunifiedStatusInvldParam; + LOG_ERROR("NULL == hSession"); + } else if (NULL + == (l_puiCmdIdArray = new (std::nothrow) UI_32[uiHandlerCount])) { + l_eStatus = eFrameworkunifiedStatusNullPointer; + LOG_ERROR("new (std::nothrow)UI_32[ uiHandlerCount ]"); + } else { + LoadCbHandlerCmdIDsIntoDetachCbIDsArray(pMsgHandler, l_puiCmdIdArray, + uiHandlerCount); + + l_eStatus = FrameworkunifiedDetachCallbacksFromDispatcher(hApp, pServiceName, + l_puiCmdIdArray, + uiHandlerCount, hSession); + LOG_STATUS(l_eStatus, "FrameworkunifiedDetachCallbacksFromDispatcher()"); + delete[] l_puiCmdIdArray; + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of EFrameworkunifiedStatus DetachCallbacksFromInterfaceunifiedDispatcher(HANDLE hApp, + +EFrameworkunifiedStatus DetachParentCallbacksFromInterfaceunifiedDispatcher( + HANDLE hApp, const FrameworkunifiedProtocolCallbackHandler* pMsgHandler, + UI_32 uiHandlerCount) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + PUI_32 l_puiCmdIdArray; + + if (NULL == pMsgHandler) { + l_eStatus = eFrameworkunifiedStatusInvldParam; + LOG_ERROR("NULL == pMsgHandler"); + } else if (0 == uiHandlerCount) { + l_eStatus = eFrameworkunifiedStatusInvldParam; + LOG_ERROR("0 == uiHandlerCount"); + } else if (NULL + == (l_puiCmdIdArray = new (std::nothrow) UI_32[uiHandlerCount])) { + l_eStatus = eFrameworkunifiedStatusNullPointer; + LOG_ERROR("new (std::nothrow)UI_32[ uiHandlerCount ]"); + } else { + LoadCbHandlerCmdIDsIntoDetachCbIDsArray(pMsgHandler, l_puiCmdIdArray, + uiHandlerCount); + + l_eStatus = FrameworkunifiedDetachParentCallbacksFromDispatcher(hApp, l_puiCmdIdArray, + uiHandlerCount); + LOG_STATUS(l_eStatus, "FrameworkunifiedDetachParentCallbacksFromDispatcher()"); + delete[] l_puiCmdIdArray; + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} // End of EFrameworkunifiedStatus DetachParentCallbacksFromInterfaceunifiedDispatcher(HANDLE hApp, + +VOID LoadCbHandlerCmdIDsIntoDetachCbIDsArray( + const FrameworkunifiedProtocolCallbackHandler* pMsgHandler, UI_32 * puiCmdIdArray, + UI_32 uiHandlerCount) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + for (UI_32 i = 0; i < uiHandlerCount; i++) { + puiCmdIdArray[i] = pMsgHandler[i].iCmd; + } + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); +} // End of VOID LoadCbHandlerCmdIDsIntoDetachCbIDsArray(const FrameworkunifiedProtocolCallbackHandler* pMsgHandler, + +/////////////////////////////////////////////////////////// +/// Function: SendLogStartRequestToSystemManager +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendLogStartRequestToSystemManager(EErrorEventType f_errorEvent) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + + l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_LOGGING_START_REQ, + "SS_SM_ERROR_EVENT_LOGGING_START_REQ", + sizeof(f_errorEvent), &f_errorEvent); + + LOG_STATUS_IF_ERRORED( + l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_LOGGING_START_REQ)"); + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return (l_eStatus); +} + +/////////////////////////////////////////////////////////// +/// Function: SendLogArtifactRequestToSystemManager +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendLogArtifactRequestToSystemManager(EArtifactId f_artifactId) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + + l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_ARTIFACT_REQ, + "SS_SM_ERROR_EVENT_ARTIFACT_REQ", + sizeof(f_artifactId), &f_artifactId); + + LOG_STATUS_IF_ERRORED( + l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_ARTIFACT_REQ)"); + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return (l_eStatus); +} + +/////////////////////////////////////////////////////////// +/// Function: SendLogCompleteRequestToSystemManager +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendLogCompleteRequestToSystemManager(EFrameworkunifiedStatus f_eStatus) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + + if (eFrameworkunifiedStatusOK != f_eStatus) { + l_eStatus = eFrameworkunifiedStatusFail; + } else { + l_eStatus = f_eStatus; + } + + l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_LOGGING_COMPLETE, + "SS_SM_ERROR_EVENT_LOGGING_COMPLETE", + sizeof(l_eStatus), &l_eStatus); + + LOG_STATUS_IF_ERRORED( + l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_LOGGING_COMPLETE)"); + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return (l_eStatus); +} + +/////////////////////////////////////////////////////////// +/// Function: SendEelExportRequestToSystemManager +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendEelExportRequestToSystemManager(std::string f_path) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + + l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_EEL_EXPORT_REQ, + "SS_SM_ERROR_EVENT_EEL_EXPORT_REQ", + f_path.length() + 1, f_path.c_str()); + + LOG_STATUS_IF_ERRORED( + l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_EEL_EXPORT_REQ)"); + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return (l_eStatus); +} +// LCOV_EXCL_STOP + +/////////////////////////////////////////////////////////// +/// Function: SendInterfaceunifiedEmmcLogsRequestToSystemManager +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendInterfaceunifiedEmmcLogsRequestToSystemManager(std::string f_path) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + + l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_REQ, + "SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_REQ", + f_path.length() + 1, f_path.c_str()); + + LOG_STATUS_IF_ERRORED( + l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_REQ)"); + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return (l_eStatus); +} + +/////////////////////////////////////////////////////////// +/// Function: SendClearLogsRequestToSystemManager +/// +/////////////////////////////////////////////////////////// +EFrameworkunifiedStatus SendClearLogsRequestToSystemManager( + TSystemManagerClearLogsInfo *f_info) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus; + + if (!f_info) { + l_eStatus = eFrameworkunifiedStatusInvldParam; + } else { + l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_CLR_LOGS_REQ, + "SS_SM_ERROR_EVENT_CLR_LOGS_REQ", 0, + NULL); + + LOG_STATUS_IF_ERRORED( + l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_CLR_LOGS_REQ)"); + } + + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return (l_eStatus); +} + +VOID SetModuleState(ModuleStateType f_moduleState, BOOL f_bLog) { + if (f_bLog) { // LCOV_EXCL_BR_LINE 8:f_bLog is true only + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Changing SM_IF state from '%s' to '%s'", + GetStr(g_moduleState).c_str(), GetStr(f_moduleState).c_str()); + } + g_moduleState = f_moduleState; +} // LCOV_EXCL_BR_LINE 10:Because the last line +// End of VOID ModuleLaunchParams::SetModuleState(SMModuleState f_moduleState ) + +// EOF /SS_SystemIf/src/ss_sm_client.cpp diff --git a/service/system/interface_unified/library/src/ss_string_maps.cpp b/service/system/interface_unified/library/src/ss_string_maps.cpp new file mode 100755 index 0000000..629043a --- /dev/null +++ b/service/system/interface_unified/library/src/ss_string_maps.cpp @@ -0,0 +1,462 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_SystemManagerIf +/// \brief This file provides support for the System Manager client interface. +/// +/////////////////////////////////////////////////////////////////////////////// + +#include "system_service/ss_string_maps.h" +#include <native_service/frameworkunified_types.h> +#include <native_service/ns_logger_if.h> +#include <map> +#include "system_service/ss_power_service.h" +#include "system_service/ss_templates.h" +#include "system_service/ss_system_manager_if.h" +#include "system_service/ss_system_manager_protocol.h" +#include "ss_system_if_interfaceunifiedlog.h" + +/* + * 't'emplate for string-map initialization functions +void Init_SS_xyz_StrMap(std::map<SS_xyz, SS_String> &m_strMap) +{ + MAP_ENTRY( m_strMap, ); + MAP_ENTRY( m_strMap, ); +} // End of void Init_SS_xyz_StrMap(std::map<SS_xyz, SS_String> &m_strMap) +*/ + + +//****************************************************************************** +void Init_eSMBootMicroResetReason_StrMap(std::map<eSMBootMicroResetReason, + SS_String> & m_strMap) { // NOLINT (runtime/references) + MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_RESET_REASON_SELF_RESET); + MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_RESET_REASON_USER_FORCE_RESET); + MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_RESET_REASON_DSP_RESET); + MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_RESET_REASON_HB_TIMEOUT); +} +class EnumStringMap< eSMBootMicroResetReason, + Init_eSMBootMicroResetReason_StrMap> + m_oeSMBootMicroResetReasonMap; +// LCOV_EXCL_START 6:Because the condition cannot be set +SS_String GetStr(eSMBootMicroResetReason f_enum) { + return m_oeSMBootMicroResetReasonMap.GetStr(f_enum); +} +// LCOV_EXCL_STOP + +//****************************************************************************** +void Init_EInterfaceunifiedSystemError_StrMap(std::map<EFrameworkunifiedSystemError, SS_String> & m_strMap) { // NOLINT (runtime/references) + MAP_ENTRY(m_strMap, eFrameworkunifiedSystemErrorNone); + MAP_ENTRY(m_strMap, eFrameworkunifiedDSPHardwareReset); +} +class EnumStringMap< EFrameworkunifiedSystemError, Init_EInterfaceunifiedSystemError_StrMap> m_oEInterfaceunifiedSystemErrorMap; +// LCOV_EXCL_START 6:Because the condition cannot be set +SS_String GetStr(EFrameworkunifiedSystemError f_enum) { + return m_oEInterfaceunifiedSystemErrorMap.GetStr(f_enum); +} +// LCOV_EXCL_STOP + +//****************************************************************************** +void Init_EErrorEventType_StrMap(std::map<EErrorEventType, SS_String> & m_strMap); // NOLINT (runtime/references) +class EnumStringMap< EErrorEventType, Init_EErrorEventType_StrMap> m_oEErrorEventTypeMap; +SS_String GetStr(EErrorEventType f_enum) { + return m_oEErrorEventTypeMap.GetStr(f_enum); +} + +//****************************************************************************** +void Init_BOOL_StrMap(std::map<BOOL, SS_String> & m_strMap) { // NOLINT (runtime/references) + MAP_ENTRY(m_strMap, TRUE); + MAP_ENTRY(m_strMap, FALSE); +} // End of void Init_BOOL_StrMap(std::map<BOOL, SS_String> & m_strMap) +class EnumStringMap< BOOL, Init_BOOL_StrMap> m_oBOOLMap; +SS_String GetStr(BOOL f_enum) { + return m_oBOOLMap.GetStr(f_enum); +} + +//****************************************************************************** +void Init_SS_LimpHomeCutoff_StrMap(std::map<EPWR_LHC_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references) + MAP_ENTRY(m_strMap, epslhcINVALID); + MAP_ENTRY(m_strMap, epslhcDISABLED); + MAP_ENTRY(m_strMap, epslhcENABLED); +} // End of void Init_SS_LimpHomeCutoff_StrMap(std::map<EPWR_LHC_TYPE, SS_String> & m_strMap) +class EnumStringMap< EPWR_LHC_TYPE, Init_SS_LimpHomeCutoff_StrMap> m_oSS_LimpHomeCutoffMap; +SS_String GetStr(EPWR_LHC_TYPE f_enum) { + return m_oSS_LimpHomeCutoffMap.GetStr(f_enum); +} + +//****************************************************************************** +void Init_SS_ProductionMode_StrMap(std::map<EPWR_PROD_MODE_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references) + MAP_ENTRY(m_strMap, epspmINVALID); + MAP_ENTRY(m_strMap, epspmDISABLED); + MAP_ENTRY(m_strMap, epspmENABLED); +} // End of void Init_SS_ProductionMode_StrMap(std::map<EPWR_PROD_MODE_TYPE, SS_String> & m_strMap) +class EnumStringMap< EPWR_PROD_MODE_TYPE, Init_SS_ProductionMode_StrMap> + m_oSS_ProductionModeMap; +SS_String GetStr(EPWR_PROD_MODE_TYPE f_enum) { + return m_oSS_ProductionModeMap.GetStr(f_enum); +} + +//****************************************************************************** +void Init_SS_StartupStage_StrMap(std::map<EPWR_STARTUP_STAGE_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references) + MAP_ENTRY(m_strMap, epssusfINVALID); + MAP_ENTRY(m_strMap, epssusSYSTEM_SERVICES_STARTED); + MAP_ENTRY(m_strMap, epssusALL_SERVICES_LAUNCHED); +} // End of void Init_SS_StartupStage_StrMap(std::map<EPWR_STARTUP_STAGE_TYPE, SS_String> & m_strMap) +class EnumStringMap< EPWR_STARTUP_STAGE_TYPE, Init_SS_StartupStage_StrMap> + m_oSS_StartupStageMap; +// LCOV_EXCL_START 6:Because the condition cannot be set +SS_String GetStr(EPWR_STARTUP_STAGE_TYPE f_enum) { + return m_oSS_StartupStageMap.GetStr(f_enum); +} +// LCOV_EXCL_STOP + +//****************************************************************************** +void Init_SS_SystemMode_StrMap(std::map<EPWR_SYSTEM_MODE_INFO, SS_String> & m_strMap) { // NOLINT (runtime/references) + MAP_ENTRY(m_strMap, epssinfINVALID); + MAP_ENTRY(m_strMap, epssinfNORMAL); + MAP_ENTRY(m_strMap, epssinfPROGRAMMING); +} // End of void Init_SS_SystemMode_StrMap(std::map<EPWR_SYSTEM_MODE_INFO, SS_String> & m_strMap) +class EnumStringMap< EPWR_SYSTEM_MODE_INFO, Init_SS_SystemMode_StrMap> + m_oSS_SystemModeMap; +// LCOV_EXCL_START 6:Because the condition cannot be set +SS_String GetStr(EPWR_SYSTEM_MODE_INFO f_enum) { + return m_oSS_SystemModeMap.GetStr(f_enum); +} +// LCOV_EXCL_STOP + +//****************************************************************************** +void Init_SS_TransportMode_StrMap(std::map<EPWR_TRANSPORT_MODE_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references) + MAP_ENTRY(m_strMap, epstmINVALID); + MAP_ENTRY(m_strMap, epstmDISABLED); + MAP_ENTRY(m_strMap, epstmENABLED); +} // End of void Init_SS_TransportMode_StrMap(std::map<EPWR_TRANSPORT_MODE_TYPE, SS_String> & m_strMap) +class EnumStringMap< EPWR_TRANSPORT_MODE_TYPE, Init_SS_TransportMode_StrMap> + m_oSS_TransportModeMap; +SS_String GetStr(EPWR_TRANSPORT_MODE_TYPE f_enum) { + return m_oSS_TransportModeMap.GetStr(f_enum); +} + +//****************************************************************************** +void Init_EInterfaceunifiedStatus_StrMap(std::map<EFrameworkunifiedStatus, SS_String> & m_strMap); // NOLINT (runtime/references) +class EnumStringMap< EFrameworkunifiedStatus, Init_EInterfaceunifiedStatus_StrMap> m_oEInterfaceunifiedStatusMap; +SS_String GetStr(EFrameworkunifiedStatus f_enum) { + return m_oEInterfaceunifiedStatusMap.GetStr(f_enum); +} + +//****************************************************************************** +void Init_SS_SystemManagerProtocol_StrMap(std::map<SS_SystemManagerProtocol, + SS_String> & m_strMap); // NOLINT (runtime/references) +class EnumStringMap< SS_SystemManagerProtocol, + Init_SS_SystemManagerProtocol_StrMap> m_oSSSMProtocolMap; +SS_String GetStr(SS_SystemManagerProtocol f_enum) { + return m_oSSSMProtocolMap.GetStr(f_enum); +} + +//****************************************************************************** +void Init_SS_ColdStart_StrMap(std::map<EPWR_SC_COLD_START_REQ_TYPE, + SS_String> &m_strMap) { // NOLINT (runtime/references) + MAP_ENTRY(m_strMap, epsscrtINVALID); + MAP_ENTRY(m_strMap, epsscrtNOT_REQUIRED); + MAP_ENTRY(m_strMap, epsscrtREQUIRED); +} +class EnumStringMap< EPWR_SC_COLD_START_REQ_TYPE, + Init_SS_ColdStart_StrMap> m_oSSColdStart_Map; +// LCOV_EXCL_START 6:Because the condition cannot be set +SS_String GetStr(EPWR_SC_COLD_START_REQ_TYPE f_enum) { + return m_oSSColdStart_Map.GetStr(f_enum); +} +// LCOV_EXCL_STOP + +//****************************************************************************** +void Init_SS__CWORD56__BootMode_StrMap(std::map<EPWR_SC__CWORD56__BOOT_MODE_TYPE, SS_String> &m_strMap) { // NOLINT (runtime/references) + MAP_ENTRY(m_strMap, eps_CWORD56_bmINVALID); + MAP_ENTRY(m_strMap, eps_CWORD56_bmAPPLICATION_MODE); + MAP_ENTRY(m_strMap, eps_CWORD56_bmPROGRAMMING_MODE); +} // End of void Init_SS__CWORD56__BootMode_StrMap(std::map<EPWR_SC__CWORD56__BOOT_MODE_TYPE, SS_String> &m_strMap) +class EnumStringMap< EPWR_SC__CWORD56__BOOT_MODE_TYPE, + Init_SS__CWORD56__BootMode_StrMap> m_oSS_CWORD56_BootMode_Map; +SS_String GetStr(EPWR_SC__CWORD56__BOOT_MODE_TYPE f_enum) { + return m_oSS_CWORD56_BootMode_Map.GetStr(f_enum); +} + +//****************************************************************************** +void Init_SS__CWORD102__BootMode_StrMap(std::map<ESMBootModeInfo, SS_String> &m_strMap) { // NOLINT (runtime/references) + MAP_ENTRY(m_strMap, e_SS_SM_BOOT_MODE_INVALID); + MAP_ENTRY(m_strMap, e_SS_SM_BOOT_MODE_APPLICATION); + MAP_ENTRY(m_strMap, e_SS_SM_BOOT_MODE_PROGRAMMING); +} // End of void Init_SS__CWORD102__BootMode_StrMap(std::map<ESMBootModeInfo, SS_String> &m_strMap) + +class EnumStringMap< ESMBootModeInfo, + Init_SS__CWORD102__BootMode_StrMap> m_oSS_CWORD102_BootMode_Map; +SS_String GetStr(ESMBootModeInfo f_enum) { + return m_oSS_CWORD102_BootMode_Map.GetStr(f_enum); +} + +//****************************************************************************** +void Init_SS_ShutdownTrigger_StrMap(std::map<EPWR_SHUTDOWN_TRIGGER_TYPE, + SS_String> & m_strMap); // NOLINT (runtime/references) +class EnumStringMap< EPWR_SHUTDOWN_TRIGGER_TYPE, + Init_SS_ShutdownTrigger_StrMap> m_oSSShutdownTrigger_Map; +SS_String GetStr(EPWR_SHUTDOWN_TRIGGER_TYPE f_enum) { + return m_oSSShutdownTrigger_Map.GetStr(f_enum); +} + +//****************************************************************************** +void Init_SS_UserMode_StrMap(std::map<EPWR_USER_MODE_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references) + // Map of System Services User Mode enum values to string description + MAP_ENTRY(m_strMap, epsumINVALID); + MAP_ENTRY(m_strMap, epsumOFF); + MAP_ENTRY(m_strMap, epsumON); +} // End of void Init_SS_UserMode_StrMap(std::map<EPWR_USER_MODE_TYPE, SS_String> & m_strMap) + +class EnumStringMap< EPWR_USER_MODE_TYPE, + Init_SS_UserMode_StrMap> m_oSSUserMode_Map; +SS_String GetStr(EPWR_USER_MODE_TYPE f_enum) { + return m_oSSUserMode_Map.GetStr(f_enum); +} + +//****************************************************************************** +void Init_SS_CpuResetReason_StrMap(std::map<ESMCpuResetReason, SS_String> &m_strMap) { // NOLINT (runtime/references) + MAP_ENTRY(m_strMap, e_SS_SM_CPU_RESET_REASON_NORMAL); + MAP_ENTRY(m_strMap, e_SS_SM_CPU_RESET_REASON_DATA_RESET); + MAP_ENTRY(m_strMap, e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET); + MAP_ENTRY(m_strMap, e_SS_SM_CPU_RESET_REASON_GENERIC_ERR); + MAP_ENTRY(m_strMap, e_SS_SM_CPU_RESET_REASON_DSP_ERR); + MAP_ENTRY(m_strMap, e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR); +} // End of void Init_SS_CpuResetReason_StrMap(std::map<ESMCpuResetReason, SS_String> &m_strMap) +class EnumStringMap< ESMCpuResetReason, + Init_SS_CpuResetReason_StrMap> m_oSS_CpuResetReason_Map; +// LCOV_EXCL_START 6:Because the condition cannot be set +SS_String GetStr(ESMCpuResetReason f_enum) { + return m_oSS_CpuResetReason_Map.GetStr(f_enum); +} +// LCOV_EXCL_STOP + +//****************************************************************************** +void Init_SS_UserModeChangeReason_StrMap(std::map<ePwrServiceUserModeChangeReasonType, SS_String> &m_strMap) { // NOLINT (runtime/references) + // LCOV_EXCL_BR_START 11:Excluded due to gcov restrictions(other) + MAP_ENTRY(m_strMap, epsumcrNOT_AVAILABLE); + MAP_ENTRY(m_strMap, epsumcrON_KEY); + MAP_ENTRY(m_strMap, epsumcrPARKING_B); + MAP_ENTRY(m_strMap, epsumcrPRE_BA); + MAP_ENTRY(m_strMap, epsumcrNORMAL); + MAP_ENTRY(m_strMap, epsumcrBACKGROUND_BA); + // LCOV_EXCL_BR_STOP 11:Excluded due to gcov restrictions(other) +} +class EnumStringMap< EPWR_USER_MODE_CHANGE_REASON_TYPE, + Init_SS_UserModeChangeReason_StrMap> m_oSS_UMCR_Map; +SS_String GetStr(EPWR_USER_MODE_CHANGE_REASON_TYPE f_enum) { + return m_oSS_UMCR_Map.GetStr(f_enum); +} + +//****************************************************************************** +void Init_SS_StartupReason_StrMap(std::map<EPWR_WAKEUP_FACTOR_TYPE, + SS_String> & m_strMap); // NOLINT (runtime/references) +class EnumStringMap< EPWR_WAKEUP_FACTOR_TYPE , + Init_SS_StartupReason_StrMap> m_oSSStartupReason_Map; +SS_String GetStr(EPWR_WAKEUP_FACTOR_TYPE f_enum) { + return m_oSSStartupReason_Map.GetStr(f_enum); +} + +//****************************************************************************** +void Init_EErrorEventType_StrMap(std::map<EErrorEventType, SS_String> & m_strMap) { // NOLINT (runtime/references) + MAP_ENTRY(m_strMap, eErrorEventTypeProcessCrash); + MAP_ENTRY(m_strMap, eErrorEventTypeHeartBeatFailure); + MAP_ENTRY(m_strMap, eErrorEventTypeSystemLowMemory); + MAP_ENTRY(m_strMap, eErrorEventTypeReserved1); + MAP_ENTRY(m_strMap, eErrorEventTypeUserInvokedUserForceReset); + MAP_ENTRY(m_strMap, eErrorEventTypeReserved2); + MAP_ENTRY(m_strMap, eErrorEventTypeReserved3); + MAP_ENTRY(m_strMap, eErrorEventTypeUserInvokedCollectAllLogs); + MAP_ENTRY(m_strMap, eErrorEventTypeBootMicroReset); + MAP_ENTRY(m_strMap, eErrorEventTypeProcessExit); + MAP_ENTRY(m_strMap, eErrorEventTypeUserInvokedCollectScreenShot); + MAP_ENTRY(m_strMap, eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs); + MAP_ENTRY(m_strMap, eErrorEventTypeEelExport); + MAP_ENTRY(m_strMap, eErrorEventTypeInterfaceunifiedEmmcLogs); + MAP_ENTRY(m_strMap, eErrorEventTypeDiagEvent); + MAP_ENTRY(m_strMap, eErrorEventTypeCanEvent); + MAP_ENTRY(m_strMap, eErrorEventTypeDtcEvent); + MAP_ENTRY(m_strMap, eErrorEventTypeModConnFailed); + MAP_ENTRY(m_strMap, eErrorEventTypeStartRespFailed); + MAP_ENTRY(m_strMap, eErrorEventTypeUserInvokedCollectDevLogs); + MAP_ENTRY(m_strMap, eErrorEventTypeModuleInvokedResetRequest); + MAP_ENTRY(m_strMap, eErrorEventTypeModuleInvokedCollectDebugLogs); + MAP_ENTRY(m_strMap, eErrorEventTypeUserInvokedClearLogs); + MAP_ENTRY(m_strMap, eErrorEventTypeGroupRelaunch); + MAP_ENTRY(m_strMap, eErrorEventTypeMaxValue); +} // End of void Init_EErrorEventType_StrMap(std::map<EErrorEventType, SS_String> & m_strMap) + +void Init_SS_SystemManagerProtocol_StrMap(std::map<SS_SystemManagerProtocol, SS_String> &m_strMap) { // NOLINT (runtime/references) + // LCOV_EXCL_BR_START 11:Excluded due to gcov restrictions(other) + MAP_ENTRY(m_strMap, SS_SM_NOTIFY_SYSTEM_LAUNCH_COMPLETE); + MAP_ENTRY(m_strMap, SS_SM_PROTOCOL_INTERFACE_END); + MAP_ENTRY(m_strMap, SS_SM_START); + MAP_ENTRY(m_strMap, SS_SM_START_COMPL_RSPN); + MAP_ENTRY(m_strMap, SS_SM_STOP); + MAP_ENTRY(m_strMap, SS_SM_STOP_COMPL_RSPN); + MAP_ENTRY(m_strMap, SS_SM_PRE_START); + MAP_ENTRY(m_strMap, SS_SM_PRE_START_COMPL_RSPN); + MAP_ENTRY(m_strMap, SS_SM_PRE_STOP); + MAP_ENTRY(m_strMap, SS_SM_PRE_STOP_COMPL_RSPN); + MAP_ENTRY(m_strMap, SS_SM_BACKGROUND_START); + MAP_ENTRY(m_strMap, SS_SM_BACKGROUND_START_COMPL_RSPN); + MAP_ENTRY(m_strMap, SS_SM_BACKGROUND_STOP); + MAP_ENTRY(m_strMap, SS_SM_BACKGROUND_STOP_COMPL_RSPN); + MAP_ENTRY(m_strMap, SS_SM_GET_START_EXT_INFO); + MAP_ENTRY(m_strMap, SS_SM_GET_STOP_EXT_INFO); + MAP_ENTRY(m_strMap, SS_SM_WAKEUP_MODULES_CMPL_RSPN); + MAP_ENTRY(m_strMap, SS_SM_SHUTDOWN_MODULES_CMPL_RSPN); + MAP_ENTRY(m_strMap, SS_SM_WAKEUP_MODULES); + MAP_ENTRY(m_strMap, SS_SM_SHUTDOWN_MODULES); + MAP_ENTRY(m_strMap, SS_SM_CRNT_STATE_QUERY); + MAP_ENTRY(m_strMap, SS_SM_CRNT_STATE_QUERY_RSPN); + MAP_ENTRY(m_strMap, SS_SM_SYSTEM_MODE_INFO_REQ); + MAP_ENTRY(m_strMap, SS_SM_SYSTEM_MODE_INFO_RSPN); + MAP_ENTRY(m_strMap, SS_SM_INITCOMP_REP); + MAP_ENTRY(m_strMap, SS_SM_DATA_RESET_MODE_SET_REQ); + MAP_ENTRY(m_strMap, SS_SM_PROG_UPDATE_STATE_SET_REQ); + MAP_ENTRY(m_strMap, SS_SM_CPU_RESET_REQ); + MAP_ENTRY(m_strMap, SS_SM_REMOTE_DATA_RESET_REQ); + MAP_ENTRY(m_strMap, SS_SM_FWD_STARTUP_CONFIRMATION_MSG_REQ); + MAP_ENTRY(m_strMap, SS_SM_FWD_START_CONFIRMATION_MSG_RESP); + MAP_ENTRY(m_strMap, SS_SM_POWER_REQUEST_MSG); + MAP_ENTRY(m_strMap, SS_SM_POWER_REQUEST_MSG_RESP); + MAP_ENTRY(m_strMap, SS_SM_USER_MODE_SET_RESP); + + MAP_ENTRY(m_strMap, SS_SM_EVENT_ERROR); + MAP_ENTRY(m_strMap, SS_SM_EVENT_ERROR_TO_SSL); + MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_LOGGING_START_REQ); + MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_LOGGING_START_RSPN); + MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_ARTIFACT_REQ); + MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_ARTIFACT_RSPN); + MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_LOGGING_COMPLETE); + MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_LOGGING_COMPLETE_RSPN); + MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_TIMER_ID_LOGGER_START_REQ); + MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_TIMER_ID_DEBUG_DUMP_RSPN); + MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_TIMER_ID_BOOT_MICRO_LOG_RSPN); + MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_TIMER_ID_CORE_FILE_POLL); + MAP_ENTRY(m_strMap, SS_SM_USER_INVOKED_LOG_REQ); + MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_EEL_EXPORT_REQ); + MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_REQ); + MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_RSPN); + MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_CLR_LOGS_REQ); + MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_PROCESS_EXIT); + MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_DIAG_LOG_REQ); + MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_CAN_LOG_REQ); + MAP_ENTRY(m_strMap, SS_SM_GROUP_LAUNCH_TRIGGER); + MAP_ENTRY(m_strMap, SS_SM_DEBUG_DUMP); + MAP_ENTRY(m_strMap, SS_SM_DEBUG_DUMP_RSPN); + MAP_ENTRY(m_strMap, SS_SM_CPU_HIGH_LOAD_DETECTED); + MAP_ENTRY(m_strMap, SS_SM_PROPAGATE_SYSTEM_ERROR); + MAP_ENTRY(m_strMap, SS_SM__CWORD56__HEARTBEAT_REQ); + MAP_ENTRY(m_strMap, SS_SM__CWORD56__HEARTBEAT_RSPN); + MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_RESET_NTF); + MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_LOG_REQ); + MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_LOG_RSP); + MAP_ENTRY(m_strMap, SS_SM_NEXT_WAKEUP_TYPE_SET_REQ); + // LCOV_EXCL_BR_STOP 11:Excluded due to gcov restrictions(other) +} // End of void Init_SS_SystemManagerProtocol_StrMap(std::map<SS_SystemManagerProtocol, SS_String> &m_strMap) + + + +void Init_EInterfaceunifiedStatus_StrMap(std::map<EFrameworkunifiedStatus, SS_String> & m_strMap) { // NOLINT (runtime/references) + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusEmptyMediaList); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusSessionLimitMaxedOut); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusDbRecNotFound); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusDbResultError); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusDbExecuteFail); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusSemCloseFail); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusSemUnlockFail); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusSemLockFail); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusFail); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusErrOther); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusOK); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldBuf); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldHandle); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldHndlType); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldQName); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusMsgQFull); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldNotification); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldParam); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldBufSize); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldID); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusCannotRelease); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusBadConnection); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusExit); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusNotImplemented); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusThreadBusy); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusThreadSelfJoin); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusThreadInvalidVal); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusThreadNotExist); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusFault); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusServNotFound); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusServerInUse); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusDbIndexing); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusNullPointer); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusMsgNotProcessed); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusFileLoadSuccess); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusFileLoadError); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusAccessError); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusDuplicate); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusMsgQEmpty); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusThreadAlreadyRunning); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusErrNoEBADF); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusErrNoEAGAIN); + MAP_ENTRY(m_strMap, eFrameworkunifiedStatusErrNoEINTR); +} // End of void Init_EInterfaceunifiedStatus_StrMap(std::map<EFrameworkunifiedStatus, SS_String> & m_strMap){ + +void Init_SS_ShutdownTrigger_StrMap(std::map<EPWR_SHUTDOWN_TRIGGER_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references) + MAP_ENTRY(m_strMap, epssdmsdtINVALID); + MAP_ENTRY(m_strMap, epssdmsdtTESTACC_OFF); + MAP_ENTRY(m_strMap, epssdmsdtON_KEY); + MAP_ENTRY(m_strMap, epssdmsdtIGN_LOCK); + MAP_ENTRY(m_strMap, epssdmsdtPWR_SAVE); + MAP_ENTRY(m_strMap, epssdmsdtTMP_STARTUP); + MAP_ENTRY(m_strMap, epssdmsdtDIAG_DEACTIVATION); + MAP_ENTRY(m_strMap, epssdmsdtABNORMAL_VOLTAGE); + MAP_ENTRY(m_strMap, epssdmsdtABNORMAL_TEMP); + MAP_ENTRY(m_strMap, epssdmsdtBATTERYCUTOFF); + MAP_ENTRY(m_strMap, epssdmsdtLIMPHOME); + MAP_ENTRY(m_strMap, epssdmsdtHU_CAN_ERROR); + MAP_ENTRY(m_strMap, epssdmsdtBODY_CAN_ERROR); + MAP_ENTRY(m_strMap, epssdmsdtTRANSPORT_MODE); + MAP_ENTRY(m_strMap, epssdmsdtPRODUCTION_MODE); + MAP_ENTRY(m_strMap, epssdmsdtIGN_OFF); + MAP_ENTRY(m_strMap, epssdmsdtGENERIC_ERROR_RESET); + MAP_ENTRY(m_strMap, epssdmsdtFATAL_ERROR_RESET); + MAP_ENTRY(m_strMap, epssdmsdtUSER_DATA_RESET); + MAP_ENTRY(m_strMap, epssdmsdtFACTORY_DATA_RESET); + MAP_ENTRY(m_strMap, epssdmsdtFAST_SLEEP_MODE); + MAP_ENTRY(m_strMap, epssdmsdtNORMAL_RESET); +} // End of void Init_SS_ShutdownTrigger_StrMap(std::map<EPWR_SHUTDOWN_TRIGGER_TYPE, SS_String> & m_strMap) + +void Init_SS_StartupReason_StrMap(std::map<EPWR_WAKEUP_FACTOR_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references) + MAP_ENTRY(m_strMap, epswfINVALID); + MAP_ENTRY(m_strMap, epswfTESTACC); + MAP_ENTRY(m_strMap, epswfON_KEY); + MAP_ENTRY(m_strMap, epswfIGN_ACC); + MAP_ENTRY(m_strMap, epswfDR_OPEN_CLOSE); + MAP_ENTRY(m_strMap, epswfDX_ACTIVATION); + MAP_ENTRY(m_strMap, epswfPASS_ACTIVATION); + MAP_ENTRY(m_strMap, epswfSPVACTIVATION); + MAP_ENTRY(m_strMap, epswfUSER_DATA_RESET); +} // LCOV_EXCL_BR_LINE 10:Because the last line +// End of void Init_SS_WakeupFactor_StrMap(std::map<EPWR_WAKEUP_FACTOR_TYPE, SS_String> & m_strMap) + +// EOF ss_string_maps.cpp + + diff --git a/service/system/interface_unified/library/src/ss_system_process.cpp b/service/system/interface_unified/library/src/ss_system_process.cpp new file mode 100755 index 0000000..71a969a --- /dev/null +++ b/service/system/interface_unified/library/src/ss_system_process.cpp @@ -0,0 +1,1147 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_SystemManagerIf +/// \brief This file provides support for the System Manager client interface. +/// +/////////////////////////////////////////////////////////////////////////////// + +#include "system_service/ss_system_process.h" +#include <errno.h> +#include <sys/types.h> +#include <unistd.h> +#include <limits.h> +#include <pwd.h> +#include <grp.h> +#include <elfio/elfio_dump.hpp> + +#include <string.h> +#include <signal.h> +#include <sys/wait.h> +#include <assert.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <libgen.h> +#include <stdio.h> +#include <stdlib.h> +#include <vector> +#include "ss_system_if_interfaceunifiedlog.h" + +const char* iProcess_DEFAULT_PROCESS_USER_NAME = "default_user"; +uid_t iProcess_DEFAULT_PROCESS_USER = 4999; +gid_t iPrpocess_DEFAULT_PROCESS_GROUP = 4999; + +/** + * Process: Called when the class is instantiated. + * + * @return + */ +Process::Process(int cpu_assign) : + m_lValidationTag(lProcess_VALIDATION_VALUE), + m_cpu_assign(cpu_assign), + m_tProcessId(-1), + m_eProcessLoadMode(NOWAIT), + m_strFile(""), + m_strProcessName(""), + m_iErrorCode(0), + m_fAutoKill(TRUE), + m_iReturnCode(0) { +} + + +/** + * ~Process: Called when the object is destroyed. + * + * @return + */ +Process::~Process() { + // ASSERT_VALID (this); + + // + // Set the validation tag to NOT valid + m_lValidationTag = 0; + + // + // Cleanup after ourselves... + // + if ((m_fAutoKill) && (m_tProcessId != -1) && (m_tProcessId != getpid())) { + KillProcess(); // Then remove the process from PosixBasedOS001 + } +} + +/** + * Process: Used to create an object and copy another + * object to the new object. + * + * @param p_rhs_i Reference to the class being copied from. + * @return Process( const + */ +Process::Process(const Process& p_rhs_i) { + // Copy data from the specified object to this object. + Copy(p_rhs_i); +} + + +/** + * operator=: Called when one object is assigned + * to another object. + * + * @param p_rhs_i Reference to the class being copied from. + * @return Process& + */ +Process& Process::operator= (const Process& p_rhs_i) { + // Don't do anything if we're being copied on to ourselves. + if (this == &p_rhs_i) return (*this); + + // Copy data from the specified object to this object. + Copy(p_rhs_i); + + return (*this); +} + + +/** + * Copy: Copies data members from the specified object to this object. + * No attempt is made to free dynamically allocated objects within + * this object (you must do that before calling this function). + * + * @param p_rhs_i + * @return void + */ +void Process::Copy(const Process& p_rhs_i) { + // Copy data from the specified object to this object. + m_lValidationTag = p_rhs_i.m_lValidationTag; + + m_tProcessId = p_rhs_i.m_tProcessId; + m_eProcessLoadMode = p_rhs_i.m_eProcessLoadMode; + m_strFile = p_rhs_i.m_strFile; + m_strlstArgv = p_rhs_i.m_strlstArgv; + m_strProcessName = p_rhs_i.m_strProcessName; + m_iErrorCode = p_rhs_i.m_iErrorCode; + m_fAutoKill = p_rhs_i.m_fAutoKill; + m_iReturnCode = p_rhs_i.m_iReturnCode; +} + +/** + * GetProcessReturnCode: This function will return the processes + * exit/return code. This is not the value of ERRNO as returned by + * GetLastPosixBasedOS001ErrorCode(). + * + * @return code from the process + */ +int Process::GetProcessReturnCode() { + int iProcessReturn = 0; + if (waitpid(m_tProcessId, &iProcessReturn, WNOHANG) > 0) { + m_iReturnCode = WEXITSTATUS(iProcessReturn); + } + + return m_iReturnCode; +} + +static int getIdsFromUserName(const char* user_name, uid_t *uid, gid_t *gid) { + int ret = -1; + + try { + if (NULL == user_name) { + *uid = geteuid(); + *gid = getegid(); + } else { + static __thread size_t bufSize = 0; + static __thread char *buf = NULL; + struct passwd pwd; + struct passwd *result; + + if (0 == bufSize) { + struct stat statInfo; + + bufSize = -1; + + if (0 != stat("/etc/passwd", &statInfo) || 0 >= statInfo.st_size) { + throw "/etc/passwd is not exist"; + } + + bufSize = statInfo.st_size * 2; + + // Since SystemManager is a resident service, + // the area secured here is not explicity released by free() + // in anticipation of release at the end of the process + buf = reinterpret_cast<char *>(malloc(sizeof(char) * bufSize)); + if (NULL == buf) { + throw "malloc()"; + } + } + + if (NULL == buf) { + throw "buf = NULL"; + } + + ret = getpwnam_r(user_name, &pwd, buf, bufSize, &result); + if (ret == 0 && result != NULL) { + *uid = pwd.pw_uid; + *gid = pwd.pw_gid; + } else { + throw "getpwnam_r()"; + } + } + + ret = 0; + } + + catch (const char *e) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "ERROR:%s", e); + } + + return ret; +} + +/** + * CreateProcess: This method will create a PosixBasedOS001 process with the executable provided and mode as a calling parameter. + * The caller can also provide a list of arguments that will be provided to the executable at startup. + * The calling p_strProcessName parameter is a textual name that will be + * associated with the newly created process by the OS. The process state information + * will be maintained by this object. + * + * Upon successful creation of the process, the scheduling policy and priority + * of the process will be set to the provided values. The user can change these + * values through the SetSchedulingPolicy() and SetPriority() method calls. + * + * @param p_strFile_i Path and Filename of executable to create process for + * @param p_strlstArgv_i List of ARGV values for new process + * @param p_eMode_i Mode to create and load new process + * WAIT - The invoked program is loaded into available memory, is executed, + * and then the original program resumes execution. + * NOWAIT - Causes the current program to execute concurrently with the new child process. + * @param p_strProcessName_i This is the name that will be registered to the OS for this process + * @param p_eSchedulingPolicy_i Scheduling Policy for this process + * FIFO - A fixed priority scheduler in which the highest ready process runs until it + * blocks or is preempted by a higher priority process. + * ROUND_ROBIN - The same as FIFO, except processes at the same priority level time-slice. + * OTHER - A general time sharing scheduler in which a process decays in priority if it + * consumes too much processor before blocking. It reverts to its default priority + * when it blocks. Should it fail to run over a 2 second period and it has decayed + * then it's boosted one priority level up to a maximum of its default priority. + * @param p_iPriority_i Priority for this process + * @param p_lSpawnFlags_i Spawning flags. These are PosixBasedOS001 specific.... + * @return void + */ +void Process::CreateProcess( + const SS_String& p_strFile_i, // Path and Filename of executable to create process for + const StringList& p_strlstArgv_i, // List of ARGV values for new process + const eProcessLoadMode p_eMode_i, // Mode to create and load new process + const SS_String& p_strProcessName_i, // This is the name that will be registered to the OS for this process + const eProcessSchedulingPolicy p_eSchedulingPolicy_i, // Scheduling Policy for this process + const int p_iPriority_i, // Priority for this process + const char* unix_user_name, + const long p_lSpawnFlags_i // Posix Spawning flags. These are PosixBasedOS001 specific.... // NOLINT (runtime/int) +) { + //======================================================================================== + // Perform some idiot checking of the parameters that are passed in. + // Check the priority level that is being set to make sure it is in bounds. + // Then save off the calling parameters into the objects member variables. + // Also check the number of valid calling (argv[]) parameters passed in + //======================================================================================== + m_iErrorCode = 0; // Initialize to NO ERROR + m_iReturnCode = 0; // Initialize value (0 usually means good in unix/PosixBasedOS001) + + // + // Process filename os provided + // + if (p_strFile_i.empty()) { + return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful + } + + // + // Save off process calling arguments + // + m_eProcessLoadMode = p_eMode_i; + + m_strFile = p_strFile_i; + + if (!p_strProcessName_i.empty()) + m_strProcessName = p_strProcessName_i; + + // + // Copy Argument List... + // + SetCallingArgumentList(p_strlstArgv_i); + + // + // Valid number of calling arguments + // + int iNumberElements = m_strlstArgv.size(); + if (iNumberElements > (iProcess_MAXIMUM_NUMBER_OF_PROCESS_ARGUMENTS - 3)) { + return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful + } + + + //======================================================================================== + // Initialize to the beginning of the provided argument list. + // Allocate an array of buffer pointers that will be used for the ARGV calling parameters + // for the specified process. + // Set the ARGV[0] equal to the process name being created + // Set the ARGV[1] equal to the process name to be registered with the OS. + // If p_strProcessName_is NULL, do not set the cArgv[1] parameter + // Populate the array that will hold the argument list for the new process we are creating. + //======================================================================================== + // + + int iLoop = 1; + char * cArgv[iProcess_MAXIMUM_NUMBER_OF_PROCESS_ARGUMENTS]; + + cArgv[0] = basename(const_cast<char *>(p_strFile_i.c_str())); // Set the executable filename + + // Go through the list of provided argv calling parameters to the CreateProcess + // function, and copy the arguments to the ARGV[] calling argument which will be passed + // into the process being created. + StringListIter at = m_strlstArgv.begin(); + for (; at != m_strlstArgv.end(); at++, iLoop++) { + cArgv[iLoop] = const_cast<char *>(at->c_str()); + } + + cArgv[iLoop] = NULL; + + try { + CL_ProcessAttr_t clAttr; + CL_ProcessSchedPolicy_t clPolicy = CL_PROCESS_SCHED_POLICY_OTHER; + int clPriority = 0; + + if (0 != CL_ProcessCreateAttrInit(&clAttr)) { + throw "CL_ProcessCreateAttrInit()"; + } + + + // In order to collect even the child processes of the service, all are group leaders. + if (0 != CL_ProcessCreateAttrSetGroup(&clAttr, 1)) { + throw "CL_ProcessCreateAttrInit()"; + } + + if (0 != CL_ProcessCreateAttrSetCpuAssign(&clAttr, m_cpu_assign)) { + throw "CL_ProcessCreateAttrSetCpuAssign()"; + } + + switch (p_eSchedulingPolicy_i) { + case FIFO: + clPolicy = CL_PROCESS_SCHED_POLICY_FIFO; + break; + case ROUND_ROBIN: + clPolicy = CL_PROCESS_SCHED_POLICY_RR; + break; + case OTHER: + clPolicy = CL_PROCESS_SCHED_POLICY_OTHER; + break; + default: + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "p_eSchedulingPolicy_i = %d", p_eSchedulingPolicy_i); + break; + } + + switch (p_eSchedulingPolicy_i) { + case FIFO: + case ROUND_ROBIN: + if ((1 > p_iPriority_i) || (p_iPriority_i > 99)) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "p_eSchedulingPolicy_i = %d", p_eSchedulingPolicy_i); + } else { + clPriority = p_iPriority_i; + } + break; + case OTHER: + default: + if ((-20 > p_iPriority_i) || (p_iPriority_i > 19)) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "p_eSchedulingPolicy_i = %d", p_eSchedulingPolicy_i); + } else { + clPriority = p_iPriority_i; + } + break; + } + + if (0 != CL_ProcessCreateAttrSetSchedule(&clAttr, clPolicy, clPriority)) { + throw "CL_ProcessCreateAttrSetSchedule()"; + } + + uid_t uid = 0; + gid_t gid = 0; + + if (0 != getIdsFromUserName(unix_user_name, &uid, &gid)) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "unexpected unix_user_name [%s]", unix_user_name); + uid = geteuid(); + gid = getegid(); + } + if (uid == 0) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "!! uid=root %s", m_strFile.c_str()); + uid = UINT_MAX; + } + if (0 != CL_ProcessCreateAttrSetUid(&clAttr, uid)) { + throw "CL_ProcessCreateAttrSetUid()"; + } + + if (0 != CL_ProcessCreateAttrSetGid(&clAttr, gid)) { + throw "CL_ProcessCreateAttrSetGid()"; + } + + if (0 != CL_ProcessCreateAttrSetDisableCloseFds(&clAttr)) { + throw "CL_ProcessCreateAttrSetDisableCloseFds()"; + } + char environment_string[2048] = {0}; // Size is provisional + fprintf(stderr, "[%s](%d)Process Create Target : %s \n", __func__, __LINE__, m_strFile.c_str()); + + CheckLdPreLoad(&m_strFile, environment_string); + + CreateProcess(&m_strFile, const_cast<char* const*>(cArgv), environment_string, &clAttr); + } + + catch(const char *e) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "%s", e); + } +} + +/** + * CreateProcess: This method will create a process with the executable provided and mode as a calling parameter. + * The caller can also provide a list of arguments that will be provided to the executable at startup. + * The calling p_strProcessName parameter is a textual name that will be + * associated with the newly created process by the OS. The process state information + * will be maintained by this object. + * + * @param p_str_file Path and Filename of executable to create process for + * @param c_argv use process arguments + * @param environment_string Set LD_PRELOAD string + * @param cl_attr CL_ProcessAttr_t + * @return void + */ +void Process::CreateProcess(const SS_String *p_str_file, char* const*c_argv, char* environment_string, + const CL_ProcessAttr_t *cl_attr) { + try { + if ((p_str_file == NULL) || (c_argv == NULL) || (cl_attr == NULL)) { + throw "CreateProcess() Invaild Param"; + } + + int process_id = -1; + if (environment_string[0] == '\0') { + // If there is no LD_PRELOAD setting, set envp to NULL + process_id = CL_ProcessCreate(p_str_file->c_str(), c_argv, NULL, cl_attr); + } else { + // vector holding preferences + std::vector<SS_String> *vec_environ = GetEnvironVector(); + + // Set LD_PRELOAD string as the last element + SS_String ld_preload_string = SS_String(environment_string); + vec_environ->push_back(environment_string); + + // Number of acquired environment variables + 1(For terminal) memory allocation + size_t env_num = sizeof(char*) * (vec_environ->size() + 1); + char **p_environment = static_cast<char **>(malloc(env_num)); + memset(p_environment, 0x00, env_num); + + // Create environment variable list + int i = 0; + char **p_environment_tmp = p_environment; + for (std::vector<SS_String>::iterator itr = vec_environ->begin(); itr != vec_environ->end(); itr++, i++) { + p_environment_tmp[i] = static_cast<char *>(malloc(sizeof(char) * (itr->length() + 1))); + + snprintf(p_environment_tmp[i], itr->length() + 1, "%s", itr->c_str()); + } + + // Set envp for environment variable + process_id = CL_ProcessCreate(p_str_file->c_str(), c_argv, p_environment, cl_attr); + + // Free memory + i = 0; + p_environment_tmp = p_environment; + for (std::vector<SS_String>::iterator itr = vec_environ->begin(); itr != vec_environ->end(); itr++, i++) { + free(p_environment_tmp[i]); + } + + free(p_environment); + delete(vec_environ); + } + + if (process_id == -1) { + throw "CL_ProcessCreate()"; + } + + m_tProcessId = process_id; + } + catch (const char *e) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "%s", e); + } +} +/** + * CreateProcess: This method will create a PosixBasedOS001 process with the executable provided and mode as a calling parameter. + * The caller can also provide a list of arguments that will be provided to the executable at startup. + * The calling p_strProcessName parameter is a textual name that will be + * associated with the newly created process by the OS. The process state information + * will be maintained by this object. + * + * @param p_strFile_i Path and Filename of executable to create process for + * @param p_strProcessName This is the name that will be registered to the OS for this process + * @return void + */ +void Process::CreateProcess(const SS_String& p_strFile_i, const SS_String& p_strProcessName, + const char* unix_user_name, const long p_lSpawnFlags_i) { // NOLINT (runtime/int) + StringList strlstArgv; + + try { + CreateProcess(p_strFile_i, + strlstArgv, + NOWAIT, + p_strProcessName, + FIFO, + iProcess_DEFAULT_PROCESS_PRIORITY, + unix_user_name, + p_lSpawnFlags_i); + } + catch (...) { + return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful + } +} + + +/** + * CreateProcess: This method will create a process with the executable provided and mode as a calling parameter. + * The caller can also provide a list of arguments that will be provided to the executable at startup. + * The calling p_strProcessName parameter is a textual name that will be + * associated with the newly created process by the OS. The process state information + * will be maintained by this object. + * + * + * @param p_strFile_i Path and Filename of executable to create process for + * @param p_strProcessName This is the name that will be registered to the OS for this process + * @param p_iPriority_i Priority of process + * @return void + */ +void Process::CreateProcess(const SS_String& p_strFile_i, const SS_String& p_strProcessName, const int p_iPriority_i, + const char* unix_user_name, const long p_lSpawnFlags_i) { // NOLINT (runtime/int) + StringList strlstArgv; + + try { + eProcessSchedulingPolicy policy; + + if (0 < p_iPriority_i) { + policy = FIFO; + } else { + policy = OTHER; + } + + CreateProcess(p_strFile_i, + strlstArgv, + NOWAIT, + p_strProcessName, + policy, + p_iPriority_i, + unix_user_name, + p_lSpawnFlags_i); + } + catch (...) { + return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful + } +} + +/** + * CreateProcess: This method will create a process with the executable provided and mode as a calling parameter. + * The caller can also provide a list of arguments that will be provided to the executable at startup. + * The calling p_strProcessName parameter is a textual name that will be + * associated with the newly created process by the OS. The process state information + * will be maintained by this object. + * + * @param p_strFile_i Path and Filename of executable to create process for + * @param p_lSpawnFlags_i Spawning flags. These are PosixBasedOS001 specific. + * @return void + */ +void Process::CreateProcess(const SS_String& p_strFile_i, const char* unix_user_name, const long p_lSpawnFlags_i) { // NOLINT (runtime/int) + StringList strlstArgv; + + try { + CreateProcess(p_strFile_i, + strlstArgv, + NOWAIT, + basename(const_cast<char *>(p_strFile_i.c_str())), + FIFO, + iProcess_DEFAULT_PROCESS_PRIORITY, + unix_user_name, + p_lSpawnFlags_i); + } + catch (...) { + return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful + } +} + + + +/** + * CreateProcess: This method will create a process with the executable provided and mode as a calling parameter. + * The caller can also provide a list of arguments that will be provided to the executable at startup. + * The calling p_strProcessName parameter is a textual name that will be + * associated with the newly created process by the OS. The process state information + * will be maintained by this object. + * + * @param p_strFile_i Path and Filename of executable to create process for + * @param p_strProcessName This is the name that will be registered to the OS for this process + * @param p_strlstArgv_i List of ARGV values for new process + * @param p_lSpawnFlags_i Spawning flags. These are PosixBasedOS001 specific. + * @return void + */ +void Process::CreateProcess(const SS_String& p_strFile_i, const SS_String& p_strProcessName_i, + const StringList& p_strlstArgv_i, const char* unix_user_name, const long p_lSpawnFlags_i) { // NOLINT (runtime/int) + try { + CreateProcess(p_strFile_i, + p_strlstArgv_i, + NOWAIT, + p_strProcessName_i, + FIFO, + iProcess_DEFAULT_PROCESS_PRIORITY, + unix_user_name, + p_lSpawnFlags_i); + } + catch (...) { + return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful + } +} + + +void Process::CreateProcess(const SS_String& p_strFile_i, const SS_String& p_strProcessName_i, const int p_iPriority_i, + const StringList& p_strlstArgv_i, const char* unix_user_name, const long p_lSpawnFlags_i) { // NOLINT (runtime/int) + try { + eProcessSchedulingPolicy policy; + + if (0 < p_iPriority_i) { + policy = FIFO; + } else { + policy = OTHER; + } + + CreateProcess(p_strFile_i, + p_strlstArgv_i, + NOWAIT, + p_strProcessName_i, + policy, + p_iPriority_i, + unix_user_name, + p_lSpawnFlags_i); + } + catch (...) { + return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful + } +} + + +/** + * CreateProcessWait: This method will create a process with the executable provided. + * The process state information will be maintained by this object. + * + * @param p_strFile_i Path and Filename of executable to create process for + * @return void + */ +void Process::CreateProcessWait(const SS_String& p_strFile_i) { + StringList strlstArgv; + + try { + CreateProcess(p_strFile_i, + strlstArgv, + WAIT, + basename(const_cast<char *>(p_strFile_i.c_str())), + FIFO, + iProcess_DEFAULT_PROCESS_PRIORITY, + iProcess_DEFAULT_PROCESS_USER_NAME, + iProcess_DEFAULT_PROCESS_FLAGS); + } + catch (...) { + return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful + } +} + +/** + * CreateProcessWait: This method will create a PosixBasedOS001 process with the executable provided. + * The process state information will be maintained by this object. + * + * + * @param p_strFile_i Path and Filename of executable to create process for + * @param p_strlstArguments_i List of process calling arguments + * @return void + */ +void Process::CreateProcessWait(const SS_String& p_strFile_i, const StringList& p_strlstArguments_i) { + try { + CreateProcess(p_strFile_i, + p_strlstArguments_i, + WAIT, + basename(const_cast<char *>(p_strFile_i.c_str())), + FIFO, + iProcess_DEFAULT_PROCESS_PRIORITY, + iProcess_DEFAULT_PROCESS_USER_NAME, + iProcess_DEFAULT_PROCESS_FLAGS); + } + catch (...) { + return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful + } +} + + + +/** + * KillProcess: This method will delete the process represented by this object. All variables associated + * with this object will be initialized to a know value. + * + * @param + * @return void + */ +void Process::KillProcess(int signal) { + //===================================================================================== + // Intialize the objects m_iErrorCode member variable to 0 (no error). + // Then try to delete the process that this object represents. + m_iErrorCode = 0; + + if (DoesProcessExist()) { + if (-1 == killpg(m_tProcessId, signal)) { + return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful + } + } + + // + // If no errors, clear out any process specific member variables for this object + // + m_tProcessId = -1; + m_strProcessName = ""; +} + +/** + * SetSchedulingPolicy: This method will change the scheduling policy for the process this + * object represents. + * + * @param p_eSchedulingPolicy_i Scheduling policy + * @return void + */ +void Process::SetSchedulingPolicy( + const eProcessSchedulingPolicy p_eSchedulingPolicy_i // Scheduling policy +) { + //======================================================================================= + // Attempt to change the scheduling policy for the process that this object + // represents. If the change fails, restore the previous settings. + // + m_iErrorCode = 0; + struct sched_param cur_sch_params; + sched_getparam(m_tProcessId, &cur_sch_params); + if (0 != sched_setscheduler(m_tProcessId, ConvertToPosixBasedOS001SchedularPolicy(p_eSchedulingPolicy_i), + &cur_sch_params)) { + m_iErrorCode = errno; + return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful + } +} + +/** + * SetPriority: This method will change the priority for the process this + * object represents. + * + * @param p_iPriority_i Scheduling Policy for this process + * @return void + */ +void Process::SetPriority(const int p_iPriority_i) { + //======================================================================================= + // Attempt to change the priority for the process that this object + // represents. If the change fails, restore the previous settings. + // + m_iErrorCode = 0; + struct sched_param cur_sch_params; + sched_getparam(m_tProcessId, &cur_sch_params); + cur_sch_params.sched_priority = p_iPriority_i; + + if (-1 == sched_setparam(m_tProcessId, &cur_sch_params)) { + m_iErrorCode = errno; + return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful + } +} + + +/** + * IncreasePriorityByOne: This method will increase the priority for the process this + * object represents by one. + * + * @param + * @return void + */ +void Process::IncreasePriorityByOne(void) { + //================================================================================ + // Retrieve the current priority of the process. Check to see if already at max. + // If so just return. Otherwise increase by one and set the priority... + // + try { + int iCurrentPriority = GetPriority(); + if (iCurrentPriority < iProcess_MAXIMUM_PROCESS_PRIORITY) { + SetPriority(iCurrentPriority + 1); + } + } + catch (...) { + return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful + } +} + + +/** + * DecreasePriorityByOne: This method will decrease the priority for the process this + * object represents by one. + * + * + * @return void + */ +void Process::DecreasePriorityByOne(void) { + //================================================================================ + // Retrieve the current priority of the process. Check to see if already at minimum. + // If so just return. Otherwise decrease by one and set the priority... + // + try { + int iCurrentPriority = GetPriority(); + if (iCurrentPriority > 1) { + SetPriority(iCurrentPriority - 1); + } + } + catch (...) { + return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful + } +} + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// ConvertToPosixBasedOS001SchedularPolicy +// +// This method will return to the caller the equivalent PosixBasedOS001 schedular policy for the process +// that this object represents +// +// +// Calling Arguments: +// NONE +// +// Return Argument: +// FIFO, // A fixed priority scheduler in which the highest ready process runs until it +// // blocks or is preempted by a higher priority process. +// ROUND_ROBIN, // The same as FIFO, except processes at the same priority level time-slice. +// OTHER // A general time sharing scheduler in which a process decays in priority if it +// // consumes too much processor before blocking. It reverts to its default priority +// // when it blocks. Should it fail to run over a 2 second period and it has decayed +// // then it's boosted one priority level up to a maximum of its default priority. +// +int const Process::ConvertToPosixBasedOS001SchedularPolicy(const eProcessSchedulingPolicy p_eSchedulingPolicy_i) { + int iReturnValue = SCHED_RR; // Default is RR + switch (p_eSchedulingPolicy_i) { + case FIFO: + { + iReturnValue = SCHED_FIFO; + break; + } + + case ROUND_ROBIN: + { + iReturnValue = SCHED_RR; + break; + } + + case OTHER: + { + iReturnValue = SCHED_OTHER; + break; + } + } + + return iReturnValue; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// ConvertFromPosixBasedOS001SchedularPolicy +// +// This method will return to the caller the eProcessSchedulingPolicy based on the PosixBasedOS001 schedular +// policy for the process that this object represents +// +// +// Calling Arguments: +// PosixBasedOS001 Scheduling Policy +// +// Return Argument: +// FIFO, // A fixed priority scheduler in which the highest ready process runs until it +// // blocks or is preempted by a higher priority process. +// ROUND_ROBIN, // The same as FIFO, except processes at the same priority level time-slice. +// OTHER // A general time sharing scheduler in which a process decays in priority if it +// // consumes too much processor before blocking. It reverts to its default priority +// // when it blocks. Should it fail to run over a 2 second period and it has decayed +// // then it's boosted one priority level up to a maximum of its default priority. +// +Process::eProcessSchedulingPolicy const Process::ConvertFromPosixBasedOS001SchedularPolicy + (const int p_iPosixBasedOS001chedulingPolicy_i) { + eProcessSchedulingPolicy ePolicy = ROUND_ROBIN; // Default is RR + switch (p_iPosixBasedOS001chedulingPolicy_i) { + case SCHED_FIFO: + { + ePolicy = FIFO; + break; + } + + case SCHED_RR: + { + ePolicy = ROUND_ROBIN; + break; + } + case SCHED_OTHER: + { + ePolicy = OTHER; + break; + } + } // Switch + + return ePolicy; +} + + +/** + * DoesProcessExist: This method will return a BOOLean indicating whether this + * process exists. + * + * @return BOOL TRUE - Process Exists, FALSE - Process does not exist + */ +BOOL Process::DoesProcessExist(void) { + struct sched_param cur_sch_params; + if (-1 >= sched_getparam(m_tProcessId, &cur_sch_params)) { // or the segment data + return FALSE; + } + + return TRUE; +} + + + +/** + * SetProcessName: This method will set this objects process name member variable to the + * provided string value. + * + * @param p_strProcessName_i Process Name to set the m_strProcessName member variable to + * @return void + */ +void Process::SetProcessName(const SS_String& p_strProcessName_i) { + // + // Idiot checking + // + assert(!p_strProcessName_i.empty()); + + m_strProcessName = p_strProcessName_i; +} + +/** + * GetSchedulingPolicy: This method will return to the caller the + * currently configured process scheduling policy. + * + * @return Process::eProcessSchedulingPolicy const + */ +Process::eProcessSchedulingPolicy const Process::GetSchedulingPolicy(void) { + int policy = 0; + if (-1 == (policy = sched_getscheduler(m_tProcessId))) { + m_iErrorCode = errno; + return ROUND_ROBIN; // PAD THIS IS BAD!!! TODO: Change this to something meaningful + } + + return (ConvertFromPosixBasedOS001SchedularPolicy (policy)); +} + + + +/** + * GetPriority: This method will return to the caller the currently configured + * process priority. + * + * @return int const + */ +int const Process::GetPriority(void) { + struct sched_param cur_sch_params; + if (-1 >= sched_getparam(m_tProcessId, &cur_sch_params)) { + m_iErrorCode = errno; + return -1; // PAD THIS IS BAD!!! TODO: Change this to something meaningful + } + + return (cur_sch_params.sched_priority); +} + + + +/** + * SetCallingArgumentList: This method will set the calling argument list + * that this object represents. + * + * @param p_pcArgv_i Pointer to NULL terminated argument list. + * @param p_iArgc_i Number of parameters + * @return void + */ +void Process::SetCallingArgumentList(const char *p_pcArgv_i[], const int p_iArgc_i) { + //////////////////////////////////////////////////////////////////////// + // Set the executable filename first. This is always the 1st argument + // in the argument list. Then set the argument list for the process + // which is held in m_strlstArgv. + // + if (p_iArgc_i > (iProcess_MAXIMUM_NUMBER_OF_PROCESS_ARGUMENTS - 3)) { + return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful + } + + // + // First make sure that the argument list is empty. + // + if (!m_strlstArgv.empty()) { + m_strlstArgv.clear(); // Remove all elements from the current list + } // Process Argument list is NOT empty + + // + // Once empty, put the new arguments into the list + // + StringListIter at = m_strlstArgv.begin(); + int iLoop; + for (iLoop = 0; iLoop < p_iArgc_i; iLoop ++) { + at = m_strlstArgv.insert(at, p_pcArgv_i[iLoop]); + } +} + + +/** + * SetCallingArgumentList: This method will set the calling argument + * list that this object represents. + * + * @param p_strlstParameters_i List of parameters + * @return void + */ +void Process::SetCallingArgumentList(const StringList& p_strlstParameters_i) { + if (p_strlstParameters_i.size()) { + m_strlstArgv.clear(); // Empty the current list. + m_strlstArgv = p_strlstParameters_i; + } +} + +/** + * Search if libTestFwCommon.so is dynamically linked. + * + * @param process_path Search target binary path + * @return bool + */ +static bool CheckLinkedTestfwLibrary(SS_String *process_path) { + if (NULL == process_path) { + fprintf(stderr, "[%s](%d)Invaild Param.\n", __func__, __LINE__); + return false; + } + + ELFIO::elfio reader; + if (!reader.load(process_path->c_str())) { + fprintf(stderr, "[%s](%d)%s is not ELF!\n", __func__, __LINE__, process_path->c_str()); + return false; + } + + ELFIO::Elf_Half n = reader.sections.size(); + for ( ELFIO::Elf_Half i = 0; i < n; ++i ) { + ELFIO::section* sec = reader.sections[i]; + if ( SHT_DYNAMIC == sec->get_type() ) { + ELFIO::dynamic_section_accessor dynamic(reader, sec); + + ELFIO::Elf_Xword dynamic_num = dynamic.get_entries_num(); + if ( dynamic_num > 0 ) { + for ( ELFIO::Elf_Xword i = 0; i < dynamic_num; ++i ) { + ELFIO::Elf_Xword dynamic_tag = 0; + ELFIO::Elf_Xword dynamic_value = 0; + SS_String dynamic_str; + dynamic.get_entry(i, dynamic_tag, dynamic_value, dynamic_str); + + // Search if the acquired dynamic section string contains libTestFwCommon.so + if (SS_String::npos != dynamic_str.find("libTestFwCommon.so")) { + fprintf(stderr, "[%s](%d)libTestFwCommon is linked.\n", __func__, __LINE__); + return true; + } + + // Check for continuation of dynamic section element + if ( DT_NULL == dynamic_tag ) { + break; + } + } + } else { + // If dynamic section is not found + fprintf(stderr, "[%s](%d)dynamic symbol is not find.\n", __func__, __LINE__); + } + } + } + + fprintf(stderr, "[%s](%d)libTestFwCommon is not find. \n", __func__, __LINE__); + return false; +} + +/** + * This method is a private method to be called from CreateProcess func. + * Check environment variable MOCK_LIBRARY where Mock Library Name to set in LD_PRELOAD is set + * and output character string to set in LD_PRELOAD if there is setting. + * + * @param process_path,environment_string + * @return void + */ +void Process::CheckLdPreLoad(SS_String *process_path, char *environment_string) { + if ((process_path == NULL || environment_string == NULL)) { + fprintf(stderr, "[%s](%d)Invaild Param.\n", __func__, __LINE__); + return; + } + + // Check if environment variable MOCK_LIBRARY for LD_PRELOAD setting is set + char *value_mock_library = getenv("MOCK_LIBRARY"); + + if (value_mock_library != NULL) { + // When MOCK_LIBRARY is set + fprintf(stderr, "[%s](%d)MOCK_LIBRARY = %s \n", __func__, __LINE__, value_mock_library); + + // Check whether the process to be started is a core unit or TestFW, and execute LD_PRELOAD if libTestFwCommon.so is linked + if (CheckLinkedTestfwLibrary(process_path)) { + SS_String key_value; + SS_String key_ld_preload = "LD_PRELOAD="; + + // Create LD_PRELOAD setting string + // LD_PRELOAD is enabled when the string is an envp argument in the form "LD_PRELOAD=hoge_mock.so hoge_mock.so ..." + key_value = key_ld_preload + value_mock_library; + strncpy(environment_string, key_value.c_str(), key_value.length()); + fprintf(stderr, "[%s](%d)Set envp: %s \n", __func__, __LINE__, environment_string); + return; + } else { + // If the unit does not require LD_PRELOAD setting, set envairoment_string to NULL. + fprintf(stderr, "[%s](%d)Core Unit is not setting LD_PRELOAD\n", __func__, __LINE__); + return; + } + } else { + // If it is not set to MOCK_LIBRARY, it is not necessary to set LD_PRELOAD, so set envairoment_string to NULL. + fprintf(stderr, "[%s](%d)The MOCK_LIBRARY variable was unestablished.\n", __func__, __LINE__); + return; + } +} + +/** + * Acquire the character string of the environment variable and set it in String Vector + * and return in a pointer of Vector. + * + * @param process_path,environment_string + * @return vector<SS_String> pointer + */ +extern char ** environ; +std::vector<SS_String> *Process::GetEnvironVector(void) { + // If LD_PRELOAD is set, copy existing environment settings and set to environment_pointer + + std::vector<SS_String>* vector_environ = new std::vector<SS_String>; + + char **environ_tmp = environ; + + // Insert environ_string into the vector table + int i = 0; + while (environ_tmp[i] != NULL) { + SS_String str_env(environ_tmp[i]); + vector_environ->push_back(str_env); + i++; + } + + return vector_environ; +} +// ---------------------------------------- diff --git a/service/system/interface_unified/library/src/ss_system_timer.cpp b/service/system/interface_unified/library/src/ss_system_timer.cpp new file mode 100755 index 0000000..24209fb --- /dev/null +++ b/service/system/interface_unified/library/src/ss_system_timer.cpp @@ -0,0 +1,228 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_SystemManagerIf +/// \brief This file provides support for the System Manager client interface. +/// +/////////////////////////////////////////////////////////////////////////////// + +#include "system_service/ss_system_timer.h" +#include <native_service/ns_timer_if.h> +#include <native_service/ns_message_center_if.h> +#include <utility> +#include "ss_system_timer_local.h" + +Timer::Timer() : + m_bInit(FALSE), m_hApp(NULL), m_hSnd(NULL), m_hTmr(NULL) { + bzero(&m_tTi, sizeof(m_tTi)); +} + +Timer::Timer(HANDLE hdl, UI_32 id, CbFuncPtr CbFn): + m_bInit(FALSE), m_hApp(NULL), m_hSnd(NULL), m_hTmr(NULL) { + bzero(&m_tTi, sizeof(m_tTi)); + Initialize(hdl, id, CbFn); +} + +Timer::~Timer() { + if (m_bInit) { + Shutdown(); + } +} // LCOV_EXCL_BR_LINE 10:Because destructor + +BOOL Timer::Initialize(HANDLE hApp, UI_32 id, CbFuncPtr CbFn) { + if (!m_bInit && hApp && id && CbFn) { + m_hApp = hApp; + m_tTi.iCmd = id; + m_tTi.t_sec = 0; + m_tTi.t_nsec = 0; + m_tTi.rpt_sec = 0; + m_tTi.rpt_nsec = 0; + m_CbFn = CbFn; + m_hSnd = McOpenSender(FrameworkunifiedGetAppName(m_hApp)); + m_hTmr = NS_TimerCreate(m_tTi, CALLBACK_MESSAGE, m_hSnd); + m_bInit = TRUE; + } + return m_bInit; +} + +void Timer::Reinitialize(UI_32 id) { + if (!m_bInit && id) { + m_tTi.iCmd = id; + + m_tTi.t_sec = 0; + m_tTi.t_nsec = 0; + m_tTi.rpt_sec = 0; + m_tTi.rpt_nsec = 0; + + m_hSnd = McOpenSender(FrameworkunifiedGetAppName(m_hApp)); + m_hTmr = NS_TimerCreate(m_tTi, CALLBACK_MESSAGE, m_hSnd); + m_bInit = TRUE; + } + return; +} + +void Timer::Shutdown() { + if (m_bInit) { + Stop(); + NS_TimerDelete(m_hTmr); + m_hTmr = NULL; + McClose(m_hSnd); + m_hSnd = NULL; + m_bInit = FALSE; + } +} + +BOOL Timer::SetTime(UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms) { + if (m_bInit) { + m_tTi.t_sec = ss; + m_tTi.t_nsec = (ss || sms) ? sms*NS_PER_MS : 1; // LCOV_EXCL_BR_LINE 11:Unexpected branch + m_tTi.rpt_sec = rs; + m_tTi.rpt_nsec = rms*NS_PER_MS; + } + return m_bInit; +} + +BOOL Timer::Start(UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms) { + if (m_bInit) { + SetTime(ss, sms, rs, rms); + FrameworkunifiedAttachCallbackToDispatcher(m_hApp, TIMER_SERVICE_NAME, m_tTi.iCmd, m_CbFn); + NS_TimerSetTime(m_hTmr, m_tTi); + } + return m_bInit; +} + +BOOL Timer::Start() { + if (m_bInit) { + FrameworkunifiedAttachCallbackToDispatcher(m_hApp, TIMER_SERVICE_NAME, m_tTi.iCmd, m_CbFn); + m_tTi.t_nsec = (m_tTi.t_sec || m_tTi.t_nsec) ? m_tTi.t_nsec : 1; // LCOV_EXCL_BR_LINE 11:Unexpected branch + NS_TimerSetTime(m_hTmr, m_tTi); + } + return m_bInit; +} + +BOOL Timer::Stop() { + if (m_bInit) { + NSTimerInfo ti = m_tTi; + ti.t_sec = 0; + ti.t_nsec = 0; + ti.rpt_sec = 0; + ti.rpt_nsec = 0; + NS_TimerSetTime(m_hTmr, ti); + FrameworkunifiedDetachCallbackFromDispatcher(m_hApp, TIMER_SERVICE_NAME, ti.iCmd); + } + return m_bInit; +} + +// LCOV_EXCL_START 6:Because the condition cannot be set +TimerCtrl::TimerCtrl() + : m_hApp(NULL), m_nTimersMax(DEFAULT_NTIMERS) { +} + +TimerCtrl::TimerCtrl(UI_32 ntimers) + : m_hApp(NULL), m_nTimersMax(ntimers) { +} + +void TimerCtrl::Initialize(HANDLE hApp) { + if ( NULL != hApp ) { + m_hApp = hApp; + if (m_aTimers.empty() && m_rTimers.empty()) { + for (UI_32 i = DEFAULT_TIMERID; i < DEFAULT_TIMERID+m_nTimersMax; ++i) { + m_aTimers.push_back(i); + } + } + } +} + +void TimerCtrl::Shutdown() { + m_aTimers.clear(); + while (m_rTimers.begin() != m_rTimers.end()) { + Timer* p_timer = m_rTimers.begin()->second; + p_timer->Shutdown(); + delete p_timer; + m_rTimers.erase(m_rTimers.begin()); + } +} + +UI_32 TimerCtrl::CreateTimer(CbFuncPtr CbFn) { + if (!m_aTimers.empty()) { + UI_32 id = m_aTimers.front(); + m_aTimers.pop_front(); + Timer* p_timer = new Timer(m_hApp, id, CbFn); + m_rTimers.insert(std::pair<UI_32, Timer*>(id, p_timer)); + return id; + } + return 0; +} + +UI_32 TimerCtrl::DeleteTimer(UI_32 id) { + if (m_rTimers.find(id) != m_rTimers.end()) { + Timer* p_timer = m_rTimers.find(id)->second; + p_timer->Shutdown(); + delete p_timer; + m_rTimers.erase(m_rTimers.find(id)); + m_aTimers.push_back(id); + return id; + } + return 0; +} + +UI_32 TimerCtrl::SetTimer(UI_32 id, UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms) { + if (m_rTimers.find(id) != m_rTimers.end()) { + Timer* p_timer = m_rTimers.find(id)->second; + p_timer->SetTime(ss, sms, rs, rms); + return id; + } + return 0; +} +UI_32 TimerCtrl::StartTimer(UI_32 id, UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms) { + if (m_rTimers.find(id) != m_rTimers.end()) { + Timer* p_timer = m_rTimers.find(id)->second; + p_timer->Start(ss, sms, rs, rms); + return id; + } + return 0; +} + +UI_32 TimerCtrl::StartTimerMulti(UI_32 id, UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms, UI_32 subId) { + if (m_rTimers.find(id) != m_rTimers.end()) { + Timer* p_timer = m_rTimers.find(id)->second; + p_timer->Shutdown(); + p_timer->Reinitialize(id + subId); + p_timer->Start(ss, sms, rs, rms); + return id; + } + return 0; +} + +UI_32 TimerCtrl::StartTimer(UI_32 id) { + if (m_rTimers.find(id) != m_rTimers.end()) { + Timer* p_timer = m_rTimers.find(id)->second; + p_timer->Start(); + return id; + } + return 0; +} + +UI_32 TimerCtrl::StopTimer(UI_32 id) { + if (m_rTimers.find(id) != m_rTimers.end()) { + Timer* p_timer = m_rTimers.find(id)->second; + p_timer->Stop(); + return id; + } + return 0; +} +// LCOV_EXCL_STOP |