Skip to content
Snippets Groups Projects
Unverified Commit d6f44675 authored by Dimitrios Stoupis's avatar Dimitrios Stoupis
Browse files

Added octet and uint64 functions

parent 23e55912
No related branches found
No related tags found
No related merge requests found
......@@ -187,6 +187,16 @@ public:
return appendWord(value);
}
/**
* Adds an 8 byte unsigned integer to the end of the message
*
* PTC = 3, PFC = 16
*/
void appendUint64(uint64_t value) {
appendWord(static_cast<uint32_t >(value >> 32));
return appendWord(static_cast<uint32_t >(value));
}
/**
* Adds a 1 byte signed integer to the end of the message
*
......@@ -226,6 +236,20 @@ public:
return appendWord(reinterpret_cast<uint32_t &>(value));
}
/**
* Adds a N-byte string to the end of the message
*
*
* PTC = 7, PFC = 0
*/
void appendOctetString(uint16_t size, uint8_t *byteString) {
assert(size < ECSS_MAX_STRING_SIZE);
for (std::size_t i = 0; i < size; i++) {
appendByte(byteString[i]);
}
}
/**
* Fetches a single-byte boolean value from the current position in the message
*
......@@ -301,6 +325,15 @@ public:
return readWord();
}
/**
* Fetches an 8-byte unsigned integer from the current position in the message
*
* PTC = 3, PFC = 16
*/
uint64_t readUint64() {
return ((uint64_t)readWord() << 32) |(uint64_t)readWord();
}
/**
* Fetches an 1-byte signed integer from the current position in the message
*
......@@ -347,6 +380,20 @@ public:
return reinterpret_cast<float &>(value);
}
/**
* Fetches a N-byte string from the current position in the message
*
*
* PTC = 7, PFC = 0
*/
void readOctetString(uint8_t *byteString, uint16_t size) {
assert(size < ECSS_MAX_STRING_SIZE);
for (std::size_t i = 0; i < size; i++) {
byteString[i] = readByte();
}
}
/**
* Reset the message reading status, and start reading data from it again
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment