2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <other_service/rpc.h>
18 #include "resm_internal.h"
19 #include "resmgr_api.h"
20 #include "resmgr_api_resourcemanagerlog.h"
22 /**********************************************
23 * External variable definitions
24 **********************************************/
25 RPC_ID __thread rpcId;
27 /*******************************************************************************
29 *******************************************************************************/
32 RESM_Open(const RESM_RSV_t* p_prim, uint32_t* p_ssnId)
39 if( p_ssnId == NULL ) {
44 if( RPC_OK != RPC_START_CLIENT(&rpcId) ) {
45 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr Open: RPC_START Error"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
51 resmRet = RESM_SV_Open(p_prim, p_ssnId);
52 if( resmRet != RESM_E_OK ) {
53 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr Open: Open Session Error. ret[%d]", resmRet); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
58 evRet = EV_create_flag(Resm_Flag_ID_Base + *p_ssnId);
59 if( evRet != EV_OK ) {
60 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr Open: create_flag Error. ret[%d]", evRet);
69 RESM_Close(uint32_t ssnId)
75 resmRet = RESM_SV_Close(ssnId);
76 if( resmRet != RESM_E_OK ) {
80 // Destroy RPC Resources
88 RESM_GetEventFd(uint32_t ssnId, int32_t* p_fd)
98 resmRet = RESM_SV_ChkSsnId(ssnId);
99 if( resmRet != RESM_E_OK ) {
103 if( EV_OK != EV_get_flag_fd(Resm_Flag_ID_Base + ssnId, p_fd) ) {
104 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr GetEventFd Error");
113 RESM_GetEvent(uint32_t ssnId, RESM_EV_t* p_evFlag)
120 if( p_evFlag == NULL ) {
124 resmRet = RESM_SV_ChkSsnId(ssnId);
125 if( resmRet != RESM_E_OK ) {
129 if( EV_OK != EV_get_flag(Resm_Flag_ID_Base + ssnId, &flag)) {
130 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr GetEvent(get_flag) Error");
134 if( flag.bits == 0 ) {
139 *p_evFlag = flag.bits;