2020-08-28 18:46:47 +02:00
|
|
|
#include "../parameters/ParameterMessage.h"
|
2020-08-13 20:53:35 +02:00
|
|
|
#include "../objectmanager/ObjectManagerIF.h"
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
ParameterId_t ParameterMessage::getParameterId(const CommandMessage* message) {
|
|
|
|
return message->getParameter();
|
|
|
|
}
|
|
|
|
|
|
|
|
store_address_t ParameterMessage::getStoreId(const CommandMessage* message) {
|
|
|
|
store_address_t address;
|
|
|
|
address.raw = message->getParameter2();
|
|
|
|
return address;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ParameterMessage::setParameterDumpCommand(CommandMessage* message,
|
|
|
|
ParameterId_t id) {
|
|
|
|
message->setCommand(CMD_PARAMETER_DUMP);
|
|
|
|
message->setParameter(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ParameterMessage::setParameterDumpReply(CommandMessage* message,
|
|
|
|
ParameterId_t id, store_address_t storageID) {
|
|
|
|
message->setCommand(REPLY_PARAMETER_DUMP);
|
|
|
|
message->setParameter(id);
|
|
|
|
message->setParameter2(storageID.raw);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ParameterMessage::setParameterLoadCommand(CommandMessage* message,
|
2020-10-29 17:57:27 +01:00
|
|
|
ParameterId_t id, store_address_t storeId, uint8_t ptc, uint8_t pfc,
|
|
|
|
uint8_t rows = 1, uint8_t columns = 1) {
|
2016-06-15 23:48:41 +02:00
|
|
|
message->setCommand(CMD_PARAMETER_LOAD);
|
|
|
|
message->setParameter(id);
|
2020-10-29 17:57:27 +01:00
|
|
|
message->setParameter2(storeId.raw);
|
|
|
|
uint32_t packedParameterSettings = (ptc << 24) | (pfc << 16) |
|
|
|
|
(rows << 8) | columns;
|
|
|
|
message->setParameter3(packedParameterSettings);
|
|
|
|
}
|
|
|
|
|
|
|
|
store_address_t ParameterMessage::getParameterLoadCommand(
|
|
|
|
const CommandMessage *message, ParameterId_t* parameterId, uint8_t *ptc,
|
|
|
|
uint8_t *pfc, uint8_t *rows, uint8_t *columns) {
|
2021-01-31 00:27:47 +01:00
|
|
|
*parameterId = message->getParameter();
|
2020-10-29 17:57:27 +01:00
|
|
|
uint32_t packedParamSettings = message->getParameter3();
|
|
|
|
*ptc = packedParamSettings >> 24 & 0xff;
|
|
|
|
*pfc = packedParamSettings >> 16 & 0xff;
|
|
|
|
*rows = packedParamSettings >> 8 & 0xff;
|
|
|
|
*columns = packedParamSettings & 0xff;
|
|
|
|
return message->getParameter2();
|
2016-06-15 23:48:41 +02:00
|
|
|
}
|
2018-07-12 16:29:32 +02:00
|
|
|
|
|
|
|
void ParameterMessage::clear(CommandMessage* message) {
|
|
|
|
switch (message->getCommand()) {
|
|
|
|
case CMD_PARAMETER_LOAD:
|
|
|
|
case REPLY_PARAMETER_DUMP: {
|
|
|
|
StorageManagerIF *ipcStore = objectManager->get<StorageManagerIF>(
|
|
|
|
objects::IPC_STORE);
|
|
|
|
if (ipcStore != NULL) {
|
|
|
|
ipcStore->deleteData(getStoreId(message));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|