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 @@
|
||||
/*
|
||||
* ModeTable.h
|
||||
*
|
||||
* Created on: 12.07.2013
|
||||
* Author: tod
|
||||
*/
|
||||
|
||||
#ifndef MODEDEFINITIONS_H_
|
||||
#define MODEDEFINITIONS_H_
|
||||
|
||||
@ -15,13 +8,15 @@
|
||||
class ModeListEntry: public SerializeIF, public LinkedElement<ModeListEntry> {
|
||||
public:
|
||||
ModeListEntry() :
|
||||
LinkedElement<ModeListEntry>(this), value1(0), value2(0), value3(0) {
|
||||
LinkedElement<ModeListEntry>(this), value1(0), value2(0), value3(0), value4(
|
||||
0) {
|
||||
|
||||
}
|
||||
|
||||
uint32_t value1;
|
||||
uint32_t value2;
|
||||
uint8_t value3;
|
||||
uint8_t value4;
|
||||
|
||||
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
|
||||
const uint32_t max_size, bool bigEndian) const {
|
||||
@ -43,16 +38,23 @@ public:
|
||||
result = SerializeAdapter<uint8_t>::serialize(&value3, buffer, size,
|
||||
max_size, bigEndian);
|
||||
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = SerializeAdapter<uint8_t>::serialize(&value4, buffer, size,
|
||||
max_size, bigEndian);
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
virtual uint32_t getSerializedSize() const {
|
||||
return sizeof(value1) + sizeof(value2) + sizeof(value3);
|
||||
return sizeof(value1) + sizeof(value2) + sizeof(value3) + sizeof(value4);
|
||||
}
|
||||
|
||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
||||
bool bigEndian) {
|
||||
bool bigEndian) {
|
||||
ReturnValue_t result;
|
||||
|
||||
result = SerializeAdapter<uint32_t>::deSerialize(&value1, buffer, size,
|
||||
@ -70,6 +72,12 @@ public:
|
||||
result = SerializeAdapter<uint8_t>::deSerialize(&value3, buffer, size,
|
||||
bigEndian);
|
||||
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = SerializeAdapter<uint8_t>::deSerialize(&value4, buffer, size,
|
||||
bigEndian);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -98,7 +106,6 @@ public:
|
||||
this->value3 = checkSuccess;
|
||||
}
|
||||
|
||||
|
||||
//for Tables
|
||||
object_id_t getObject() const {
|
||||
return value1;
|
||||
@ -108,7 +115,6 @@ public:
|
||||
this->value1 = object;
|
||||
}
|
||||
|
||||
//TODO no cast!
|
||||
Mode_t getMode() const {
|
||||
return value2;
|
||||
}
|
||||
@ -125,6 +131,18 @@ public:
|
||||
this->value3 = submode;
|
||||
}
|
||||
|
||||
bool inheritSubmode() const {
|
||||
return value4 == 1;
|
||||
}
|
||||
|
||||
void setInheritSubmode(bool inherit){
|
||||
if (inherit){
|
||||
value4 = 1;
|
||||
} else {
|
||||
value4 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool operator==(ModeListEntry other) {
|
||||
return ((value1 == other.value1) && (value2 == other.value2)
|
||||
&& (value3 == other.value3));
|
||||
|
@ -69,7 +69,7 @@ void ModeSequenceMessage::clear(CommandMessage *message) {
|
||||
ipcStore->deleteData(ModeSequenceMessage::getStoreAddress(message));
|
||||
}
|
||||
}
|
||||
/*NO BREAK*/
|
||||
/* NO BREAK falls through*/
|
||||
case DELETE_SEQUENCE:
|
||||
case DELETE_TABLE:
|
||||
case READ_SEQUENCE:
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
class ModeSequenceMessage {
|
||||
public:
|
||||
static const uint8_t MESSAGE_ID = MODE_SEQUENCE_MESSAGE_ID;
|
||||
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::MODE_SEQUENCE;
|
||||
|
||||
static const Command_t ADD_SEQUENCE = MAKE_COMMAND_ID(0x01);
|
||||
static const Command_t ADD_TABLE = MAKE_COMMAND_ID(0x02);
|
||||
|
@ -1,8 +1,10 @@
|
||||
#include <framework/subsystem/modes/ModeStore.h>
|
||||
|
||||
#ifdef USE_MODESTORE
|
||||
|
||||
ModeStore::ModeStore(object_id_t objectId, uint32_t slots) :
|
||||
SystemObject(objectId), store(slots), emptySlot(store.front()) {
|
||||
mutex = new MutexId_t;
|
||||
mutex = MutexFactory::instance()->createMutex();;
|
||||
OSAL::createMutex(objectId + 1, mutex);
|
||||
clear();
|
||||
}
|
||||
@ -38,7 +40,7 @@ ReturnValue_t ModeStore::storeArray(ArrayList<ModeListEntry>* sequence,
|
||||
|
||||
ArrayList<ModeListEntry>::Iterator iter;
|
||||
for (iter = sequence->begin(); iter != sequence->end(); ++iter) {
|
||||
//TODO: I need to check this in detail. What is the idea? Why does it not work?
|
||||
//SHOULDDO: I need to check this in detail. What is the idea? Why does it not work?
|
||||
pointer = pointer->getNext()->value;
|
||||
if (pointer == NULL) {
|
||||
deleteListNoLock(*storedFirstEntry);
|
||||
@ -120,3 +122,5 @@ ReturnValue_t ModeStore::isValidEntry(ModeListEntry* sequence) {
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef MODESTORE_H_
|
||||
#define MODESTORE_H_
|
||||
|
||||
#ifdef USE_MODESTORE
|
||||
|
||||
#include <framework/container/ArrayList.h>
|
||||
#include <framework/container/SinglyLinkedList.h>
|
||||
#include <framework/objectmanager/SystemObject.h>
|
||||
@ -37,5 +39,7 @@ private:
|
||||
ReturnValue_t isValidEntry(ModeListEntry *sequence);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* MODESTORE_H_ */
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef MODESTOREIF_H_
|
||||
#define MODESTOREIF_H_
|
||||
|
||||
#ifdef USE_MODESTORE
|
||||
|
||||
#include <framework/container/ArrayList.h>
|
||||
#include <framework/container/SinglyLinkedList.h>
|
||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
||||
@ -8,7 +10,7 @@
|
||||
|
||||
class ModeStoreIF {
|
||||
public:
|
||||
static const uint8_t INTERFACE_ID = MODE_STORE_IF;
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::MODE_STORE_IF;
|
||||
static const ReturnValue_t INVALID_ENTRY = MAKE_RETURN_CODE(0x02);
|
||||
static const ReturnValue_t TOO_MANY_ELEMENTS = MAKE_RETURN_CODE(0x03);
|
||||
static const ReturnValue_t CANT_STORE_EMPTY = MAKE_RETURN_CODE(0x04);
|
||||
@ -30,4 +32,6 @@ public:
|
||||
virtual uint32_t getFreeSlots() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* MODESTOREIF_H_ */
|
||||
|
Reference in New Issue
Block a user