diff options
author | 2020-11-19 12:45:32 +0900 | |
---|---|---|
committer | 2020-11-19 12:45:32 +0900 | |
commit | 8e0e00d21146a84c18f9cf9409e187b4fb0248aa (patch) | |
tree | ef791689dad216ac61091a1d1bd3b928d563aba6 /video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf | |
parent | 18df6e21c6743a137e2760c52ca89d0789e90417 (diff) |
Init basesystem source codes.
Signed-off-by: Riku Nomoto <riku_nomoto@mail.toyota.co.jp>
Change-Id: I55aa2f1406ce7f751ae14140b613b53b68995528
Diffstat (limited to 'video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf')
8 files changed, 1598 insertions, 0 deletions
diff --git a/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/cfg/depends.mk b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/cfg/depends.mk new file mode 100755 index 0000000..93b9f97 --- /dev/null +++ b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/cfg/depends.mk @@ -0,0 +1,25 @@ +# +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Standard Dependency Makefile Version 2.0 +# +# Dependency file dictates not only what other modules the project is dependent on, but +# also where to get that dependent element which logically includes versioning or +# baselining information + +# Utilizing Base Domain Dependency File. Can override at any point +include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk diff --git a/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__service_if.cpp b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__service_if.cpp new file mode 100755 index 0000000..3965783 --- /dev/null +++ b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__service_if.cpp @@ -0,0 +1,367 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +//////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_HMI_CWORD77_Controller +/// \brief +/// +//////////////////////////////////////////////////////////////////////////////// + +#include <native_service/frameworkunified_service_protocol.h> +#include <native_service/frameworkunified_framework_if.h> +#include <native_service/frameworkunified__CWORD77__service_if.h> +#include <native_service/ns__CWORD77__data_pool_if.h> +#include <other_service/strlcpy.h> + +#include <map> +#include <string> +#include <vector> + +#include "ns__CWORD77__data_pool_internal.h" +#include "ns__CWORD77__common_internal.h" + +#define NS__CWORD77__MAX_SESSION_RETRY_COUNT 10 + +////////////////////////////////////////// +/// Function : CFrameworkunified_CWORD77_Service +////////////////////////////////////////// +CFrameworkunified_CWORD77_Service::CFrameworkunified_CWORD77_Service() + : m_cbResponse(NULL), + m_cbSessionACK(NULL), + m_pSession(NULL), + m_cServiceName(""), + m_bServiceAvailable(FALSE), + m_ui8SessionRetryCount(0), + m_hApp(NULL) { // LCOV_EXCL_BR_LINE 11:except branch + m_SessTypeToSessObj.clear(); +} +////////////////////////////////////////// +/// Function : ~CFrameworkunified_CWORD77_Service +////////////////////////////////////////// +CFrameworkunified_CWORD77_Service::~CFrameworkunified_CWORD77_Service() { // LCOV_EXCL_BR_LINE 11:except branch + std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter; + l_iter = m_SessTypeToSessObj.begin(); + while (l_iter != m_SessTypeToSessObj.end()) { + CFrameworkunified_CWORD77_Session *l_pTemp = l_iter->second; + DELETEPTR(l_pTemp); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns__CWORD77__common.h" + l_iter++; + } +} +////////////////////////////////////////// +/// Function : SetResponseCallback +////////////////////////////////////////// +void CFrameworkunified_CWORD77_Service::SetResponseCallback(ResponseServiceTo_CWORD77_ cbResponse) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + m_cbResponse = cbResponse; + if (m_cbResponse == NULL) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __PRETTY_FUNCTION__, "Call back function ptr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + } + std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter; + l_iter = m_SessTypeToSessObj.begin(); + while (l_iter != m_SessTypeToSessObj.end()) { + if (l_iter->second != NULL) { + l_iter->second->SetResponseCallback(m_cbResponse); + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Object ptr for session type[%d] is NULL ", l_iter->first); + } + l_iter++; + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" +} +////////////////////////////////////////// +/// Function : SetSession +////////////////////////////////////////// +void CFrameworkunified_CWORD77_Service::SetSession(CFrameworkunified_CWORD77_Session *f_pSessionObj) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + m_SessTypeToSessObj[f_pSessionObj->GetSessionType()] = f_pSessionObj; + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" +} +////////////////////////////////////////// +/// Function : SendMessageToSession +////////////////////////////////////////// +void CFrameworkunified_CWORD77_Service::SendMessageToSession(UI_32 f_uiSessionType, UI_32 f_uiSrvProtocol) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter; + l_iter = m_SessTypeToSessObj.begin(); + l_iter = m_SessTypeToSessObj.find(f_uiSessionType); + if (l_iter != m_SessTypeToSessObj.end()) { + if (l_iter->second != NULL) { + if (eFrameworkunifiedStatusSessionErr == l_iter->second->HandleSessionMessage(f_uiSrvProtocol)) { + if (m_bServiceAvailable) { + if (NS__CWORD77__MAX_SESSION_RETRY_COUNT < m_ui8SessionRetryCount) { + FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Unable to send cmd 0x%X." + " But, service is available. Open session req max limit reached [%s].", + f_uiSrvProtocol, m_cServiceName.c_str()); + // TODO(framework_unified): what to do in case of max limit reached? + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Unable to send cmd 0x%X." + " But, service is available. Re-sending open session req [%s].", + f_uiSrvProtocol, m_cServiceName.c_str()); + // send open session request + OpenSessionRetry(f_uiSessionType); + m_ui8SessionRetryCount++; + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Unable to send cmd 0x%X." + " Service not yet available.", f_uiSrvProtocol); + } + } else { + // ignore error, already printed by HandleSessionMessage + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Object ptr for session type[%d] is NULL ", l_iter->first); + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Object is not there in Map for session type %d ", f_uiSessionType); + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); +} +////////////////////////////////////////// +/// Function : OpenSession +////////////////////////////////////////// +void CFrameworkunified_CWORD77_Service::OpenSession(HANDLE f_hApp, const std::string &f_sServiceName) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __PRETTY_FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + m_cServiceName = f_sServiceName; + std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter; + l_iter = m_SessTypeToSessObj.begin(); + while (l_iter != m_SessTypeToSessObj.end()) { + if (l_iter->second != NULL) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, " Sent open session request for session %d ", l_iter->first); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + l_iter->second->OpenSession(f_hApp, f_sServiceName); // LCOV_EXCL_BR_LINE 11:except branch + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Object ptr for session type[%d] is NULL ", l_iter->first); + } + l_iter++; + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __PRETTY_FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" +} +////////////////////////////////////////// +/// Function : CloseSession +////////////////////////////////////////// +void CFrameworkunified_CWORD77_Service::CloseSession(HANDLE f_hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter; + l_iter = m_SessTypeToSessObj.begin(); + while (l_iter != m_SessTypeToSessObj.end()) { + if (l_iter->second != NULL) { + l_iter->second->CloseSession(f_hApp); + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Object ptr for session type[%d] is NULL ", l_iter->first); + } + l_iter++; + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" +} +////////////////////////////////////////// +/// Function : OpenSessionAcks +////////////////////////////////////////// +void CFrameworkunified_CWORD77_Service::OpenSessionAcks(HANDLE f_hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + OpenSessionAck tOpenSessAck; + + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + m_ui8SessionRetryCount = 0; + + if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &tOpenSessAck, sizeof(tOpenSessAck)))) { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " FrameworkunifiedGetMsgDataOfSize Failed"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + l_eStatus = eFrameworkunifiedStatusFail; + } + // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h" + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __PRETTY_FUNCTION__, "/***********************************************************************/"); + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, + __PRETTY_FUNCTION__, + "Open session ACK obtained for service: [%s] with session type: [%d]", + tOpenSessAck.cSessionName != 0 ? tOpenSessAck.cSessionName : NULL, + tOpenSessAck.sessionType); + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __PRETTY_FUNCTION__, "/***********************************************************************/"); + // LCOV_EXCL_BR_STOP + UI_32 l_uisessionType = tOpenSessAck.sessionType; + /// Session Acks + std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter; + l_iter = m_SessTypeToSessObj.begin(); + while (l_iter != m_SessTypeToSessObj.end()) { + if (l_iter->second != NULL) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __PRETTY_FUNCTION__, "Get session type = %d", l_iter->second->GetSessionType()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + if (l_uisessionType == l_iter->second->GetSessionType()) { + l_iter->second->OpenSessionAcknowledge(f_hApp); + + if (m_cbSessionACK != NULL) { + (VOID)m_cbSessionACK(f_hApp, m_cServiceName, tOpenSessAck.cSessionName, tOpenSessAck.sessionType, + tOpenSessAck.eStatus); + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, + __FUNCTION__, + "Unexpected Session_Type from service [%s]. Obtained Session_Type: [%d] != Expected Session_Type: [%d]", + tOpenSessAck.cSessionName != 0 ? tOpenSessAck.cSessionName : NULL, + l_uisessionType, + l_iter->second->GetSessionType()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Object ptr for session type[%d] is NULL ", l_iter->first); + } + l_iter++; + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" +} +////////////////////////////////////////// +/// Function : OpenServiceOnAvailability +////////////////////////////////////////// +EFrameworkunifiedStatus CFrameworkunified_CWORD77_Service::OpenServiceOnAvailability(HANDLE f_hApp, const std::string &f_sServiceName) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK; + m_hApp = f_hApp; + m_bServiceAvailable = TRUE; + m_ui8SessionRetryCount = 0; + AttachOpenSessionAckCallback(f_hApp); + OpenSession(f_hApp, f_sServiceName); + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + return eStatus; +} +////////////////////////////////////////// +/// Function : CloseServiceOnUnavailability +////////////////////////////////////////// +EFrameworkunifiedStatus CFrameworkunified_CWORD77_Service::CloseServiceOnUnavailability(HANDLE f_hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK; + m_bServiceAvailable = FALSE; + m_ui8SessionRetryCount = 0; + CloseSession(f_hApp); + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + return eStatus; +} + +////////////////////////////////////////// +/// Function : AddNotification +////////////////////////////////////////// +void CFrameworkunified_CWORD77_Service::AddNotification(PCSTR f_pNotification) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + FrameworkunifiedNotificationCallbackHandler tNotifyStruct = {}; + /** + * @todo + * Defining a NULL for argument f_pNotification results in a segmentation fault. + */ + strlcpy(tNotifyStruct.cNotification, f_pNotification, sizeof(tNotifyStruct.cNotification)); // LCOV_EXCL_BR_LINE 11:except branch + tNotifyStruct.callBack = CCallback< CFrameworkunified_CWORD77_Service, &CFrameworkunified_CWORD77_Service::OnServiceNtf >::set(this); // LCOV_EXCL_BR_LINE 11:except branch + m_vServiceNotifications.push_back(tNotifyStruct); // LCOV_EXCL_BR_LINE 11:except branch + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" +} + +////////////////////////////////////////// +/// Function : SubscribeNotifications +////////////////////////////////////////// +EFrameworkunifiedStatus CFrameworkunified_CWORD77_Service::SubscribeNotifications(HANDLE f_hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + size_t Size = m_vServiceNotifications.size(); + for (size_t i = 0; i < Size; i++) { + if (m_vServiceNotifications[i].callBack != NULL) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "Before subscribing notifications"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + if (eFrameworkunifiedStatusOK != FrameworkunifiedSubscribeNotificationWithCallback(f_hApp, m_vServiceNotifications[i].cNotification, + m_vServiceNotifications[i].callBack)) { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedSubscribeNotificationWithCallback fail"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + } + } + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + return l_eStatus; +} +////////////////////////////////////////// +/// Function : UnSubscribeNotifications +////////////////////////////////////////// +EFrameworkunifiedStatus CFrameworkunified_CWORD77_Service::UnSubscribeNotifications(HANDLE f_hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + size_t Size = m_vServiceNotifications.size(); + for (size_t i = 0; i < Size; i++) { + if (eFrameworkunifiedStatusOK != FrameworkunifiedUnsubscribeNotificationWithCallback(f_hApp, m_vServiceNotifications[i].cNotification)) { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedUnsubscribeNotificationWithCallback fail"); + } + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); + return l_eStatus; +} + +////////////////////////////////////////// +/// Function : OnServiceNtf +////////////////////////////////////////// +EFrameworkunifiedStatus CFrameworkunified_CWORD77_Service::OnServiceNtf(HANDLE hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + + // CHAR l_cNotificationName[MAX_SYS_INFO_SIZE] = {}; + PCSTR l_cNotificationName = FrameworkunifiedGetLastNotification(hApp); + // retrieve notification name + // FrameworkunifiedGetSystemInfo(hApp, l_cNotificationName); + + UI_32 l_uiLength = FrameworkunifiedGetMsgLength(hApp); + if (l_uiLength != 0) { + std::vector<char> data; + data.resize(l_uiLength); + if (eFrameworkunifiedStatusOK == (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &data[0], l_uiLength))) { + SetRespNotfnDataIn_CWORD77_DataPool(l_cNotificationName, static_cast<UI_32>(data.size()), &data[0]); + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " FrameworkunifiedGetMsgDataOfSize Error, " + "Resp Notfn Data not set in _CWORD77_ data pool, status: 0x%x", l_eStatus); + } + } else { + SetRespNotfnDataIn_CWORD77_DataPool(l_cNotificationName, 0, NULL); + } + + m_cbResponse(hApp, NOTIFICATION, m_cServiceName); + + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); + + return l_eStatus; +} + +////////////////////////////////////////// +/// Function : OpenSessionRetry +////////////////////////////////////////// +void CFrameworkunified_CWORD77_Service::OpenSessionRetry(UI_32 f_ui32SessionType) { + FRAMEWORKUNIFIEDLOG(ZONE_NS_FUNC, __FUNCTION__, "+"); + if (!m_cServiceName.empty() && (NULL != m_hApp)) { + std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter; + l_iter = m_SessTypeToSessObj.find(f_ui32SessionType); + if (l_iter != m_SessTypeToSessObj.end()) { + if (NULL != l_iter->second) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "Re-sending open session req for session type %d ", l_iter->first); + l_iter->second->OpenSession(m_hApp, m_cServiceName); + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Object ptr for session type[%d] is NULL ", l_iter->first); + } + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Can't retry for open session req. Service name: [%s], hApp:[%p].", + m_cServiceName.c_str(), + m_hApp); + } + FRAMEWORKUNIFIEDLOG(ZONE_NS_FUNC, __FUNCTION__, "-"); +} + +////////////////////////////////////////// +/// Function : Set_CWORD77_OpenSessionACK +////////////////////////////////////////// +void CFrameworkunified_CWORD77_Service::Set_CWORD77_OpenSessionACK(SessionAckTo_CWORD77_ cbResponse) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + + m_cbSessionACK = cbResponse; + if (NULL == m_cbSessionACK) { + FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __PRETTY_FUNCTION__, "Call back function ptr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + } + + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" +} diff --git a/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__session_if.cpp b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__session_if.cpp new file mode 100755 index 0000000..1211f91 --- /dev/null +++ b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__session_if.cpp @@ -0,0 +1,325 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +//////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_HMI_CWORD77_Controller +/// \brief +/// +//////////////////////////////////////////////////////////////////////////////// + +#include <native_service/frameworkunified__CWORD77__session_if.h> +#include <native_service/ns__CWORD77__data_pool_if.h> +#include <boost/bind.hpp> +#include <utility> +#include <vector> +#include "ns__CWORD77__data_pool_internal.h" +#include "ns__CWORD77__common_internal.h" + +////////////////////////////////////////// +/// Function : CFrameworkunified_CWORD77_Session +////////////////////////////////////////// +CFrameworkunified_CWORD77_Session::CFrameworkunified_CWORD77_Session() { + m_hSession = NULL; + m_hApp = NULL; + m_hService = NULL; + m_uiSessionType = 0; +} +////////////////////////////////////////// +/// Function : ~CFrameworkunified_CWORD77_Session +////////////////////////////////////////// +CFrameworkunified_CWORD77_Session::~CFrameworkunified_CWORD77_Session() { // LCOV_EXCL_BR_LINE 11:except branch +} + +void CFrameworkunified_CWORD77_Session::SetSessionType(const UI_32 &sessioType) { + m_uiSessionType = sessioType; +} + +////////////////////////////////////////// +/// Function : GetSessionType +////////////////////////////////////////// +UI_32 CFrameworkunified_CWORD77_Session::GetSessionType() { + return m_uiSessionType; +} +////////////////////////////////////////// +/// Function : SetResponseCallback +////////////////////////////////////////// +void CFrameworkunified_CWORD77_Session::SetResponseCallback(ResponseServiceTo_CWORD77_ f_cbResponse) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + m_ResponseTo_CWORD77_ = f_cbResponse; + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" +} +////////////////////////////////////////// +/// Function : AddProtocolHandler +////////////////////////////////////////// +void CFrameworkunified_CWORD77_Session::AddProtocolHandler(UI_32 f_uiCmdId, CbFuncPtr f_cbFuncPtr) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + FrameworkunifiedProtocolCallbackHandler l_tProtocolCallback; + l_tProtocolCallback.iCmd = f_uiCmdId; + l_tProtocolCallback.callBack = f_cbFuncPtr; + m_vSessionProtocolHanlder.push_back(l_tProtocolCallback); + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); +} +////////////////////////////////////////// +/// Function : AddEventHandler +////////////////////////////////////////// +void CFrameworkunified_CWORD77_Session::AddEventHandler(UI_32 f_uiCmdId, CbFuncPtr f_cbFuncPtr) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + FrameworkunifiedProtocolCallbackHandler l_tProtocolCallback; + l_tProtocolCallback.iCmd = f_uiCmdId; + l_tProtocolCallback.callBack = f_cbFuncPtr; + m_vSessionEventHandler.push_back(l_tProtocolCallback); + m_vEventVector.push_back(f_uiCmdId); // Code added by Shyam + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); +} +////////////////////////////////////////// +/// Function : AttachProtocolwithDispatcher +////////////////////////////////////////// +EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::AttachProtocolwithDispatcher(HANDLE f_hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + size_t l_uiSize = m_vSessionProtocolHanlder.size(); + PCSTR l_pRequester = FrameworkunifiedGetMsgSrc(f_hApp); + for (size_t i = 0; i < l_uiSize; i++) { + FrameworkunifiedAttachCallbackToDispatcher(f_hApp, l_pRequester, m_vSessionProtocolHanlder[i].iCmd, + m_vSessionProtocolHanlder[i].callBack, m_hSession); + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); + return l_eStatus; +} +////////////////////////////////////////// +/// Function : DetachProtocolwithDispatcher +////////////////////////////////////////// +EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::DetachProtocolwithDispatcher(HANDLE f_hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + size_t l_uiSize = m_vSessionProtocolHanlder.size(); + PCSTR l_pRequester = FrameworkunifiedGetMsgSrc(f_hApp); + for (size_t i = 0; i < l_uiSize; i++) { + FrameworkunifiedDetachCallbackFromDispatcher(f_hApp, l_pRequester, m_vSessionProtocolHanlder[i].iCmd, + m_hSession); + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); + return l_eStatus; +} +////////////////////////////////////////// +/// Function : AttachEventswithDispatcher +////////////////////////////////////////// +EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::AttachEventswithDispatcher(HANDLE f_hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + size_t l_uiSize = m_vEventVector.size(); + + for (size_t i = 0; i < l_uiSize; i++) { + l_eStatus = FrameworkunifiedRegisterEvent(m_hSession, m_vEventVector[i]); + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); + return l_eStatus; +} +////////////////////////////////////////// +/// Function : AttachEventswithDispatcher +////////////////////////////////////////// +EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::RegisterEvents(HANDLE f_hApp) { + // Function: added by Shyam to overcome the naming conflict in registering the event + return AttachEventswithDispatcher(f_hApp); +} + +////////////////////////////////////////// +/// Function : AttachEventHandlerswithDispatcher +////////////////////////////////////////// +EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::AttachEventHandlerswithDispatcher(HANDLE f_hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + size_t l_uiSize = m_vSessionEventHandler.size(); + PCSTR l_pRequester = FrameworkunifiedGetMsgSrc(f_hApp); + for (size_t i = 0; i < l_uiSize; i++) { + FrameworkunifiedAttachCallbackToDispatcher(f_hApp, l_pRequester, m_vSessionEventHandler[i].iCmd, + m_vSessionEventHandler[i].callBack, m_hSession); + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); + return l_eStatus; +} +////////////////////////////////////////// +/// Function : DetachEventHandlerswithDispatcher +////////////////////////////////////////// +EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::DetachEventHandlerswithDispatcher(HANDLE f_hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + size_t l_uiSize = m_vSessionEventHandler.size(); + PCSTR l_pRequester = FrameworkunifiedGetMsgSrc(f_hApp); + for (size_t i = 0; i < l_uiSize; i++) { + FrameworkunifiedDetachCallbackFromDispatcher(f_hApp, l_pRequester, m_vSessionEventHandler[i].iCmd, + m_hSession); + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); + return l_eStatus; +} + +////////////////////////////////////////// +/// Function : HandleSessionMessage +////////////////////////////////////////// +EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::HandleSessionMessage(UI_32 cmdID) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK; + + UI_32 size = 0; + PVOID data = NULL; + + if (NULL != m_hSession && NULL != m_hService) { + eStatus = GetReqDataFrom_CWORD77_DataPool(std::make_pair(cmdID, FrameworkunifiedGetSessionName(m_hService)), size, data); + + if (eFrameworkunifiedStatusOK == eStatus) { + eStatus = FrameworkunifiedSendMsg(m_hSession, cmdID, size, data); + if (eFrameworkunifiedStatusOK != eStatus) { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg() returned %d", eStatus); + } + } else if (eFrameworkunifiedStatusDbRecNotFound == eStatus) { + // FIXME: This is added to help, if there is any command with no data. So, that services + // don't need to provide _CWORD77_ interfaces for such command. + // Correct way to solve the problem is, let services provide one _CWORD77_ interface + // which will write 0 length in data pool. + // Impact: This may have one impact that, service is expecting some data, but + // _CWORD77_ sends data with 0 length because it didn't find anything in the data pool. + FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, + "GetReqDataFrom_CWORD77_DataPool() returned %d. But, still sending cmd 0x%X to service %s with length 0.", + eStatus, cmdID, FrameworkunifiedGetSessionName(m_hService)); + eStatus = FrameworkunifiedSendMsg(m_hSession, cmdID, 0, NULL); + if (eFrameworkunifiedStatusOK != eStatus) { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg() returned %d", eStatus); + } + // end fixme + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, + "GetReqDataFrom_CWORD77_DataPool() returned %d. Can't send cmd 0x%X to service %s.", + eStatus, cmdID, FrameworkunifiedGetSessionName(m_hService)); + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, + "Error: HandleSessionMessage: Error sending cmd 0x%X request to service." + " Session handle %p Service Handle %p", cmdID, m_hSession, m_hService); + if (NULL == m_hSession) { + eStatus = eFrameworkunifiedStatusSessionErr; + } + } + + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "- %d", eStatus); + return eStatus; +} + +////////////////////////////////////////// +/// Function : AttachResponseCallbacks +////////////////////////////////////////// +void CFrameworkunified_CWORD77_Session::AttachResponseCallbacks(HANDLE f_hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + UI_32 l_uiCount = 0; + PCSTR l_pRequester = FrameworkunifiedGetMsgSrc(f_hApp); + + // attach response protocols + UI_32 const *l_uiResponseProtocol = GetResponseProtocolArray(); + if (NULL != l_uiResponseProtocol) { + for (; l_uiCount < GetResponseProtocolArrayLength(); l_uiResponseProtocol++, l_uiCount++) { + FrameworkunifiedAttachCallbackToDispatcher(f_hApp, l_pRequester, *l_uiResponseProtocol, + boost::bind(&CFrameworkunified_CWORD77_Session::OnResponse, this, f_hApp), m_hSession); + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "No Response protocols available for session with %s", + FrameworkunifiedGetSessionName(m_hService)); + } + + // attach events + l_uiCount = 0; + UI_32 const *l_uiEvents = GetEventArray(); + if (NULL != l_uiEvents) { + for (; l_uiCount < GetEventArrayLength(); l_uiEvents++, l_uiCount++) { + // attach callback + FrameworkunifiedAttachCallbackToDispatcher(f_hApp, l_pRequester, *l_uiEvents, + boost::bind(&CFrameworkunified_CWORD77_Session::OnResponse, this, f_hApp), m_hSession); // LCOV_EXCL_BR_LINE 11:except branch + // register event + FrameworkunifiedRegisterEvent(m_hSession, *l_uiEvents); + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "No event protocols available for session with %s", + FrameworkunifiedGetSessionName(m_hService)); + } + + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" +} + +////////////////////////////////////////// +/// Function : DetachResponseCallbacks +////////////////////////////////////////// +void CFrameworkunified_CWORD77_Session::DetachResponseCallbacks(HANDLE f_hApp) { + if (NULL != m_hSession) { + UI_32 l_uiCount = 0; + PCSTR l_cSessionName = FrameworkunifiedGetSessionName(m_hSession); + // detach response protocols + UI_32 const *l_uiResponseProtocol = GetResponseProtocolArray(); + if (NULL != l_uiResponseProtocol) { + for (; l_uiCount < GetResponseProtocolArrayLength(); l_uiResponseProtocol++, l_uiCount++) { + FrameworkunifiedDetachCallbackFromDispatcher(f_hApp, l_cSessionName, *l_uiResponseProtocol, m_hSession); + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "No Response protocols available for session with %s", + FrameworkunifiedGetSessionName(m_hService)); + } + + // detach and unregister events + l_uiCount = 0; + UI_32 const *l_uiEvents = GetEventArray(); + if (NULL != l_uiEvents) { + for (; l_uiCount < GetEventArrayLength(); l_uiEvents++, l_uiCount++) { + FrameworkunifiedDetachCallbackFromDispatcher(f_hApp, l_cSessionName, *l_uiEvents, m_hSession); + FrameworkunifiedUnRegisterEvent(m_hSession, *l_uiEvents); + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "No event protocols available for session with %s", + FrameworkunifiedGetSessionName(m_hService)); + } + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Detach not required. Session not yet available"); + } +} + +////////////////////////////////////////// +/// Function : OnResponse +////////////////////////////////////////// +EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::OnResponse(HANDLE f_hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK; + + UI_32 length = FrameworkunifiedGetMsgLength(f_hApp); + UI_32 cmdId = FrameworkunifiedGetMsgProtocol(f_hApp); + PCSTR l_cMsgSourceName = FrameworkunifiedGetMsgSrc(f_hApp); + if (NULL != l_cMsgSourceName) { + if (length != 0) { + std::vector<char> data; + data.resize(length); + eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &data[0], length); + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "OnResponse from %s cmdId:%d", l_cMsgSourceName, cmdId); + SetRespDataIn_CWORD77_DataPool(std::make_pair(cmdId, l_cMsgSourceName), static_cast<UI_32>(data.size()), &data[0]); + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "OnResponse from %s cmdId:[%d], Value: [NULL]", l_cMsgSourceName, cmdId); + SetRespDataIn_CWORD77_DataPool(std::make_pair(cmdId, l_cMsgSourceName), 0, NULL); + } + + m_ResponseTo_CWORD77_(f_hApp, RESPONSE, l_cMsgSourceName); + } else { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Setting response value of cmd 0x%X in data pool.", cmdId); + } + + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "- %d", eStatus); + return eStatus; +} + diff --git a/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified_stub.h b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified_stub.h new file mode 100755 index 0000000..68efb44 --- /dev/null +++ b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified_stub.h @@ -0,0 +1,20 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef FRAMEWORK_UNIFIED_CLIENT_NS__CWORD77__SERVICEIF_SRC_FRAMEWORKUNIFIED_STUB_H_ +#define FRAMEWORK_UNIFIED_CLIENT_NS__CWORD77__SERVICEIF_SRC_FRAMEWORKUNIFIED_STUB_H_ +extern size_t strlcpy(char *destination, const char *source, size_t size); + +#endif // FRAMEWORK_UNIFIED_CLIENT_NS__CWORD77__SERVICEIF_SRC_FRAMEWORKUNIFIED_STUB_H_ diff --git a/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/makefile_PosixBasedOS001 b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/makefile_PosixBasedOS001 new file mode 100755 index 0000000..88693cd --- /dev/null +++ b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/makefile_PosixBasedOS001 @@ -0,0 +1,208 @@ +# +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Standard Module Makefile version 2.0 +# + +# Name of the componet (team/domain prefix '_' component name) +COMPONENT_NAME = NS__CWORD77__ServiceIf + +ifndef PRJ_ROOT +export PRJ_ROOT = $(CURDIR)/../ +endif +include $(PRJ_ROOT)cfg/depends.mk + +# Name of the componet (team/domain prefix '_' component name) +# This must be the same as the RTC Component name and Eclipse Project Name +COMPONENT_NAME = NS__CWORD77__ServiceIf + + +# Additive Compile Flags (Flags from initiating make process will still apply) +DEFS += + +# Set local includes and then the reference includes (priority order determines search path) +# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories, +# dependencies includes (other teams) +# Local (current component references should be in the form of +# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory +# Example your public include directory would be +# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc +# Team references should only be to other's public includes such as +# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc +# Global (non-team) references should be only to other's public includes such +# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable +INCLUDES = \ + $(CFG_INCS) \ + $(CC_IFLAG)./ \ + $(DEPENDS_INCLUDES) \ + $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc + + +# Do the same if you need to include library paths as well +# Do an incremental in case additional library paths are defined +# at the top-level make. Use similar guidelines as for includes +# for example to include a team component library it would be +# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/ +LIB_PATHS += \ + $(DEPENDS_LIB_PATHS) \ + + + +# Define binary outputs. These can be libraries or executables. +# Name a variable for each deliverable. Suffixes should be +# EXEC - For Executables -> output to the bin directory +#TIME_EXEC = $(BIN_PATH)time +# LIB - For Static Libraries -> output to lib directory with specific naming +#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT) +# SLIB - For Shared Objects +#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT) +# LIB - Define the static library for Message Queue +# +# +ifdef DYNAMIC + COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT) +else + COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT) +endif + + +## Sources Section + +# Define Library & Executable Sources (on a per deliverable basis) +# This includes sources located in subdirectories. + +# Define generic line that pulls all c, cc, cpp files +# since your in the src folder is pull only files from there +COMPONENT_SRCS = \ + $(wildcard *.c) \ + $(wildcard *.cpp) + +# Define sources that my not be local to your component +# here, you can define indivial files or wildcard from +# a different folder. +NON_LOCAL_SRCS = \ + + +# List of all sources to be built. Can be assembled from the other defintitions. +# This only defines sources for the current directory, so if there are subdirectories +# those are not included. (Those are found in simple subdirectory makefiles that only +# direct the building of sources, but no linking into a binary) +SOURCES = \ + $(COMPONENT_SRCS) \ + $(NON_LOCAL_SRCS) \ + + + +# +# Convert the source files to object files with correct folder location. +# +# +C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) ) +CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) ) + + +# List of all sources to be generated. Can be assembled from the other defintitions. +OBJECTS = \ + $(C_LANG_OBJECTS) \ + $(CPP_LANG_OBJECTS) + + + +# All headers that are dependencies. Wildcard is easy to pickup local headers. +# This is only to automate the rebuilding, all builds on the servers are cleans +# So this is not a huge deal when building on a component level. +HEADERS = \ + $(wildcard *.h) \ + $(wildcard $(TEAM_ROOT)$(COMPONENT_NAME)/inc/*.h) \ + $(wildcard $(TEAM_ROOT)NativeServices/inc/*.h) \ + $(wildcard $(TEAM_ROOT)NativeServices/inc/native/*.h) \ + $(wildcard $(TEAM_ROOT)NativeServices/inc/_CWORD77_/*.h) \ + + +LIBRARIES = \ + $(COMPONENT_LIB) \ + +#DYNAMIC_LIBS += \ +# xml2 \ +# m + +# Make targets +# Standard +all: banner module_dirs subdirs local library binary + +debug: + $(MAKE) TARGET=arm DEBUG=TRUE all + +base: banner module_dirs subdirs local + +# Standard Building of Source Files (Default builds for all objects defined above) +$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS) + $(CC_CMD) + +$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS) + $(CPP_CMD) + +local: $(OBJECTS) + +# Defines specific for each deliverable + +# For a static library +$(COMPONENT_LIB): $(OBJECTS) +ifdef DYNAMIC +# For a dynamic library + $(SLIB_CMD) + $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug + $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@) + $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@) +else +# For a static library + $(AR_CMD) +endif + +# Standard set of derived targets +library: base \ + $(LIBRARIES) + @echo "***** `date` Done building library: $(COMPONENT_NAME) ******" + +binary: base \ + $(BINARIES) + +# Subdirs should be to jump to subdirectories +# standard form is of +# $(MAKE) -C subdirectory_name $(MAKECMDGOALS) +subdirs: + +clean: + -rm -f $(BINARIES) + -rm -f $(LIBRARIES) + -rm -f $(OBJECTS) + -rm -f $(COMPONENT_LIB).map + -rm -f $(COMPONENT_LIB).debug + +-v: + @echo "objs: --> $(OBJECTS)" + @echo "sources: --> $(SOURCES)" + @echo "headers: --> $(HEADERS)" + @echo "includes: --> $(INCLUDES)" + @echo "lib paths: --> $(LIB_PATHS)" + @echo "static libs: --> $(LD_STATIC_LIBS)" + @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)" + @echo "lib: --> $(LIBRARIES)" + @echo "bin: --> $(BINARIES)" + +module_dirs: build_dirs + diff --git a/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__common_internal.h b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__common_internal.h new file mode 100755 index 0000000..78f96a7 --- /dev/null +++ b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__common_internal.h @@ -0,0 +1,51 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +//////////////////////////////////////////////////////////////////////////////// +/// @defgroup tag_HMI_CWORD77_Controller HMI _CWORD77_ Controller +/// @file ns__CWORD77__common_internal.h +/// @brief +/// +//////////////////////////////////////////////////////////////////////////////// +//@{ + +#ifndef NS_NS__CWORD77__SERVICEIF_SRC_NS__CWORD77__COMMON_INTERNAL_H_ // NOLINT (readability/nolint) +#define NS_NS__CWORD77__SERVICEIF_SRC_NS__CWORD77__COMMON_INTERNAL_H_ + +#include <native_service/ns__CWORD77__types.h> +#include <cstdlib> +#include <iostream> +#include <string> + +EFrameworkunifiedStatus Set_CWORD77_DataPoolKeyValue(std::string Key, std::string Value); +std::string Get_CWORD77_DataPoolKeyValue(std::string Key); + +template <typename T> +UI_32 _CWORD77_GetMsgLength(HANDLE hApp) { + UI_32 uiLength = FrameworkunifiedGetMsgLength(hApp); + return (uiLength / sizeof(T)); +} + +template <typename T> +EFrameworkunifiedStatus _CWORD77_GetMsgData(HANDLE hApp, T *pData) { + EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK; + UI_8 *pTemp = reinterpret_cast<UI_8 *>(pData); + eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, pTemp, sizeof(T)); + return eStatus; +} + +#endif // NS_NS__CWORD77__SERVICEIF_SRC_NS__CWORD77__COMMON_INTERNAL_H_ // NOLINT (readability/nolint) +//@} diff --git a/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_internal.h b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_internal.h new file mode 100755 index 0000000..1ad792e --- /dev/null +++ b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_internal.h @@ -0,0 +1,64 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +//////////////////////////////////////////////////////////////////////////////// +/// @file ns__CWORD77__data_pool_internal.h +/// @brief +/// +//////////////////////////////////////////////////////////////////////////////// +//@{ + +#ifndef NS_NS__CWORD77__SERVICEIF_SRC_NS__CWORD77__DATA_POOL_INTERNAL_H_ // NOLINT (readability/nolint) +#define NS_NS__CWORD77__SERVICEIF_SRC_NS__CWORD77__DATA_POOL_INTERNAL_H_ + +#include <native_service/ns__CWORD77__types.h> + +//////////////////////////////////////////////////////////////////////////////////////////// +/// SetRespDataIn_CWORD77_DataPool +/// API to set data associated with response into _CWORD77_ Data Pool +/// +/// \param [in] f_DataPoolKey +/// _CWORD77_DataPoolKey - Data pool key +/// \param [in] f_uiSize +/// UI_32 - size of the data +/// \param [in] f_pData +/// PVOID - void pointer to data +/// +/// \return VOID - None +/// +//////////////////////////////////////////////////////////////////////////////////////////// +VOID SetRespDataIn_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 f_uiSize, const PVOID f_pData); + +//////////////////////////////////////////////////////////////////////////////////////////// +/// GetReqDataIn_CWORD77_DataPool +/// API to get data associated with request from _CWORD77_ Data Pool +/// +/// \param [in] f_DataPoolKey +/// _CWORD77_DataPoolKey - Data pool key +/// \param [in] f_uiSize +/// UI_32 - size of the data +/// \param [in] f_pData +/// PVOID - void pointer to data +/// +/// \return EFrameworkunifiedStatus - Succes or Error +/// +//////////////////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus GetReqDataFrom_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint) + UI_32 &f_uiSize, // NOLINT (readability/nolint) + PVOID &f_pData); // NOLINT (readability/nolint) + +#endif // NS_NS__CWORD77__SERVICEIF_SRC_NS__CWORD77__DATA_POOL_INTERNAL_H_ // NOLINT (readability/nolint) +//@} diff --git a/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_table.cpp b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_table.cpp new file mode 100755 index 0000000..b48062a --- /dev/null +++ b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_table.cpp @@ -0,0 +1,538 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +//////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_HMI_CWORD77_Controller +/// \brief +/// +//////////////////////////////////////////////////////////////////////////////// + +#include <native_service/ns__CWORD77__data_pool_table.h> +#include <native_service/ns__CWORD77__data_pool_if.h> +#include <vector> +#include <string> +#include <map> +#include <utility> +#include "ns__CWORD77__data_pool_internal.h" +#include "ns__CWORD77__common_internal.h" + +C_CWORD77_DataPool g__CWORD77_DataPool; +C_CWORD77_DataPool *C_CWORD77_DataPool::m_p_CWORD77_DataPoolInstance = NULL; + +// For getting/setting notification data from data pool, +// data key will be pair<g_uiNotificationDataPoolId,"NotificationName"> +static const UI_32 g_uiNotificationDataPoolId = 0; + +///////////////////////////////////////////////////////////////////////////////// +/// NoOfElementsinData +///////////////////////////////////////////////////////////////////////////////// +UI_32 NoOfElementsinData(std::string Input) { + std::string first = ""; + std::istringstream ss(Input); + int i = 0; + while (!ss.eof()) { + getline(ss, first, ','); + if (first != "") { + i++; + } + } + return i; +} + +///////////////////////////////////////////////////////////////////////////////// +/// ConvertArrayStringsToString +///////////////////////////////////////////////////////////////////////////////// +std::string ConvertArrayStringsToString(std::string *strArr, int Size) { + int length = 0; + std::string Result; + if (strArr == NULL) { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "strArr is NULL"); + Result.append(""); + return Result; + } + while (length < Size) { + Result.append(strArr[length]); + Result.append(","); + length++; + } + Result.append(""); + return Result; +} +///////////////////////////////////////////////////////////////////////////////// +/// ConvertStringToArrString +///////////////////////////////////////////////////////////////////////////////// +void ConvertStringToArrString(std::string Input, std::string *strArr, + UI_32 &ArraySize) { // NOLINT (readability/nolint) + if (strArr == NULL) { + FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "strArr is NULL"); + return; + } + int i = 0; + std::string first = ""; + std::istringstream ss(Input); + while (!ss.eof()) { + getline(ss, first, ','); + if (first != "") { + strArr[i] = first; + i++; + } + } + ArraySize = i; +} +///////////////////////////////////////////////////////////////////////////////// +/// C_CWORD77_DataPool +///////////////////////////////////////////////////////////////////////////////// +C_CWORD77_DataPool::C_CWORD77_DataPool() { + m__CWORD77_DataRequestTable.clear(); + m__CWORD77_DataResponseTable.clear(); +} +///////////////////////////////////////////////////////////////////////////////// +/// ~C_CWORD77_DataPool +///////////////////////////////////////////////////////////////////////////////// +C_CWORD77_DataPool::~C_CWORD77_DataPool() { + m__CWORD77_DataRequestTable.clear(); + m__CWORD77_DataResponseTable.clear(); +} + +////////////////////////////////////////// +/// Function : GetInstance +////////////////////////////////////////// +C_CWORD77_DataPool *C_CWORD77_DataPool::GetInstance() { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "GetInstance"); + if (m_p_CWORD77_DataPoolInstance == NULL) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "Before creating object"); + m_p_CWORD77_DataPoolInstance = new C_CWORD77_DataPool(); + } + return m_p_CWORD77_DataPoolInstance; +} + +////////////////////////////////////////// +/// Function : DeleteInstance +////////////////////////////////////////// +void C_CWORD77_DataPool::DeleteInstance() { + DELETEPTR(m_p_CWORD77_DataPoolInstance); +} +///////////////////////////////////////////////////////////////////////////////// +/// GetValueFromMap +///////////////////////////////////////////////////////////////////////////////// +void C_CWORD77_DataPool::GetValueFromMap(ETableType TableType, UI_32 VarName, EDataType &DataType, std::string &Strvalue) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + std::map<UI_32, _CWORD77_Data>::iterator iter; + std::string temp; + + if (TableType == REQUEST_TABLE) { + iter = m__CWORD77_DataRequestTable.begin(); + iter = m__CWORD77_DataRequestTable.find(VarName); + if (iter != m__CWORD77_DataRequestTable.end()) { + DataType = iter->second.DataType; + temp = iter->second.DataValue; + } + } else { + iter = m__CWORD77_DataResponseTable.begin(); + iter = m__CWORD77_DataResponseTable.find(VarName); + if (iter != m__CWORD77_DataResponseTable.end()) { + DataType = iter->second.DataType; + temp = iter->second.DataValue; + } + } + Strvalue.assign(temp); + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); +} +///////////////////////////////////////////////////////////////////////////////// +/// SetValueinMap +///////////////////////////////////////////////////////////////////////////////// +void C_CWORD77_DataPool::SetValueinMap(ETableType TableType, UI_32 VarName, EDataType VarType, std::string Result) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + _CWORD77_Data t_CWORD77_Data; + t_CWORD77_Data.DataType = VarType; + t_CWORD77_Data.DataValue = Result; + if (TableType == REQUEST_TABLE) { + m__CWORD77_DataRequestTable[VarName] = t_CWORD77_Data; + } else { + m__CWORD77_DataResponseTable[VarName] = t_CWORD77_Data; + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); +} + +///////////////////////////////////////////////////////////////////////////////// +/// GetNoofElementsofData +///////////////////////////////////////////////////////////////////////////////// +UI_32 C_CWORD77_DataPool::GetNoofElementsofData(ETableType TableType, UI_32 KeyName) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + EDataType DataType = UNKNOWNTYPE; + std::string Result = ""; + GetValueFromMap(TableType, KeyName, DataType, Result); + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); + return NoOfElementsinData(Result); +} +///////////////////////////////////////////////////////////////////////////////// +/// GetDataType +///////////////////////////////////////////////////////////////////////////////// +EDataType C_CWORD77_DataPool::GetDataType(ETableType TableType, UI_32 KeyName) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + EDataType DataType = UNKNOWNTYPE; + std::string Result = ""; + GetValueFromMap(TableType, KeyName, DataType, Result); + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); + return DataType; +} +///////////////////////////////////////////////////////////////////////////////// +/// SetArrayStringData +///////////////////////////////////////////////////////////////////////////////// +void C_CWORD77_DataPool::SetArrayStringData(ETableType TableType, UI_32 VarName, EDataType VarType, + std::string DataValue[], UI_32 size) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + std::string Result = ConvertArrayStringsToString(DataValue, size); + SetValueinMap(TableType, VarName, VarType, Result); + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); +} +///////////////////////////////////////////////////////////////////////////////// +/// GetArrayStringData +///////////////////////////////////////////////////////////////////////////////// +void C_CWORD77_DataPool::GetArrayStringData(ETableType TableType, UI_32 VarName, std::string DataValue[], UI_32 &size) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + std::string Result = ""; + EDataType DataType = UNKNOWNTYPE; + GetValueFromMap(TableType, VarName, DataType, Result); + ConvertStringToArrString(Result, DataValue, size); + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); +} + + +///////////////////////////////////////////////////////////////////////////////// +/// SetRequestArrayStringData +///////////////////////////////////////////////////////////////////////////////// +void SetRequestArrayStringData(UI_32 VarName, EDataType VarType, std::string DataValue[], UI_32 size) { + g__CWORD77_DataPool.SetReqArrayStringData(VarName, VarType, DataValue, size); +} + +///////////////////////////////////////////////////////////////////////////////// +/// SetResponseArrayStringData +///////////////////////////////////////////////////////////////////////////////// +void SetResponseArrayStringData(UI_32 VarName, EDataType VarType, std::string DataValue[], UI_32 size) { + g__CWORD77_DataPool.SetRespArrayStringData(VarName, VarType, DataValue, size); +} +///////////////////////////////////////////////////////////////////////////////// +/// GetRequestArrayStringData +///////////////////////////////////////////////////////////////////////////////// +void GetRequestArrayStringData(UI_32 VarName, std::string DataValue[], + UI_32 &size) { // NOLINT (readability/nolint) + g__CWORD77_DataPool.GetReqArrayStringData(VarName, DataValue, size); +} + +///////////////////////////////////////////////////////////////////////////////// +/// GetResponseArrayStringData +///////////////////////////////////////////////////////////////////////////////// +void GetResponseArrayStringData(UI_32 VarName, std::string DataValue[], + UI_32 &size) { // NOLINT (readability/nolint) + g__CWORD77_DataPool.GetRespArrayStringData(VarName, DataValue, size); +} + +///////////////////////////////////////////////////////////////////////////////// +/// SetRequestStringData +///////////////////////////////////////////////////////////////////////////////// + +void SetRequestStringData(UI_32 VarName, EDataType VarType, std::string DataValue) { + g__CWORD77_DataPool.SetReqStringData(VarName, VarType, DataValue); +} +///////////////////////////////////////////////////////////////////////////////// +/// SetResponseStringData +///////////////////////////////////////////////////////////////////////////////// +void SetResponseStringData(UI_32 VarName, EDataType VarType, std::string DataValue) { + g__CWORD77_DataPool.SetRespStringData(VarName, VarType, DataValue); +} +///////////////////////////////////////////////////////////////////////////////// +/// GetRequestStringData +///////////////////////////////////////////////////////////////////////////////// +std::string GetRequestStringData(UI_32 VarName) { + return g__CWORD77_DataPool.GetReqStringData(VarName); +} + +///////////////////////////////////////////////////////////////////////////////// +/// GetRequestDataSize +///////////////////////////////////////////////////////////////////////////////// +UI_32 GetRequestDataSize(UI_32 Key) { + return g__CWORD77_DataPool.GetReqDataSize(Key); +} + +///////////////////////////////////////////////////////////////////////////////// +/// GetResponseDataSize +///////////////////////////////////////////////////////////////////////////////// +UI_32 GetResponseDataSize(UI_32 Key) { + return g__CWORD77_DataPool.GetRespDataSize(Key); +} + +///////////////////////////////////////////////////////////////////////////////// +/// GetRequestDataType +///////////////////////////////////////////////////////////////////////////////// +EDataType GetRequestDataType(UI_32 Key) { + return g__CWORD77_DataPool.GetReqDataType(Key); +} +///////////////////////////////////////////////////////////////////////////////// +/// GetResponseDataType +///////////////////////////////////////////////////////////////////////////////// +EDataType GetResponseDataType(UI_32 Key) { + return g__CWORD77_DataPool.GetRespDataType(Key); +} + + + +C_CWORD77_Data *C_CWORD77_Data::m_p_CWORD77_DataInstance = NULL; + +///////////////////////////////////////////////////////////////////////////////// +/// Constructor +///////////////////////////////////////////////////////////////////////////////// +C_CWORD77_Data::C_CWORD77_Data() { + m__CWORD77_RequestDataTable.clear(); + m__CWORD77_ResponseDataTable.clear(); +} +///////////////////////////////////////////////////////////////////////////////// +/// Destructor +///////////////////////////////////////////////////////////////////////////////// +C_CWORD77_Data::~C_CWORD77_Data() { + m__CWORD77_RequestDataTable.clear(); + m__CWORD77_ResponseDataTable.clear(); +} +///////////////////////////////////////////////////////////////////////////////// +/// GetInstacne +///////////////////////////////////////////////////////////////////////////////// +C_CWORD77_Data *C_CWORD77_Data::GetInstance() { + if (m_p_CWORD77_DataInstance == NULL) { + m_p_CWORD77_DataInstance = new C_CWORD77_Data(); // LCOV_EXCL_BR_LINE 11:except branch + } + return m_p_CWORD77_DataInstance; +} +///////////////////////////////////////////////////////////////////////////////// +/// DeleteInstance +///////////////////////////////////////////////////////////////////////////////// +void C_CWORD77_Data::DeleteInstance() { + delete m_p_CWORD77_DataInstance; + m_p_CWORD77_DataInstance = NULL; +} +///////////////////////////////////////////////////////////////////////////////// +/// SetRequData +///////////////////////////////////////////////////////////////////////////////// +VOID C_CWORD77_Data::SetRequData(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 f_uiSize, PVOID f_pData) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + std::vector<CHAR> &DataVector = m__CWORD77_RequestDataTable[f_DataPoolKey]; + CHAR *l_pTemp = static_cast<CHAR *>(f_pData); + DataVector.assign(l_pTemp, (l_pTemp + f_uiSize)); + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); +} +///////////////////////////////////////////////////////////////////////////////// +/// SetRequData +///////////////////////////////////////////////////////////////////////////////// +VOID C_CWORD77_Data::SetRequData(UI_32 f_uiMsgId, UI_32 f_uiSize, PVOID f_pData) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + std::vector<CHAR> &DataVector = m__CWORD77_RequestDataTableOrig[f_uiMsgId]; + CHAR *l_pTemp = static_cast<CHAR *>(f_pData); + DataVector.assign(l_pTemp, (l_pTemp + f_uiSize)); + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); +} +///////////////////////////////////////////////////////////////////////////////// +/// SetRespoData +///////////////////////////////////////////////////////////////////////////////// +VOID C_CWORD77_Data::SetRespoData(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 f_uiSize, const PVOID f_pData) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + std::vector<CHAR> &DataVector = m__CWORD77_ResponseDataTable[f_DataPoolKey]; + CHAR *l_pTemp = static_cast<CHAR *>(f_pData); + DataVector.assign(l_pTemp, (l_pTemp + f_uiSize)); + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" +} +///////////////////////////////////////////////////////////////////////////////// +/// SetRespoData +///////////////////////////////////////////////////////////////////////////////// +VOID C_CWORD77_Data::SetRespoData(UI_32 f_uiMsgId, UI_32 f_uiSize, const PVOID f_pData) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + std::vector<CHAR> &DataVector = m__CWORD77_ResponseDataTableOrig[f_uiMsgId]; + CHAR *l_pTemp = static_cast<CHAR *>(f_pData); + DataVector.assign(l_pTemp, (l_pTemp + f_uiSize)); + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); +} +///////////////////////////////////////////////////////////////////////////////// +/// GetRequData +///////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus C_CWORD77_Data::GetRequData(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 &f_uiSize, PVOID &f_pData) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusDbRecNotFound; // data not found in data pool + T_CWORD77_DataPool::iterator l_iter; + + l_iter = m__CWORD77_RequestDataTable.find(f_DataPoolKey); + if (l_iter != m__CWORD77_RequestDataTable.end()) { + f_uiSize = static_cast<UI_32>(l_iter->second.size()); + if (f_uiSize > 0) { + f_pData = &l_iter->second[0]; + } else { + f_pData = NULL; + } + l_eStatus = eFrameworkunifiedStatusOK; + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); + return l_eStatus; +} +///////////////////////////////////////////////////////////////////////////////// +/// GetRequData +///////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus C_CWORD77_Data::GetRequData(UI_32 f_uiMsgId, UI_32 &f_uiSize, PVOID &f_pData) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusDbRecNotFound; // data not found in data pool + std::map<UI_32, std::vector<CHAR> >::iterator l_iter; + + l_iter = m__CWORD77_RequestDataTableOrig.find(f_uiMsgId); + if (l_iter != m__CWORD77_RequestDataTableOrig.end()) { + f_uiSize = static_cast<UI_32>(l_iter->second.size()); + if (f_uiSize > 0) { + f_pData = &l_iter->second[0]; + } else { + f_pData = NULL; + } + l_eStatus = eFrameworkunifiedStatusOK; + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); + return l_eStatus; +} +///////////////////////////////////////////////////////////////////////////////// +/// GetRespoData +///////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus C_CWORD77_Data::GetRespoData(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 &f_uiSize, PVOID &f_pData) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail; + T_CWORD77_DataPool::iterator l_iter; + l_iter = m__CWORD77_ResponseDataTable.find(f_DataPoolKey); + if (l_iter != m__CWORD77_ResponseDataTable.end()) { + f_uiSize = static_cast<UI_32>(l_iter->second.size()); + if (f_uiSize > 0) { + /** + * @todo + * If *f_pData is set to NULL, a segmentation fault occurs. + */ + f_pData = &l_iter->second[0]; + } else { + f_pData = NULL; + } + l_eStatus = eFrameworkunifiedStatusOK; + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + return l_eStatus; +} +///////////////////////////////////////////////////////////////////////////////// +/// GetRespoData +///////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus C_CWORD77_Data::GetRespoData(UI_32 f_uiMsgId, + UI_32 &f_uiSize, PVOID &f_pData) { // NOLINT (readability/nolint) + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail; + std::map<UI_32, std::vector<CHAR> >::iterator l_iter; + l_iter = m__CWORD77_ResponseDataTableOrig.find(f_uiMsgId); + if (l_iter != m__CWORD77_ResponseDataTableOrig.end()) { + f_uiSize = static_cast<UI_32>(l_iter->second.size()); + if (f_uiSize > 0) { + f_pData = &l_iter->second[0]; + } else { + f_pData = NULL; + } + l_eStatus = eFrameworkunifiedStatusOK; + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); + return l_eStatus; +} + +///////////////////////////////////////////////////////////////////////////////// +/// SetReqDataIn_CWORD77_DataPool +///////////////////////////////////////////////////////////////////////////////// +VOID SetReqDataIn_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint) + UI_32 f_uiSize, PVOID f_pData) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + if (C_CWORD77_Data::GetInstance()) { + C_CWORD77_Data::GetInstance()->SetRequData(f_DataPoolKey, f_uiSize, f_pData); + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); +} + +///////////////////////////////////////////////////////////////////////////////// +/// SetRespDataIn_CWORD77_DataPool +///////////////////////////////////////////////////////////////////////////////// +VOID SetRespDataIn_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint) + UI_32 f_uiSize, const PVOID f_pData) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + if (C_CWORD77_Data::GetInstance()) { + C_CWORD77_Data::GetInstance()->SetRespoData(f_DataPoolKey, f_uiSize, f_pData); + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); +} + +///////////////////////////////////////////////////////////////////////////////// +/// SetRespNotfnDataIn_CWORD77_DataPool +///////////////////////////////////////////////////////////////////////////////// +VOID SetRespNotfnDataIn_CWORD77_DataPool(const std::string &f_cNotificationName, // NOLINT (readability/nolint) + UI_32 f_uiSize, const PVOID f_pData) { + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + if (C_CWORD77_Data::GetInstance()) { + // LCOV_EXCL_BR_START 11:except branch + C_CWORD77_Data::GetInstance()->SetRespoData(std::make_pair(g_uiNotificationDataPoolId, f_cNotificationName), f_uiSize, // LCOV_EXCL_BR_LINE 11:except branch + f_pData); + // LCOV_EXCL_BR_STOP + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" +} + +///////////////////////////////////////////////////////////////////////////////// +/// GetReqDataFrom_CWORD77_DataPool +///////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus GetReqDataFrom_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint) + UI_32 &f_uiSize, // NOLINT (readability/nolint) + PVOID &f_pData) { // NOLINT (readability/nolint) + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail; + if (C_CWORD77_Data::GetInstance()) { + l_eStatus = C_CWORD77_Data::GetInstance()->GetRequData(f_DataPoolKey, f_uiSize, f_pData); + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); + return l_eStatus; +} + +///////////////////////////////////////////////////////////////////////////////// +/// GetRespDataFrom_CWORD77_DataPool +///////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus GetRespDataFrom_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint) + UI_32 &f_uiSize, // NOLINT (readability/nolint) + PVOID &f_pData) { // NOLINT (readability/nolint) + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail; + if (C_CWORD77_Data::GetInstance()) { + l_eStatus = C_CWORD77_Data::GetInstance()->GetRespoData(f_DataPoolKey, f_uiSize, f_pData); + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); + return l_eStatus; +} + +///////////////////////////////////////////////////////////////////////////////// +/// GetRespDataFrom_CWORD77_DataPool +///////////////////////////////////////////////////////////////////////////////// +EFrameworkunifiedStatus GetRespNotfnDataFrom_CWORD77_DataPool(const std::string &f_cNotificationName, // NOLINT (readability/nolint) + UI_32 &f_uiSize, // NOLINT (readability/nolint) + PVOID &f_pData) { // NOLINT (readability/nolint) + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail; + if (C_CWORD77_Data::GetInstance()) { + // LCOV_EXCL_BR_START 11:except branch + l_eStatus = C_CWORD77_Data::GetInstance()->GetRespoData(std::make_pair(g_uiNotificationDataPoolId, f_cNotificationName), + f_uiSize, f_pData); + // LCOV_EXCL_BR_STOP + } + FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" + return l_eStatus; +} |