Pool Raw Access Helper tested, appesrs to work. SerializeAdapter doc
changes, tm packet stored debug output if not enough storage available
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
/**
|
||||
* @brief This adapter provides an interface to use the SerializeIF functions
|
||||
* with arbitrary template objects to facilitate and simplify the serialization of classes
|
||||
* with different multiple different data types into buffers vice-versa.
|
||||
* with different multiple different data types into buffers and vice-versa.
|
||||
* @details
|
||||
* Examples:
|
||||
* A report class is converted into a TM buffer. The report class implements a serialize functions and calls
|
||||
@ -20,27 +20,31 @@
|
||||
*
|
||||
* The AutoSerializeAdapter functions can also be used as an alternative to memcpy
|
||||
* to retrieve data out of a buffer directly into a class variable with data type T while being able to specify endianness.
|
||||
* The boolean bigEndian specifies the endiness of the data to serialize or deSerialize.
|
||||
* The boolean bigEndian specifies whether an endian swap is performed on the data before
|
||||
* serialization or deserialization.
|
||||
*
|
||||
* If the target architecture is little endian (ARM), any data types created might
|
||||
* have the wrong endiness if they are to be used for the FSFW.
|
||||
* there are three ways to retrieve data out of a buffer to be used in the FSFW to use regular aligned (big endian) data.
|
||||
* There are three ways to retrieve data out of a buffer to be used in the FSFW
|
||||
* to use regular aligned (big endian) data.
|
||||
* This can also be applied to uint32_t and uint64_t:
|
||||
*
|
||||
* 1. Use the AutoSerializeAdapter::deSerialize function with bool bigEndian = true:
|
||||
* The pointer *buffer will be incremented automatically by the typeSize of data,
|
||||
* so this function can be called on &buffer without adjusting pointer position
|
||||
* 1. Use the AutoSerializeAdapter::deSerialize function
|
||||
* The pointer *buffer will be incremented automatically by the typeSize of the object,
|
||||
* so this function can be called on &buffer repeatedly without adjusting pointer position.
|
||||
* Set bigEndian parameter to true to perform endian swapping.
|
||||
*
|
||||
* uint16_t data;
|
||||
* int32_t dataLen = sizeof(data);
|
||||
* ReturnValue_t result = AutoSerializeAdapter::deSerialize(&data,&buffer,&dataLen,true);
|
||||
*
|
||||
* 2. Perform a bitshift operation:
|
||||
* 2. Perform a bitshift operation. Perform endian swapping if necessary:
|
||||
*
|
||||
* uint16_t data;
|
||||
* data = buffer[targetByte1] >> 8 | buffer[targetByte2];
|
||||
* data = buffer[targetByte1] << 8 | buffer[targetByte2];
|
||||
* data = EndianSwapper::swap(data);
|
||||
*
|
||||
* 3. Memcpy can be used when data is little-endian. Otherwise, endian-swapper has to be used.
|
||||
* 3. Memcpy can be used when data is little-endian. Perform endian-swapping if necessary.
|
||||
*
|
||||
* uint16_t data;
|
||||
* memcpy(&data,buffer + positionOfTargetByte1,sizeof(data));
|
||||
@ -79,7 +83,7 @@ public:
|
||||
/**
|
||||
* Deserialize buffer into object
|
||||
* @param object [out] Object to be deserialized with buffer data
|
||||
* @param buffer buffer containing the data
|
||||
* @param buffer buffer containing the data. Non-Const pointer to non-const pointer to const buffer.
|
||||
* @param size int32_t type to allow value to be values smaller than 0, needed for range/size checking
|
||||
* @param bigEndian Specify endianness
|
||||
* @return
|
||||
|
Reference in New Issue
Block a user