In the function ttiCreateCstInfoEntry all fctInfo enteris are copied to index 0. The idx counter are not used.
Old sources:
for (idx = 0u; idx < pDest->fctCnt; idx++)
{
memcpy(pDest->pFctInfoList->fctName, pData, sizeof(TRDP_NET_LABEL_T));
pData += sizeof(TRDP_NET_LABEL_T);
pDest->pFctInfoList->fctId = vos_ntohs((UINT16 )pData);
pData += sizeof(UINT16);
pDest->pFctInfoList->grp = pData++;
pDest->pFctInfoList->reserved01 = pData++;
pDest->pFctInfoList->cstVehNo = pData++;
pDest->pFctInfoList->etbId = pData++;
pDest->pFctInfoList->cnId = pData++;
pDest->pFctInfoList->reserved02 = pData++;
}
Suggested change:
for (idx = 0u; idx < pDest->fctCnt; idx++)
{
memcpy(pDest->pFctInfoList[idx].fctName, pData, sizeof(TRDP_NET_LABEL_T));
pData += sizeof(TRDP_NET_LABEL_T);
pDest->pFctInfoList[idx].fctId = vos_ntohs(*(UINT16 *)pData);
pData += sizeof(UINT16);
pDest->pFctInfoList[idx].grp = *pData++;
pDest->pFctInfoList[idx].reserved01 = *pData++;
pDest->pFctInfoList[idx].cstVehNo = *pData++;
pDest->pFctInfoList[idx].etbId = *pData++;
pDest->pFctInfoList[idx].cnId = *pData++;
pDest->pFctInfoList[idx].reserved02 = *pData++;
}
Changed accordingly. To be tested.
In the function tau_getCstInfo() in tau_tti.c etbCnt, vehCnt and fctCnt in appHandle.pTTDB->cstInfo are already in Host endianess. Rotating them again leads to false values:
Tested in api_test_4.c test3
Last edit: Stefan Bender 2021-08-11