Ejemplo n.º 1
0
bool CTxEthernetDataStore::bSetChannelConfig(xmlNodePtr pNode)
{
    //Index
    m_ouEthernet_Frame_Data.clear();
    m_ouMapIndexToKey.clear();

    xmlChar* pchPathMsg = (xmlChar*)"Message";
    xmlXPathObjectPtr pObjectPath = xmlUtils::pGetChildNodes(pNode, pchPathMsg);
    if  (pObjectPath != NULL )
    {
        xmlNodeSetPtr pNodeSet = pObjectPath->nodesetval;
        if( NULL != pNodeSet )
        {
            m_ouEthernet_Frame_Data.clear();
            for ( int i =0 ; i < pNodeSet->nodeNr; i++ )
            {
                xmlNodePtr pNode = pNodeSet->nodeTab[i];       //Take First One only
                ETHERNET_FRAME_DATA ouData;
                if ( parseForMessage(pNode, ouData) == true )
                {
                    m_ouEthernet_Frame_Data.push_back(ouData);
                }
            }
        }
        xmlFree(pObjectPath);
    }
    return true;
}
Ejemplo n.º 2
0
bool CTxFlexRayDataStore::bSetChannelConfig(xmlNodePtr pNode)
{
    //Index
    int nChannel = -1;
    xmlChar* pchPath = (xmlChar*)"Index";
    xmlXPathObjectPtr pObjectPath = xmlUtils::pGetChildNodes(pNode, pchPath);
    if  (pObjectPath != nullptr )
    {
        xmlNodeSetPtr pNodeSet = pObjectPath->nodesetval;
        if( nullptr != pNodeSet )
        {
            xmlNodePtr pNode = pNodeSet->nodeTab[0];       //Take First One only
            std::string strVar;
            xmlChar* key = xmlNodeListGetString(pNode->doc, pNode->xmlChildrenNode , 1);
            nChannel = atoi( (char*)key);            //Trigger value
        }
    }

    if ( nChannel < 0 || nChannel > CHANNEL_ALLOWED )
    {
        return false;
    }

    m_ouFlexray_Frame_Data[nChannel].clear();

    xmlChar* pchPathMsg = (xmlChar*)"Message";
    pObjectPath = xmlUtils::pGetChildNodes(pNode, pchPathMsg);
    if  (pObjectPath != nullptr )
    {
        xmlNodeSetPtr pNodeSet = pObjectPath->nodesetval;
        if( nullptr != pNodeSet )
        {

            for ( int i =0 ; i < pNodeSet->nodeNr; i++ )
            {
                xmlNodePtr pNode = pNodeSet->nodeTab[i];       //Take First One only
                FLEXRAY_CONFIG_DATA ouData;
                if ( parseForMessage(pNode, ouData) == true )
                {
                    bAddToChannelList(nChannel, ouData);
                }

            }

        }
    }
    return true;
}