UcsXml component use libxml2 instead of libmxml
[apps/agl-service-unicens.git] / ucs2-interface / ucs_interface.h
index 82bba55..d7a1f66 100644 (file)
@@ -1,5 +1,5 @@
 /*------------------------------------------------------------------------------------------------*/
-/* Unicens Integration Helper Component                                                           */
+/* UNICENS Integration Helper Component                                                           */
 /* Copyright 2017, Microchip Technology Inc. and its subsidiaries.                                */
 /*                                                                                                */
 /* Redistribution and use in source and binary forms, with or without                             */
@@ -41,20 +41,8 @@ extern "C" {
 /*                            Public API                                */
 /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
 
-// Fulup interface added to support ucs2vol
-typedef const struct {
-    char* name;
-    int numid;
-} UCSI_channelsT;
-
-typedef void (*UCSI_VolumeServiceCB_t)(uint16_t timeout);
-UCSI_channelsT *UCSI_Vol_Init (UCSI_Data_t *pPriv, UCSI_VolumeServiceCB_t serviceCB);
-uint8_t UCSI_Vol_Set  (UCSI_Data_t *pPriv, int numId, uint8_t volume);
-void UCSI_Vol_Service (UCSI_Data_t *pPriv);
-
-
 /**
- * \brief Initializes Unicens Integration module.
+ * \brief Initializes UNICENS Integration module.
  * \note Must be called before any other function of this component
  *
  * \param pPriv - External allocated memory area for this particular
@@ -78,7 +66,7 @@ void UCSI_Init(UCSI_Data_t *pPriv, void *pTag);
 bool UCSI_NewConfig(UCSI_Data_t *pPriv, UcsXmlVal_t *ucsConfig);
 
 /**
- * \brief Offer the received control data from LLD to Unicens
+ * \brief Offer the received control data from LLD to UNICENS
  * \note Call this function only from single context (not from ISR)
  * \note This function can be called repeated until it return false
  *
@@ -95,7 +83,7 @@ bool UCSI_NewConfig(UCSI_Data_t *pPriv, UcsXmlVal_t *ucsConfig);
 bool UCSI_ProcessRxData(UCSI_Data_t *pPriv, const uint8_t *pBuffer, uint16_t len);
 
 /**
- * \brief Gives Unicens Integration module time to do its job
+ * \brief Gives UNICENS Integration module time to do its job
  * \note Call this function only from single context (not from ISR)
  *
  * \param pPriv - private data section of this instance
@@ -128,7 +116,7 @@ void UCSI_Timeout(UCSI_Data_t *pPriv);
 bool UCSI_SendAmsMessage(UCSI_Data_t *my, uint16_t msgId, uint16_t targetAddress, uint8_t *pPayload, uint32_t payloadLen);
 
 /**
- * \brief Gets the queued AMS message from Unicens stack
+ * \brief Gets the queued AMS message from UNICENS stack
  *
  * \note Call this function only from single context (not from ISR)
  * \note This function may be called cyclic or when UCSI_CB_OnAmsMessageReceived was raised
@@ -163,7 +151,7 @@ void UCSI_ReleaseAmsMessage(UCSI_Data_t *my);
  * \param routeId - identifier as given in XML file along with MOST socket (unique)
  * \param isActive - true, route will become active. false, route will be deallocated
  * 
- * \return true, if route was found and the specific command was enqueued to Unicens.
+ * \return true, if route was found and the specific command was enqueued to UNICENS.
  */
 bool UCSI_SetRouteActive(UCSI_Data_t *pPriv, uint16_t routeId, bool isActive);
 
@@ -182,7 +170,7 @@ bool UCSI_SetRouteActive(UCSI_Data_t *pPriv, uint16_t routeId, bool isActive);
  * \param result_fptr - Callback function notifying the asynchronous result.
  * \param request_ptr - User reference which is provided for the asynchronous result.
  *
- * \return true, if route command was enqueued to Unicens.
+ * \return true, if route command was enqueued to UNICENS.
  */
 bool UCSI_I2CWrite(UCSI_Data_t *pPriv, uint16_t targetAddress, bool isBurst, uint8_t blockCount,
     uint8_t slaveAddr, uint16_t timeout, uint8_t dataLen, uint8_t *pData,
@@ -197,7 +185,7 @@ bool UCSI_I2CWrite(UCSI_Data_t *pPriv, uint16_t targetAddress, bool isBurst, uin
  * \param gpioPinId - INIC GPIO PIN starting with 0 for the first GPIO.
  * \param isHighState - true, high state = 3,3V. false, low state = 0V.
  *
- * \return true, if GPIO command was enqueued to Unicens.
+ * \return true, if GPIO command was enqueued to UNICENS.
  */
 bool UCSI_SetGpioState(UCSI_Data_t *pPriv, uint16_t targetAddress, uint8_t gpioPinId, bool isHighState);
 
@@ -224,9 +212,18 @@ extern uint16_t UCSI_CB_OnGetTime(void *pTag);
  */
 extern void UCSI_CB_OnSetServiceTimer(void *pTag, uint16_t timeout);
 
+/**
+ * \brief Callback when ever the state of the Network has changed.
+ * \note This function must be implemented by the integrator
+ * \param pTag - Pointer given by the integrator by UCSI_Init
+ * \param isAvailable - true, if the network is operable. false, network is down. No message or stream can be sent or received.
+ * \param packetBandwidth - The amount of bytes per frame reserved for the Ethernet channel. Must match to the given packetBw value passed to UCSI_NewConfig.
+ * \param amountOfNodes - The amount of network devices found in the ring.
+ */
+extern void UCSI_CB_OnNetworkState(void *pTag, bool isAvailable, uint16_t packetBandwidth, uint8_t amountOfNodes);
 
 /**
- * \brief Callback when ever an Unicens forms a human readable message.
+ * \brief Callback when ever an UNICENS forms a human readable message.
  *        This can be error events or when enabled also debug messages.
  * \note This function must be implemented by the integrator
  * \param pTag - Pointer given by the integrator by UCSI_Init
@@ -237,7 +234,6 @@ extern void UCSI_CB_OnSetServiceTimer(void *pTag, uint16_t timeout);
 extern void UCSI_CB_OnUserMessage(void *pTag, bool isError, const char format[],
     uint16_t vargsCnt, ...);
 
-
 /**
  * \brief Callback when ever this instance needs to be serviced.
  * \note Call UCSI_Service by your scheduler at the next run
@@ -247,7 +243,7 @@ extern void UCSI_CB_OnUserMessage(void *pTag, bool isError, const char format[],
 extern void UCSI_CB_OnServiceRequired(void *pTag);
 
 /**
- * \brief Callback when ever this instance of Unicens wants to send control data to the LLD.
+ * \brief Callback when ever this instance of UNICENS wants to send control data to the LLD.
  * \note This function must be implemented by the integrator
  * \param pTag - Pointer given by the integrator by UCSI_Init
  * \param pPayload - Byte array to be sent on the INIC control channel
@@ -257,7 +253,7 @@ extern void UCSI_CB_OnTxRequest(void *pTag,
     const uint8_t *pPayload, uint32_t payloadLen);
 
 /**
- * \brief Callback when Unicens instance has been stopped.
+ * \brief Callback when UNICENS instance has been stopped.
  * \note This event can be used to free memory holding the resources
  *       passed with UCSI_NewConfig
  * \note This function must be implemented by the integrator
@@ -266,7 +262,7 @@ extern void UCSI_CB_OnTxRequest(void *pTag,
 extern void UCSI_CB_OnStop(void *pTag);
 
 /**
- * \brief Callback when Unicens instance has received an AMS message
+ * \brief Callback when UNICENS instance has received an AMS message
  * \note This function must be implemented by the integrator
  * \note After this callback, call UCSI_GetAmsMessage indirect by setting a flag
  * \param pTag - Pointer given by the integrator by UCSI_Init
@@ -279,8 +275,9 @@ extern void UCSI_CB_OnAmsMessageReceived(void *pTag);
  * \param pTag - Pointer given by the integrator by UCSI_Init
  * \param routeId - identifier as given in XML file along with MOST socket (unique)
  * \param isActive - true, if the route is now in use. false, the route is not established.
+ * \param connectionLabel - The connection label used on the Network. Only valid, if isActive=true
  */
-extern void UCSI_CB_OnRouteResult(void *pTag, uint16_t routeId, bool isActive);
+extern void UCSI_CB_OnRouteResult(void *pTag, uint16_t routeId, bool isActive, uint16_t connectionLabel);
 
 /**
  * \brief Callback when a INIC GPIO changes its state