From e9aa8f0519f75d8dc1d698e11596c4720cd977e5 Mon Sep 17 00:00:00 2001 From: Tobias Jahnke Date: Thu, 3 Aug 2017 16:48:18 +0200 Subject: adds node-availibility event and subscribe function --- ucs2-interface/ucs_interface.h | 10 ++++++++++ ucs2-interface/ucs_lib_interf.c | 2 ++ 2 files changed, 12 insertions(+) (limited to 'ucs2-interface') diff --git a/ucs2-interface/ucs_interface.h b/ucs2-interface/ucs_interface.h index 0ec603a..82bba55 100644 --- a/ucs2-interface/ucs_interface.h +++ b/ucs2-interface/ucs_interface.h @@ -292,6 +292,16 @@ extern void UCSI_CB_OnRouteResult(void *pTag, uint16_t routeId, bool isActive); */ extern void UCSI_CB_OnGpioStateChange(void *pTag, uint16_t nodeAddress, uint8_t gpioPinId, bool isHighState); +/** + * \brief Callback when nodes are discovered or disappear + * \note This function must be implemented by the integrator + * \param pTag - Pointer given by the integrator by UCSI_Init + * \param code - Report code + * \param nodeAddress - Node Address of the INIC sending the update. + * \param pNode - Reference to the node structure or NULL. + */ +extern void UCSI_CB_OnMgrReport(void *pTag, Ucs_MgrReport_t code, uint16_t nodeAddress, Ucs_Rm_Node_t *pNode); + #ifdef __cplusplus } #endif diff --git a/ucs2-interface/ucs_lib_interf.c b/ucs2-interface/ucs_lib_interf.c index 52840ba..9e7167d 100644 --- a/ucs2-interface/ucs_lib_interf.c +++ b/ucs2-interface/ucs_lib_interf.c @@ -784,6 +784,8 @@ static void OnUcsMgrReport(Ucs_MgrReport_t code, uint16_t node_address, Ucs_Rm_N UCSI_CB_OnUserMessage(my->tag, true, "Node=%X: unknown code", 1, node_address); break; } + + UCSI_CB_OnMgrReport(my->tag, code, node_address, node_ptr); } static void OnUcsNsRun(Ucs_Rm_Node_t * node_ptr, Ucs_Ns_ResultCode_t result, void *ucs_user_ptr) -- cgit 1.2.3-korg