+ if (!src_ptr)
+ {
+ /* first time usage: create and trigger event source */
+ sd_event_add_defer(afb_daemon_get_event_loop(), &src_ptr, &OnAmsMessageReceivedCB, pTag);
+ }
+ else
+ {
+ sd_event_source_set_enabled(src_ptr, SD_EVENT_ONESHOT);
+ }
+}
+
+void UCSI_CB_OnRouteResult(void *pTag, uint16_t routeId, bool isActive, uint16_t connectionLabel)
+{
+ AFB_NOTICE ("Route 0x%X is active=%d, connection label=0x%X", routeId, isActive, connectionLabel);
+}
+
+void UCSI_CB_OnGpioStateChange(void *pTag, uint16_t nodeAddress, uint8_t gpioPinId, bool isHighState)
+{
+ AFB_NOTICE ("GPIO state of node 0x%X changed, pin=%d isHigh=%d", nodeAddress, gpioPinId, isHighState);
+}
+
+PUBLIC void UCSI_CB_OnMgrReport(void *pTag, Ucs_MgrReport_t code, uint16_t nodeAddress, Ucs_Rm_Node_t *pNode){
+
+ bool available;
+
+ if (code == UCS_MGR_REP_AVAILABLE) {
+ available = true;
+ }
+ else if (code == UCS_MGR_REP_NOT_AVAILABLE) {
+ available = false;
+ }
+ else {
+ /*untracked event - just exit*/
+ return;
+ }
+
+ if (eventData) {
+
+ json_object *j_event_info = json_object_new_object();
+ json_object_object_add(j_event_info, "node", json_object_new_int(nodeAddress));
+ json_object_object_add(j_event_info, "available", json_object_new_boolean(available));
+
+ afb_event_push(eventData->node_event, j_event_info);
+ }