34 #if defined(ENABLE_SD_NOTIFY)
35 #include <systemd/sd-daemon.h>
41 #ifdef INCLUDE_BREAKPAD
42 #include "breakpad_wrapper.h"
45 static bool gbExitBTRMgr =
false;
49 btrMgr_SignalHandler (
55 printf (
"Received SIGNAL %d = %s - %s\n", i32SignalNumber, strsignal(i32SignalNumber), ctime(&curr));
58 if (i32SignalNumber == SIGTERM)
72 if ((lenBtrMgrResult =
BTRMGR_Init()) == BTRMGR_RESULT_SUCCESS) {
74 signal(SIGTERM, btrMgr_SignalHandler);
76 #if defined(ENABLE_SD_NOTIFY)
77 sd_notify(0,
"READY=1");
81 printf (
"I-ARM BTMgr Bus: BTRMgr_BeginIARMMode %s\n", ctime(&curr));
84 BTRMgr_BeginIARMMode();
86 #ifdef INCLUDE_BREAKPAD
87 breakpad_ExceptionHandler();
91 printf (
"BTRMGR_StartAudioStreamingOut_StartUp - %d\n", lenBtrMgrSoResult);
94 #if defined(ENABLE_SD_NOTIFY)
95 sd_notifyf(0,
"READY=1\n"
96 "STATUS=BTRMgr Successfully Initialized - Processing requests…\n"
97 "MAINPID=%lu", (
unsigned long) getpid());
100 while (gbExitBTRMgr ==
false) {
102 printf (
"I-ARM BTMgr Bus: HeartBeat at %s\n", ctime(&curr));
107 #if defined(ENABLE_SD_NOTIFY)
108 sd_notify(0,
"STOPPING=1");
111 BTRMgr_TermIARMMode();
114 printf (
"I-ARM BTMgr Bus: BTRMgr_TermIARMMode %s\n", ctime(&curr));
120 if (lenBtrMgrResult != BTRMGR_RESULT_SUCCESS) {
121 #if defined(ENABLE_SD_NOTIFY)
122 sd_notifyf(0, SD_EMERG
"STATUS=BTRMgr Init Failed %d\n", lenBtrMgrResult);
124 printf (
"BTRMGR_Init Failed\n");
132 printf (
"BTRMGR_DeInit %d - %s\n", lenBtrMgrResult, ctime(&curr));
135 #if defined(ENABLE_SD_NOTIFY)
136 sd_notifyf(0,
"STOPPING=1\n"
137 "STATUS=BTRMgr Successfully DeInitialized\n"
138 "MAINPID=%lu", (
unsigned long) getpid());
141 return lenBtrMgrResult;