|
|
|
@ -1,25 +1,20 @@
|
|
|
|
|
#include "Subsystem.h"
|
|
|
|
|
#include "../health/HealthMessage.h"
|
|
|
|
|
#include "../objectmanager/ObjectManagerIF.h"
|
|
|
|
|
#include "../serialize/SerialArrayListAdapter.h"
|
|
|
|
|
#include "../serialize/SerialFixedArrayListAdapter.h"
|
|
|
|
|
#include "../serialize/SerializeElement.h"
|
|
|
|
|
#include "../serialize/SerialLinkedListAdapter.h"
|
|
|
|
|
#include "../subsystem/Subsystem.h"
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
Subsystem::Subsystem(object_id_t setObjectId, object_id_t parent,
|
|
|
|
|
uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables) :
|
|
|
|
|
SubsystemBase(setObjectId, parent, 0), isInTransition(false), childrenChangedHealth(
|
|
|
|
|
false), uptimeStartTable(0), currentTargetTable(), targetMode(
|
|
|
|
|
0), targetSubmode(SUBMODE_NONE), initialMode(0), currentSequenceIterator(), modeTables(
|
|
|
|
|
maxNumberOfTables), modeSequences(maxNumberOfSequences), IPCStore(
|
|
|
|
|
NULL)
|
|
|
|
|
#ifdef USE_MODESTORE
|
|
|
|
|
,modeStore(NULL)
|
|
|
|
|
#endif
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
SubsystemBase(setObjectId, parent, 0), isInTransition(false),
|
|
|
|
|
childrenChangedHealth(false), currentTargetTable(),
|
|
|
|
|
targetMode(0), targetSubmode(SUBMODE_NONE), initialMode(0),
|
|
|
|
|
currentSequenceIterator(), modeTables(maxNumberOfTables),
|
|
|
|
|
modeSequences(maxNumberOfSequences) {}
|
|
|
|
|
|
|
|
|
|
Subsystem::~Subsystem() {
|
|
|
|
|
//Auto-generated destructor stub
|
|
|
|
@ -151,7 +146,6 @@ HybridIterator<ModeListEntry> Subsystem::getTable(Mode_t id) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ReturnValue_t Subsystem::handleCommandMessage(CommandMessage *message) {
|
|
|
|
|
ReturnValue_t result;
|
|
|
|
|
switch (message->getCommand()) {
|
|
|
|
|
case HealthMessage::HEALTH_INFO: {
|
|
|
|
|
HealthState health = HealthMessage::getHealth(message);
|
|
|
|
@ -166,7 +160,7 @@ ReturnValue_t Subsystem::handleCommandMessage(CommandMessage *message) {
|
|
|
|
|
FixedArrayList<ModeListEntry, MAX_LENGTH_OF_TABLE_OR_SEQUENCE> sequence;
|
|
|
|
|
const uint8_t *pointer;
|
|
|
|
|
size_t sizeRead;
|
|
|
|
|
result = IPCStore->getData(
|
|
|
|
|
ReturnValue_t result = IPCStore->getData(
|
|
|
|
|
ModeSequenceMessage::getStoreAddress(message), &pointer,
|
|
|
|
|
&sizeRead);
|
|
|
|
|
if (result == RETURN_OK) {
|
|
|
|
@ -193,7 +187,7 @@ ReturnValue_t Subsystem::handleCommandMessage(CommandMessage *message) {
|
|
|
|
|
FixedArrayList<ModeListEntry, MAX_LENGTH_OF_TABLE_OR_SEQUENCE> table;
|
|
|
|
|
const uint8_t *pointer;
|
|
|
|
|
size_t sizeRead;
|
|
|
|
|
result = IPCStore->getData(
|
|
|
|
|
ReturnValue_t result = IPCStore->getData(
|
|
|
|
|
ModeSequenceMessage::getStoreAddress(message), &pointer,
|
|
|
|
|
&sizeRead);
|
|
|
|
|
if (result == RETURN_OK) {
|
|
|
|
@ -210,21 +204,23 @@ ReturnValue_t Subsystem::handleCommandMessage(CommandMessage *message) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case ModeSequenceMessage::DELETE_SEQUENCE:
|
|
|
|
|
case ModeSequenceMessage::DELETE_SEQUENCE:{
|
|
|
|
|
if (isInTransition) {
|
|
|
|
|
replyToCommand(IN_TRANSITION, 0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
result = deleteSequence(ModeSequenceMessage::getSequenceId(message));
|
|
|
|
|
ReturnValue_t result = deleteSequence(ModeSequenceMessage::getSequenceId(message));
|
|
|
|
|
replyToCommand(result, 0);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case ModeSequenceMessage::DELETE_TABLE:
|
|
|
|
|
case ModeSequenceMessage::DELETE_TABLE:{
|
|
|
|
|
if (isInTransition) {
|
|
|
|
|
replyToCommand(IN_TRANSITION, 0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
result = deleteTable(ModeSequenceMessage::getTableId(message));
|
|
|
|
|
ReturnValue_t result = deleteTable(ModeSequenceMessage::getTableId(message));
|
|
|
|
|
replyToCommand(result, 0);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case ModeSequenceMessage::LIST_SEQUENCES: {
|
|
|
|
|
SerialFixedArrayListAdapter<Mode_t, MAX_NUMBER_OF_TABLES_OR_SEQUENCES> sequences;
|
|
|
|
|