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.
21 * PSMShadow service-to-service interface
24 /*---------------------------------------------------------------------------------*
26 *---------------------------------------------------------------------------------*/
27 #include <vehicle_service/positioning_base_library.h>
28 #include "PSMShadowIf.h"
30 /*---------------------------------------------------------------------------------*
32 *---------------------------------------------------------------------------------*/
34 /*---------------------------------------------------------------------------------*
36 *---------------------------------------------------------------------------------*/
38 /*---------------------------------------------------------------------------------*
39 * Local Function Prototype *
40 *---------------------------------------------------------------------------------*/
42 /*---------------------------------------------------------------------------------*
44 *---------------------------------------------------------------------------------*/
46 /*---------------------------------------------------------------------------------*
48 *---------------------------------------------------------------------------------*/
51 * PSMShadow Services IF Availability Change Notification Registration
53 * @param[in] fp_on_cmd Callback function
54 * @return eFrameworkunifiedStatusOK
55 * @return eFrameworkunifiedStatusFail
57 EFrameworkunifiedStatus PSMShadowIfNotifyOnPSMShadowAvailability(CbFuncPtr fp_on_cmd) {
58 EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
61 happ = _pb_GetAppHandle();
63 /* PS_PSMShadow/Availability Changing notification registration */
64 estatus = FrameworkunifiedSubscribeNotificationWithCallback(happ, NTFY_PSMShadowService_Availability, fp_on_cmd); // LCOV_EXCL_BR_LINE 6:unexpected branch //NOLINT (whitespace/line_length)
65 if (eFrameworkunifiedStatusOK != estatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
66 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
67 "PositioningSubscriveNotificationswithCallback ERROR!! [estatus=%d]", estatus);
70 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
78 * Register PSMShadow services IF start completion notification
80 * @param[in] fp_on_cmd Callback function
81 * @return eFrameworkunifiedStatusOK
82 * @return eFrameworkunifiedStatusFail
84 EFrameworkunifiedStatus PSMShadowIfNotifyOnPSMShadowInitComp(CbFuncPtr fp_on_cmd) {
85 EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
88 happ = _pb_GetAppHandle();
90 /* PS_PSMShadow startup completion notice */
91 estatus = FrameworkunifiedSubscribeNotificationWithCallback(happ, NTFY_PSM_INITCOMP, fp_on_cmd); // LCOV_EXCL_BR_LINE 6:unexpected branch //NOLINT (whitespace/line_length)
92 if (eFrameworkunifiedStatusOK != estatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
93 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
94 "PositioningSubscriveNotificationswithCallback ERROR!! [estatus=%d]", estatus);
97 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);