aboutsummaryrefslogtreecommitdiffstats
path: root/ucs2-interface/ucs-xml
diff options
context:
space:
mode:
Diffstat (limited to 'ucs2-interface/ucs-xml')
-rw-r--r--ucs2-interface/ucs-xml/UcsXml.c49
-rw-r--r--ucs2-interface/ucs-xml/UcsXml_Private.c6
2 files changed, 39 insertions, 16 deletions
diff --git a/ucs2-interface/ucs-xml/UcsXml.c b/ucs2-interface/ucs-xml/UcsXml.c
index 2360c7a..7715cd4 100644
--- a/ucs2-interface/ucs-xml/UcsXml.c
+++ b/ucs2-interface/ucs-xml/UcsXml.c
@@ -42,6 +42,7 @@
#define RETURN_ASSERT(result) { UcsXml_CB_OnError("Assertion in file=%s, line=%d", 2, __FILE__, __LINE__); return result; }
#define MISC_HB(value) ((uint8_t)((uint16_t)(value) >> 8))
#define MISC_LB(value) ((uint8_t)((uint16_t)(value) & (uint16_t)0xFF))
+#define ROUTE_AUTO_ID_START (0x8000)
struct UcsXmlRoute
{
@@ -260,6 +261,7 @@ static ParseResult_t ParseScriptPortWrite(xmlNode *act, Ucs_Ns_Script_t *scr, Pr
static ParseResult_t ParseScriptPortRead(xmlNode *act, Ucs_Ns_Script_t *scr, PrivateData_t *priv);
static ParseResult_t ParseScriptPause(xmlNode *act, Ucs_Ns_Script_t *scr, PrivateData_t *priv);
static ParseResult_t ParseRoutes(UcsXmlVal_t *ucs, PrivateData_t *priv);
+static bool IsAutoRouteId(uint16_t id, PrivateData_t *priv);
/************************************************************************/
/* Public Functions */
@@ -708,7 +710,7 @@ static ParseResult_t ParseAll(xmlNode *tree, UcsXmlVal_t *ucs, PrivateData_t *pr
uint32_t nodeCount;
xmlNode *sub;
ParseResult_t result;
- priv->autoRouteId = 0x8000;
+ priv->autoRouteId = ROUTE_AUTO_ID_START;
if (!GetCount(tree, NODE, &nodeCount, true))
RETURN_ASSERT(Parse_XmlError);
@@ -1535,9 +1537,19 @@ static ParseResult_t ParseRoutes(UcsXmlVal_t *ucs, PrivateData_t *priv)
sourceRoute = priv->pRtLst;
while (NULL != sourceRoute)
{
- if (!sourceRoute->isSource) /*There can be more sinks than sources, so count them*/
+ if (sourceRoute->isSource)
{
- ++routeAmount;
+ struct UcsXmlRoute *sinkRoute = priv->pRtLst;
+ while (NULL != sinkRoute)
+ {
+ if (sourceRoute != sinkRoute
+ && !sinkRoute->isSource
+ && (0 == strncmp(sourceRoute->routeName, sinkRoute->routeName, sizeof(sourceRoute->routeName))))
+ {
+ routeAmount++;
+ }
+ sinkRoute = sinkRoute->next;
+ }
}
sourceRoute = sourceRoute->next;
}
@@ -1559,22 +1571,30 @@ static ParseResult_t ParseRoutes(UcsXmlVal_t *ucs, PrivateData_t *priv)
&& !sinkRoute->isSource
&& (0 == strncmp(sourceRoute->routeName, sinkRoute->routeName, sizeof(sourceRoute->routeName))))
{
- Ucs_Rm_Route_t *route = &ucs->pRoutes[ucs->routesSize++];
+ Ucs_Rm_Route_t *route;
+ if(ucs->routesSize >= routeAmount)
+ {
+ RETURN_ASSERT(Parse_MemoryError);
+ }
+ route = &ucs->pRoutes[ucs->routesSize++];
route->source_endpoint_ptr = sourceRoute->ep;
route->sink_endpoint_ptr = sinkRoute->ep;
- route->active = sinkRoute->isActive;
- route->route_id = sinkRoute->routeId;
+ if (!IsAutoRouteId(sourceRoute->routeId, priv))
+ {
+ route->active = sourceRoute->isActive;
+ route->route_id = sourceRoute->routeId;
+ }
+ else
+ {
+ route->active = sinkRoute->isActive;
+ route->route_id = sinkRoute->routeId;
+ }
}
sinkRoute = sinkRoute->next;
}
}
sourceRoute = sourceRoute->next;
}
- if (routeAmount != ucs->routesSize)
- {
- UcsXml_CB_OnError("At least one sink (num=%d) is not connected, because of wrong Route name!", 2, (routeAmount - ucs->routesSize));
- RETURN_ASSERT(Parse_XmlError);
- }
#ifdef DEBUG
/* Third perform checks when running in debug mode*/
@@ -1610,3 +1630,10 @@ static ParseResult_t ParseRoutes(UcsXmlVal_t *ucs, PrivateData_t *priv)
#endif
return Parse_Success;
}
+
+static bool IsAutoRouteId(uint16_t id, PrivateData_t *priv)
+{
+ assert(NULL != priv);
+ return (id >= ROUTE_AUTO_ID_START && id <= priv->autoRouteId);
+}
+
diff --git a/ucs2-interface/ucs-xml/UcsXml_Private.c b/ucs2-interface/ucs-xml/UcsXml_Private.c
index 743598f..4fb4e0c 100644
--- a/ucs2-interface/ucs-xml/UcsXml_Private.c
+++ b/ucs2-interface/ucs-xml/UcsXml_Private.c
@@ -65,10 +65,6 @@ static const char* I2S_PIN_SRXB1 = "SRXB1";
static const char* MUTE_OFF = "NoMuting";
static const char* MUTE_SIGNAL = "MuteSignal";
-/*
-static const char* VAL_TRUE = "true";
-static const char* VAL_FALSE = "false";
- */
#define ASSERT_FALSE(func, par) { UcsXml_CB_OnError("Parameter error in attribute=%s value=%s, file=%s, line=%d", 4, func, par, __FILE__, __LINE__); return false; }
#define CHECK_POINTER(PTR) if (NULL == PTR) { ASSERT_FALSE(PTR, "NULL pointer"); }
@@ -508,4 +504,4 @@ bool GetAvpCon(Ucs_Xrm_AvpCon_t **avpCon, struct AvpConParameters *param)
con->isoc_packet_size = UCS_ISOC_PCKT_SIZE_188;
}
return true;
-} \ No newline at end of file
+}