pnp-software / cordetfw-pus

PUS Extension of the CORDET Framework
Mozilla Public License 2.0
2 stars 1 forks source link

Name of Getter/Setter Functions for Parameters in Derived Packets #13

Open pasetti opened 1 year ago

pasetti commented 1 year ago

Consider the function to get parameter 'Par' from the 'InfoRep' packet (formerly called 'Rep1') with discriminant EVT_DUMMY_1. In the past, its getter function had the following structure:

/**
 * Get "Par" from "Rep1_EVT_DUMMY_1" packet.
 * @param p Pointer to the packet.
 * @return Value of "Par".
 */
static inline CrPsEightBit_t getEvtRep1_EVT_DUMMY_1Par(void* p) {
   Rep1_EVT_DUMMY_1_t* t;
   t = (Rep1_EVT_DUMMY_1_t*)p;
   return t->Par;
}

Now instead it looks like this:

/**
 * Getter function for parameter Par in packet InfoRep_Dummy1
 * @param p Pointer to the packet
 * @return Value of parameter InfoRep_Dummy1
 */
static inline CrPsEightBit_t getEvtInfoRep_Dummy1Par(void* p) {
    InfoRep_Dummy1_t* t;
     t = (InfoRep_Dummy1_t*)p;
    return __builtin_bswap16(t->Par);
}

What has happened is that now we build the name of the getter function using the name of the packet ('InfoRep_Dummy1') rather than the name of the packet's distriminant ('EVT_DUMMY_1'). I think that the new format is preferable but its use will require some changes to the test suite.