Merge branch 'mueller_framework'
This commit is contained in:
commit
5582ca278b
@ -55,7 +55,8 @@ void Clcw::setBitLock(bool bitLock) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Clcw::print() {
|
void Clcw::print() {
|
||||||
debug << "Clcw::print: Clcw is: " << std::hex << getAsWhole() << std::dec << std::endl;
|
debug << "Clcw::print: Clcw is: " << std::hex << getAsWhole()
|
||||||
|
<< std::dec << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clcw::setWhole(uint32_t rawClcw) {
|
void Clcw::setWhole(uint32_t rawClcw) {
|
||||||
|
@ -42,7 +42,8 @@ private:
|
|||||||
/**
|
/**
|
||||||
* \brief This is the actual data pool itself.
|
* \brief This is the actual data pool itself.
|
||||||
* \details It is represented by a map
|
* \details It is represented by a map
|
||||||
* with the data pool id as index and a pointer to a single PoolEntry as value.
|
* with the data pool id as index and a pointer to a single
|
||||||
|
* PoolEntry as value.
|
||||||
*/
|
*/
|
||||||
std::map<uint32_t, PoolEntryIF*> data_pool;
|
std::map<uint32_t, PoolEntryIF*> data_pool;
|
||||||
public:
|
public:
|
||||||
|
@ -60,7 +60,8 @@ uint8_t PoolEntry<T>::getValid() {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
void PoolEntry<T>::print() {
|
void PoolEntry<T>::print() {
|
||||||
for (uint8_t size = 0; size < this->length; size++ ) {
|
for (uint8_t size = 0; size < this->length; size++ ) {
|
||||||
debug << "| " << std::hex << (double)this->address[size] << (this->valid? " (valid) " : " (invalid) ");
|
debug << "| " << std::hex << (double)this->address[size]
|
||||||
|
<< (this->valid? " (valid) " : " (invalid) ");
|
||||||
}
|
}
|
||||||
debug << std::dec << std::endl;
|
debug << std::dec << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -89,8 +89,7 @@ void HealthHelper::handleSetHealthCommand(CommandMessage* message) {
|
|||||||
}
|
}
|
||||||
if (MessageQueueSenderIF::sendMessage(message->getSender(), &reply,
|
if (MessageQueueSenderIF::sendMessage(message->getSender(), &reply,
|
||||||
owner->getCommandQueue()) != HasReturnvaluesIF::RETURN_OK) {
|
owner->getCommandQueue()) != HasReturnvaluesIF::RETURN_OK) {
|
||||||
debug
|
debug << "HealthHelper::handleHealthCommand: sending health "
|
||||||
<< "HealthHelper::handleHealthCommand: sending health reply failed."
|
"reply failed." << std::endl;
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,26 +21,68 @@ BinarySemaphore::~BinarySemaphore() {
|
|||||||
vSemaphoreDelete(handle);
|
vSemaphoreDelete(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This copy ctor is important as it prevents the assignment to a ressource
|
||||||
|
// (other.handle) variable which is later deleted!
|
||||||
|
BinarySemaphore::BinarySemaphore(const BinarySemaphore& other) {
|
||||||
|
xSemaphoreCreateBinary(handle);
|
||||||
|
if(handle == nullptr) {
|
||||||
|
error << "Binary semaphore creation failure" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BinarySemaphore& BinarySemaphore::operator =(const BinarySemaphore& s) {
|
||||||
|
if(this != &s) {
|
||||||
|
xSemaphoreCreateBinary(handle);
|
||||||
|
if(handle == nullptr) {
|
||||||
|
error << "Binary semaphore creation failure" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
BinarySemaphore::BinarySemaphore(BinarySemaphore&& s) {
|
||||||
|
xSemaphoreCreateBinary(handle);
|
||||||
|
if(handle == nullptr) {
|
||||||
|
error << "Binary semaphore creation failure" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BinarySemaphore& BinarySemaphore::operator =(
|
||||||
|
BinarySemaphore&& s) {
|
||||||
|
if(&s != this) {
|
||||||
|
xSemaphoreCreateBinary(handle);
|
||||||
|
if(handle == nullptr) {
|
||||||
|
error << "Binary semaphore creation failure" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t BinarySemaphore::takeBinarySemaphore(uint32_t timeoutMs) {
|
ReturnValue_t BinarySemaphore::takeBinarySemaphore(uint32_t timeoutMs) {
|
||||||
if(handle == nullptr) {
|
if(handle == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return SEMAPHORE_NULLPOINTER;
|
||||||
}
|
}
|
||||||
TickType_t timeout = portMAX_DELAY;
|
TickType_t timeout = BinarySemaphore::NO_BLOCK_TICKS;
|
||||||
if(timeoutMs != 0) {
|
if(timeoutMs == BinarySemaphore::BLOCK_TIMEOUT) {
|
||||||
timeout = pdMS_TO_TICKS(timeoutMs);
|
timeout = BinarySemaphore::BLOCK_TIMEOUT_TICKS;
|
||||||
|
}
|
||||||
|
else if(timeoutMs > BinarySemaphore::NO_BLOCK_TIMEOUT){
|
||||||
|
timeout = pdMS_TO_TICKS(timeoutMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseType_t returncode = xSemaphoreTake(handle, timeout);
|
BaseType_t returncode = xSemaphoreTake(handle, timeout);
|
||||||
if (returncode == pdPASS) {
|
if (returncode == pdPASS) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
} else {
|
}
|
||||||
return SEMAPHORE_NOT_FOUND;
|
else {
|
||||||
|
return SEMAPHORE_TIMEOUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t BinarySemaphore::takeBinarySemaphoreTickTimeout(TickType_t timeoutTicks) {
|
ReturnValue_t BinarySemaphore::takeBinarySemaphoreTickTimeout(
|
||||||
|
TickType_t timeoutTicks) {
|
||||||
if(handle == nullptr) {
|
if(handle == nullptr) {
|
||||||
return SEMAPHORE_NOT_FOUND;
|
return SEMAPHORE_NULLPOINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseType_t returncode = xSemaphoreTake(handle, timeoutTicks);
|
BaseType_t returncode = xSemaphoreTake(handle, timeoutTicks);
|
||||||
@ -53,7 +95,7 @@ ReturnValue_t BinarySemaphore::takeBinarySemaphoreTickTimeout(TickType_t timeout
|
|||||||
|
|
||||||
ReturnValue_t BinarySemaphore::giveBinarySemaphore() {
|
ReturnValue_t BinarySemaphore::giveBinarySemaphore() {
|
||||||
if (handle == nullptr) {
|
if (handle == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return SEMAPHORE_NULLPOINTER;
|
||||||
}
|
}
|
||||||
BaseType_t returncode = xSemaphoreGive(handle);
|
BaseType_t returncode = xSemaphoreGive(handle);
|
||||||
if (returncode == pdPASS) {
|
if (returncode == pdPASS) {
|
||||||
@ -69,7 +111,7 @@ SemaphoreHandle_t BinarySemaphore::getSemaphore() {
|
|||||||
|
|
||||||
ReturnValue_t BinarySemaphore::giveBinarySemaphore(SemaphoreHandle_t semaphore) {
|
ReturnValue_t BinarySemaphore::giveBinarySemaphore(SemaphoreHandle_t semaphore) {
|
||||||
if (semaphore == nullptr) {
|
if (semaphore == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return SEMAPHORE_NULLPOINTER;
|
||||||
}
|
}
|
||||||
BaseType_t returncode = xSemaphoreGive(semaphore);
|
BaseType_t returncode = xSemaphoreGive(semaphore);
|
||||||
if (returncode == pdPASS) {
|
if (returncode == pdPASS) {
|
||||||
@ -86,11 +128,12 @@ void BinarySemaphore::resetSemaphore() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Be careful with the stack size here. This is called from an ISR!
|
// Be careful with the stack size here. This is called from an ISR!
|
||||||
ReturnValue_t BinarySemaphore::giveBinarySemaphoreFromISR(SemaphoreHandle_t semaphore,
|
ReturnValue_t BinarySemaphore::giveBinarySemaphoreFromISR(SemaphoreHandle_t semaphore,
|
||||||
BaseType_t * higherPriorityTaskWoken) {
|
BaseType_t * higherPriorityTaskWoken) {
|
||||||
if (semaphore == nullptr) {
|
if (semaphore == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return SEMAPHORE_NULLPOINTER;
|
||||||
}
|
}
|
||||||
BaseType_t returncode = xSemaphoreGiveFromISR(semaphore, higherPriorityTaskWoken);
|
BaseType_t returncode = xSemaphoreGiveFromISR(semaphore, higherPriorityTaskWoken);
|
||||||
if (returncode == pdPASS) {
|
if (returncode == pdPASS) {
|
||||||
@ -99,11 +142,10 @@ ReturnValue_t BinarySemaphore::giveBinarySemaphoreFromISR(SemaphoreHandle_t sema
|
|||||||
// TODO: I don't know if this will ever happen but if it does,
|
// TODO: I don't know if this will ever happen but if it does,
|
||||||
// I want to to know in case this causes issues. If it doesn't
|
// I want to to know in case this causes issues. If it doesn't
|
||||||
// we should remove this.
|
// we should remove this.
|
||||||
TRACE_INFO("Binary Semaphore: Higher priority task unblocked!");
|
|
||||||
TaskManagement::requestContextSwitch(CallContext::isr);
|
TaskManagement::requestContextSwitch(CallContext::isr);
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
} else {
|
} else {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return SEMAPHORE_NOT_OWNED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,22 +20,51 @@ class BinarySemaphore: public HasReturnvaluesIF {
|
|||||||
public:
|
public:
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::SEMAPHORE_IF;
|
static const uint8_t INTERFACE_ID = CLASS_ID::SEMAPHORE_IF;
|
||||||
|
|
||||||
/** Semaphore object not found */
|
//! No block time, poll the semaphore. Can also be used as tick type.
|
||||||
static const ReturnValue_t SEMAPHORE_NOT_FOUND = MAKE_RETURN_CODE(1);
|
//! Can be passed as tick type and ms value.
|
||||||
/** Semaphore timeout */
|
static constexpr uint32_t NO_BLOCK_TIMEOUT = 0;
|
||||||
static const ReturnValue_t SEMAPHORE_TIMEOUT = MAKE_RETURN_CODE(2);
|
static constexpr TickType_t NO_BLOCK_TICKS = 0;
|
||||||
|
//! No block time, poll the semaphore.
|
||||||
|
//! Can be passed as tick type and ms value.
|
||||||
|
static constexpr TickType_t BLOCK_TIMEOUT_TICKS = portMAX_DELAY;
|
||||||
|
static constexpr uint32_t BLOCK_TIMEOUT = portMAX_DELAY;
|
||||||
|
|
||||||
|
//! Semaphore timeout
|
||||||
|
static constexpr ReturnValue_t SEMAPHORE_TIMEOUT = MAKE_RETURN_CODE(1);
|
||||||
/** The current semaphore can not be given, because it is not owned */
|
/** The current semaphore can not be given, because it is not owned */
|
||||||
static const ReturnValue_t SEMAPHORE_NOT_OWNED = MAKE_RETURN_CODE(3);
|
static constexpr ReturnValue_t SEMAPHORE_NOT_OWNED = MAKE_RETURN_CODE(2);
|
||||||
|
static constexpr ReturnValue_t SEMAPHORE_NULLPOINTER = MAKE_RETURN_CODE(3);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a binary semaphore
|
* Create a binary semaphore
|
||||||
*/
|
*/
|
||||||
BinarySemaphore();
|
BinarySemaphore();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy ctor
|
||||||
|
* @param
|
||||||
|
*/
|
||||||
|
BinarySemaphore(const BinarySemaphore&);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy assignment
|
||||||
|
*/
|
||||||
|
BinarySemaphore& operator=(const BinarySemaphore&);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move constructor
|
||||||
|
*/
|
||||||
|
BinarySemaphore (BinarySemaphore &&);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move assignment
|
||||||
|
*/
|
||||||
|
BinarySemaphore & operator=(BinarySemaphore &&);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the binary semaphore to prevent a memory leak
|
* Delete the binary semaphore to prevent a memory leak
|
||||||
*/
|
*/
|
||||||
~BinarySemaphore();
|
virtual ~BinarySemaphore();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Take the binary semaphore.
|
* Take the binary semaphore.
|
||||||
@ -46,7 +75,8 @@ public:
|
|||||||
* @return -@c RETURN_OK on success
|
* @return -@c RETURN_OK on success
|
||||||
* -@c RETURN_FAILED on failure
|
* -@c RETURN_FAILED on failure
|
||||||
*/
|
*/
|
||||||
ReturnValue_t takeBinarySemaphore(uint32_t timeoutMs);
|
ReturnValue_t takeBinarySemaphore(uint32_t timeoutMs =
|
||||||
|
BinarySemaphore::NO_BLOCK_TIMEOUT);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as lockBinarySemaphore() with timeout in FreeRTOS ticks.
|
* Same as lockBinarySemaphore() with timeout in FreeRTOS ticks.
|
||||||
@ -54,7 +84,8 @@ public:
|
|||||||
* @return -@c RETURN_OK on success
|
* @return -@c RETURN_OK on success
|
||||||
* -@c RETURN_FAILED on failure
|
* -@c RETURN_FAILED on failure
|
||||||
*/
|
*/
|
||||||
ReturnValue_t takeBinarySemaphoreTickTimeout(TickType_t timeoutTicks);
|
ReturnValue_t takeBinarySemaphoreTickTimeout(TickType_t timeoutTicks =
|
||||||
|
BinarySemaphore::NO_BLOCK_TICKS);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Give back the binary semaphore
|
* Give back the binary semaphore
|
||||||
@ -96,8 +127,4 @@ private:
|
|||||||
SemaphoreHandle_t handle;
|
SemaphoreHandle_t handle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* FRAMEWORK_OSAL_FREERTOS_BINARYSEMPAHORE_H_ */
|
#endif /* FRAMEWORK_OSAL_FREERTOS_BINARYSEMPAHORE_H_ */
|
||||||
|
@ -5,19 +5,19 @@
|
|||||||
template<typename count_t>
|
template<typename count_t>
|
||||||
SerialBufferAdapter<count_t>::SerialBufferAdapter(const void* buffer,
|
SerialBufferAdapter<count_t>::SerialBufferAdapter(const void* buffer,
|
||||||
count_t bufferLength, bool serializeLength) :
|
count_t bufferLength, bool serializeLength) :
|
||||||
m_serialize_length(serializeLength),
|
serializeLength(serializeLength),
|
||||||
m_const_buffer(static_cast<const uint8_t *>(buffer)), m_buffer(nullptr),
|
constBuffer(static_cast<const uint8_t *>(buffer)), m_buffer(nullptr),
|
||||||
m_buffer_length(bufferLength) {
|
bufferLength(bufferLength) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename count_t>
|
template<typename count_t>
|
||||||
SerialBufferAdapter<count_t>::SerialBufferAdapter(void* buffer, count_t bufferLength,
|
SerialBufferAdapter<count_t>::SerialBufferAdapter(void* buffer, count_t bufferLength,
|
||||||
bool serializeLength) :
|
bool serializeLength) :
|
||||||
m_serialize_length(serializeLength), m_buffer_length(bufferLength) {
|
serializeLength(serializeLength), bufferLength(bufferLength) {
|
||||||
uint8_t * member_buffer = static_cast<uint8_t *>(buffer);
|
uint8_t * member_buffer = static_cast<uint8_t *>(buffer);
|
||||||
m_buffer = member_buffer;
|
m_buffer = member_buffer;
|
||||||
m_const_buffer = member_buffer;
|
constBuffer = member_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -28,37 +28,37 @@ SerialBufferAdapter<count_t>::~SerialBufferAdapter() {
|
|||||||
template<typename count_t>
|
template<typename count_t>
|
||||||
ReturnValue_t SerialBufferAdapter<count_t>::serialize(uint8_t** buffer, size_t* size,
|
ReturnValue_t SerialBufferAdapter<count_t>::serialize(uint8_t** buffer, size_t* size,
|
||||||
const size_t max_size, bool bigEndian) const {
|
const size_t max_size, bool bigEndian) const {
|
||||||
uint32_t serializedLength = m_buffer_length;
|
uint32_t serializedLength = bufferLength;
|
||||||
if (m_serialize_length) {
|
if (serializeLength) {
|
||||||
serializedLength += AutoSerializeAdapter::getSerializedSize(
|
serializedLength += AutoSerializeAdapter::getSerializedSize(
|
||||||
&m_buffer_length);
|
&bufferLength);
|
||||||
}
|
}
|
||||||
if (*size + serializedLength > max_size) {
|
if (*size + serializedLength > max_size) {
|
||||||
return BUFFER_TOO_SHORT;
|
return BUFFER_TOO_SHORT;
|
||||||
} else {
|
} else {
|
||||||
if (m_serialize_length) {
|
if (serializeLength) {
|
||||||
AutoSerializeAdapter::serialize(&m_buffer_length, buffer, size,
|
AutoSerializeAdapter::serialize(&bufferLength, buffer, size,
|
||||||
max_size, bigEndian);
|
max_size, bigEndian);
|
||||||
}
|
}
|
||||||
if (m_const_buffer != nullptr) {
|
if (constBuffer != nullptr) {
|
||||||
memcpy(*buffer, m_const_buffer, m_buffer_length);
|
memcpy(*buffer, constBuffer, bufferLength);
|
||||||
} else if (m_buffer != nullptr) {
|
} else if (m_buffer != nullptr) {
|
||||||
memcpy(*buffer, m_buffer, m_buffer_length);
|
memcpy(*buffer, m_buffer, bufferLength);
|
||||||
} else {
|
} else {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
*size += m_buffer_length;
|
*size += bufferLength;
|
||||||
(*buffer) += m_buffer_length;
|
(*buffer) += bufferLength;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename count_t>
|
template<typename count_t>
|
||||||
size_t SerialBufferAdapter<count_t>::getSerializedSize() const {
|
size_t SerialBufferAdapter<count_t>::getSerializedSize() const {
|
||||||
if (m_serialize_length) {
|
if (serializeLength) {
|
||||||
return m_buffer_length + AutoSerializeAdapter::getSerializedSize(&m_buffer_length);
|
return bufferLength + AutoSerializeAdapter::getSerializedSize(&bufferLength);
|
||||||
} else {
|
} else {
|
||||||
return m_buffer_length;
|
return bufferLength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
template<typename count_t>
|
template<typename count_t>
|
||||||
@ -66,15 +66,15 @@ ReturnValue_t SerialBufferAdapter<count_t>::deSerialize(const uint8_t** buffer,
|
|||||||
ssize_t* size, bool bigEndian) {
|
ssize_t* size, bool bigEndian) {
|
||||||
//TODO Ignores Endian flag!
|
//TODO Ignores Endian flag!
|
||||||
if (buffer != NULL) {
|
if (buffer != NULL) {
|
||||||
if(m_serialize_length){
|
if(serializeLength){
|
||||||
// Suggestion (would require removing rest of the block inside this if clause !):
|
// Suggestion (would require removing rest of the block inside this if clause !):
|
||||||
//ReturnValue_t result = AutoSerializeAdapter::deSerialize(&bufferLength,buffer,size,bigEndian);
|
//ReturnValue_t result = AutoSerializeAdapter::deSerialize(&bufferLength,buffer,size,bigEndian);
|
||||||
//if (result != HasReturnvaluesIF::RETURN_OK) {
|
//if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
// return result;
|
// return result;
|
||||||
//}
|
//}
|
||||||
count_t serializedSize = AutoSerializeAdapter::getSerializedSize(
|
count_t serializedSize = AutoSerializeAdapter::getSerializedSize(
|
||||||
&m_buffer_length);
|
&bufferLength);
|
||||||
if((*size - m_buffer_length - serializedSize) >= 0){
|
if((*size - bufferLength - serializedSize) >= 0){
|
||||||
*buffer += serializedSize;
|
*buffer += serializedSize;
|
||||||
*size -= serializedSize;
|
*size -= serializedSize;
|
||||||
}else{
|
}else{
|
||||||
@ -82,10 +82,10 @@ ReturnValue_t SerialBufferAdapter<count_t>::deSerialize(const uint8_t** buffer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//No Else If, go on with buffer
|
//No Else If, go on with buffer
|
||||||
if (*size - m_buffer_length >= 0) {
|
if (*size - bufferLength >= 0) {
|
||||||
*size -= m_buffer_length;
|
*size -= bufferLength;
|
||||||
memcpy(m_buffer, *buffer, m_buffer_length);
|
memcpy(m_buffer, *buffer, bufferLength);
|
||||||
(*buffer) += m_buffer_length;
|
(*buffer) += bufferLength;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
} else {
|
} else {
|
||||||
return STREAM_TOO_SHORT;
|
return STREAM_TOO_SHORT;
|
||||||
@ -106,17 +106,17 @@ uint8_t * SerialBufferAdapter<count_t>::getBuffer() {
|
|||||||
|
|
||||||
template<typename count_t>
|
template<typename count_t>
|
||||||
const uint8_t * SerialBufferAdapter<count_t>::getConstBuffer() {
|
const uint8_t * SerialBufferAdapter<count_t>::getConstBuffer() {
|
||||||
if(m_const_buffer == nullptr) {
|
if(constBuffer == nullptr) {
|
||||||
error << "Wrong access function for stored type ! Use getBuffer()" << std::endl;
|
error << "Wrong access function for stored type ! Use getBuffer()" << std::endl;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return m_const_buffer;
|
return constBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename count_t>
|
template<typename count_t>
|
||||||
void SerialBufferAdapter<count_t>::setBuffer(void * buffer, count_t buffer_length) {
|
void SerialBufferAdapter<count_t>::setBuffer(void * buffer, count_t buffer_length) {
|
||||||
m_buffer = static_cast<uint8_t *>(buffer);
|
m_buffer = static_cast<uint8_t *>(buffer);
|
||||||
m_buffer_length = buffer_length;
|
bufferLength = buffer_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,10 +52,10 @@ public:
|
|||||||
const uint8_t * getConstBuffer();
|
const uint8_t * getConstBuffer();
|
||||||
void setBuffer(void* buffer_, count_t bufferLength_);
|
void setBuffer(void* buffer_, count_t bufferLength_);
|
||||||
private:
|
private:
|
||||||
bool m_serialize_length = false;
|
bool serializeLength = false;
|
||||||
const uint8_t *m_const_buffer = nullptr;
|
const uint8_t *constBuffer = nullptr;
|
||||||
uint8_t *m_buffer = nullptr;
|
uint8_t *m_buffer = nullptr;
|
||||||
count_t m_buffer_length = 0;
|
count_t bufferLength = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
//Unfortunately, there must be a forward declaration of log_fe (MUST be defined in main), to let the system know where to write to.
|
//Unfortunately, there must be a forward declaration of log_fe
|
||||||
|
// (MUST be defined in main), to let the system know where to write to.
|
||||||
extern std::ostream debug;
|
extern std::ostream debug;
|
||||||
extern std::ostream info;
|
extern std::ostream info;
|
||||||
extern std::ostream warning;
|
extern std::ostream warning;
|
||||||
|
@ -196,7 +196,8 @@ ReturnValue_t CCSDSTime::convertFromASCII(Clock::TimeOfDay_t* to, const uint8_t*
|
|||||||
to->usecond = (second - floor(second)) * 1000000;
|
to->usecond = (second - floor(second)) * 1000000;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
// Warning: Compiler/Linker fails ambiguously if library does not implement C99 I/O
|
// Warning: Compiler/Linker fails ambiguously if library does not implement
|
||||||
|
// C99 I/O
|
||||||
#else
|
#else
|
||||||
uint16_t year;
|
uint16_t year;
|
||||||
uint8_t month;
|
uint8_t month;
|
||||||
|
Loading…
Reference in New Issue
Block a user