communication message continued.
Some fixed timeslot task improvements
This commit is contained in:
parent
dd4a5a45e3
commit
fb6172fdc5
@ -10,6 +10,8 @@
|
||||
CommunicationMessage::CommunicationMessage(): uninitialized(true) {
|
||||
}
|
||||
|
||||
CommunicationMessage::~CommunicationMessage() {}
|
||||
|
||||
void CommunicationMessage::setSendRequestFromPointer(uint32_t address,
|
||||
uint32_t dataLen, const uint8_t * data) {
|
||||
setMessageType(SEND_DATA_FROM_POINTER);
|
||||
@ -24,7 +26,10 @@ void CommunicationMessage::setSendRequestFromIpcStore(uint32_t address, store_ad
|
||||
setStoreId(storeId);
|
||||
}
|
||||
|
||||
void CommunicationMessage::setSendRequestRaw(uint32_t address) {
|
||||
void CommunicationMessage::setSendRequestRaw(uint32_t address, uint32_t length) {
|
||||
setMessageType(SEND_DATA_RAW);
|
||||
setAddress(address);
|
||||
setDataLen(length);
|
||||
}
|
||||
|
||||
void CommunicationMessage::setDataReplyFromIpcStore(uint32_t address, store_address_t storeId) {
|
||||
@ -34,6 +39,10 @@ void CommunicationMessage::setDataReplyFromIpcStore(uint32_t address, store_addr
|
||||
}
|
||||
void CommunicationMessage::setDataReplyFromPointer(uint32_t address,
|
||||
uint32_t dataLen, uint8_t *data) {
|
||||
setMessageType(REPLY_DATA_FROM_POINTER);
|
||||
setAddress(address);
|
||||
setDataLen(dataLen);
|
||||
setDataPointer(data);
|
||||
}
|
||||
|
||||
void CommunicationMessage::setDataReplyRaw(uint32_t address,
|
||||
@ -46,8 +55,6 @@ void CommunicationMessage::setDataReplyRaw(uint32_t address,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CommunicationMessage::setMessageType(messageType status) {
|
||||
uint8_t status_uint8 = status;
|
||||
memcpy(getData() + sizeof(uint32_t), &status_uint8, sizeof(status_uint8));
|
||||
@ -62,8 +69,8 @@ void CommunicationMessage::setReceiveBufferPosition(uint16_t bufferPosition) {
|
||||
&bufferPosition, sizeof(bufferPosition));
|
||||
}
|
||||
|
||||
void CommunicationMessage::setDataPointer(const uint8_t *sendData) {
|
||||
memcpy(getData() + 3 * sizeof(uint32_t), &sendData, sizeof(uint32_t));
|
||||
void CommunicationMessage::setDataPointer(const void * data) {
|
||||
memcpy(getData() + 3 * sizeof(uint32_t), &data, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
void CommunicationMessage::setStoreId(store_address_t storeId) {
|
||||
@ -74,31 +81,40 @@ void CommunicationMessage::setDataLen(uint32_t length) {
|
||||
memcpy(getData() + 2 * sizeof(uint32_t), &length, sizeof(length));
|
||||
}
|
||||
|
||||
void CommunicationMessage::setData(uint32_t data) {
|
||||
memcpy(getData() + 3 * sizeof(uint32_t), &data, sizeof(data));
|
||||
}
|
||||
|
||||
void CommunicationMessage::setDataByte1(uint8_t byte1) {
|
||||
memcpy(getData() + 3 * sizeof(uint32_t), &byte1, sizeof(byte1));
|
||||
}
|
||||
|
||||
void CommunicationMessage::setDataByte2(uint8_t byte2) {
|
||||
memcpy(getData() + 3 * sizeof(uint32_t) + sizeof(uint8_t), &byte2, sizeof(byte2));
|
||||
}
|
||||
|
||||
void CommunicationMessage::setDataByte3(uint8_t byte3) {
|
||||
memcpy(getData() + 3 * sizeof(uint32_t) + 2* sizeof(uint8_t), &byte3, sizeof(byte3));
|
||||
}
|
||||
|
||||
void CommunicationMessage::setDataByte4(uint8_t byte4) {
|
||||
memcpy(getData() + 3 * sizeof(uint32_t) + 3* sizeof(uint8_t), &byte4, sizeof(byte4));
|
||||
}
|
||||
|
||||
void CommunicationMessage::setDataUINT16_1(uint16_t data1) {
|
||||
memcpy(getData() + 3 * sizeof(uint32_t), &data1, sizeof(data1));
|
||||
}
|
||||
|
||||
void CommunicationMessage::setDataUINT16_2(uint16_t data2) {
|
||||
memcpy(getData() + 3 * sizeof(uint32_t) + sizeof(uint16_t), &data2, sizeof(data2));
|
||||
}
|
||||
|
||||
void CommunicationMessage::setData(uint32_t data) {
|
||||
CommunicationMessage::messageType CommunicationMessage::getMessageType() {
|
||||
messageType messageType;
|
||||
memcpy(&messageType, getData() + sizeof(uint32_t),sizeof(uint8_t));
|
||||
return messageType;
|
||||
}
|
||||
|
||||
CommunicationMessage::~CommunicationMessage() {
|
||||
void CommunicationMessage::clearCommunicationMessage() {
|
||||
messageType messageType = getMessageType();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -39,6 +39,7 @@ public:
|
||||
static const uint8_t COMMUNICATION_MESSAGE_SIZE = HEADER_SIZE + 4 * sizeof(uint32_t);
|
||||
|
||||
CommunicationMessage();
|
||||
virtual ~CommunicationMessage();
|
||||
|
||||
/**
|
||||
* Send requests with pointer to the data to be sent and send data length
|
||||
@ -64,7 +65,7 @@ public:
|
||||
* @param data Pointer to data to send
|
||||
*
|
||||
*/
|
||||
void setSendRequestRaw(uint32_t address);
|
||||
void setSendRequestRaw(uint32_t address, uint32_t length);
|
||||
|
||||
/**
|
||||
* Data message with data stored in IPC store
|
||||
@ -92,6 +93,22 @@ public:
|
||||
*/
|
||||
void setDataReplyRaw(uint32_t address, uint32_t length, uint16_t receiveBufferPosition = 0);
|
||||
|
||||
/**
|
||||
* First four bytes of message data
|
||||
* @param address
|
||||
*/
|
||||
void setAddress(uint32_t address);
|
||||
|
||||
/**
|
||||
* Message Type is stored as the fifth byte of the message data
|
||||
* @param status
|
||||
*/
|
||||
void setMessageType(messageType status);
|
||||
messageType getMessageType();
|
||||
|
||||
void setMessageId(uint8_t messageId);
|
||||
messageType getMessageId();
|
||||
|
||||
/*
|
||||
* The following functions can be used to
|
||||
* set the data field (4 bytes possible);
|
||||
@ -106,19 +123,6 @@ public:
|
||||
|
||||
void setData(uint32_t data);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Message Type is stored as the fifth byte of the message data
|
||||
* @param status
|
||||
*/
|
||||
void setMessageType(messageType status);
|
||||
|
||||
/**
|
||||
* First four bytes of message data
|
||||
* @param address
|
||||
*/
|
||||
void setAddress(uint32_t address);
|
||||
|
||||
/**
|
||||
* Stored in Bytes 13-16 of message data
|
||||
* @param length
|
||||
@ -129,19 +133,23 @@ private:
|
||||
* Stored in last four bytes (Bytes 17-20) of message data
|
||||
* @param sendData
|
||||
*/
|
||||
void setDataPointer(const uint8_t * sendData);
|
||||
void setDataPointer(const void * data);
|
||||
|
||||
/**
|
||||
* Buffer Position is stored as the seventh and eigth byte of
|
||||
* the message, so the receive buffer can't be larger than sizeof(uint16_t) for now
|
||||
* the message, so the receive buffer can't be larger than sizeof(uint16_t) for now.
|
||||
* @param bufferPosition
|
||||
*/
|
||||
void setReceiveBufferPosition(uint16_t bufferPosition);
|
||||
void setStoreId(store_address_t storeId);
|
||||
|
||||
virtual ~CommunicationMessage();
|
||||
/**
|
||||
* Clear the message
|
||||
*/
|
||||
void clearCommunicationMessage();
|
||||
private:
|
||||
|
||||
bool uninitialized;
|
||||
bool uninitialized; //!< Could be used to warn if data has not been set.
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_DEVICEHANDLERS_COMMUNICATIONMESSAGE_H_ */
|
||||
|
@ -33,6 +33,11 @@ class StorageManagerIF;
|
||||
* Contains all devices and the DeviceHandlerBase class.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Physical address type
|
||||
*/
|
||||
typedef uint32_t address_t;
|
||||
|
||||
/**
|
||||
* @brief This is the abstract base class for device handlers.
|
||||
* @details
|
||||
@ -91,7 +96,7 @@ public:
|
||||
* @param fdirInstance
|
||||
* @param cmdQueueSize
|
||||
*/
|
||||
DeviceHandlerBase(uint32_t logicalAddress, object_id_t setObjectId,
|
||||
DeviceHandlerBase(address_t logicalAddress, object_id_t setObjectId,
|
||||
uint32_t maxDeviceReplyLen, uint8_t setDeviceSwitch,
|
||||
object_id_t deviceCommunication,
|
||||
uint32_t thermalStatePoolId = PoolVariableIF::NO_PARAMETER,
|
||||
|
@ -104,7 +104,7 @@ protected:
|
||||
* \brief This list contains all OPUSPollingSlot objects, defining order and execution time of the
|
||||
* device handler objects.
|
||||
*
|
||||
* \details The slot list is a std:list object that contains all created OPUSPollingSlot instances.
|
||||
* @details The slot list is a std:list object that contains all created PollingSlot instances.
|
||||
* They are NOT ordered automatically, so by adding entries, the correct order needs to be ensured.
|
||||
* By iterating through this list the polling sequence is executed. Two entries with identical
|
||||
* polling times are executed immediately one after another.
|
||||
|
@ -58,6 +58,10 @@ ReturnValue_t FixedTimeslotTask::startTask() {
|
||||
ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId,
|
||||
uint32_t slotTimeMs, int8_t executionStep) {
|
||||
if (objectManager->get<ExecutableObjectIF>(componentId) != NULL) {
|
||||
if(slotTimeMs == 0) {
|
||||
// FreeRTOS throws errors for zero values
|
||||
slotTimeMs = 1;
|
||||
}
|
||||
pst.addSlot(componentId, slotTimeMs, executionStep, this);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user