updating code from Flying Laptop
This is the framework of Flying Laptop OBSW version A.13.0.
This commit is contained in:
@ -1,10 +1,3 @@
|
||||
/*
|
||||
* HasParametersIF.h
|
||||
*
|
||||
* Created on: 26.11.2015
|
||||
* Author: mohr
|
||||
*/
|
||||
|
||||
#ifndef HASPARAMETERSIF_H_
|
||||
#define HASPARAMETERSIF_H_
|
||||
|
||||
@ -16,26 +9,28 @@ typedef uint32_t ParameterId_t;
|
||||
|
||||
class HasParametersIF {
|
||||
public:
|
||||
static const uint8_t INTERFACE_ID = HAS_PARAMETERS_IF;
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::HAS_PARAMETERS_IF;
|
||||
static const ReturnValue_t INVALID_MATRIX_ID = MAKE_RETURN_CODE(0x01);
|
||||
static const ReturnValue_t INVALID_DOMAIN_ID = MAKE_RETURN_CODE(0x02);
|
||||
static const ReturnValue_t INVALID_VALUE = MAKE_RETURN_CODE(0x03);
|
||||
static const ReturnValue_t READ_ONLY = MAKE_RETURN_CODE(0x05);
|
||||
|
||||
|
||||
|
||||
|
||||
static uint8_t getDomain(ParameterId_t id){
|
||||
static uint8_t getDomain(ParameterId_t id) {
|
||||
return id >> 24;
|
||||
}
|
||||
|
||||
static uint16_t getMatrixId(ParameterId_t id){
|
||||
static uint16_t getMatrixId(ParameterId_t id) {
|
||||
return id >> 8;
|
||||
}
|
||||
|
||||
static uint8_t getIndex(ParameterId_t id){
|
||||
static uint8_t getIndex(ParameterId_t id) {
|
||||
return id;
|
||||
}
|
||||
|
||||
static uint32_t getFullParameterId(uint8_t domainId, uint16_t parameterId,
|
||||
uint8_t index) {
|
||||
return (domainId << 24) + (parameterId << 8) + index;
|
||||
}
|
||||
|
||||
virtual ~HasParametersIF() {
|
||||
}
|
||||
|
@ -1,10 +1,3 @@
|
||||
/*
|
||||
* ParameterHelper.cpp
|
||||
*
|
||||
* Created on: 28.11.2015
|
||||
* Author: mohr
|
||||
*/
|
||||
|
||||
#include <framework/objectmanager/ObjectManagerIF.h>
|
||||
#include <framework/parameters/ParameterHelper.h>
|
||||
#include <framework/parameters/ParameterMessage.h>
|
||||
@ -26,7 +19,7 @@ ReturnValue_t ParameterHelper::handleParameterMessage(CommandMessage *message) {
|
||||
ParameterMessage::getParameterId(message));
|
||||
uint16_t parameterId = HasParametersIF::getMatrixId(
|
||||
ParameterMessage::getParameterId(message));
|
||||
ReturnValue_t result = owner->getParameter(domain, parameterId,
|
||||
result = owner->getParameter(domain, parameterId,
|
||||
&description, &description, 0);
|
||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||
result = sendParameter(message->getSender(),
|
||||
@ -45,7 +38,7 @@ ReturnValue_t ParameterHelper::handleParameterMessage(CommandMessage *message) {
|
||||
|
||||
const uint8_t *storedStream;
|
||||
uint32_t storedStreamSize;
|
||||
ReturnValue_t result = storage->getData(
|
||||
result = storage->getData(
|
||||
ParameterMessage::getStoreId(message), &storedStream,
|
||||
&storedStreamSize);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
@ -115,8 +108,7 @@ ReturnValue_t ParameterHelper::sendParameter(MessageQueueId_t to, uint32_t id,
|
||||
|
||||
ParameterMessage::setParameterDumpReply(&reply, id, address);
|
||||
|
||||
MessageQueueSender sender;
|
||||
sender.sendMessage(to, &reply, ownerQueueId);
|
||||
MessageQueueSenderIF::sendMessage(to, &reply, ownerQueueId);
|
||||
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
@ -133,6 +125,5 @@ ReturnValue_t ParameterHelper::initialize() {
|
||||
void ParameterHelper::rejectCommand(MessageQueueId_t to, ReturnValue_t reason, Command_t initialCommand) {
|
||||
CommandMessage reply;
|
||||
reply.setReplyRejected(reason, initialCommand);
|
||||
MessageQueueSender sender;
|
||||
sender.sendMessage(to, &reply, ownerQueueId);
|
||||
MessageQueueSenderIF::sendMessage(to, &reply, ownerQueueId);
|
||||
}
|
||||
|
@ -1,10 +1,3 @@
|
||||
/*
|
||||
* ParameterHelper.h
|
||||
*
|
||||
* Created on: 28.11.2015
|
||||
* Author: mohr
|
||||
*/
|
||||
|
||||
#ifndef PARAMETERHELPER_H_
|
||||
#define PARAMETERHELPER_H_
|
||||
|
||||
|
@ -1,11 +1,5 @@
|
||||
/*
|
||||
* ParameterMessage.cpp
|
||||
*
|
||||
* Created on: 28.11.2015
|
||||
* Author: mohr
|
||||
*/
|
||||
|
||||
#include <framework/parameters/ParameterMessage.h>
|
||||
#include <framework/objectmanager/ObjectManagerIF.h>
|
||||
|
||||
ParameterId_t ParameterMessage::getParameterId(const CommandMessage* message) {
|
||||
return message->getParameter();
|
||||
@ -36,3 +30,19 @@ void ParameterMessage::setParameterLoadCommand(CommandMessage* message,
|
||||
message->setParameter(id);
|
||||
message->setParameter2(storageID.raw);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,3 @@
|
||||
/*
|
||||
* ParameterMessage.h
|
||||
*
|
||||
* Created on: 28.11.2015
|
||||
* Author: mohr
|
||||
*/
|
||||
|
||||
#ifndef PARAMETERMESSAGE_H_
|
||||
#define PARAMETERMESSAGE_H_
|
||||
|
||||
@ -16,7 +9,7 @@ class ParameterMessage {
|
||||
private:
|
||||
ParameterMessage();
|
||||
public:
|
||||
static const uint8_t MESSAGE_ID = PARAMETER_MESSAGE_ID;
|
||||
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::PARAMETER;
|
||||
static const Command_t CMD_PARAMETER_LOAD = MAKE_COMMAND_ID( 0x01 );
|
||||
static const Command_t CMD_PARAMETER_DUMP = MAKE_COMMAND_ID( 0x02 );
|
||||
static const Command_t REPLY_PARAMETER_DUMP = MAKE_COMMAND_ID( 0x03 );
|
||||
@ -29,6 +22,7 @@ public:
|
||||
ParameterId_t id, store_address_t storageID);
|
||||
static void setParameterLoadCommand(CommandMessage* message,
|
||||
ParameterId_t id, store_address_t storageID);
|
||||
static void clear(CommandMessage* message);
|
||||
|
||||
};
|
||||
|
||||
|
@ -114,7 +114,7 @@ ReturnValue_t ParameterWrapper::deSerializeData(uint8_t startingRow,
|
||||
const uint8_t *fromAsStream = (const uint8_t *) from;
|
||||
int32_t streamSize = fromRows * fromColumns * sizeof(T);
|
||||
|
||||
ReturnValue_t result;
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
|
||||
for (uint8_t fromRow = 0; fromRow < fromRows; fromRow++) {
|
||||
|
||||
@ -219,7 +219,7 @@ ReturnValue_t ParameterWrapper::copyFrom(const ParameterWrapper* from,
|
||||
|
||||
uint8_t typeSize = type.getSize();
|
||||
|
||||
ReturnValue_t result;
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
|
||||
//copy data
|
||||
if (from->pointsToStream) {
|
||||
switch (type) {
|
||||
@ -271,5 +271,5 @@ ReturnValue_t ParameterWrapper::copyFrom(const ParameterWrapper* from,
|
||||
}
|
||||
}
|
||||
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
return result;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef PARAMETERWRAPPER_H_
|
||||
#define PARAMETERWRAPPER_H_
|
||||
|
||||
#include <framework/globalfunctions/Type.h>
|
||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
||||
#include <framework/serialize/SerializeAdapter.h>
|
||||
#include <framework/serialize/SerializeIF.h>
|
||||
@ -9,8 +8,9 @@
|
||||
#include <framework/globalfunctions/Type.h>
|
||||
|
||||
class ParameterWrapper: public SerializeIF {
|
||||
friend class DataPoolParameterWrapper;
|
||||
public:
|
||||
static const uint8_t INTERFACE_ID = PARAMETER_WRAPPER;
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::PARAMETER_WRAPPER;
|
||||
static const ReturnValue_t UNKNOW_DATATYPE = MAKE_RETURN_CODE(0x01);
|
||||
static const ReturnValue_t DATATYPE_MISSMATCH = MAKE_RETURN_CODE(0x02);
|
||||
static const ReturnValue_t READONLY = MAKE_RETURN_CODE(0x03);
|
||||
@ -46,7 +46,7 @@ public:
|
||||
return DATATYPE_MISSMATCH;
|
||||
}
|
||||
|
||||
if ((row > rows) || (column > columns)) {
|
||||
if ((row >= rows) || (column >= columns)) {
|
||||
return OUT_OF_BOUNDS;
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ public:
|
||||
|
||||
template<typename T>
|
||||
void setVector(T& member) {
|
||||
this->set(member, 1, sizeof(member)/sizeof(member[0]));
|
||||
this->set(member, sizeof(member)/sizeof(member[0]), 1);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
@ -2,12 +2,13 @@
|
||||
#define RECEIVESPARAMETERMESSAGESIF_H_
|
||||
|
||||
|
||||
#include <framework/ipc/MessageQueue.h>
|
||||
#include <framework/parameters/HasParametersIF.h>
|
||||
#include <framework/ipc/MessageQueueSenderIF.h>
|
||||
|
||||
class ReceivesParameterMessagesIF : public HasParametersIF {
|
||||
public:
|
||||
|
||||
static const uint8_t DOMAIN_ID_BASE = 0;
|
||||
virtual ~ReceivesParameterMessagesIF() {
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user