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 ////////////////////////////////////////////////////////////////////////////////////////////////////
18 /// \defgroup <<Group Tag>> <<Group Name>>
19 /// \ingroup tag_NS_NPPService
21 ////////////////////////////////////////////////////////////////////////////////////////////////////
23 ////////////////////////////////////////////////////////////////////////////////////////////////////
24 /// \ingroup tag_NS_NPPService
25 /// \brief This file contains implementation of internal transitions of state machine
27 ////////////////////////////////////////////////////////////////////////////////////////////////////
30 #include <native_service/ns_np_service.h>
31 #include <native_service/frameworkunified_framework_if.h>
32 #include <native_service/ns_np_service_protocol.h>
33 #include <native_service/ns_np_service_notification.h>
36 #include "app_states.h"
38 #include "ns_npp_notificationpersistentservicelog.h"
39 #include "ns_npp_notification_manager.h"
40 #include "ns_npp_persistence_manager.h"
41 #include "ns_npp_persistent_data.h"
42 #include "ns_npp_personalization_manager.h"
45 #ifdef NPP_PROFILEINFO_ENABLE
46 #include <ns_npp_profiling_protocols_internal.h>
50 #include <other_service/strlcpy.h>
53 static size_t NppUIToA(unsigned int value, char *buf) {
54 static const char c[] = "0123456789";
56 char *p = b + sizeof(b);
65 strcpy(buf, p); // NOLINT (runtime/printf)
70 static size_t NppStrlcpy(char *dst, const char *src, size_t siz) {
71 size_t ret = strlen(src);
73 if (siz) { // LCOV_EXCL_BR_LINE 6: siz can't be 0
74 size_t len = (ret >= siz) ? siz - 1 : ret;
75 memcpy(dst, src, len);
81 #define NPP_SET_FIXSTR(buf, str) \
83 strcpy(buf, str); /* NOLINT (runtime/printf) */ \
84 buf += sizeof(str) - 1; \
87 #define NPP_SET_VARSTR(buf, str, siz) \
88 buf += NppStrlcpy(buf, str, siz)
90 extern CHAR g_csendreadyackto[];
92 ////////////////////////////////////////////////////////////////////////////////////////////////////
93 /// NotificationpersistentserviceOnNPRegisterNotifications
94 /// The state machine executes this transition when event for registering notification is triggered.
95 ////////////////////////////////////////////////////////////////////////////////////////////////////
96 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterNotifications) { // NOLINT (readability/naming)
98 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
99 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
101 CHKNULL(f_pSourceState);
102 NC_register_multiple_notif_msg *l_pMsg = NULL;
104 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
107 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
108 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
110 // get app name of message source
111 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
112 CHKNULL(l_cMsgSource);
114 // get instance of notification manager
115 CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
117 if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
118 UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
120 if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
121 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
122 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register notifications. Invalid message length received."); // LCOV_EXCL_LINE 6: l_uiMsgLength must be greater than 0 // NOLINT[whitespace/line_length]
124 std::vector<CHAR> l_vData = std::vector<CHAR>(l_uiMsgLength);
126 // get the received data
127 if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(
128 l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) {
129 l_pMsg = reinterpret_cast<NC_register_multiple_notif_msg *>(&l_vData[0]);
131 if (NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 6: l_pMsg can't be NULL
132 NC_register_notif_msg *l_pEventInfo = NULL;
134 // register all the notifications
135 for (UI_32 l_uiCount = 0;
136 l_uiCount < l_pMsg->numNotifications;
138 l_pEventInfo = &l_pMsg->notifierList[l_uiCount];
140 if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
141 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Register Notfn request, src=%s, name=%s, len=%d, type=%d",
142 l_cMsgSource, l_pEventInfo->notificationName, l_pEventInfo->maxLength, l_pEventInfo->persType);
144 // register the notification
145 if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnRegisterEvents(l_cMsgSource,
146 l_pEventInfo->notificationName,
147 l_pEventInfo->maxLength,
148 l_pEventInfo->persType)) {
149 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
150 "Error in NotificationpersistentserviceServiceOnRegisterEvents :: %s", l_pEventInfo->notificationName);
153 // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
154 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
155 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
156 "Can't register notification from source %s. l_pEventInfo is NULL", l_cMsgSource);
161 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
162 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid src mq"); // LCOV_EXCL_LINE 6: l_pMsg can't be NULL
165 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
166 "Can't register notifications from source %s, Unable to get message data. Error Status: 0x%x",
167 l_cMsgSource, l_estatus);
171 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
172 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationManager is NULL"); // LCOV_EXCL_LINE 6: l_pNotificationManager can't be NULL // NOLINT[whitespace/line_length]
174 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
175 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
176 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
177 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
181 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
182 return f_pSourceState;
185 ////////////////////////////////////////////////////////////////////////////////////////////////////
186 /// NotificationpersistentserviceOnNPSubscribeToNotification
187 /// The state machine executes this transition when event for subscribing single notification is
189 ////////////////////////////////////////////////////////////////////////////////////////////////////
190 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotification) {
192 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
193 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
195 CHKNULL(f_pSourceState);
196 NC_subscribe_msg l_objSubscribeMsg;
198 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
201 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
202 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
204 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
205 CHKNULL(l_cMsgSource);
207 // get instance of notification manager
208 CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
210 if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
211 if (FrameworkunifiedGetMsgLength(l_pHApp) == sizeof(NC_subscribe_msg)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
212 // get the data received
213 if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_objSubscribeMsg), sizeof(NC_subscribe_msg), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
214 #ifdef NPP_PERFORMANCE_ANALYZE_ENABLE
217 NPP_SET_FIXSTR(p, "Subscribing Notfn request, src=");
218 NPP_SET_VARSTR(p, l_cMsgSource, sizeof(buf) - (p - buf));
219 NPP_SET_FIXSTR(p, ", name=");
220 strcpy(p, l_objSubscribeMsg.notificationName); // NOLINT (runtime/printf)
221 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, buf);
222 /* FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
223 * "Subscribing Notfn request, src=%s, name=%s",
224 * l_cMsgSource, l_objSubscribeMsg.notificationName);*/
225 #endif // ifdef NPP_PERFORMANCE_ANALYZE_ENABLE
227 // subscribe for notification
228 if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnSubscribeToEvent(
230 l_objSubscribeMsg.notificationName)) {
231 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
232 "Error in NotificationpersistentserviceServiceOnSubscribeToEvent :: %s", l_objSubscribeMsg.notificationName);
235 // LCOV_EXCL_START 4: NSFW error case
236 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
237 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
238 "Can't subscribe to notification from source %s. Unable to get msg data, status: 0x%x",
239 l_cMsgSource, l_estatus);
243 // LCOV_EXCL_START 4: NSFW error case
244 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
245 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
246 "Can't subscribe to notification from source %s. Invalid message length received.",
251 // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
252 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
253 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't subscribe to notification from source %s. l_pNotificationManager is NULL",
257 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
258 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
259 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
260 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
264 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
265 return f_pSourceState;
268 ////////////////////////////////////////////////////////////////////////////////////////////////////
269 /// NotificationpersistentserviceOnNPSubscribeToNotifications
270 /// The state machine executes this transition when event for subscribing multiple notification is
272 ////////////////////////////////////////////////////////////////////////////////////////////////////
273 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotifications) {
275 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
276 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
278 CHKNULL(f_pSourceState);
279 NC_subscribe_multiple_notif_msg *l_pMsg = NULL;
281 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
284 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
285 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
287 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
288 CHKNULL(l_cMsgSource);
290 // get instance of notification manager
291 CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
293 if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
294 UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
296 if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
297 // LCOV_EXCL_START 6: l_uiMsgLength must be greater than 0
298 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
299 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid msg len");
302 std::vector<CHAR> l_vData = std::vector<CHAR>(l_uiMsgLength);
304 // get the data received
305 if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
306 l_pMsg = reinterpret_cast<NC_subscribe_multiple_notif_msg *>(&l_vData[0]);
308 if (NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 6: l_pMsg can't be NULL
309 NC_subscribe_msg *l_pEventInfo = NULL;
311 // subscribe to multiple notifications
312 for (UI_32 l_uiCount = 0;
313 l_uiCount < l_pMsg->numNotifications;
315 l_pEventInfo = &l_pMsg->notificationList[l_uiCount];
317 if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
318 #ifdef NPP_PERFORMANCE_ANALYZE_ENABLE
321 NPP_SET_FIXSTR(p, "Subscribe Notfn request, src=");
322 NPP_SET_VARSTR(p, l_cMsgSource, sizeof(buf) - (p - buf));
323 NPP_SET_FIXSTR(p, ", name=");
324 strcpy(p, l_pEventInfo->notificationName); // NOLINT (runtime/printf)
325 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, buf);
326 /* FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
327 "Subscribe Notfn request, src=%s, name=%s",
329 l_pEventInfo->notificationName);*/
330 #endif // ifdef NPP_PERFORMANCE_ANALYZE_ENABLE
332 // subscribe to notification
333 if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnSubscribeToEvent(
335 l_pEventInfo->notificationName)) {
336 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
337 "Error in NotificationpersistentserviceServiceOnSubscribeToEvent :: %s", l_pEventInfo->notificationName);
340 // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
341 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
342 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
343 "Unable to subscribe to notifications from source %s, l_pEventInfo is NULL", l_cMsgSource);
348 // LCOV_EXCL_START 6: l_pMsg can't be NULL
349 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
350 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
351 "Unable to subscribe to notifications from source %s, Invalid src mq", l_cMsgSource);
357 // LCOV_EXCL_START 4: NSFW error case
358 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
359 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
360 "Unable to subscribe to notifications from source %s, error retrieving message data, status: 0x%x",
367 // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
368 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
369 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
370 "Unable to subscribe to notifications from source %s, l_pNotificationManager is NULL",
374 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
375 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
376 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
377 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
381 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
382 return f_pSourceState;
385 ////////////////////////////////////////////////////////////////////////////////////////////////////
386 /// NotificationpersistentserviceOnNPPublishNotification
387 /// The state machine executes this transition when event for publishing notification is triggered.
388 ////////////////////////////////////////////////////////////////////////////////////////////////////
389 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishNotification) {
391 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
392 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
394 CHKNULL(f_pSourceState);
396 CHAR l_cData[MAX_SYS_INFO_SIZE];
398 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
401 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
402 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
404 // get the app name of message source
405 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
406 CHKNULL(l_cMsgSource);
408 // get instance of notification manager
409 CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
411 if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
412 // retrieve notification name
413 FrameworkunifiedGetSystemInfo(l_pHApp, l_cData);
415 UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
419 NPP_SET_FIXSTR(p, "Publish Notfn request, src=");
420 NPP_SET_VARSTR(p, l_cMsgSource, sizeof(buf) - (p - buf));
421 NPP_SET_FIXSTR(p, ", name=");
422 NPP_SET_VARSTR(p, l_cData, sizeof(buf) - (p - buf));
423 NPP_SET_FIXSTR(p, ", len=");
424 NppUIToA(l_uiMsgLength, p);
425 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, buf);
426 /* FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
427 "Publish Notfn request, src=%s, name=%s, len=%d",
428 l_cMsgSource, l_cData, l_uiMsgLength);*/
430 if (0 != l_uiMsgLength) {
431 std::vector<CHAR> pMsgData = std::vector<CHAR>(l_uiMsgLength);
433 // get the received data
434 if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &pMsgData[0], static_cast<UI_32>(pMsgData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
435 // publish the notification
436 (VOID)l_pNotificationManager->NotificationpersistentserviceServiceOnPublishEvent(l_cMsgSource, l_cData,
437 (PVOID)&pMsgData[0], l_uiMsgLength);
439 // LCOV_EXCL_START 4: NSFW error case
440 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
441 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
442 "Can't publish notification from source %s, Unable to get messsage data, Error Status: 0x%x",
443 l_cMsgSource, l_estatus);
444 // LCOV_EXCL_STOP 4: NSFW error case
447 // publish the notification
448 (VOID)l_pNotificationManager->NotificationpersistentserviceServiceOnPublishEvent(l_cMsgSource, l_cData, NULL, l_uiMsgLength);
451 // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
452 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
453 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't publish notification from source %s. l_pNotificationManager is NULL",
457 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
458 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
459 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
460 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
464 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
465 return f_pSourceState;
468 ////////////////////////////////////////////////////////////////////////////////////////////////////
469 /// NotificationpersistentserviceOnNPUnSubscribeFromNotification
470 /// The state machine executes this transition when event for unsubscribing notification is triggered.
471 ////////////////////////////////////////////////////////////////////////////////////////////////////
472 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotification) {
474 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
475 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
477 CHKNULL(f_pSourceState);
478 NC_unsubscribe_frm_notif_msg unsubscribeMsg;
480 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
483 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
484 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
486 // get the msg source name
487 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
488 CHKNULL(l_cMsgSource);
490 // get instance of notification manager
491 CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
493 if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 200: l_pNotificationManager can't be NULL
494 if (FrameworkunifiedGetMsgLength(l_pHApp) == sizeof(NC_unsubscribe_frm_notif_msg)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
495 // get the received data
496 if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&unsubscribeMsg), sizeof(NC_unsubscribe_frm_notif_msg), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
497 FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Source: %s is unsubscribing from notification: %s", l_cMsgSource,
498 unsubscribeMsg.notificationName);
500 // unsubscribe from notification
501 if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnUnSubscribeFromEvent(
503 unsubscribeMsg.notificationName)) {
504 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
505 "Error in NotificationpersistentserviceServiceOnUnSubscribeFromEvent :: %s",
506 unsubscribeMsg.notificationName);
509 // LCOV_EXCL_START 4: NSFW error case
510 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
511 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
512 "%s is unable to subscribe from notification, error getting message data, status: 0x%x",
513 l_cMsgSource, l_estatus);
517 // LCOV_EXCL_START 4: NSFW error case
518 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
519 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
520 "Can't unsubscribe to notification from source %s, Invalid Message size received.",
525 // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
526 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
527 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
528 "Can't unsubscribe to notification from source %s, l_pNotificationManager is NULL",
532 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
533 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
534 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
535 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
539 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
540 return f_pSourceState;
543 ////////////////////////////////////////////////////////////////////////////////////////////////////
544 /// NotificationpersistentserviceOnNPUnSubscribeFromNotification
545 /// The state machine executes this transition when event for unsubscribing notification is triggered.
546 ////////////////////////////////////////////////////////////////////////////////////////////////////
547 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotifications) {
549 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
550 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
552 CHKNULL(f_pSourceState);
553 NC_unsubscribe_multiple_notif_msg *l_pMsg = NULL;
555 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
558 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
559 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
561 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
562 CHKNULL(l_cMsgSource);
564 // get instance of notification manager
565 CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
567 if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
568 UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
570 if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
571 // LCOV_EXCL_START 6: l_uiMsgLength must be greater than 0
572 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
573 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
574 "Can't unsubscribe from notifications from source %s. Invalid message length received",
578 std::vector<CHAR> l_vData = std::vector<CHAR>(l_uiMsgLength);
580 // get the data received
581 if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
582 l_pMsg = reinterpret_cast<NC_unsubscribe_multiple_notif_msg *>(&l_vData[0]);
584 if (NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 6: l_pMsg can't be NULL
585 NC_unsubscribe_frm_notif_msg *l_pEventInfo = NULL;
587 // subscribe to multiple notifications
588 for (UI_32 l_uiCount = 0;
589 l_uiCount < l_pMsg->numNotifications;
591 l_pEventInfo = &l_pMsg->notificationList[l_uiCount];
593 if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
594 FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Source: %s is unsubscribing from notification: %s", l_cMsgSource,
595 l_pEventInfo->notificationName);
597 // unsubscribe from notification
598 if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnUnSubscribeFromEvent(
600 l_pEventInfo->notificationName)) {
601 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
602 "Error in NotificationpersistentserviceServiceOnUnSubscribeFromEvent :: %s", l_pEventInfo->notificationName);
606 // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
607 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
608 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
609 "Can't unsubscribe from notifications from source %s. l_pEventInfo is NULL",
615 // LCOV_EXCL_START 6: l_pMsg can't be NULL
616 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
617 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
618 "Can't unsubscribe from notifications from source %s. Invalid src mq", l_cMsgSource);
624 // LCOV_EXCL_START 4: NSFW error case
625 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
626 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
627 "Can't unsubscribe from notifications from source %s, error getting message data, status: 0x%x",
634 // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
635 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
636 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
637 "Can't unsubscribe from notifications from source %s. l_pNotificationManager is NULL",
641 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
642 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
643 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
644 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
648 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
649 return f_pSourceState;
652 ////////////////////////////////////////////////////////////////////////////////////////////////////
653 /// NotificationpersistentserviceOnNPUnRegisterNotifications
654 /// The state machine executes this transition when event for unregistering notifications is triggered.
655 ////////////////////////////////////////////////////////////////////////////////////////////////////
656 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnRegisterNotifications) {
658 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
659 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
661 CHKNULL(f_pSourceState);
662 NC_unregister_multiple_notif_msg *l_pMsg = NULL;
664 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
667 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
668 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
670 // get the source name
671 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
672 CHKNULL(l_cMsgSource);
674 // get instance of notification manager
675 CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
677 if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
678 UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
680 if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
681 // LCOV_EXCL_START 6: l_uiMsgLength must be greater than 0
682 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
683 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
684 "Can't unregister to notifications from source %s. Invalid message length received.",
688 std::vector<CHAR>l_vData = std::vector<CHAR>(l_uiMsgLength);
690 // get the received data
691 if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
692 l_pMsg = reinterpret_cast<NC_unregister_multiple_notif_msg *>(&l_vData[0]);
694 // unregister multiple notifications
695 if (NULL != l_cMsgSource && NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 6: l_cMsgSource and l_pMsg can't be NULL
696 NC_unregister_notif_msg *l_pEventInfo = NULL;
698 for (UI_32 l_uiCount = 0;
699 l_uiCount < l_pMsg->numNotifications;
701 l_pEventInfo = &l_pMsg->notificationList[l_uiCount];
703 if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
704 FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Source %s is unregistering to notification %s", l_cMsgSource,
705 l_pEventInfo->notificationName);
707 // unregister notification
708 if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnUnRegisterEvents(
710 l_pEventInfo->notificationName)) {
711 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
712 "Error in NotificationpersistentserviceServiceOnUnRegisterEvents :: %s", l_pEventInfo->notificationName);
715 // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
716 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
717 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
718 "Can't unregister to notifications from source %s, l_pEventInfo is NULL", l_cMsgSource);
723 // LCOV_EXCL_START 6: l_cMsgSource and l_pMsg can't be NULL
724 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
725 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
726 "Can't unregister to notificationsfrom source %s, Invalid src mq ", l_cMsgSource);
732 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
733 "Can't unregister to notifications from source %s, Unable to get message data, status: 0x%x",
734 l_cMsgSource, l_estatus);
738 // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
739 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
740 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
741 "Can't unregister to notifications from source %s, l_pNotificationManager is NULL",
745 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
746 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
747 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
748 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
752 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
753 return f_pSourceState;
756 ////////////////////////////////////////////////////////////////////////////////////////////////////
757 /// NotificationpersistentserviceOnNPReadPersistedData
758 /// The state machine executes this transition when event for getting notification's persistent data
760 ////////////////////////////////////////////////////////////////////////////////////////////////////
761 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPReadPersistedData) {
763 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
764 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
766 CHKNULL(f_pSourceState);
767 NC_get_pers_data_msg l_tMsg;
769 l_tMsg.notificationName[0] = '\0';
771 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
774 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
775 CHKNULL(l_cMsgSource);
777 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
778 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
780 // get instance of notification manager
781 CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
783 if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
784 if (FrameworkunifiedGetMsgLength(l_pHApp) == sizeof(NC_get_pers_data_msg)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
785 // get the message data received
786 if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(NC_get_pers_data_msg), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
787 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Source %s is requesting to read data for persistent notification %s",
788 l_cMsgSource, l_tMsg.notificationName);
789 // get persistent data related to notification
790 if (eFrameworkunifiedStatusOK != (l_estatus = l_pNotificationManager->NotificationpersistentserviceServiceOnGetPersistentData(
791 l_tMsg.notificationName,
793 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in NotificationpersistentserviceServiceOnGetPersistentData :: %s", l_tMsg.notificationName);
796 // LCOV_EXCL_START 4: NSFW error case
797 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
798 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
799 "Can't read persistent data for source %s, Error getting message data, status: 0x%x",
800 l_cMsgSource, l_estatus);
804 // LCOV_EXCL_START 4: NSFW error case
805 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
806 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't read persistent data for source %s. Invalid Message size received.",
808 l_estatus = eFrameworkunifiedStatusFail;
812 // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
813 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
814 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't read persistent data for source %s. l_pNotificationManager is NULL",
816 l_estatus = eFrameworkunifiedStatusFail;
820 // if any error occurs while reading persistent data, send failed ack to the requestor
821 if (eFrameworkunifiedStatusOK != l_estatus) {
822 HANDLE l_hReceiverMq = McOpenSender(l_cMsgSource);
823 if (NULL != l_hReceiverMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
824 NC_get_persdata_failed_ack gpdFailed = {};
825 std::strncpy(&gpdFailed.notificationName[0], l_tMsg.notificationName, MAX_STRING_SIZE_NOTIFICATION);
827 // send the failure ack to requester
828 l_estatus = McSend(l_hReceiverMq, AppName, NPS_GET_PERS_DATA_FAILED_ACK, sizeof(gpdFailed), &gpdFailed); // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
829 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
830 "Sent NPS_GET_PERS_DATA_FAILED_ACK to %s. Status: %d.",
831 l_cMsgSource, l_estatus);
833 McClose(l_hReceiverMq);
835 // LCOV_EXCL_START 4: NSFW error case.
836 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
837 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in opening sender queue of %s. Can't send NPS_GET_PERS_DATA_FAILED_ACK",
842 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
843 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
844 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
845 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
850 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
851 return f_pSourceState;
854 ////////////////////////////////////////////////////////////////////////////////////////////////////
855 /// NotificationpersistentserviceOnNPPublishImmediateNotification
856 /// This transition is executed when service updates the immediate notification data
857 /// using synchronous API
858 ////////////////////////////////////////////////////////////////////////////////////////////////////
859 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishImmediateNotification) {
861 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
862 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
864 CHKNULL(f_pSourceState);
866 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
869 // get the app name of message source
870 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
871 CHKNULL(l_cMsgSource);
873 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
874 CHKNULL(l_pNotificationpersistentserviceHSM);
875 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
877 // get instance of notification manager
878 CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
879 CHKNULL(l_pNotificationManager);
881 CHAR l_cNotfName[MAX_SYS_INFO_SIZE] = {};
883 // retrieve notification name
884 (VOID)FrameworkunifiedGetSystemInfo(l_pHApp, l_cNotfName);
886 UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
888 FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
889 "Warning::Notification %s published using sync API by %s, Data length: %d",
891 l_cMsgSource, l_uiMsgLength);
893 if (0 != l_uiMsgLength) {
894 std::vector<CHAR> pMsgData = std::vector<CHAR>(l_uiMsgLength);
896 // get the received data
897 if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &pMsgData[0], l_uiMsgLength, eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
898 // publish the notification
899 (VOID)l_pNotificationManager->NotificationpersistentservicePublishImmediateNotification(l_cMsgSource, l_cNotfName, (PVOID)&pMsgData[0],
902 // LCOV_EXCL_START 4: NSFW error case
903 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
904 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
905 "Can't publish notification %s from source %s, Unable to get messsage data, Error Status: 0x%x",
907 l_cMsgSource, l_estatus);
911 // publish the notification
912 (VOID)l_pNotificationManager->NotificationpersistentservicePublishImmediateNotification(l_cMsgSource, l_cNotfName, NULL, l_uiMsgLength);
914 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
915 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
916 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
917 f_pSourceState = NULL;
921 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
922 return f_pSourceState;
924 ////////////////////////////////////////////////////////////////////////////////////////////////////
925 /// NotificationpersistentserviceOnNPPersistentSync
926 /// Processing which synchronizes by NPPService (syncfs)
928 ////////////////////////////////////////////////////////////////////////////////////////////////////
929 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPPersistentSync) {
931 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
932 CHKNULL(f_pSourceState);
934 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
936 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
937 CHKNULL(l_pNotificationpersistentserviceHSM);
938 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
941 if (TRUE == l_pnsnpp->Syncfs()) { // LCOV_EXCL_BR_LINE 6: always return true
942 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
943 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "syncfs are processed."); // LCOV_EXCL_LINE 6: always return true
945 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
946 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
947 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
948 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
953 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
954 return f_pSourceState;
957 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPReleaseFileAck) {
959 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
961 NSP_CopyStatusResponse l_tCpStatus = {};
963 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
966 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
967 CHKNULL(l_pNotificationpersistentserviceHSM);
969 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
971 if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, (PVOID)&l_tCpStatus, sizeof(l_tCpStatus), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
972 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s for tag: %s sender: %s, persist type:%d",
973 (l_tCpStatus.m_bpersistencechk ? "Successful copy" : "Non-Successful copy"),
974 l_tCpStatus.m_cpersistenttag, l_tCpStatus.m_crequesterappname, l_tCpStatus.m_eloadtype);
976 if (LOADTYPE_LOAD == l_tCpStatus.m_eloadtype) { // ack for load file/folder
978 NC_LoadPersistedAck l_tMsgAck = {};
980 // HANDLE hMq = McOpenSender(l_tCpStatus.sender);
981 hMq = FrameworkunifiedMcOpenSender(l_pHApp, l_tCpStatus.m_crequesterappname);
983 // send NC_LoadPersistedAck to the requester
984 l_tMsgAck.eStatus = (TRUE == l_tCpStatus.m_bpersistencechk) ? eFrameworkunifiedStatusOK : eFrameworkunifiedStatusFail;
986 #ifdef AGL_PosixBasedOS001LEGACY_USED
987 strlcpy(l_tMsgAck.cTag, l_tCpStatus.m_cpersistenttag, sizeof(l_tMsgAck.cTag));
990 if (NULL == hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case
991 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
992 // catastrophic failure!
993 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenSender failed for %s ", l_tCpStatus.m_crequesterappname); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
995 if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE == l_tCpStatus.m_epersisttype) {
996 // send ack to requester for file successfully persisted
997 if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hMq, NPS_GET_PERS_FILE_ACK, sizeof(l_tMsgAck), &l_tMsgAck)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
998 // LCOV_EXCL_START 4: NSFW error case
999 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1000 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
1001 "ERROR :: Sending NPS_GET_PERS_FILE_ACK message to %s", l_tCpStatus.m_crequesterappname);
1004 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
1005 "NPS_GET_PERS_FILE_ACK is sent to %s for file tag %s and load status: %d.",
1006 l_tCpStatus.m_crequesterappname, l_tMsgAck.cTag, l_tMsgAck.eStatus);
1008 } else if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER == l_tCpStatus.m_epersisttype) { // LCOV_EXCL_BR_LINE 6: m_epersisttype must be ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE or ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER // NOLINT[whitespace/line_length]
1009 // send ack to requester for folder successfully persisted
1010 if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hMq, NPS_GET_PERS_FOLDER_ACK, sizeof(l_tMsgAck), &l_tMsgAck)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
1011 // LCOV_EXCL_START 4: NSFW error case
1012 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1013 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
1014 "ERROR :: Sending NPS_GET_PERS_FOLDER_ACK message to %s", l_tCpStatus.m_crequesterappname);
1017 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
1018 "NPS_GET_PERS_FOLDER_ACK is sent to %s for folder tag %s and load status: %d.",
1019 l_tCpStatus.m_crequesterappname, l_tMsgAck.cTag, l_tMsgAck.eStatus);
1025 FrameworkunifiedMcClose(hMq);
1031 CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
1032 if (l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: unexpected branch can't be NULL
1033 l_pPersistenceManager->AckReceivedFromWorker(l_tCpStatus.m_crequesterappname,
1034 l_tCpStatus.m_cpersistenttag,
1035 l_tCpStatus.m_epersisttype,
1036 l_tCpStatus.m_bpersistencechk,
1037 l_tCpStatus.m_eloadtype);
1040 if (LOADTYPE_RELEASE == l_tCpStatus.m_eloadtype) {
1041 f_pSourceState->FrameworkunifiedPostEvent(EVENT(evCheckAllFilesPersisted));
1044 // LCOV_EXCL_START 4: NSFW error case
1045 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1046 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
1047 "ERROR ::invalid length FrameworkunifiedGetMsgDataOfSize expected(%ld)", static_cast<long int>(sizeof(l_tCpStatus))); // NOLINT (runtime/int)
1050 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
1051 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1052 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
1053 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1057 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1058 return f_pSourceState;
1062 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnSaveDataAck) { // LCOV_EXCL_START 6: unused code
1063 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1064 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
1065 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1066 return f_pSourceState;
1070 ////////////////////////////////////////////////////////////////////////////////////////////////////
1071 /// NotificationpersistentserviceOnUserChange
1072 /// The state machine executes this transition when event to set or change personality is received
1073 /// from the system.
1074 ////////////////////////////////////////////////////////////////////////////////////////////////////
1075 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnUserChange) {
1076 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
1077 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
1080 CHKNULL(f_pSourceState);
1082 std::string l_cCurrentUsername;
1084 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
1085 // TODO(my_username): Only accept user change from authorized app. Compare l_cMsgSource with authorized source.
1086 if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(NC_User), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
1087 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
1088 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
1090 if (NULL != l_pnsnpp) { // LCOV_EXCL_BR_LINE 6: l_pnsnpp can't be NULL
1091 CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
1092 CnotificationpersistentservicePersonalizationManager *l_pPersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
1094 if (NULL != l_pPersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersonalizationManager can't be NULL
1095 l_pPersonalizationManager->NotificationpersistentserviceGetPersonality(l_cCurrentUsername);
1098 // writes the temporary user files and folders to permanent memory
1099 if (NULL != l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager can't be NULL
1100 if (!l_cCurrentUsername.empty()) { // LCOV_EXCL_BR_LINE 6: double check, l_cCurrentUsername can't be empty
1101 if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentservicePersistAllUserRequests()) { // LCOV_EXCL_BR_LINE 6: NotificationpersistentservicePersistAllUserRequests will always return ok // NOLINT[whitespace/line_length]
1102 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1103 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while persisting user files and folders."); // LCOV_EXCL_LINE 6: NotificationpersistentservicePersistAllUserRequests will always return ok // NOLINT[whitespace/line_length]
1108 // save the user persistent notification data
1109 if (eFrameworkunifiedStatusOK != l_pnsnpp->NotificationpersistentserviceSaveNotificationPersistentData(eFrameworkunifiedPersistedStateUserVar)) {
1110 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while NotificationpersistentserviceSaveNotificationPersistentData");
1114 // set new personality
1115 SetPersonality(l_pHApp, l_tMsg);
1117 // LCOV_EXCL_START 4: NSFW error case
1118 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1119 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
1120 "Cannot set new personality, error getting message data, status: 0x%x", l_estatus);
1123 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
1124 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1125 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
1126 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1131 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1132 return f_pSourceState;
1135 // ===========Shutdown
1136 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnShutdownTimeout) { // LCOV_EXCL_START 200: cannot test code
1137 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1138 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
1139 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1140 return f_pSourceState;
1144 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceCheckAllReleaseRequestsProcessed) {
1146 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
1147 CHKNULL(f_pSourceState);
1149 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
1151 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
1152 CHKNULL(l_pNotificationpersistentserviceHSM);
1153 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
1155 CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
1156 CHKNULL(l_pPersistenceManager);
1157 if (TRUE == l_pPersistenceManager->HaveAllReleaseRequestsPersisted()) { // LCOV_EXCL_BR_LINE 6: always return ok
1158 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "All release requests are processed.");
1159 f_pSourceState->FrameworkunifiedPostEvent(EVENT(evIdle));
1161 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
1162 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1163 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
1164 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1169 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1170 return f_pSourceState;
1173 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceReInitShutdownTimer) { // LCOV_EXCL_START 8: not be used
1174 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1175 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
1176 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1177 return f_pSourceState;
1181 CsNotificationpersistentserviceNPPStart::CsNotificationpersistentserviceNPPStart(std::string f_strName): CFrameworkunifiedOrthogonalState(f_strName) {
1184 CsNotificationpersistentserviceNPPStart::~CsNotificationpersistentserviceNPPStart() { // LCOV_EXCL_START 200: cannot test code
1185 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1189 EFrameworkunifiedStatus CsNotificationpersistentserviceNPPStart::FrameworkunifiedOnEntry(CEventDataPtr f_peventdata) {
1190 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
1192 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
1195 HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
1198 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
1199 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
1201 // Get instance of notification manager
1202 CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
1204 if (l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
1205 NC_User l_tMsg = {};
1207 // register the user change notification
1208 if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnRegisterEvents(AppName, // LCOV_EXCL_BR_LINE 6: always return ok // NOLINT[whitespace/line_length]
1209 NTFY_NPPService_UserChange,
1211 eFrameworkunifiedPersistedStateVar)) {
1212 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1213 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in user change notification registration."); // LCOV_EXCL_LINE 6: always return ok // NOLINT[whitespace/line_length]
1216 // Set initial user. By default, NS_NPPService will set the current user as last user. If no
1217 // last user found set the default user.
1218 UI_32 l_uiUserNotificationDataSize = 0;
1219 EFrameworkunifiedStatus l_eGetNotificationDataStatus = eFrameworkunifiedStatusFail;
1220 l_eGetNotificationDataStatus = l_pNotificationManager->NPGetPersistentNotificationData(
1221 NTFY_NPPService_UserChange,
1225 if ((eFrameworkunifiedStatusOK != l_eGetNotificationDataStatus) || (l_uiUserNotificationDataSize <= 0)) {
1227 #ifdef AGL_PosixBasedOS001LEGACY_USED
1228 strlcpy(l_tMsg.cUsername, DEFAULTUSERNAME, sizeof(l_tMsg.cUsername));
1232 l_estatus = SetPersonality(l_pHApp, l_tMsg);
1234 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
1235 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1236 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
1237 l_estatus = eFrameworkunifiedStatusInvldHandle;
1240 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1244 EFrameworkunifiedStatus SetPersonality(HANDLE l_pHApp, NC_User &f_tMsg) { // NOLINT (runtime/references)
1245 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
1246 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
1248 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
1249 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
1251 if (NULL != l_pnsnpp) { // LCOV_EXCL_BR_LINE 6: l_pnsnpp can't be NULL
1252 // Get the instance of personalization manager
1253 CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
1255 if (NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationpersistentservicePersonalizationManager can't be NULL
1256 // send msg to all notificationpersistentservice apps that user has change.
1257 // register user change notification
1258 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Personality :: %s", f_tMsg.cUsername);
1260 if (eFrameworkunifiedStatusOK != (l_estatus = l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceSetPersonality(f_tMsg.cUsername))) {
1261 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Personality not set in Personality Manager :: user : %s", f_tMsg.cUsername);
1263 // Get the instance of persistence manager
1264 CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
1266 if (NULL != l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager can't be NULL
1267 l_pPersistenceManager->SetUserPersistentPath(f_tMsg.cUsername);
1269 // save the user persistent notification data
1270 if (eFrameworkunifiedStatusOK != l_pnsnpp->NotificationpersistentserviceLoadPersistentNotificationData(eFrameworkunifiedPersistedStateUserVar)) {
1271 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while loading user specific notification data.");
1274 // Get instance of notification manager
1275 CNotificationManager *l_pNotificationManager = NULL;
1276 l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
1278 if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
1279 // publish the user change notification
1280 if (eFrameworkunifiedStatusOK != (l_estatus = l_pNotificationManager->NotificationpersistentserviceServiceOnPublishEvent(AppName, NTFY_NPPService_UserChange, (PVOID)&f_tMsg, sizeof(f_tMsg)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
1281 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1282 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in publish user change event."); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
1288 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1289 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationpersistentservicePersonalizationManager is NULL"); // LCOV_EXCL_LINE 6: l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
1293 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1297 EFrameworkunifiedStatus CsNotificationpersistentserviceNPPStart:: FrameworkunifiedOnExit(CEventDataPtr f_peventdata) { // LCOV_EXCL_START 200: cannot test code
1298 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1299 return eFrameworkunifiedStatusOK;
1303 CsNotificationpersistentserviceShutdownDataSave::CsNotificationpersistentserviceShutdownDataSave(std::string f_strName): CFrameworkunifiedLeafState(f_strName) {
1306 CsNotificationpersistentserviceShutdownDataSave::~CsNotificationpersistentserviceShutdownDataSave() { // LCOV_EXCL_START 200: cannot test code
1307 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1311 EFrameworkunifiedStatus CsNotificationpersistentserviceShutdownDataSave::FrameworkunifiedOnEntry(CEventDataPtr f_peventdata) {
1312 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
1314 HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
1317 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
1318 m_cShutdownRequestor = l_cMsgSource;
1319 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "NS_NPP received STOP message from %s.", l_cMsgSource);
1321 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
1322 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
1324 if (NULL != l_pnsnpp) { // LCOV_EXCL_BR_LINE 6: can't be NULL
1325 CShutDownMsgData *l_pMsgData = dynamic_cast<CShutDownMsgData *>(f_peventdata.get());
1326 CHKNULL(l_pMsgData);
1328 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Shutdown Type=%d, Data received with shutdown message:: %x",
1329 l_pMsgData->m_eShutdownType, l_pMsgData->m_uiMsgData);
1331 // save the persistent data on shutdown
1332 if (eFrameworkunifiedStatusOK != l_pnsnpp->NotificationpersistentservicePersistAll(l_pMsgData->m_eShutdownType, l_pMsgData->m_uiMsgData)) { // LCOV_EXCL_BR_LINE 6: always return ok // NOLINT[whitespace/line_length]
1333 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1334 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in NotificationpersistentserviceOnSavePersistentData"); // LCOV_EXCL_LINE 6: always return ok
1338 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1339 return eFrameworkunifiedStatusOK;
1342 EFrameworkunifiedStatus CsNotificationpersistentserviceShutdownDataSave:: FrameworkunifiedOnExit(CEventDataPtr f_peventdata) {
1343 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
1345 HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
1348 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
1349 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
1352 CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
1353 CHKNULL(l_pPersistenceManager);
1355 l_pPersistenceManager->ResetPersistFlag();
1357 // before sending shutdown ack, synchronize all the modified block buffers by NPPService for writing
1360 // Send shutdown ack response to requester
1361 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Sending shutdown complete message to requestor %s.",
1362 m_cShutdownRequestor.c_str());
1363 HANDLE hMq = FrameworkunifiedMcOpenSender(l_pHApp, m_cShutdownRequestor.c_str());
1364 if (NULL != hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
1365 if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hMq, NPS_NPP_STOP_ACK, 0, NULL)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
1366 // LCOV_EXCL_START 4: NSFW error case
1367 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1368 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error sending shutdown complete message to requestor %s.",
1369 m_cShutdownRequestor.c_str());
1372 FrameworkunifiedMcClose(hMq);
1374 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1375 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in OpenSender for requestor %s.", m_cShutdownRequestor.c_str()); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
1377 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
1378 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1379 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
1382 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1383 return eFrameworkunifiedStatusOK;
1386 ////////////////////////////////////////////////////////////////////////////////////////////////////
1387 /// NotificationpersistentserviceOnRegisterPersistentFile
1388 /// The state machine executes this transition when event for registering persistent file tag is
1390 ////////////////////////////////////////////////////////////////////////////////////////////////////
1391 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFile) {
1393 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
1394 CHKNULL(f_pSourceState);
1395 NC_RegisterPersistentFileMsg l_tMsg = {};
1397 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
1399 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
1401 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
1402 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
1404 CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
1407 if (NULL != l_pPersistenceManager && NULL != l_cMsgSource) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
1408 if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
1409 std::string l_cName;
1410 l_cName = l_tMsg.cFileTag;
1412 if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceRegister(l_cMsgSource, // LCOV_EXCL_BR_LINE 6: always return ok
1414 ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE,
1415 // l_tMsg.eRegisterType,
1416 l_tMsg.bIsUserFile)) {
1417 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1418 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Registering Persitence File :: %s", l_tMsg.cFileTag); // LCOV_EXCL_LINE 6: always return ok // NOLINT[whitespace/line_length]
1421 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Registered File %s as TO BE PERSISTED for %s",
1422 l_tMsg.cFileTag, l_cMsgSource);
1424 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1425 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register persistent file. Invalid message size received."); // LCOV_EXCL_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
1428 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1429 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register persistent file. l_pPersistenceManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
1431 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
1432 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1433 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
1434 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1438 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1439 return f_pSourceState;
1442 ////////////////////////////////////////////////////////////////////////////////////////////////////
1443 /// NotificationpersistentserviceOnReleasePersistentFile
1444 /// The state machine executes this transition when event for releasing persistent file tag is
1446 ////////////////////////////////////////////////////////////////////////////////////////////////////
1447 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFile) {
1449 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
1451 // Check if persistence has been disabled than return immediately
1452 if (TRUE == CPersistenceManager::m_bPersistenceDisabled) { // LCOV_EXCL_BR_LINE 6: custom command line options
1453 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1454 return f_pSourceState; // LCOV_EXCL_LINE 6: custom command line options
1457 CHKNULL(f_pSourceState);
1458 NC_ReleasePersistentFileMsg l_tMsg = {};
1460 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
1462 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
1464 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
1465 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
1467 // get the instance of persistence manager
1468 CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
1469 // get the instance of persistence manager
1470 CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
1472 if (NULL != l_pPersistenceManager && NULL != l_cMsgSource && NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
1473 if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
1474 // Check if the filetag is registered as user specific persistence
1475 if (TRUE == l_pPersistenceManager->IsUserPersistence(l_tMsg.cFileTag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE)) {
1476 if (!l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceIsValidPersonality(l_tMsg.cUsername)) {
1477 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1478 return f_pSourceState;
1482 if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceRelease(l_cMsgSource,
1485 l_tMsg.eFrameworkunifiedReleaseType, // NOLINT (readability/naming)
1486 ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE,
1487 l_tMsg.cUsername)) {
1488 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in releasing persitence file :: %s", l_tMsg.cFileTag);
1491 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Release file %s to tag %s for source %s",
1492 l_tMsg.cFilePath, l_tMsg.cFileTag, l_cMsgSource);
1494 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1495 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't release persistent file. Invalid message size received"); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
1498 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1499 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't release persistent file. l_pPersistenceManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
1501 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
1502 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1503 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
1504 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1508 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1509 return f_pSourceState;
1512 ////////////////////////////////////////////////////////////////////////////////////////////////////
1513 /// NotificationpersistentserviceOnLoadPersistentFile
1514 /// The state machine executes this transition when event for loading persistent file is received.
1515 ////////////////////////////////////////////////////////////////////////////////////////////////////
1516 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFile) {
1518 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
1519 CHKNULL(f_pSourceState);
1520 NC_LoadPersistedFileMsg l_tMsg = {};
1522 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
1524 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
1526 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
1527 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
1529 CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
1530 // get the instance of persistence manager
1531 CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
1533 if (NULL != l_pPersistenceManager && NULL != l_cMsgSource && NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
1534 if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
1535 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Load file %s that was PERSISTED by %s with tag %s",
1536 l_tMsg.cFilePath, l_cMsgSource, l_tMsg.cFileTag);
1538 // Check if the filetag is registered as user specific persistence
1539 if (TRUE == l_pPersistenceManager->IsUserPersistence(l_tMsg.cFileTag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE)) {
1540 if (!l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceIsValidPersonality(l_tMsg.cUsername)) {
1541 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1542 return f_pSourceState;
1546 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
1547 NC_LoadPersistedAck l_tMsgAck = {};
1549 HANDLE l_hMq = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
1551 if (NULL != l_hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case
1552 //// Check if persistence has been disabled than send positive acknowledgement to the application
1553 if (TRUE == CPersistenceManager::m_bPersistenceDisabled) { // LCOV_EXCL_BR_LINE 6: custom command line options // NOLINT[whitespace/line_length]
1554 // LCOV_EXCL_START 6: custom command line options
1555 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1556 l_tMsgAck.eStatus = eFrameworkunifiedStatusOK;
1557 #ifdef AGL_PosixBasedOS001LEGACY_USED
1558 strlcpy(l_tMsgAck.cTag, l_tMsg.cFileTag, sizeof(l_tMsgAck.cTag));
1561 // send ack to requester
1562 if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSendMsg(l_hMq, NPS_GET_PERS_FILE_ACK, sizeof(l_tMsgAck), &l_tMsgAck))) {
1563 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg returned l_estatus=%d", l_estatus);
1567 if (eFrameworkunifiedStatusOK != (l_estatus = l_pPersistenceManager->NotificationpersistentserviceLoad(l_cMsgSource,
1570 ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE,
1571 l_tMsg.cUsername))) {
1572 if (eFrameworkunifiedStatusFileLoadSuccess == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus can't be eFrameworkunifiedStatusFileLoadSuccess // NOLINT[whitespace/line_length]
1573 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1574 l_tMsgAck.eStatus = eFrameworkunifiedStatusOK; // LCOV_EXCL_LINE 6: l_estatus can't be eFrameworkunifiedStatusFileLoadSuccess
1576 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Loading Persitence File :: %s", l_tMsg.cFileTag);
1578 // return error to requester
1579 l_tMsgAck.eStatus = l_estatus;
1582 std::strncpy(l_tMsgAck.cTag, l_tMsg.cFileTag, (MAX_PATH_LENGTH - 1));
1584 // send ack to requester
1585 if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSendMsg(l_hMq, NPS_GET_PERS_FILE_ACK, sizeof(l_tMsgAck), &l_tMsgAck))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
1586 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1587 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg returned l_estatus=%d", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
1589 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "NPS_GET_PERS_FILE_ACK is sent to %s. File load status: %d, "
1590 "message sent status: %d ", l_cMsgSource, l_tMsgAck.eStatus, l_estatus);
1594 FrameworkunifiedMcClose(l_hMq);
1596 // LCOV_EXCL_START 4: NSFW error case
1597 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1598 // catastrophic failure!
1599 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenSender failed for %s", l_cMsgSource);
1603 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1604 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't load persistent file. Invalid message size received."); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
1607 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1608 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't load persistent file. l_pNotificationManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
1610 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
1611 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1612 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
1613 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1617 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1618 return f_pSourceState;
1621 ////////////////////////////////////////////////////////////////////////////////////////////////////
1622 /// NotificationpersistentserviceOnRegisterPersistentFolder
1623 /// The state machine executes this transition when event for registering persistent folder tag is
1625 ////////////////////////////////////////////////////////////////////////////////////////////////////
1626 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFolder) {
1628 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
1629 CHKNULL(f_pSourceState);
1630 NC_RegisterPersistentFolderMsg l_tMsg = {};
1632 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
1634 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
1636 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
1637 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
1639 CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
1641 if (NULL != l_pPersistenceManager && NULL != l_cMsgSource) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
1642 if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, // LCOV_EXCL_BR_LINE 4: NSFW error case
1643 static_cast<PVOID>(&l_tMsg),
1646 std::string l_cName;
1647 l_cName = l_tMsg.cFolderTag;
1649 if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceRegister(l_cMsgSource, // LCOV_EXCL_BR_LINE 6: always return ok
1651 ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER,
1652 // l_tMsg.eRegisterType,
1653 l_tMsg.bIsUserFolder)) {
1654 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1655 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Registering Persitence Folder :: %s", l_tMsg.cFolderTag); // LCOV_EXCL_LINE 6: always return ok // NOLINT[whitespace/line_length]
1658 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Registered Folder %s as TO BE PERSISTED for %s",
1659 l_tMsg.cFolderTag, l_cMsgSource);
1661 // LCOV_EXCL_START 4: NSFW error case
1662 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1663 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register persistent folder. Invalid message size received.");
1667 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1668 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register persistent folder.. l_pPersistenceManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
1670 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
1671 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1672 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
1673 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1677 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1678 return f_pSourceState;
1681 ////////////////////////////////////////////////////////////////////////////////////////////////////
1682 /// NotificationpersistentserviceOnLoadPersistentFolder
1683 /// The state machine executes this transition when event for loading persistent folder is received.
1684 ////////////////////////////////////////////////////////////////////////////////////////////////////
1685 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFolder) {
1687 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
1688 CHKNULL(f_pSourceState);
1689 NC_LoadPersistedFolderMsg l_tMsg = {};
1691 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
1693 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
1695 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
1696 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
1698 CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
1700 // get the instance of persistence manager
1701 CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
1703 if (NULL != l_pPersistenceManager && NULL != l_cMsgSource && NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
1704 if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
1705 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Load folder %s that was PERSISTED by %s with tag %s",
1706 l_tMsg.cFolderPath, l_cMsgSource, l_tMsg.cFolderTag);
1708 // Check if the foldertag is registered as user specific persistence
1709 if (TRUE == l_pPersistenceManager->IsUserPersistence(l_tMsg.cFolderTag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER)) {
1710 if (!l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceIsValidPersonality(l_tMsg.cUsername)) {
1711 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1712 return f_pSourceState;
1716 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
1717 NC_LoadPersistedAck l_tMsgAck = {};
1718 HANDLE l_hMq = NULL;
1719 l_hMq = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
1721 if (NULL != l_hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case
1722 //// Check if persistence has been disabled than send positive acknowledgement to the application
1723 if (TRUE == CPersistenceManager::m_bPersistenceDisabled) { // LCOV_EXCL_BR_LINE 6: custom command line options // NOLINT[whitespace/line_length]
1724 // LCOV_EXCL_START 6: custom command line options
1725 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1726 l_tMsgAck.eStatus = eFrameworkunifiedStatusOK;
1727 #ifdef AGL_PosixBasedOS001LEGACY_USED
1728 strlcpy(l_tMsgAck.cTag, l_tMsg.cFolderTag, sizeof(l_tMsgAck.cTag));
1731 // send ack to requester
1732 if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSendMsg(l_hMq,
1733 NPS_GET_PERS_FOLDER_ACK,
1734 sizeof(l_tMsgAck), &l_tMsgAck))) {
1735 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg returned l_estatus=%d", l_estatus);
1739 if (eFrameworkunifiedStatusOK != (l_estatus = l_pPersistenceManager->NotificationpersistentserviceLoad(l_cMsgSource,
1742 ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER,
1743 l_tMsg.cUsername))) {
1744 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Loading Persitence Folder :: %s", l_tMsg.cFolderTag);
1746 // return error to requester
1747 l_tMsgAck.eStatus = l_estatus;
1748 std::strncpy(l_tMsgAck.cTag, l_tMsg.cFolderTag, (MAX_PATH_LENGTH - 1));
1750 // send ack to requester
1751 if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSendMsg(l_hMq, // LCOV_EXCL_BR_LINE 4: NSFW error case
1752 NPS_GET_PERS_FOLDER_ACK,
1753 sizeof(l_tMsgAck), &l_tMsgAck))) {
1754 // LCOV_EXCL_START 4: NSFW error case
1755 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1756 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg returned l_estatus=%d", l_estatus);
1761 FrameworkunifiedMcClose(l_hMq);
1763 // LCOV_EXCL_START 4: NSFW error case
1764 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1765 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
1766 "Can't send ack NPS_GET_PERS_FOLDER_ACK. McOpenSender failed for %s ", l_cMsgSource);
1770 // LCOV_EXCL_START 4: NSFW error case
1771 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1772 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't load persistent folder. Invalid message size received.");
1776 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1777 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't load persistent folder. l_pNotificationManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
1779 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
1780 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1781 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
1782 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1786 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1787 return f_pSourceState;
1790 ////////////////////////////////////////////////////////////////////////////////////////////////////
1791 /// NotificationpersistentserviceOnReleasePersistentFolder
1792 /// The state machine executes this transition when event for releasing persistent folder tag is
1794 ////////////////////////////////////////////////////////////////////////////////////////////////////
1795 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFolder) {
1797 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
1798 CHKNULL(f_pSourceState);
1800 // Check if persistence has been disabled than return immediately
1801 if (TRUE == CPersistenceManager::m_bPersistenceDisabled) { // LCOV_EXCL_BR_LINE 6: custom command line options
1802 // LCOV_EXCL_START 6: custom command line options
1803 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1804 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1805 return f_pSourceState;
1809 NC_ReleasePersistentFolderMsg l_tMsg = {};
1811 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
1813 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
1815 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
1816 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
1818 // get the instance of persistence manager
1819 CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
1821 CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
1823 if (NULL != l_pPersistenceManager && NULL != l_cMsgSource && NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
1824 if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
1825 // Check if the foldertag is registered as user specific persistence
1826 if (TRUE == l_pPersistenceManager->IsUserPersistence(l_tMsg.cFolderTag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER)) {
1827 if (!l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceIsValidPersonality(l_tMsg.cUsername)) {
1828 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1829 return f_pSourceState;
1832 if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceRelease(l_cMsgSource,
1835 l_tMsg.eFrameworkunifiedReleaseType, // NOLINT (readability/naming)
1836 ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER,
1837 l_tMsg.cUsername)) {
1838 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in releasing persitence folder :: %s", l_tMsg.cFolderTag);
1841 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Release Folder %s to tag %s for source %s",
1842 l_tMsg.cFolderPath, l_tMsg.cFolderTag, l_cMsgSource);
1844 // LCOV_EXCL_START 4: NSFW error case
1845 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1846 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't release persistent folder. Invalid message size received.");
1850 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1851 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't release persistent folder. l_pPersistenceManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
1853 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
1854 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1855 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
1856 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1860 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1861 return f_pSourceState;
1864 ////////////////////////////////////////////////////////////////////////////////////////////////////
1865 /// NotificationpersistentserviceOnNPGetReadyStatus
1867 ////////////////////////////////////////////////////////////////////////////////////////////////////
1868 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPGetReadyStatus) {
1870 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
1872 CHKNULL(f_pSourceState);
1874 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
1877 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
1878 CHKNULL(l_cMsgSource);
1880 HANDLE l_hMq = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
1881 if (NULL != l_hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case
1882 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
1884 // send ack to requester
1885 if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedSendMsg(l_hMq, NPS_GET_READYSTATUS_ACK, 0, NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
1886 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __PRETTY_FUNCTION__, "NPP ready status sent to %s.", l_cMsgSource);
1888 // LCOV_EXCL_START 4: NSFW error case.
1889 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1890 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error sending NPS_GET_READYSTATUS_ACK to %s, status: %d", l_cMsgSource,
1895 FrameworkunifiedMcClose(l_hMq);
1898 // LCOV_EXCL_START 4: NSFW error case
1899 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1900 // catastrophic failure!
1901 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenSender failed for %s ", l_cMsgSource);
1904 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
1905 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1906 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
1907 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1911 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
1912 return f_pSourceState;
1915 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterImmediateNotifications) {
1917 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
1918 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
1920 CHKNULL(f_pSourceState);
1921 NC_register_multiple_immediate_notif_msg *l_pMsg = NULL;
1923 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
1926 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
1927 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
1929 // get app name of message source
1930 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
1931 CHKNULL(l_cMsgSource);
1933 // get instance of notification manager
1934 CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
1936 if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
1937 UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
1939 if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
1940 // LCOV_EXCL_START 6: l_uiMsgLength must be greater than 0
1941 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1942 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
1943 "Can't register immediate persistence notification from source %s. Invalid message length.",
1947 std::vector<CHAR> l_vData = std::vector<CHAR>(l_uiMsgLength);
1949 // get the received data
1950 if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
1951 l_pMsg = reinterpret_cast<NC_register_multiple_immediate_notif_msg *>(&l_vData[0]);
1953 if (NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 5: reinterpret_cast's error case.
1954 NC_register_immediate_notif_msg *l_pEventInfo = NULL;
1956 // register all the notifications
1957 for (l_uiCount = 0 ; l_uiCount < l_pMsg->numNotifications; ++l_uiCount) {
1958 l_pEventInfo = &l_pMsg->notifierList[l_uiCount];
1960 if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
1961 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Register immediate persistence notification: "
1962 "NotificationName[%d] = %s, data length = %d ",
1963 l_uiCount, l_pEventInfo->notificationName, l_pEventInfo->maxLength);
1965 if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnRegisterEvents(l_cMsgSource,
1966 l_pEventInfo->notificationName,
1967 l_pEventInfo->maxLength,
1968 l_pEventInfo->persType,
1969 l_pEventInfo->delay)) {
1970 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
1971 "Error in NotificationpersistentserviceServiceOnRegisterEvents :: %s", l_pEventInfo->notificationName);
1974 // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
1975 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1976 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
1977 "Can't register immediate persistence notification from source %s. l_pEventInfo is NULL",
1983 // LCOV_EXCL_START 5: reinterpret_cast's error case.
1984 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1985 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
1986 "Can't register immediate persistence notification from source %s. Invalid src mq",
1991 // LCOV_EXCL_START 4: NSFW error case.
1992 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1993 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
1994 "Can't register immediate persistence notification from source %s, "
1995 "Error getting message data, status: 0x%x",
1996 l_cMsgSource, l_estatus);
2001 // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
2002 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2003 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
2004 "Can't register immediate persistence notification from source %s. "
2005 "l_pNotificationManager is NULL", l_cMsgSource);
2008 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
2009 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2010 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
2011 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
2015 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
2016 return f_pSourceState;
2019 ////////////////////////////////////////////////////////////////////////////////////////////////////
2020 /// NotificationpersistentserviceOnNPClearPersistedData
2021 /// Deletes NPS Persistent Data and sends the ack back to requester
2022 ////////////////////////////////////////////////////////////////////////////////////////////////////
2023 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPClearPersistedData) {
2024 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
2026 // requeter MsgQ handle for sending Ack
2027 HANDLE hRequesterAck = NULL;
2029 // Application Handle
2030 HANDLE l_pHApp = NULL;
2032 // Received request data
2033 NC_ClearPersistedDataReq l_tMsg = {};
2036 NC_ClearPersisteDatadAck l_tMsgAck = {};
2039 PCSTR pRequester = NULL;
2042 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
2044 l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
2047 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
2048 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
2051 pRequester = FrameworkunifiedGetMsgSrc(l_pHApp);
2052 CHKNULL(pRequester);
2054 if (sizeof(NC_ClearPersistedDataReq) == FrameworkunifiedGetMsgLength(l_pHApp)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
2055 if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, (PVOID)(&l_tMsg), sizeof(NC_ClearPersistedDataReq), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
2056 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Request for deleting the persistent data of type %d received from %s",
2057 l_tMsg.ePersistenceData, pRequester);
2059 CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
2060 CHKNULL(l_pPersistenceManager);
2062 l_estatus = l_pPersistenceManager->ClearPersistenceData(l_tMsg.ePersistenceData);
2064 // LCOV_EXCL_START 4: NSFW error case
2065 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2066 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize Error");
2070 // LCOV_EXCL_START 4: NSFW error case
2071 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2072 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't delete persistent data. Invalid message size received.");
2075 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
2076 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2077 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
2078 f_pSourceState = NULL;
2079 l_estatus = eFrameworkunifiedStatusNullPointer;
2083 // sending acknowledgement to the requester
2085 // create the requestor handle to send the ack
2086 hRequesterAck = FrameworkunifiedMcOpenSender(l_pHApp,
2089 if (NULL != hRequesterAck) { // LCOV_EXCL_BR_LINE 4: NSFW error case
2091 l_tMsgAck.eStatus = l_estatus;
2093 // send NC_ClearPersisteDatadAck to the requester
2094 if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hRequesterAck, // LCOV_EXCL_BR_LINE 4: NSFW error case
2095 NPS_DELETE_PERSISTED_DATA_ACK,
2098 // LCOV_EXCL_START 4: NSFW error case
2099 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2100 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error sending NPS_GET_PERS_FILE_ACK message to %s", pRequester);
2105 FrameworkunifiedMcClose(hRequesterAck);
2107 // LCOV_EXCL_START 4: NSFW error case
2108 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2109 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedMcOpenSender failed for %s ", pRequester);
2112 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
2113 return f_pSourceState;
2116 ////////////////////////////////////////////////////////////////////////////////////////////////////
2117 /// NotificationpersistentserviceOnNPSetDefaultPersistentData
2118 /// Sets the default value of the persistent notification
2119 ////////////////////////////////////////////////////////////////////////////////////////////////////
2120 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetDefaultPersistentData) {
2122 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
2123 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
2125 CHKNULL(f_pSourceState);
2127 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
2130 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
2131 CHKNULL(l_pNotificationpersistentserviceHSM);
2133 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
2136 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
2137 CHKNULL(l_cMsgSource);
2139 // get instance of notification manager
2140 CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
2142 if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
2143 UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
2145 CHAR l_cNotificationName[MAX_SYS_INFO_SIZE] = {};
2147 // retrieve notification name
2148 FrameworkunifiedGetSystemInfo(l_pHApp, l_cNotificationName);
2150 if (0 != std::strlen(l_cNotificationName)) { // LCOV_EXCL_BR_LINE 6: double check, l_cNotificationName can't be empty // NOLINT[whitespace/line_length]
2151 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
2152 "Set default value request for Notification:: %s from :: %s", l_cNotificationName,
2155 if (0 != l_uiMsgLength) {
2156 std::vector<CHAR> pMsgData = std::vector<CHAR>(l_uiMsgLength);
2158 // get the received data
2159 if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &pMsgData[0], static_cast<UI_32>(pMsgData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
2160 // set the default notification data
2161 if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceSetDefaultPersistentNotificationData(l_cNotificationName,
2162 (PVOID)&pMsgData[0],
2164 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
2165 "Error in NotificationpersistentserviceSetDefaultPersistentNotificationData :: %s", l_cNotificationName);
2168 // LCOV_EXCL_START 4: NSFW error case
2169 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2170 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
2171 "Unable to set default persistent notification data for %s, "
2172 "Error retrieving data from message, status: 0x%x",
2173 l_cNotificationName, l_estatus);
2177 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
2178 "Not setting default persistent notification data for %s, Data length received is %d",
2179 l_cNotificationName, l_uiMsgLength);
2182 // LCOV_EXCL_START 6: double check, l_cNotificationName can't be empty
2183 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2184 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
2185 "Unable to Set DefaultPersistentNotificationData from source %s, Notification name is blank",
2190 // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
2191 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2192 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
2193 "Can't set default value for notification from source %s, l_pNotificationManager is NULL", l_cMsgSource);
2196 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
2197 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2198 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
2199 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
2203 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
2204 return f_pSourceState;
2207 ////////////////////////////////////////////////////////////////////////////////////////////////////
2208 /// NotificationpersistentserviceOnNPSetNotfnPersistentType
2209 /// Sets the persist type of notification
2210 ////////////////////////////////////////////////////////////////////////////////////////////////////
2211 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetNotfnPersistentType) {
2213 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
2214 CHKNULL(f_pSourceState);
2216 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
2219 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
2220 CHKNULL(l_pNotificationpersistentserviceHSM);
2222 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
2225 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
2227 CHAR l_cNotificationName[MAX_SYS_INFO_SIZE] = {};
2229 // retrieve notification name
2230 FrameworkunifiedGetSystemInfo(l_pHApp,
2231 l_cNotificationName);
2233 // get instance of notification manager
2234 CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
2236 if (NULL != l_pNotificationManager && 0 != std::strlen(l_cNotificationName)) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL, l_cNotificationName can't be empty // NOLINT[whitespace/line_length]
2237 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Set persist type request for Notification:: %s", l_cNotificationName);
2239 EFrameworkunifiedPersistCategory ePersistCategory = eFrameworkunifiedUserData;
2241 // get the received data
2242 if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &ePersistCategory, sizeof(EFrameworkunifiedPersistCategory), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
2243 // set the notification persist type
2244 if (eFrameworkunifiedStatusOK != (l_estatus = l_pNotificationManager->NotificationpersistentserviceSetPersistentCategory(l_cNotificationName, // LCOV_EXCL_BR_LINE 6: always return ok // NOLINT[whitespace/line_length]
2245 ePersistCategory))) {
2246 // LCOV_EXCL_START 6: always return ok
2247 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2248 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Setting PersistentType for notification :: %s, Status: 0x%x",
2249 l_cNotificationName, l_estatus);
2253 // LCOV_EXCL_START 4: NSFW error case
2254 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2255 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
2256 "Error in getting the PersistentType message data for notification :: %s, Status: 0x%x",
2257 l_cNotificationName, l_estatus);
2261 // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL, l_cNotificationName can't be empty
2262 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2263 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't set persist type for notification :: %s", l_cNotificationName);
2266 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
2267 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2268 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
2269 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
2274 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
2275 return f_pSourceState;
2278 ////////////////////////////////////////////////////////////////////////////////////////////////////
2279 /// NotificationpersistentserviceOnNPSetFilePersistentType
2280 /// Sets the persist type of file
2281 ////////////////////////////////////////////////////////////////////////////////////////////////////
2282 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFilePersistentType) {
2284 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
2285 CHKNULL(f_pSourceState);
2287 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
2290 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
2291 CHKNULL(l_pNotificationpersistentserviceHSM);
2293 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
2296 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
2297 CHKNULL(l_cMsgSource);
2299 // get instance of persistence manager
2300 CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
2302 if (NULL != l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager can't be NULL
2303 NC_SetFilePersistType l_tMsg = {};
2305 // get the received data
2306 if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
2307 if (0 != std::strlen(l_tMsg.cTag)) { // LCOV_EXCL_BR_LINE 6: double check, l_tMsg.cTag can't be empty
2308 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
2309 "Set persist type request for file tag:: %s from %s", l_tMsg.cTag, l_cMsgSource);
2311 // set the file persist type
2312 if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceSetPersistentCategory(l_cMsgSource,
2314 l_tMsg.ePersistType,
2315 ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE)) {
2316 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
2317 "Error in Setting FilePersistentType for tag:: %s for request from:: %s", l_tMsg.cTag,
2321 // LCOV_EXCL_START 6: double check, l_tMsg.cTag can't be empty
2322 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2323 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
2324 "set file persistent type request for NULL file tag from source:: %s", l_cMsgSource);
2329 // LCOV_EXCL_START 6: l_pPersistenceManager can't be NULL
2330 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2331 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
2332 "Can't process request for setting persist type for file from source: %s, l_pPersistenceManager is NULL",
2336 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
2337 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2338 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
2339 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
2343 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
2344 return f_pSourceState;
2347 ////////////////////////////////////////////////////////////////////////////////////////////////////
2348 /// NotificationpersistentserviceOnNPSetFolderPersistentType
2349 /// Sets the persist type of folder
2350 ////////////////////////////////////////////////////////////////////////////////////////////////////
2351 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFolderPersistentType) {
2353 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
2354 CHKNULL(f_pSourceState);
2356 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
2359 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
2360 CHKNULL(l_pNotificationpersistentserviceHSM);
2362 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
2365 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
2366 CHKNULL(l_cMsgSource);
2368 // get instance of persistence manager
2369 CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
2371 if (NULL != l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager can't be NULL
2372 NC_SetFolderPersistType l_tMsg = {};
2374 // get the received data
2375 if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
2376 if (0 != std::strlen(l_tMsg.cTag)) { // LCOV_EXCL_BR_LINE 6: double check, l_tMsg.cTag can't be empty
2377 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Set persist type request for folder tag:: %s", l_tMsg.cTag);
2379 // set the file persist type
2380 if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceSetPersistentCategory(l_cMsgSource,
2382 l_tMsg.ePersistType,
2383 ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER)) {
2384 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
2385 "Error in Setting FolderPersistentType for tag:: %s for request from:: %s", l_tMsg.cTag,
2389 // LCOV_EXCL_START 6: double check, l_tMsg.cTag can't be empty
2390 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2391 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
2392 "set file persistent type request for NULL folder tag from source:: %s", l_cMsgSource);
2397 // LCOV_EXCL_START 6: l_pPersistenceManager can't be NULL
2398 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2399 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
2400 "Can't process request for setting persist type for folder from source: %s, l_pPersistenceManager is NULL",
2404 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
2405 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2406 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
2407 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
2411 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
2412 return f_pSourceState;
2415 ////////////////////////////////////////////////////////////////////////////////////////////////////
2416 /// NotificationpersistentserviceOnNPShutdown
2417 /// Internal transition when NPP receives shutdown message
2418 ////////////////////////////////////////////////////////////////////////////////////////////////////
2419 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPShutdown) {
2420 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
2422 CHKNULL(f_pSourceState);
2424 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
2427 NC_StopMsgData l_tStopMsgData = {};
2429 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
2430 CHKNULL(l_cMsgSource);
2432 if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tStopMsgData), sizeof(l_tStopMsgData), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
2433 // make a transition to sNotificationpersistentserviceShutdownDataSave state and pass the message data through event
2434 CShutDownMsgData *l_pMsgData = new(std::nothrow) CShutDownMsgData(EVENT(evNPShutdownDataSave),
2435 l_tStopMsgData.eShutdownType,
2436 l_tStopMsgData.uiStopMsgData);
2437 CHKNULL(l_pMsgData);
2439 CEventDataPtr l_pData(l_pMsgData);
2440 f_pSourceState->FrameworkunifiedPostEvent(l_pData);
2442 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Shutdown Message received from %s with data: %d", l_cMsgSource,
2443 l_tStopMsgData.uiStopMsgData);
2445 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2446 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't process shutdown request from:: %s, Invalid message data", l_cMsgSource); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
2448 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
2449 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2450 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
2451 f_pSourceState = NULL;
2454 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
2455 return f_pSourceState;
2458 ////////////////////////////////////////////////////////////////////////////////////////////////////
2459 /// NotificationpersistentserviceOnNPNorDataSaveAck
2460 /// Internal transition when NPP receives shutdown ack message nor worker thread
2461 ////////////////////////////////////////////////////////////////////////////////////////////////////
2462 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPNorDataSaveAck) {
2463 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
2465 // data received with ack
2466 UI_32 l_uiPersistCategoryFlag = 0;
2468 CHKNULL(f_pSourceState);
2470 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
2473 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
2474 CHKNULL(l_pNotificationpersistentserviceHSM);
2476 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
2479 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
2480 CHKNULL(l_cMsgSource);
2482 // get instance of persistence manager
2483 CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
2484 CHKNULL(l_pPersistenceManager);
2486 l_pPersistenceManager->SetImmediateDataPersistedStatus(TRUE);
2488 if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_uiPersistCategoryFlag), sizeof(l_uiPersistCategoryFlag), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
2489 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "ShutdownAck received from %s with data: %d", l_cMsgSource,
2490 l_uiPersistCategoryFlag);
2493 // depending on the flag delete the persisted data from persistent memory
2494 // which are not to be persisted during shutdown
2495 l_pnsnpp->DeletePersistedDataFolder(l_uiPersistCategoryFlag);
2497 if (TRUE == l_pPersistenceManager->HaveAllReleaseRequestsPersisted()) { // LCOV_EXCL_BR_LINE 6: always return ok
2498 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "All release requests are processed.");
2499 f_pSourceState->FrameworkunifiedPostEvent(EVENT(evIdle));
2501 } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
2502 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2503 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
2504 f_pSourceState = NULL;
2507 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
2508 return f_pSourceState;
2511 CsNotificationpersistentservicePersistenceReady::CsNotificationpersistentservicePersistenceReady(std::string f_strName): CFrameworkunifiedLeafState(f_strName) {
2512 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
2513 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
2516 CsNotificationpersistentservicePersistenceReady::~CsNotificationpersistentservicePersistenceReady() { // LCOV_EXCL_START 200: cannot test code
2517 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2518 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
2519 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
2523 EFrameworkunifiedStatus CsNotificationpersistentservicePersistenceReady::FrameworkunifiedOnEntry(CEventDataPtr f_peventdata) {
2524 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
2526 HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
2528 if (NULL != l_pHApp) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
2529 HANDLE l_hMq = FrameworkunifiedMcOpenSender(l_pHApp, g_csendreadyackto);
2531 if (NULL != l_hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
2532 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
2534 // send ack to requester
2535 if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedSendMsg(l_hMq, NPS_NPP_READY_EVENT, 0, NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
2536 FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __PRETTY_FUNCTION__, "NPP ready status sent to %s.", g_csendreadyackto);
2538 // LCOV_EXCL_START 4: NSFW error case.
2539 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2540 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error sending NPS_NPP_READY_EVENT to %s, status: %d", g_csendreadyackto,
2544 FrameworkunifiedMcClose(l_hMq);
2547 // catastrophic failure!
2548 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2549 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "McOpenSender failed for %s ", g_csendreadyackto); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
2553 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
2554 return eFrameworkunifiedStatusOK;
2557 EFrameworkunifiedStatus CsNotificationpersistentservicePersistenceReady::FrameworkunifiedOnExit(CEventDataPtr f_peventdata) { // LCOV_EXCL_START 200: cannot test code
2558 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2559 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
2560 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
2561 return eFrameworkunifiedStatusOK;
2565 #ifdef NPP_PROFILEINFO_ENABLE
2567 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfileNotifications) {
2568 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
2570 CHKNULL(f_pSourceState);
2572 // get the application handle
2573 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
2576 // get the statemachine pointer of application
2577 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
2578 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
2581 // get the message source name
2582 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
2583 CHKNULL(l_cMsgSource);
2585 // get the message queue handle for sending the response
2586 HANDLE hSrcMqHandle = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
2587 CHKNULL(hSrcMqHandle);
2589 // get instance of notification manager
2590 CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
2591 CHKNULL(l_pNotificationManager);
2593 std::string l_cNotificationProfileInfo = "";
2595 // get the data from notification manager
2596 if (eFrameworkunifiedStatusOK == l_pNotificationManager->GetNotificationProfilingData(l_cNotificationProfileInfo)) {
2597 UI_32 l_uiLength = l_cNotificationProfileInfo.size();
2599 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedSendMsg NPS_PROFILE_NOTIFICATION_RESP Msg Length: %d", l_uiLength);
2601 PCHAR l_pData = new CHAR[l_uiLength];
2602 std::memset(l_pData, '0', l_uiLength);
2604 std::strncpy(l_pData, l_cNotificationProfileInfo.c_str(), l_cNotificationProfileInfo.size());
2606 if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hSrcMqHandle,
2607 NPS_PROFILE_NOTIFICATION_RESP,
2610 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
2611 "FrameworkunifiedSendMsg NPS_PROFILE_NOTIFICATION_RESP for Notification Profiling failed.");
2616 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Failed to get Notification profiling data from NSNPP.");
2618 } catch (std::exception &e) {
2619 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
2620 f_pSourceState = NULL;
2623 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
2624 return f_pSourceState;
2627 IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfilePersistence) {
2628 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
2630 CHKNULL(f_pSourceState);
2632 // get the application handle
2633 HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
2636 // get the statemachine pointer of application
2637 CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
2638 CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
2641 // get the message source name
2642 PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
2643 CHKNULL(l_cMsgSource);
2645 // get the message queue handle for sending the response
2646 HANDLE hSrcMqHandle = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
2647 CHKNULL(hSrcMqHandle);
2649 // get instance of persistence manager
2650 CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
2652 CHKNULL(l_pPersistenceManager);
2654 std::string l_cPersistenceProfileInfo = "";
2656 if (eFrameworkunifiedStatusOK == l_pPersistenceManager->GetPersistenceProfilingData(l_cPersistenceProfileInfo)) {
2657 UI_32 l_uiLength = l_cPersistenceProfileInfo.size();
2659 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedSendMsg NPS_PROFILE_PERSISTENCE_RESP Msg Length: %d", l_uiLength);
2661 PCHAR l_pData = new CHAR[l_uiLength];
2662 std::memset(l_pData, '0', l_uiLength);
2664 std::strncpy(l_pData, l_cPersistenceProfileInfo.c_str(), l_cPersistenceProfileInfo.size());
2666 if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hSrcMqHandle,
2667 NPS_PROFILE_PERSISTENCE_RESP,
2670 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedSendMsg NPS_PROFILE_PERSISTENCE_RESP for Persistence Profiling failed.");
2675 } catch (std::exception &e) {
2676 FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
2677 f_pSourceState = NULL;
2680 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
2681 return f_pSourceState;