On receiving the TTDB_OP_TRAIN_DIRECTORY_INFO (ComId 109 or 101), the data is converted to local representation and stored into the local copy.
The structure used for storing it locally is as follows:
/** Operational train structure */
typedef struct
{
TRDP_SHORT_VERSION_T version; /**< Train info structure version */
UINT8 etbId; /**< identification of the ETB the TTDB is computed for
0: ETB0 (operational network)
1: ETB1 (multimedia network)
2: ETB2 (other network)
3: ETB3 (other network) */
UINT8 opTrnOrient; /**< operational train orientation
'00'B = unknown
'01'B = same as train direction
'10'B = inverse to train direction */
UINT8 reserved01; /**< reserved for future use (= 0) */
UINT8 reserved02; /**< reserved for future use (= 0) */
UINT8 reserved03; /**< reserved for future use (= 0) */
UINT8 opCstCnt; /**< number of consists in train (1..63) */
TRDP_OP_CONSIST_T opCstList[TRDP_MAX_CST_CNT];
/**< operational consist list starting with op. consist #1
Note: This is a variable size array, only opCstCnt array elements
are present */
UINT8 reserved04; /**< reserved for future use (= 0) */
UINT8 reserved05; /**< reserved for future use (= 0) */
UINT8 reserved06; /**< reserved for future use (= 0) */
UINT8 opVehCnt;
/**< number of vehicles in train (1..63) */
TRDP_OP_VEHICLE_T opVehList[TRDP_MAX_VEH_CNT]; /**< operational vehicle list starting with op. vehicle #1
Note: This is a variable size array, only opCstCnt array elements
are present */
UINT32 opTrnTopoCnt; /**< operational train topology counter
computed as defined in 5.3.3.2.16 (seed value : trnTopoCnt) */
} GNU_PACKED TRDP_OP_TRAIN_DIR_T;
The data upto the opCstList is stored properly. The storing of the fields after that (opVehList, vehicle count and opTrnTopoCount) is incorrect.
If ticket is approved, the proposal is to do the changes as per the attached diff comparison.
Hi Chirag, before accepting this I would like to have a closer look at this (earliest next week)!
Chirag, you are right, but the proposed change would not store the opVehCnt. I changed that in the trunk - please have a look.
Bernd, just one minor correction in your commit to trunk is required, i think.
Instead of:
memcpy(&appHandle->pTTDB->opTrnDir.opCstList, pData, size);
Won't it be:
memcpy(&appHandle->pTTDB->opTrnDir, pData, size);
Because we are also copying the first 8 bytes upto the consist list from pData.
Chirag, unfortunately not enough :-(( The opTrnTopoCnt is still missing. I'll fix that, too.
Hello Bernd, based on your commit [r1869] please consider some more suggestions/corrections from my side as attached in More_Changes_TTI.diff. Also attached the complete file for reference.
Related
Commit: [r1869]
Attachments: