aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThorsten Kummermehr <thorsten.kummermehr@k2l.de>2017-11-07 16:34:55 +0100
committerThorsten Kummermehr <thorsten.kummermehr@k2l.de>2017-11-07 16:34:55 +0100
commit671879b3ab49985a06ad6ee6a58a8bcfa9726538 (patch)
tree14dac64c9717d0ccfc6f9f9bb228d71465e860bc
parent1bba2cf81dc69b4ea87ba0ebc366a58eab45ff84 (diff)
Deliver network status
-rw-r--r--ucs2-afb/ucs_binding.c4
-rw-r--r--ucs2-interface/ucs_lib_interf.c28
2 files changed, 18 insertions, 14 deletions
diff --git a/ucs2-afb/ucs_binding.c b/ucs2-afb/ucs_binding.c
index 0b4c378..e1451a0 100644
--- a/ucs2-afb/ucs_binding.c
+++ b/ucs2-afb/ucs_binding.c
@@ -107,6 +107,10 @@ STATIC int onTimerCB (sd_event_source* source,uint64_t timer, void* pTag) {
return 0;
}
+void UCSI_CB_OnNetworkState(void *pTag, bool isAvailable, uint16_t packetBandwidth, uint8_t amountOfNodes)
+{
+}
+
/* UCS2 Interface Timer Callback */
PUBLIC void UCSI_CB_OnSetServiceTimer(void *pTag, uint16_t timeout) {
uint64_t usec;
diff --git a/ucs2-interface/ucs_lib_interf.c b/ucs2-interface/ucs_lib_interf.c
index 77cf83b..59bed75 100644
--- a/ucs2-interface/ucs_lib_interf.c
+++ b/ucs2-interface/ucs_lib_interf.c
@@ -56,9 +56,9 @@ static void OnLldCtrlStop( void *lld_user_ptr );
static void OnLldCtrlRxMsgAvailable( void *lld_user_ptr );
static void OnLldCtrlTxTransmitC( Ucs_Lld_TxMsg_t *msg_ptr, void *lld_user_ptr );
static void OnUnicensRoutingResult(Ucs_Rm_Route_t* route_ptr, Ucs_Rm_RouteInfos_t route_infos, void *user_ptr);
-static void OnUnicensMostPortStatus(uint16_t most_port_handle,
- Ucs_Most_PortAvail_t availability, Ucs_Most_PortAvailInfo_t avail_info,
- uint16_t free_streaming_bw, void* user_ptr);
+static void OnUnicensNetworkStatus(uint16_t change_mask, uint16_t events, Ucs_Network_Availability_t availability,
+ Ucs_Network_AvailInfo_t avail_info, Ucs_Network_AvailTransCause_t avail_trans_cause, uint16_t node_address,
+ uint8_t node_position, uint8_t max_position, uint16_t packet_bw, void *user_ptr);
static void OnUnicensDebugXrmResources(Ucs_Xrm_ResourceType_t resource_type,
Ucs_Xrm_ResObject_t *resource_ptr, Ucs_Xrm_ResourceInfos_t resource_infos,
Ucs_Rm_EndPoint_t *endpoint_inst_ptr, void *user_ptr);
@@ -111,6 +111,8 @@ void UCSI_Init(UCSI_Data_t *my, void *pTag)
my->uniInitData.general.debug_error_msg_fptr = &OnUnicensDebugErrorMsg;
my->uniInitData.ams.enabled = ENABLE_AMS_LIB;
my->uniInitData.ams.rx.message_received_fptr = &OnUcsAmsRxMsgReceived;
+ my->uniInitData.network.status.notification_mask = 0xC2;
+ my->uniInitData.network.status.cb_fptr = &OnUnicensNetworkStatus;
my->uniInitData.lld.lld_user_ptr = my;
my->uniInitData.lld.start_fptr = &OnLldCtrlStart;
@@ -119,7 +121,6 @@ void UCSI_Init(UCSI_Data_t *my, void *pTag)
my->uniInitData.lld.tx_transmit_fptr = &OnLldCtrlTxTransmitC;
my->uniInitData.rm.report_fptr = &OnUnicensRoutingResult;
- my->uniInitData.rm.xrm.most_port_status_fptr = &OnUnicensMostPortStatus;
my->uniInitData.rm.debug_resource_status_fptr = &OnUnicensDebugXrmResources;
my->uniInitData.gpio.trigger_event_status_fptr = &OnUcsGpioTriggerEventStatus;
@@ -556,21 +557,20 @@ static void OnLldCtrlTxTransmitC( Ucs_Lld_TxMsg_t *msg_ptr, void *lld_user_ptr )
static void OnUnicensRoutingResult(Ucs_Rm_Route_t* route_ptr, Ucs_Rm_RouteInfos_t route_infos, void *user_ptr)
{
+ uint16_t conLabel;
UCSI_Data_t *my = (UCSI_Data_t *)user_ptr;
assert(MAGIC == my->magic);
- UCSI_CB_OnRouteResult(my->tag, route_ptr->route_id, UCS_RM_ROUTE_INFOS_BUILT == route_infos);
+ conLabel = Ucs_Rm_GetConnectionLabel(my->unicens, route_ptr);
+ UCSI_CB_OnRouteResult(my->tag, route_ptr->route_id, UCS_RM_ROUTE_INFOS_BUILT == route_infos, conLabel);
}
-static void OnUnicensMostPortStatus(uint16_t most_port_handle,
- Ucs_Most_PortAvail_t availability, Ucs_Most_PortAvailInfo_t avail_info,
- uint16_t free_streaming_bw, void* user_ptr)
+static void OnUnicensNetworkStatus(uint16_t change_mask, uint16_t events, Ucs_Network_Availability_t availability,
+ Ucs_Network_AvailInfo_t avail_info, Ucs_Network_AvailTransCause_t avail_trans_cause, uint16_t node_address,
+ uint8_t node_position, uint8_t max_position, uint16_t packet_bw, void *user_ptr)
{
- /*TODO: implement*/
- most_port_handle = most_port_handle;
- availability = availability;
- avail_info = avail_info;
- free_streaming_bw = free_streaming_bw;
- user_ptr = user_ptr;
+ UCSI_Data_t *my = (UCSI_Data_t *)user_ptr;
+ assert(MAGIC == my->magic);
+ UCSI_CB_OnNetworkState(my->tag, UCS_NW_AVAILABLE == availability, packet_bw, max_position);
}
static void OnUnicensDebugXrmResources(Ucs_Xrm_ResourceType_t resource_type,