Code has been cleaned and documented. The saving of data to datapool in the InterpreteDeviceReply has been fixed.
This commit is contained in:
parent
a8e498ad3a
commit
c70fed0aa9
Binary file not shown.
@ -36,7 +36,6 @@ _obj/linux/debug/mission/DeviceHandler/ArduinoComIF.o: \
|
|||||||
fsfw/tmtcservices/../ipc/../objectmanager/SystemObjectIF.h \
|
fsfw/tmtcservices/../ipc/../objectmanager/SystemObjectIF.h \
|
||||||
fsfw/tmtcservices/../ipc/../objectmanager/../returnvalues/HasReturnvaluesIF.h \
|
fsfw/tmtcservices/../ipc/../objectmanager/../returnvalues/HasReturnvaluesIF.h \
|
||||||
fsfw/tmtcservices/../ipc/../objectmanager/../serviceinterface/ServiceInterfaceStream.h \
|
fsfw/tmtcservices/../ipc/../objectmanager/../serviceinterface/ServiceInterfaceStream.h \
|
||||||
mission/DeviceHandler/ArduinoCookie.h fsfw/devicehandlers/CookieIF.h \
|
|
||||||
fsfw/serialize/SerializeAdapter.h \
|
fsfw/serialize/SerializeAdapter.h \
|
||||||
fsfw/serialize/../returnvalues/HasReturnvaluesIF.h \
|
fsfw/serialize/../returnvalues/HasReturnvaluesIF.h \
|
||||||
fsfw/serialize/EndianConverter.h fsfw/serialize/../osal/Endiness.h \
|
fsfw/serialize/EndianConverter.h fsfw/serialize/../osal/Endiness.h \
|
||||||
@ -85,7 +84,8 @@ _obj/linux/debug/mission/DeviceHandler/ArduinoComIF.o: \
|
|||||||
fsfw/tmtcpacket/pus/../../serialize/SerializeIF.h \
|
fsfw/tmtcpacket/pus/../../serialize/SerializeIF.h \
|
||||||
fsfw/tmtcpacket/pus/../../storagemanager/StorageManagerIF.h \
|
fsfw/tmtcpacket/pus/../../storagemanager/StorageManagerIF.h \
|
||||||
fsfw/tmtcpacket/pus/../../internalError/InternalErrorReporterIF.h \
|
fsfw/tmtcpacket/pus/../../internalError/InternalErrorReporterIF.h \
|
||||||
fsfw/tmtcpacket/pus/../../ipc/MessageQueueSenderIF.h
|
fsfw/tmtcpacket/pus/../../ipc/MessageQueueSenderIF.h \
|
||||||
|
mission/DeviceHandler/ArduinoCookie.h fsfw/devicehandlers/CookieIF.h
|
||||||
mission/DeviceHandler/ArduinoComIF.h:
|
mission/DeviceHandler/ArduinoComIF.h:
|
||||||
fsfw/devicehandlers/DeviceCommunicationIF.h:
|
fsfw/devicehandlers/DeviceCommunicationIF.h:
|
||||||
fsfw/devicehandlers/CookieIF.h:
|
fsfw/devicehandlers/CookieIF.h:
|
||||||
@ -125,8 +125,6 @@ fsfw/tmtcservices/../ipc/../objectmanager/frameworkObjects.h:
|
|||||||
fsfw/tmtcservices/../ipc/../objectmanager/SystemObjectIF.h:
|
fsfw/tmtcservices/../ipc/../objectmanager/SystemObjectIF.h:
|
||||||
fsfw/tmtcservices/../ipc/../objectmanager/../returnvalues/HasReturnvaluesIF.h:
|
fsfw/tmtcservices/../ipc/../objectmanager/../returnvalues/HasReturnvaluesIF.h:
|
||||||
fsfw/tmtcservices/../ipc/../objectmanager/../serviceinterface/ServiceInterfaceStream.h:
|
fsfw/tmtcservices/../ipc/../objectmanager/../serviceinterface/ServiceInterfaceStream.h:
|
||||||
mission/DeviceHandler/ArduinoCookie.h:
|
|
||||||
fsfw/devicehandlers/CookieIF.h:
|
|
||||||
fsfw/serialize/SerializeAdapter.h:
|
fsfw/serialize/SerializeAdapter.h:
|
||||||
fsfw/serialize/../returnvalues/HasReturnvaluesIF.h:
|
fsfw/serialize/../returnvalues/HasReturnvaluesIF.h:
|
||||||
fsfw/serialize/EndianConverter.h:
|
fsfw/serialize/EndianConverter.h:
|
||||||
@ -179,3 +177,5 @@ fsfw/tmtcpacket/pus/../../serialize/SerializeIF.h:
|
|||||||
fsfw/tmtcpacket/pus/../../storagemanager/StorageManagerIF.h:
|
fsfw/tmtcpacket/pus/../../storagemanager/StorageManagerIF.h:
|
||||||
fsfw/tmtcpacket/pus/../../internalError/InternalErrorReporterIF.h:
|
fsfw/tmtcpacket/pus/../../internalError/InternalErrorReporterIF.h:
|
||||||
fsfw/tmtcpacket/pus/../../ipc/MessageQueueSenderIF.h:
|
fsfw/tmtcpacket/pus/../../ipc/MessageQueueSenderIF.h:
|
||||||
|
mission/DeviceHandler/ArduinoCookie.h:
|
||||||
|
fsfw/devicehandlers/CookieIF.h:
|
||||||
|
@ -170,17 +170,17 @@ _obj/linux/debug/mission/DeviceHandler/ArduinoDeviceHandler.o: \
|
|||||||
fsfw/devicehandlers/../datapool/../action/../ipc/MessageQueueIF.h \
|
fsfw/devicehandlers/../datapool/../action/../ipc/MessageQueueIF.h \
|
||||||
fsfw/devicehandlers/../datapool/../events/EventReportingProxyIF.h \
|
fsfw/devicehandlers/../datapool/../events/EventReportingProxyIF.h \
|
||||||
fsfw/globalfunctions/PeriodicOperationDivider.h \
|
fsfw/globalfunctions/PeriodicOperationDivider.h \
|
||||||
fsfw/timemanager/Countdown.h bsp_linux/fsfwconfig/OBSWConfig.h \
|
fsfw/timemanager/Countdown.h fsfw/datapool/DataSet.h \
|
||||||
fsfw/datapool/DataSet.h fsfw/datapool/DataPool.h \
|
fsfw/datapool/DataPool.h fsfw/datapool/PoolEntry.h \
|
||||||
fsfw/datapool/PoolEntry.h fsfw/datapool/PoolEntryIF.h \
|
fsfw/datapool/PoolEntryIF.h fsfw/datapool/../globalfunctions/Type.h \
|
||||||
fsfw/datapool/../globalfunctions/Type.h fsfw/datapool/../ipc/MutexIF.h \
|
fsfw/datapool/../ipc/MutexIF.h fsfw/datapool/DataSetIF.h \
|
||||||
fsfw/datapool/DataSetIF.h fsfw/datapool/PoolRawAccess.h \
|
fsfw/datapool/PoolRawAccess.h fsfw/datapool/PoolVariableIF.h \
|
||||||
fsfw/datapool/PoolVariableIF.h fsfw/datapool/PoolVariable.h \
|
fsfw/datapool/PoolVariable.h \
|
||||||
fsfw/datapool/../serialize/SerializeAdapter.h \
|
fsfw/datapool/../serialize/SerializeAdapter.h \
|
||||||
fsfw/datapool/../serviceinterface/ServiceInterfaceStream.h \
|
fsfw/datapool/../serviceinterface/ServiceInterfaceStream.h \
|
||||||
fsfw/datapool/PoolVarList.h fsfw/datapool/PoolVector.h \
|
fsfw/datapool/PoolVarList.h fsfw/datapool/PoolVector.h \
|
||||||
fsfw/datapool/PoolVector.h bsp_linux/fsfwconfig/datapool/dataPoolInit.h \
|
fsfw/datapool/PoolVector.h bsp_linux/fsfwconfig/datapool/dataPoolInit.h \
|
||||||
fsfw/datapool/DataPool.h
|
fsfw/datapool/DataPool.h bsp_linux/fsfwconfig/OBSWConfig.h
|
||||||
mission/DeviceHandler/ArduinoDeviceHandler.h:
|
mission/DeviceHandler/ArduinoDeviceHandler.h:
|
||||||
fsfw/devicehandlers/DeviceHandlerBase.h:
|
fsfw/devicehandlers/DeviceHandlerBase.h:
|
||||||
fsfw/devicehandlers/DeviceHandlerIF.h:
|
fsfw/devicehandlers/DeviceHandlerIF.h:
|
||||||
@ -352,7 +352,6 @@ fsfw/devicehandlers/../datapool/../action/../ipc/MessageQueueIF.h:
|
|||||||
fsfw/devicehandlers/../datapool/../events/EventReportingProxyIF.h:
|
fsfw/devicehandlers/../datapool/../events/EventReportingProxyIF.h:
|
||||||
fsfw/globalfunctions/PeriodicOperationDivider.h:
|
fsfw/globalfunctions/PeriodicOperationDivider.h:
|
||||||
fsfw/timemanager/Countdown.h:
|
fsfw/timemanager/Countdown.h:
|
||||||
bsp_linux/fsfwconfig/OBSWConfig.h:
|
|
||||||
fsfw/datapool/DataSet.h:
|
fsfw/datapool/DataSet.h:
|
||||||
fsfw/datapool/DataPool.h:
|
fsfw/datapool/DataPool.h:
|
||||||
fsfw/datapool/PoolEntry.h:
|
fsfw/datapool/PoolEntry.h:
|
||||||
@ -370,3 +369,4 @@ fsfw/datapool/PoolVector.h:
|
|||||||
fsfw/datapool/PoolVector.h:
|
fsfw/datapool/PoolVector.h:
|
||||||
bsp_linux/fsfwconfig/datapool/dataPoolInit.h:
|
bsp_linux/fsfwconfig/datapool/dataPoolInit.h:
|
||||||
fsfw/datapool/DataPool.h:
|
fsfw/datapool/DataPool.h:
|
||||||
|
bsp_linux/fsfwconfig/OBSWConfig.h:
|
||||||
|
@ -275,8 +275,27 @@ _obj/linux/debug/mission/core/GenericFactory.o: \
|
|||||||
fsfw/devicehandlers/../datapool/../action/../ipc/MessageQueueIF.h \
|
fsfw/devicehandlers/../datapool/../action/../ipc/MessageQueueIF.h \
|
||||||
fsfw/devicehandlers/../datapool/../events/EventReportingProxyIF.h \
|
fsfw/devicehandlers/../datapool/../events/EventReportingProxyIF.h \
|
||||||
fsfw/globalfunctions/PeriodicOperationDivider.h \
|
fsfw/globalfunctions/PeriodicOperationDivider.h \
|
||||||
fsfw/timemanager/Countdown.h mission/DeviceHandler/ArduinoComIF.h \
|
fsfw/timemanager/Countdown.h fsfw/datapool/DataSet.h \
|
||||||
|
fsfw/datapool/DataPool.h fsfw/datapool/DataSetIF.h \
|
||||||
|
fsfw/datapool/PoolRawAccess.h fsfw/datapool/PoolVariableIF.h \
|
||||||
|
fsfw/datapool/PoolVariable.h \
|
||||||
|
fsfw/datapool/../serialize/SerializeAdapter.h \
|
||||||
|
fsfw/datapool/../serviceinterface/ServiceInterfaceStream.h \
|
||||||
|
fsfw/datapool/PoolVarList.h fsfw/datapool/PoolVector.h \
|
||||||
|
fsfw/datapool/PoolVector.h bsp_linux/fsfwconfig/datapool/dataPoolInit.h \
|
||||||
|
mission/DeviceHandler/ArduinoComIF.h \
|
||||||
fsfw/devicehandlers/DeviceCommunicationIF.h \
|
fsfw/devicehandlers/DeviceCommunicationIF.h \
|
||||||
|
fsfw/serialize/SerializeAdapter.h \
|
||||||
|
fsfw/tmtcservices/CommandingServiceBase.h \
|
||||||
|
fsfw/tmtcpacket/pus/TmPacketStored.h fsfw/tmtcpacket/pus/TmPacketBase.h \
|
||||||
|
fsfw/tmtcpacket/pus/../SpacePacketBase.h \
|
||||||
|
fsfw/tmtcpacket/pus/../../timemanager/TimeStamperIF.h \
|
||||||
|
fsfw/tmtcpacket/pus/../../timemanager/Clock.h \
|
||||||
|
fsfw/tmtcpacket/pus/../../objectmanager/SystemObjectIF.h \
|
||||||
|
fsfw/tmtcpacket/pus/../../serialize/SerializeIF.h \
|
||||||
|
fsfw/tmtcpacket/pus/../../storagemanager/StorageManagerIF.h \
|
||||||
|
fsfw/tmtcpacket/pus/../../internalError/InternalErrorReporterIF.h \
|
||||||
|
fsfw/tmtcpacket/pus/../../ipc/MessageQueueSenderIF.h \
|
||||||
mission/DeviceHandler/ArduinoCookie.h \
|
mission/DeviceHandler/ArduinoCookie.h \
|
||||||
mission/Controller/ThermalController.h fsfw/action/HasActionsIF.h \
|
mission/Controller/ThermalController.h fsfw/action/HasActionsIF.h \
|
||||||
fsfw/action/SimpleActionHelper.h fsfw/events/EventReportingProxyIF.h \
|
fsfw/action/SimpleActionHelper.h fsfw/events/EventReportingProxyIF.h \
|
||||||
@ -289,14 +308,7 @@ _obj/linux/debug/mission/core/GenericFactory.o: \
|
|||||||
fsfw/controller/../tasks/ExecutableObjectIF.h \
|
fsfw/controller/../tasks/ExecutableObjectIF.h \
|
||||||
fsfw/controller/../datapool/HkSwitchHelper.h \
|
fsfw/controller/../datapool/HkSwitchHelper.h \
|
||||||
fsfw/datapool/ControllerSet.h fsfw/datapool/DataSet.h \
|
fsfw/datapool/ControllerSet.h fsfw/datapool/DataSet.h \
|
||||||
fsfw/datapool/DataPool.h fsfw/datapool/DataSetIF.h \
|
fsfw/datapool/PoolVariable.h fsfw/health/HealthTableIF.h \
|
||||||
fsfw/datapool/PoolRawAccess.h fsfw/datapool/PoolVariableIF.h \
|
|
||||||
fsfw/datapool/PoolVariable.h \
|
|
||||||
fsfw/datapool/../serialize/SerializeAdapter.h \
|
|
||||||
fsfw/datapool/../serviceinterface/ServiceInterfaceStream.h \
|
|
||||||
fsfw/datapool/PoolVarList.h fsfw/datapool/PoolVector.h \
|
|
||||||
fsfw/datapool/DataSet.h fsfw/datapool/PoolVariable.h \
|
|
||||||
fsfw/datapool/PoolVector.h fsfw/health/HealthTableIF.h \
|
|
||||||
fsfw/returnvalues/HasReturnvaluesIF.h \
|
fsfw/returnvalues/HasReturnvaluesIF.h \
|
||||||
mission/Controller/ArduinoTCSTemperatureSensor.h \
|
mission/Controller/ArduinoTCSTemperatureSensor.h \
|
||||||
fsfw/thermal/AbstractTemperatureSensor.h \
|
fsfw/thermal/AbstractTemperatureSensor.h \
|
||||||
@ -359,8 +371,7 @@ _obj/linux/debug/mission/core/GenericFactory.o: \
|
|||||||
fsfw/thermal/../monitoring/../timemanager/TimeStamperIF.h \
|
fsfw/thermal/../monitoring/../timemanager/TimeStamperIF.h \
|
||||||
fsfw/thermal/../monitoring/../parameters/HasParametersIF.h \
|
fsfw/thermal/../monitoring/../parameters/HasParametersIF.h \
|
||||||
mission/Controller/TCS_Heater.h fsfw/power/PowerSwitchIF.h \
|
mission/Controller/TCS_Heater.h fsfw/power/PowerSwitchIF.h \
|
||||||
fsfw/thermal/Heater.h bsp_linux/fsfwconfig/objects/systemObjectList.h \
|
fsfw/thermal/Heater.h bsp_linux/fsfwconfig/objects/systemObjectList.h
|
||||||
bsp_linux/fsfwconfig/datapool/dataPoolInit.h
|
|
||||||
mission/core/GenericFactory.h:
|
mission/core/GenericFactory.h:
|
||||||
bsp_linux/fsfwconfig/OBSWConfig.h:
|
bsp_linux/fsfwconfig/OBSWConfig.h:
|
||||||
bsp_linux/fsfwconfig/datapool/dataPoolInit.h:
|
bsp_linux/fsfwconfig/datapool/dataPoolInit.h:
|
||||||
@ -659,8 +670,32 @@ fsfw/devicehandlers/../datapool/../action/../ipc/MessageQueueIF.h:
|
|||||||
fsfw/devicehandlers/../datapool/../events/EventReportingProxyIF.h:
|
fsfw/devicehandlers/../datapool/../events/EventReportingProxyIF.h:
|
||||||
fsfw/globalfunctions/PeriodicOperationDivider.h:
|
fsfw/globalfunctions/PeriodicOperationDivider.h:
|
||||||
fsfw/timemanager/Countdown.h:
|
fsfw/timemanager/Countdown.h:
|
||||||
|
fsfw/datapool/DataSet.h:
|
||||||
|
fsfw/datapool/DataPool.h:
|
||||||
|
fsfw/datapool/DataSetIF.h:
|
||||||
|
fsfw/datapool/PoolRawAccess.h:
|
||||||
|
fsfw/datapool/PoolVariableIF.h:
|
||||||
|
fsfw/datapool/PoolVariable.h:
|
||||||
|
fsfw/datapool/../serialize/SerializeAdapter.h:
|
||||||
|
fsfw/datapool/../serviceinterface/ServiceInterfaceStream.h:
|
||||||
|
fsfw/datapool/PoolVarList.h:
|
||||||
|
fsfw/datapool/PoolVector.h:
|
||||||
|
fsfw/datapool/PoolVector.h:
|
||||||
|
bsp_linux/fsfwconfig/datapool/dataPoolInit.h:
|
||||||
mission/DeviceHandler/ArduinoComIF.h:
|
mission/DeviceHandler/ArduinoComIF.h:
|
||||||
fsfw/devicehandlers/DeviceCommunicationIF.h:
|
fsfw/devicehandlers/DeviceCommunicationIF.h:
|
||||||
|
fsfw/serialize/SerializeAdapter.h:
|
||||||
|
fsfw/tmtcservices/CommandingServiceBase.h:
|
||||||
|
fsfw/tmtcpacket/pus/TmPacketStored.h:
|
||||||
|
fsfw/tmtcpacket/pus/TmPacketBase.h:
|
||||||
|
fsfw/tmtcpacket/pus/../SpacePacketBase.h:
|
||||||
|
fsfw/tmtcpacket/pus/../../timemanager/TimeStamperIF.h:
|
||||||
|
fsfw/tmtcpacket/pus/../../timemanager/Clock.h:
|
||||||
|
fsfw/tmtcpacket/pus/../../objectmanager/SystemObjectIF.h:
|
||||||
|
fsfw/tmtcpacket/pus/../../serialize/SerializeIF.h:
|
||||||
|
fsfw/tmtcpacket/pus/../../storagemanager/StorageManagerIF.h:
|
||||||
|
fsfw/tmtcpacket/pus/../../internalError/InternalErrorReporterIF.h:
|
||||||
|
fsfw/tmtcpacket/pus/../../ipc/MessageQueueSenderIF.h:
|
||||||
mission/DeviceHandler/ArduinoCookie.h:
|
mission/DeviceHandler/ArduinoCookie.h:
|
||||||
mission/Controller/ThermalController.h:
|
mission/Controller/ThermalController.h:
|
||||||
fsfw/action/HasActionsIF.h:
|
fsfw/action/HasActionsIF.h:
|
||||||
@ -677,18 +712,7 @@ fsfw/controller/../tasks/ExecutableObjectIF.h:
|
|||||||
fsfw/controller/../datapool/HkSwitchHelper.h:
|
fsfw/controller/../datapool/HkSwitchHelper.h:
|
||||||
fsfw/datapool/ControllerSet.h:
|
fsfw/datapool/ControllerSet.h:
|
||||||
fsfw/datapool/DataSet.h:
|
fsfw/datapool/DataSet.h:
|
||||||
fsfw/datapool/DataPool.h:
|
|
||||||
fsfw/datapool/DataSetIF.h:
|
|
||||||
fsfw/datapool/PoolRawAccess.h:
|
|
||||||
fsfw/datapool/PoolVariableIF.h:
|
|
||||||
fsfw/datapool/PoolVariable.h:
|
fsfw/datapool/PoolVariable.h:
|
||||||
fsfw/datapool/../serialize/SerializeAdapter.h:
|
|
||||||
fsfw/datapool/../serviceinterface/ServiceInterfaceStream.h:
|
|
||||||
fsfw/datapool/PoolVarList.h:
|
|
||||||
fsfw/datapool/PoolVector.h:
|
|
||||||
fsfw/datapool/DataSet.h:
|
|
||||||
fsfw/datapool/PoolVariable.h:
|
|
||||||
fsfw/datapool/PoolVector.h:
|
|
||||||
fsfw/health/HealthTableIF.h:
|
fsfw/health/HealthTableIF.h:
|
||||||
fsfw/returnvalues/HasReturnvaluesIF.h:
|
fsfw/returnvalues/HasReturnvaluesIF.h:
|
||||||
mission/Controller/ArduinoTCSTemperatureSensor.h:
|
mission/Controller/ArduinoTCSTemperatureSensor.h:
|
||||||
@ -762,4 +786,3 @@ mission/Controller/TCS_Heater.h:
|
|||||||
fsfw/power/PowerSwitchIF.h:
|
fsfw/power/PowerSwitchIF.h:
|
||||||
fsfw/thermal/Heater.h:
|
fsfw/thermal/Heater.h:
|
||||||
bsp_linux/fsfwconfig/objects/systemObjectList.h:
|
bsp_linux/fsfwconfig/objects/systemObjectList.h:
|
||||||
bsp_linux/fsfwconfig/datapool/dataPoolInit.h:
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -10,7 +10,6 @@
|
|||||||
void dataPoolInit(std::map<uint32_t, PoolEntryIF*>* pool_map) {
|
void dataPoolInit(std::map<uint32_t, PoolEntryIF*>* pool_map) {
|
||||||
|
|
||||||
//Here the pool map entries of the DH and CONTROLLER are defined.
|
//Here the pool map entries of the DH and CONTROLLER are defined.
|
||||||
|
|
||||||
float Temperature_value[36] = {0};
|
float Temperature_value[36] = {0};
|
||||||
pool_map->insert(
|
pool_map->insert(
|
||||||
std::pair<uint32_t, PoolEntryIF*>(datapool::Temperature_value,
|
std::pair<uint32_t, PoolEntryIF*>(datapool::Temperature_value,
|
||||||
@ -19,22 +18,6 @@ void dataPoolInit(std::map<uint32_t, PoolEntryIF*>* pool_map) {
|
|||||||
pool_map->insert(
|
pool_map->insert(
|
||||||
std::pair<uint32_t, PoolEntryIF*>(datapool::Temperature_Timestamp,
|
std::pair<uint32_t, PoolEntryIF*>(datapool::Temperature_Timestamp,
|
||||||
new PoolEntry<unsigned int>(Temperature_Timestamp, 36)));
|
new PoolEntry<unsigned int>(Temperature_Timestamp, 36)));
|
||||||
float Environmental_value[9] = {0};
|
|
||||||
pool_map->insert(
|
|
||||||
std::pair<uint32_t, PoolEntryIF*>(datapool::Environmental_value,
|
|
||||||
new PoolEntry<float>(Environmental_value, 9)));
|
|
||||||
unsigned int Environmental_Timestamp[9] = {0};
|
|
||||||
pool_map->insert(
|
|
||||||
std::pair<uint32_t, PoolEntryIF*>(datapool::Environmental_Timestamp,
|
|
||||||
new PoolEntry<unsigned int>(Environmental_Timestamp, 9)));
|
|
||||||
float Accelerometer_value[15] = {0};
|
|
||||||
pool_map->insert(
|
|
||||||
std::pair<uint32_t, PoolEntryIF*>(datapool::Accelerometer_value,
|
|
||||||
new PoolEntry<float>(Accelerometer_value, 15)));
|
|
||||||
unsigned int Accelerometer_Timestamp[15] = {0};
|
|
||||||
pool_map->insert(
|
|
||||||
std::pair<uint32_t, PoolEntryIF*>(datapool::Accelerometer_Timestamp,
|
|
||||||
new PoolEntry<unsigned int>(Accelerometer_Timestamp, 15)));
|
|
||||||
float TEMP_SENSOR_CH1[1] = {0};
|
float TEMP_SENSOR_CH1[1] = {0};
|
||||||
pool_map->insert(
|
pool_map->insert(
|
||||||
std::pair<uint32_t, PoolEntryIF*>(datapool::TEMP_SENSOR_CH1,
|
std::pair<uint32_t, PoolEntryIF*>(datapool::TEMP_SENSOR_CH1,
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* dataPoolInit.h
|
* dataPoolInit.h
|
||||||
*
|
*
|
||||||
* brief: Initialisation function for all variables in the data pool.
|
* brief: Initialization function for all variables in the data pool.
|
||||||
* This file was auto-generated by getDataPoolFromFLPmib.py via
|
|
||||||
* the flpmib database at 2018-06-04T12:02:46+00:00.
|
|
||||||
*/
|
*/
|
||||||
#ifndef DATAPOOLINIT_H_
|
#ifndef DATAPOOLINIT_H_
|
||||||
#define DATAPOOLINIT_H_
|
#define DATAPOOLINIT_H_
|
||||||
@ -16,19 +14,14 @@ namespace datapool {
|
|||||||
// The IDs of the variables of the DH and CONTROLLER are here defined.
|
// The IDs of the variables of the DH and CONTROLLER are here defined.
|
||||||
Temperature_value = 0x100001,
|
Temperature_value = 0x100001,
|
||||||
Temperature_Timestamp = 0x100002,
|
Temperature_Timestamp = 0x100002,
|
||||||
Environmental_value = 0x10003,
|
TEMP_SENSOR_CH1 = 0x10003,
|
||||||
Environmental_Timestamp = 0x10004,
|
TEMP_SENSOR_CH2 = 0x10004,
|
||||||
Accelerometer_value = 0x10005,
|
TargetState_COMPONENT_1 = 0x10005,
|
||||||
Accelerometer_Timestamp = 0x10006,
|
CurrentState_COMPONENT_1 = 0x100006,
|
||||||
TEMP_SENSOR_CH1 = 0x10007,
|
HeaterRequest_COMPONENT_1 = 0x100007,
|
||||||
TEMP_SENSOR_CH2 = 0x10008,
|
TargetState_COMPONENT_2 = 0x100008,
|
||||||
TargetState_COMPONENT_1 = 0x10009,
|
CurrentState_COMPONENT_2 = 0x100009,
|
||||||
CurrentState_COMPONENT_1 = 0x100010,
|
HeaterRequest_COMPONENT_2 = 0x100010
|
||||||
HeaterRequest_COMPONENT_1 = 0x100011,
|
|
||||||
TargetState_COMPONENT_2 = 0x100012,
|
|
||||||
CurrentState_COMPONENT_2 = 0x100013,
|
|
||||||
HeaterRequest_COMPONENT_2 = 0x100014
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
* ArduinoComIF.cpp
|
* Title: ArduinoComIF.cpp
|
||||||
*
|
|
||||||
* Last Modify: 20/09/2021
|
|
||||||
* Author: Marco Modè
|
* Author: Marco Modè
|
||||||
|
* Last version: 24/09/2021
|
||||||
|
* Project: ESBO-DS
|
||||||
|
*-------------------------------------------------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <mission/DeviceHandler/ArduinoComIF.h>
|
#include <mission/DeviceHandler/ArduinoComIF.h>
|
||||||
#include <mission/DeviceHandler/ArduinoCookie.h>
|
#include <mission/DeviceHandler/ArduinoCookie.h>
|
||||||
#include <fsfw/serialize/SerializeAdapter.h>
|
|
||||||
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
|
||||||
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <vector>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cstdint>
|
|
||||||
// Linux headers
|
|
||||||
#include <fcntl.h> // Contains file controls like O_RDWR
|
|
||||||
#include <errno.h> // Error integer and strerror() function
|
|
||||||
#include <termios.h> // Contains POSIX terminal control definitions
|
|
||||||
#include <unistd.h> // write(), read(), close()
|
|
||||||
|
|
||||||
ArduinoComIF::ArduinoComIF(object_id_t objectId) :
|
ArduinoComIF::ArduinoComIF(object_id_t objectId) :
|
||||||
SystemObject(objectId) {
|
SystemObject(objectId) {
|
||||||
@ -30,22 +18,25 @@ ArduinoComIF::~ArduinoComIF() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::initializeInterface(CookieIF *cookie) {
|
ReturnValue_t ArduinoComIF::initializeInterface(CookieIF *cookie) {
|
||||||
|
|
||||||
ArduinoCookie *Cookie = dynamic_cast<ArduinoCookie*>(cookie);
|
ArduinoCookie *Cookie = dynamic_cast<ArduinoCookie*>(cookie);
|
||||||
|
|
||||||
// The Arduino device which manage the sensors of temperature,
|
/* The Arduino device which manage the sensors of temperature,
|
||||||
// environmental data and acceleration, sends through serial
|
* environmental data and orientation, sends through serial
|
||||||
// output these data employing a USB port.
|
* output these data employing a USB port.
|
||||||
// Here it is then set-up the interface to manage this communication.
|
* Here it is then set-up the interface to manage this communication.
|
||||||
//
|
*
|
||||||
// In typical UNIX style, serial ports are represented by files
|
* In typical UNIX style, serial ports are represented by files
|
||||||
// within the operating system.
|
* within the operating system.
|
||||||
// These files usually pop-up in /dev/, and begin with the name tty*.
|
* These files usually pop-up in /dev/, and begin with the name tty*.
|
||||||
//
|
*
|
||||||
// To write/read to a serial port, you write/read to the file.
|
* To write/read to a serial port, you write/read to the file.
|
||||||
// Here the serial port parameters are defined exploiting a
|
* Here the serial port parameters are defined exploiting a
|
||||||
// special tty configuration struct.
|
* special tty configuration struct.
|
||||||
|
*/
|
||||||
|
|
||||||
// Open the serial port. Change device path as needed (see README in InterfaceCode/testArduino/testArduino/ ).
|
// Set-up of the Linux serial port.
|
||||||
|
// The serial port is here opened. Change device path as needed.
|
||||||
int serial_port = open("/dev/ttyACM0", O_RDWR);
|
int serial_port = open("/dev/ttyACM0", O_RDWR);
|
||||||
|
|
||||||
// Create new termios struc, we call it 'tty' for convention.
|
// Create new termios struc, we call it 'tty' for convention.
|
||||||
@ -64,15 +55,13 @@ ReturnValue_t ArduinoComIF::initializeInterface(CookieIF *cookie) {
|
|||||||
tty.c_cflag |= CS8; // 8 bits per byte (most common)
|
tty.c_cflag |= CS8; // 8 bits per byte (most common)
|
||||||
tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control (most common)
|
tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control (most common)
|
||||||
tty.c_cflag |= CREAD | CLOCAL; // Turn on READ & ignore ctrl lines (CLOCAL = 1)
|
tty.c_cflag |= CREAD | CLOCAL; // Turn on READ & ignore ctrl lines (CLOCAL = 1)
|
||||||
|
tty.c_lflag &= ~ICANON; //Canonical mode is disabled
|
||||||
tty.c_lflag &= ~ICANON;
|
|
||||||
tty.c_lflag &= ~ECHO; // Disable echo
|
tty.c_lflag &= ~ECHO; // Disable echo
|
||||||
tty.c_lflag &= ~ECHOE; // Disable erasure
|
tty.c_lflag &= ~ECHOE; // Disable erasure
|
||||||
tty.c_lflag &= ~ECHONL; // Disable new-line echo
|
tty.c_lflag &= ~ECHONL; // Disable new-line echo
|
||||||
tty.c_lflag &= ~ISIG; // Disable interpretation of INTR, QUIT and SUSP
|
tty.c_lflag &= ~ISIG; // Disable interpretation of INTR, QUIT and SUSP
|
||||||
tty.c_iflag &= ~(IXON | IXOFF | IXANY); // Turn off s/w flow ctrl
|
tty.c_iflag &= ~(IXON | IXOFF | IXANY); // Turn off s/w flow ctrl
|
||||||
tty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL); // Disable any special handling of received bytes
|
tty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL); // Disable any special handling of received bytes
|
||||||
|
|
||||||
tty.c_oflag &= ~OPOST; // Prevent special interpretation of output bytes (e.g. newline chars)
|
tty.c_oflag &= ~OPOST; // Prevent special interpretation of output bytes (e.g. newline chars)
|
||||||
tty.c_oflag &= ~ONLCR; // Prevent conversion of newline to carriage return/line feed
|
tty.c_oflag &= ~ONLCR; // Prevent conversion of newline to carriage return/line feed
|
||||||
|
|
||||||
@ -83,16 +72,23 @@ ReturnValue_t ArduinoComIF::initializeInterface(CookieIF *cookie) {
|
|||||||
cfsetispeed(&tty, B115200);
|
cfsetispeed(&tty, B115200);
|
||||||
cfsetospeed(&tty, B115200);
|
cfsetospeed(&tty, B115200);
|
||||||
|
|
||||||
// Save tty settings, also checking for error.
|
// Save tty settings, also checking for error
|
||||||
if (tcsetattr(serial_port, TCSANOW, &tty) != 0) {
|
if (tcsetattr(serial_port, TCSANOW, &tty) != 0) {
|
||||||
printf("Error %i from tcsetattr: %s\n", errno, strerror(errno));
|
printf("Error %i from tcsetattr: %s\n", errno, strerror(errno));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf(
|
||||||
|
"***********************************************************************************************\n");
|
||||||
|
printf(
|
||||||
|
"***********************************************************************************************\n");
|
||||||
printf("\nSerial port set. \n");
|
printf("\nSerial port set. \n");
|
||||||
|
|
||||||
// End of Linux serial port set-up.
|
// End of Linux serial port set-up.
|
||||||
|
|
||||||
|
/* The serial port number is saved in the cookie such that it can
|
||||||
|
* be exploited from other functionalities or components.
|
||||||
|
*/
|
||||||
Cookie->Serial_port_number = serial_port;
|
Cookie->Serial_port_number = serial_port;
|
||||||
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
@ -116,119 +112,113 @@ ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie,
|
|||||||
uint8_t **buffer, size_t *size) {
|
uint8_t **buffer, size_t *size) {
|
||||||
ArduinoCookie *Cookie = dynamic_cast<ArduinoCookie*>(cookie);
|
ArduinoCookie *Cookie = dynamic_cast<ArduinoCookie*>(cookie);
|
||||||
|
|
||||||
/* Afterward, the buffer array to store the data read are initialized.
|
// The buffer elements are set to 0 at the beginning of each read-loop.
|
||||||
* The whole data packet to be read is 2580 bytes, the limit for one reading (VMAX) is 255 bytes.
|
|
||||||
* In order to avoid problems during the acquisition of data in the framework, the buffer is set to
|
|
||||||
* be 3 times the needed dimension: 7740 bytes.
|
|
||||||
* Exploiting then some control loop, the beginning of a full and complete buffer is identified.
|
|
||||||
* Since the acquisition limit for one reading is of 255 bytes, as mentioned above,
|
|
||||||
* the reading is divided in 31 separate stages which employ 31 different buffer array.
|
|
||||||
* At the end these 31 arrays are concatenated in the main buffer array read_buf.
|
|
||||||
*/
|
|
||||||
uint8_t read_buf[7740]; // 7740 bytes from SPC serial output
|
|
||||||
// Intermediate buffers (limit for one single read call is 255 bytes)
|
|
||||||
uint8_t read_buf1[255]; uint8_t read_buf2[255]; uint8_t read_buf3[255];
|
|
||||||
uint8_t read_buf4[255]; uint8_t read_buf5[255]; uint8_t read_buf6[255];
|
|
||||||
uint8_t read_buf7[255]; uint8_t read_buf8[255]; uint8_t read_buf9[255];
|
|
||||||
uint8_t read_buf10[255]; uint8_t read_buf11[255]; uint8_t read_buf12[255];
|
|
||||||
uint8_t read_buf13[255]; uint8_t read_buf14[255]; uint8_t read_buf15[255];
|
|
||||||
uint8_t read_buf16[255]; uint8_t read_buf17[255]; uint8_t read_buf18[255];
|
|
||||||
uint8_t read_buf19[255]; uint8_t read_buf20[255]; uint8_t read_buf21[255];
|
|
||||||
uint8_t read_buf22[255]; uint8_t read_buf23[255]; uint8_t read_buf24[255];
|
|
||||||
uint8_t read_buf25[255]; uint8_t read_buf26[255]; uint8_t read_buf27[255];
|
|
||||||
uint8_t read_buf28[255]; uint8_t read_buf29[255]; uint8_t read_buf30[255];
|
|
||||||
uint8_t read_buf31[90];
|
|
||||||
|
|
||||||
// The buffer elements are initially set to 0.
|
|
||||||
memset(&read_buf, '\0', sizeof(read_buf));
|
memset(&read_buf, '\0', sizeof(read_buf));
|
||||||
memset(&read_buf1, '\0', 255); memset(&read_buf2, '\0', 255); memset(&read_buf3, '\0', 255);
|
memset(&read_buf1, '\0', 255);
|
||||||
memset(&read_buf4, '\0', 255); memset(&read_buf5, '\0', 255); memset(&read_buf6, '\0', 255);
|
memset(&read_buf2, '\0', 255);
|
||||||
memset(&read_buf7, '\0', 255); memset(&read_buf8, '\0', 255); memset(&read_buf9, '\0', 255);
|
memset(&read_buf3, '\0', 255);
|
||||||
memset(&read_buf10, '\0', 255); memset(&read_buf11, '\0', 255); memset(&read_buf12, '\0', 255);
|
memset(&read_buf4, '\0', 255);
|
||||||
memset(&read_buf13, '\0', 255); memset(&read_buf14, '\0', 255); memset(&read_buf15, '\0', 255);
|
memset(&read_buf5, '\0', 255);
|
||||||
memset(&read_buf16, '\0', 255); memset(&read_buf17, '\0', 255); memset(&read_buf18, '\0', 255);
|
memset(&read_buf6, '\0', 255);
|
||||||
memset(&read_buf19, '\0', 255); memset(&read_buf20, '\0', 255); memset(&read_buf21, '\0', 255);
|
memset(&read_buf7, '\0', 255);
|
||||||
memset(&read_buf22, '\0', 255); memset(&read_buf23, '\0', 255); memset(&read_buf24, '\0', 255);
|
memset(&read_buf8, '\0', 255);
|
||||||
memset(&read_buf25, '\0', 255); memset(&read_buf26, '\0', 255); memset(&read_buf27, '\0', 255);
|
memset(&read_buf9, '\0', 255);
|
||||||
memset(&read_buf28, '\0', 255); memset(&read_buf29, '\0', 255); memset(&read_buf30, '\0', 255);
|
memset(&read_buf10, '\0', 255);
|
||||||
|
memset(&read_buf11, '\0', 255);
|
||||||
|
memset(&read_buf12, '\0', 255);
|
||||||
|
memset(&read_buf13, '\0', 255);
|
||||||
|
memset(&read_buf14, '\0', 255);
|
||||||
|
memset(&read_buf15, '\0', 255);
|
||||||
|
memset(&read_buf16, '\0', 255);
|
||||||
|
memset(&read_buf17, '\0', 255);
|
||||||
|
memset(&read_buf18, '\0', 255);
|
||||||
|
memset(&read_buf19, '\0', 255);
|
||||||
|
memset(&read_buf20, '\0', 255);
|
||||||
|
memset(&read_buf21, '\0', 255);
|
||||||
|
memset(&read_buf22, '\0', 255);
|
||||||
|
memset(&read_buf23, '\0', 255);
|
||||||
|
memset(&read_buf24, '\0', 255);
|
||||||
|
memset(&read_buf25, '\0', 255);
|
||||||
|
memset(&read_buf26, '\0', 255);
|
||||||
|
memset(&read_buf27, '\0', 255);
|
||||||
|
memset(&read_buf28, '\0', 255);
|
||||||
|
memset(&read_buf29, '\0', 255);
|
||||||
|
memset(&read_buf30, '\0', 255);
|
||||||
memset(&read_buf31, '\0', 90);
|
memset(&read_buf31, '\0', 90);
|
||||||
/*memset(&read_buf, '\0', sizeof(read_buf));
|
|
||||||
memset(&read_buf1, '\0', 255); memset(&read_buf2, '\0', 255); memset(&read_buf3, '\0', 255);
|
|
||||||
memset(&read_buf4, '\0', 255); memset(&read_buf5, '\0', 255); memset(&read_buf6, '\0', 255);
|
|
||||||
memset(&read_buf7, '\0', 255); memset(&read_buf8, '\0', 255); memset(&read_buf9, '\0', 255);
|
|
||||||
memset(&read_buf10, '\0', 255); memset(&read_buf11, '\0', 255); memset(&read_buf12, '\0', 255);
|
|
||||||
memset(&read_buf13, '\0', 255); memset(&read_buf14, '\0', 255); memset(&read_buf15, '\0', 255);
|
|
||||||
memset(&read_buf16, '\0', 255); memset(&read_buf17, '\0', 255); memset(&read_buf18, '\0', 255);
|
|
||||||
memset(&read_buf19, '\0', 255); memset(&read_buf20, '\0', 255); memset(&read_buf21, '\0', 60);*/
|
|
||||||
|
|
||||||
// Read bytes. The behaviour of read() (e.g. does it block?, how long does it block for?)
|
/* Read bytes. The behaviour of read() depends on the configuration
|
||||||
// depends on the configuration settings above, specifically VMIN and VTIME.
|
* settings in initializeInterface, specifically VMIN and VTIME.
|
||||||
int num_bytes1 = read(Cookie->Serial_port_number, &read_buf1, sizeof(read_buf1));
|
*/
|
||||||
int num_bytes2 = read(Cookie->Serial_port_number, &read_buf2, sizeof(read_buf2));
|
int num_bytes1 = read(Cookie->Serial_port_number, &read_buf1,
|
||||||
int num_bytes3 = read(Cookie->Serial_port_number, &read_buf3, sizeof(read_buf3));
|
sizeof(read_buf1));
|
||||||
int num_bytes4 = read(Cookie->Serial_port_number, &read_buf4, sizeof(read_buf4));
|
int num_bytes2 = read(Cookie->Serial_port_number, &read_buf2,
|
||||||
int num_bytes5 = read(Cookie->Serial_port_number, &read_buf5, sizeof(read_buf5));
|
sizeof(read_buf2));
|
||||||
int num_bytes6 = read(Cookie->Serial_port_number, &read_buf6, sizeof(read_buf6));
|
int num_bytes3 = read(Cookie->Serial_port_number, &read_buf3,
|
||||||
int num_bytes7 = read(Cookie->Serial_port_number, &read_buf7, sizeof(read_buf7));
|
sizeof(read_buf3));
|
||||||
int num_bytes8 = read(Cookie->Serial_port_number, &read_buf8, sizeof(read_buf8));
|
int num_bytes4 = read(Cookie->Serial_port_number, &read_buf4,
|
||||||
int num_bytes9 = read(Cookie->Serial_port_number, &read_buf9, sizeof(read_buf9));
|
sizeof(read_buf4));
|
||||||
int num_bytes10 = read(Cookie->Serial_port_number, &read_buf10, sizeof(read_buf10));
|
int num_bytes5 = read(Cookie->Serial_port_number, &read_buf5,
|
||||||
int num_bytes11 = read(Cookie->Serial_port_number, &read_buf11, sizeof(read_buf11));
|
sizeof(read_buf5));
|
||||||
int num_bytes12 = read(Cookie->Serial_port_number, &read_buf12, sizeof(read_buf12));
|
int num_bytes6 = read(Cookie->Serial_port_number, &read_buf6,
|
||||||
int num_bytes13 = read(Cookie->Serial_port_number, &read_buf13, sizeof(read_buf13));
|
sizeof(read_buf6));
|
||||||
int num_bytes14 = read(Cookie->Serial_port_number, &read_buf14, sizeof(read_buf14));
|
int num_bytes7 = read(Cookie->Serial_port_number, &read_buf7,
|
||||||
int num_bytes15 = read(Cookie->Serial_port_number, &read_buf15, sizeof(read_buf15));
|
sizeof(read_buf7));
|
||||||
int num_bytes16 = read(Cookie->Serial_port_number, &read_buf16, sizeof(read_buf16));
|
int num_bytes8 = read(Cookie->Serial_port_number, &read_buf8,
|
||||||
int num_bytes17 = read(Cookie->Serial_port_number, &read_buf17, sizeof(read_buf17));
|
sizeof(read_buf8));
|
||||||
int num_bytes18 = read(Cookie->Serial_port_number, &read_buf18, sizeof(read_buf18));
|
int num_bytes9 = read(Cookie->Serial_port_number, &read_buf9,
|
||||||
int num_bytes19 = read(Cookie->Serial_port_number, &read_buf19, sizeof(read_buf19));
|
sizeof(read_buf9));
|
||||||
int num_bytes20 = read(Cookie->Serial_port_number, &read_buf20, sizeof(read_buf20));
|
int num_bytes10 = read(Cookie->Serial_port_number, &read_buf10,
|
||||||
int num_bytes21 = read(Cookie->Serial_port_number, &read_buf21, sizeof(read_buf21));
|
sizeof(read_buf10));
|
||||||
int num_bytes22 = read(Cookie->Serial_port_number, &read_buf22, sizeof(read_buf22));
|
int num_bytes11 = read(Cookie->Serial_port_number, &read_buf11,
|
||||||
int num_bytes23 = read(Cookie->Serial_port_number, &read_buf23, sizeof(read_buf23));
|
sizeof(read_buf11));
|
||||||
int num_bytes24 = read(Cookie->Serial_port_number, &read_buf24, sizeof(read_buf24));
|
int num_bytes12 = read(Cookie->Serial_port_number, &read_buf12,
|
||||||
int num_bytes25 = read(Cookie->Serial_port_number, &read_buf25, sizeof(read_buf25));
|
sizeof(read_buf12));
|
||||||
int num_bytes26 = read(Cookie->Serial_port_number, &read_buf26, sizeof(read_buf26));
|
int num_bytes13 = read(Cookie->Serial_port_number, &read_buf13,
|
||||||
int num_bytes27 = read(Cookie->Serial_port_number, &read_buf27, sizeof(read_buf27));
|
sizeof(read_buf13));
|
||||||
int num_bytes28 = read(Cookie->Serial_port_number, &read_buf28, sizeof(read_buf28));
|
int num_bytes14 = read(Cookie->Serial_port_number, &read_buf14,
|
||||||
int num_bytes29 = read(Cookie->Serial_port_number, &read_buf29, sizeof(read_buf29));
|
sizeof(read_buf14));
|
||||||
int num_bytes30 = read(Cookie->Serial_port_number, &read_buf30, sizeof(read_buf30));
|
int num_bytes15 = read(Cookie->Serial_port_number, &read_buf15,
|
||||||
int num_bytes31 = read(Cookie->Serial_port_number, &read_buf31, sizeof(read_buf31));
|
sizeof(read_buf15));
|
||||||
|
int num_bytes16 = read(Cookie->Serial_port_number, &read_buf16,
|
||||||
|
sizeof(read_buf16));
|
||||||
|
int num_bytes17 = read(Cookie->Serial_port_number, &read_buf17,
|
||||||
|
sizeof(read_buf17));
|
||||||
|
int num_bytes18 = read(Cookie->Serial_port_number, &read_buf18,
|
||||||
|
sizeof(read_buf18));
|
||||||
|
int num_bytes19 = read(Cookie->Serial_port_number, &read_buf19,
|
||||||
|
sizeof(read_buf19));
|
||||||
|
int num_bytes20 = read(Cookie->Serial_port_number, &read_buf20,
|
||||||
|
sizeof(read_buf20));
|
||||||
|
int num_bytes21 = read(Cookie->Serial_port_number, &read_buf21,
|
||||||
|
sizeof(read_buf21));
|
||||||
|
int num_bytes22 = read(Cookie->Serial_port_number, &read_buf22,
|
||||||
|
sizeof(read_buf22));
|
||||||
|
int num_bytes23 = read(Cookie->Serial_port_number, &read_buf23,
|
||||||
|
sizeof(read_buf23));
|
||||||
|
int num_bytes24 = read(Cookie->Serial_port_number, &read_buf24,
|
||||||
|
sizeof(read_buf24));
|
||||||
|
int num_bytes25 = read(Cookie->Serial_port_number, &read_buf25,
|
||||||
|
sizeof(read_buf25));
|
||||||
|
int num_bytes26 = read(Cookie->Serial_port_number, &read_buf26,
|
||||||
|
sizeof(read_buf26));
|
||||||
|
int num_bytes27 = read(Cookie->Serial_port_number, &read_buf27,
|
||||||
|
sizeof(read_buf27));
|
||||||
|
int num_bytes28 = read(Cookie->Serial_port_number, &read_buf28,
|
||||||
|
sizeof(read_buf28));
|
||||||
|
int num_bytes29 = read(Cookie->Serial_port_number, &read_buf29,
|
||||||
|
sizeof(read_buf29));
|
||||||
|
int num_bytes30 = read(Cookie->Serial_port_number, &read_buf30,
|
||||||
|
sizeof(read_buf30));
|
||||||
|
int num_bytes31 = read(Cookie->Serial_port_number, &read_buf31,
|
||||||
|
sizeof(read_buf31));
|
||||||
int num_bytes = num_bytes1 + num_bytes2 + num_bytes3 + num_bytes4
|
int num_bytes = num_bytes1 + num_bytes2 + num_bytes3 + num_bytes4
|
||||||
+ num_bytes5 + num_bytes6 + num_bytes7 + num_bytes8
|
+ num_bytes5 + num_bytes6 + num_bytes7 + num_bytes8 + num_bytes9
|
||||||
+ num_bytes9 + num_bytes10 + num_bytes11 + num_bytes12
|
+ num_bytes10 + num_bytes11 + num_bytes12 + num_bytes13
|
||||||
+ num_bytes13 + num_bytes14 + num_bytes15 + num_bytes16
|
+ num_bytes14 + num_bytes15 + num_bytes16 + num_bytes17
|
||||||
+ num_bytes17 + num_bytes18 + num_bytes19 + num_bytes20
|
+ num_bytes18 + num_bytes19 + num_bytes20 + num_bytes21
|
||||||
+ num_bytes21 + num_bytes22 + num_bytes23 + num_bytes24
|
+ num_bytes22 + num_bytes23 + num_bytes24 + num_bytes25
|
||||||
+ num_bytes25 + num_bytes26 + num_bytes27 + num_bytes28
|
+ num_bytes26 + num_bytes27 + num_bytes28 + num_bytes29
|
||||||
+ num_bytes29 + num_bytes30 + num_bytes31;
|
+ num_bytes30 + num_bytes31;
|
||||||
/*int num_bytes1 = read(Cookie->Serial_port_number, &read_buf1, sizeof(read_buf1));
|
|
||||||
int num_bytes2 = read(Cookie->Serial_port_number, &read_buf2, sizeof(read_buf2));
|
|
||||||
int num_bytes3 = read(Cookie->Serial_port_number, &read_buf3, sizeof(read_buf3));
|
|
||||||
int num_bytes4 = read(Cookie->Serial_port_number, &read_buf4, sizeof(read_buf4));
|
|
||||||
int num_bytes5 = read(Cookie->Serial_port_number, &read_buf5, sizeof(read_buf5));
|
|
||||||
int num_bytes6 = read(Cookie->Serial_port_number, &read_buf6, sizeof(read_buf6));
|
|
||||||
int num_bytes7 = read(Cookie->Serial_port_number, &read_buf7, sizeof(read_buf7));
|
|
||||||
int num_bytes8 = read(Cookie->Serial_port_number, &read_buf8, sizeof(read_buf8));
|
|
||||||
int num_bytes9 = read(Cookie->Serial_port_number, &read_buf9, sizeof(read_buf9));
|
|
||||||
int num_bytes10 = read(Cookie->Serial_port_number, &read_buf10, sizeof(read_buf10));
|
|
||||||
int num_bytes11 = read(Cookie->Serial_port_number, &read_buf11, sizeof(read_buf11));
|
|
||||||
int num_bytes12 = read(Cookie->Serial_port_number, &read_buf12, sizeof(read_buf12));
|
|
||||||
int num_bytes13 = read(Cookie->Serial_port_number, &read_buf13, sizeof(read_buf13));
|
|
||||||
int num_bytes14 = read(Cookie->Serial_port_number, &read_buf14, sizeof(read_buf14));
|
|
||||||
int num_bytes15 = read(Cookie->Serial_port_number, &read_buf15, sizeof(read_buf15));
|
|
||||||
int num_bytes16 = read(Cookie->Serial_port_number, &read_buf16, sizeof(read_buf16));
|
|
||||||
int num_bytes17 = read(Cookie->Serial_port_number, &read_buf17, sizeof(read_buf17));
|
|
||||||
int num_bytes18 = read(Cookie->Serial_port_number, &read_buf18, sizeof(read_buf18));
|
|
||||||
int num_bytes19 = read(Cookie->Serial_port_number, &read_buf19, sizeof(read_buf19));
|
|
||||||
int num_bytes20 = read(Cookie->Serial_port_number, &read_buf20, sizeof(read_buf20));
|
|
||||||
int num_bytes21 = read(Cookie->Serial_port_number, &read_buf21, sizeof(read_buf21));
|
|
||||||
int num_bytes = num_bytes1 + num_bytes2 + num_bytes3 + num_bytes4
|
|
||||||
+ num_bytes5 + num_bytes6 + num_bytes7 + num_bytes8
|
|
||||||
+ num_bytes9 + num_bytes10 + num_bytes11 + num_bytes12
|
|
||||||
+ num_bytes13 + num_bytes14 + num_bytes15 + num_bytes16
|
|
||||||
+ num_bytes17 + num_bytes18 + num_bytes19 + num_bytes20
|
|
||||||
+ num_bytes21;*/
|
|
||||||
|
|
||||||
// The 11 buffer arrays are here concatenated in one single vector.
|
// The 11 buffer arrays are here concatenated in one single vector.
|
||||||
std::copy(read_buf1, read_buf1 + 255, read_buf);
|
std::copy(read_buf1, read_buf1 + 255, read_buf);
|
||||||
@ -262,27 +252,6 @@ ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie,
|
|||||||
std::copy(read_buf29, read_buf29 + 255, read_buf + 28 * 255);
|
std::copy(read_buf29, read_buf29 + 255, read_buf + 28 * 255);
|
||||||
std::copy(read_buf30, read_buf30 + 255, read_buf + 29 * 255);
|
std::copy(read_buf30, read_buf30 + 255, read_buf + 29 * 255);
|
||||||
std::copy(read_buf31, read_buf31 + 90, read_buf + 30 * 255);
|
std::copy(read_buf31, read_buf31 + 90, read_buf + 30 * 255);
|
||||||
/*std::copy(read_buf1, read_buf1 + 255, read_buf);
|
|
||||||
std::copy(read_buf2, read_buf2 + 255, read_buf + 255);
|
|
||||||
std::copy(read_buf3, read_buf3 + 255, read_buf + 2 * 255);
|
|
||||||
std::copy(read_buf4, read_buf4 + 255, read_buf + 3 * 255);
|
|
||||||
std::copy(read_buf5, read_buf5 + 255, read_buf + 4 * 255);
|
|
||||||
std::copy(read_buf6, read_buf6 + 255, read_buf + 5 * 255);
|
|
||||||
std::copy(read_buf7, read_buf7 + 255, read_buf + 6 * 255);
|
|
||||||
std::copy(read_buf8, read_buf8 + 255, read_buf + 7 * 255);
|
|
||||||
std::copy(read_buf9, read_buf9 + 255, read_buf + 8 * 255);
|
|
||||||
std::copy(read_buf10, read_buf10 + 255, read_buf + 9 * 255);
|
|
||||||
std::copy(read_buf11, read_buf11 + 255, read_buf + 10 * 255);
|
|
||||||
std::copy(read_buf12, read_buf12 + 255, read_buf + 11 * 255);
|
|
||||||
std::copy(read_buf13, read_buf13 + 255, read_buf + 12 * 255);
|
|
||||||
std::copy(read_buf14, read_buf14 + 255, read_buf + 13 * 255);
|
|
||||||
std::copy(read_buf15, read_buf15 + 255, read_buf + 14 * 255);
|
|
||||||
std::copy(read_buf16, read_buf16 + 255, read_buf + 15 * 255);
|
|
||||||
std::copy(read_buf17, read_buf17 + 255, read_buf + 16 * 255);
|
|
||||||
std::copy(read_buf18, read_buf18 + 255, read_buf + 17 * 255);
|
|
||||||
std::copy(read_buf19, read_buf19 + 255, read_buf + 18 * 255);
|
|
||||||
std::copy(read_buf20, read_buf20 + 255, read_buf + 19 * 255);
|
|
||||||
std::copy(read_buf21, read_buf21 + 60, read_buf + 20 * 255);*/
|
|
||||||
|
|
||||||
// num_bytes is the number of bytes read (n=0: no bytes received, n=-1: error).
|
// num_bytes is the number of bytes read (n=0: no bytes received, n=-1: error).
|
||||||
if (num_bytes < 0) {
|
if (num_bytes < 0) {
|
||||||
@ -293,16 +262,35 @@ ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie,
|
|||||||
printf("Read %i bytes.\n", num_bytes);
|
printf("Read %i bytes.\n", num_bytes);
|
||||||
|
|
||||||
// Loop to define the adress of the buffer start
|
// Loop to define the adress of the buffer start
|
||||||
|
/*
|
||||||
|
* Here it is performed a control loop in order to ensure the identification
|
||||||
|
* of a full and not-corrupted array of measurement in the buffer defined above.
|
||||||
|
* The index related to the first byte of the array is saved in the
|
||||||
|
* variable first_index which is given as output.
|
||||||
|
* It will then will be exploited in the device handler by ScanForReply and
|
||||||
|
* InterpreteForReply.
|
||||||
|
*/
|
||||||
int first_index = 0;
|
int first_index = 0;
|
||||||
while (first_index < 7740) {
|
while (first_index < 7740) {
|
||||||
if (read_buf[first_index] == 91){
|
// start character: '['
|
||||||
|
if (read_buf[first_index] == 91) {
|
||||||
|
// fourth character: 'S' (First variable is the char [ChStr])
|
||||||
if (read_buf[first_index + 3] == 83) {
|
if (read_buf[first_index + 3] == 83) {
|
||||||
|
// first channel must be channel 1 (SPCChNumber: 1)
|
||||||
if (read_buf[first_index + 9] == 1) {
|
if (read_buf[first_index + 9] == 1) {
|
||||||
if (read_buf[first_index + 27*35 + 9] == 39) {
|
// last channel of temperature board must be channel 39 (SPCChNumber: 39)
|
||||||
if (read_buf[first_index + 27*35 + 22] == 69) {
|
if (read_buf[first_index + 27 * 35 + 9] == 39) {
|
||||||
if (read_buf[first_index + 27*45 + 91*13 + 9] == 122) {
|
// 22nd character of last channel of temperature board: 'E' ([ChEnd])
|
||||||
if (read_buf[first_index + 27*45 + 91*14 + 9] == 123) {
|
if (read_buf[first_index + 27 * 35 + 22] == 69) {
|
||||||
if (read_buf[first_index + 27*45 + 91*14 + 86] == 69) {
|
// second to last channel of orientation board must be channel 122 (SPCChNumber: 122)
|
||||||
|
if (read_buf[first_index + 27 * 45 + 91 * 13 + 9]
|
||||||
|
== 122) {
|
||||||
|
// last channel of orientation board must be channel 123 (SPCChNumber: 123)
|
||||||
|
if (read_buf[first_index + 27 * 45 + 91 * 14 + 9]
|
||||||
|
== 123) {
|
||||||
|
// 69th character of last channel of orientation board: 'E' ([ChEnd])
|
||||||
|
if (read_buf[first_index + 27 * 45 + 91 * 14
|
||||||
|
+ 86] == 69) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
first_index++;
|
first_index++;
|
||||||
@ -330,11 +318,10 @@ ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Definition of buffer array and buffer size to return after reading.
|
// Definition of buffer size and buffer array start to return after reading.
|
||||||
*size = num_bytes;
|
*size = num_bytes;
|
||||||
*buffer = &read_buf[first_index];
|
*buffer = &read_buf[first_index];
|
||||||
|
|
||||||
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Title: ArduinoComIF.h
|
* Title: ArduinoComIF.h
|
||||||
*
|
|
||||||
* Last Modify: 20/09/2021
|
|
||||||
* Author: Marco Modè
|
* Author: Marco Modè
|
||||||
|
* Last version: 24/09/2021
|
||||||
|
* Project: ESBO-DS
|
||||||
|
*
|
||||||
|
* @ brief: Used to initialize the communication Interface (USB connector, serial port) and
|
||||||
|
* to perform the 4 periodical function described in the DeviceCommunicationIF
|
||||||
|
* (child of DeviceCommunicationIF).
|
||||||
|
* In this case sendMessage, getSendSuccess and requestReceiveMessage are
|
||||||
|
* just returning RETURN_OK.
|
||||||
|
* @ details: The ArduinoComIF is instantiated in the generic factory.
|
||||||
|
* @ ingroup: mission/DeviceHandler
|
||||||
|
*-------------------------------------------------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -13,28 +22,29 @@
|
|||||||
#include <fsfw/objectmanager/SystemObject.h>
|
#include <fsfw/objectmanager/SystemObject.h>
|
||||||
#include <fsfw/ipc/MessageQueueIF.h>
|
#include <fsfw/ipc/MessageQueueIF.h>
|
||||||
#include <fsfw/tmtcservices/AcceptsTelemetryIF.h>
|
#include <fsfw/tmtcservices/AcceptsTelemetryIF.h>
|
||||||
|
#include <fsfw/serialize/SerializeAdapter.h>
|
||||||
|
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
||||||
|
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <algorithm>
|
||||||
/**
|
// Linux headers
|
||||||
* @brief Used to initialize the communication Interface (USB connector, serial port) and
|
#include <fcntl.h> // Contains file controls like O_RDWR
|
||||||
* to perform the 4 periodical function described in the DeviceCommunicationIF.
|
#include <errno.h> // Error integer and strerror() function
|
||||||
* In this case sendMessage, getSendSuccess and requestReceiveMessage are
|
#include <termios.h> // Contains POSIX terminal control definitions
|
||||||
* just returning RETURN_OK.
|
#include <unistd.h> // write(), read(), close()
|
||||||
* @details The ArduinoComIF is instantiated in the generic factory.
|
|
||||||
* @author: Marco Modè
|
|
||||||
* @ingroup mission/DeviceHandler
|
|
||||||
*/
|
|
||||||
|
|
||||||
class ArduinoComIF: public DeviceCommunicationIF, public SystemObject {
|
class ArduinoComIF: public DeviceCommunicationIF, public SystemObject {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ArduinoComIF(object_id_t objectId);
|
ArduinoComIF(object_id_t objectId);
|
||||||
virtual ~ArduinoComIF();
|
virtual ~ArduinoComIF();
|
||||||
|
|
||||||
|
// DeviceCommunicationIF inherited functions.
|
||||||
ReturnValue_t initializeInterface(CookieIF *cookie) override;
|
ReturnValue_t initializeInterface(CookieIF *cookie) override;
|
||||||
ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t *sendData,
|
ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t *sendData,
|
||||||
size_t sendLen) override;
|
size_t sendLen) override;
|
||||||
@ -44,6 +54,51 @@ public:
|
|||||||
ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer,
|
ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer,
|
||||||
size_t *size) override;
|
size_t *size) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/* The buffer array to store the data read are initialized.
|
||||||
|
* The whole data packet to be read is 2580 bytes, the limit for one reading (VMAX) is 255 bytes.
|
||||||
|
* In order to avoid problems during the acquisition of data in the framework, the buffer is set to
|
||||||
|
* be 3 times the needed dimension: 7740 bytes.
|
||||||
|
* Exploiting then some control loop, the beginning of a full and complete buffer is identified.
|
||||||
|
* Since the acquisition limit for one reading is of 255 bytes, as mentioned above,
|
||||||
|
* the reading is divided in 31 separate stages which employ 31 different buffer array.
|
||||||
|
* At the end these 31 arrays are concatenated in the main buffer array read_buf.
|
||||||
|
*/
|
||||||
|
uint8_t read_buf[7740]; // 7740 bytes from SPC serial output
|
||||||
|
// Intermediate buffers (limit for one single read call is 255 bytes)
|
||||||
|
uint8_t read_buf1[255];
|
||||||
|
uint8_t read_buf2[255];
|
||||||
|
uint8_t read_buf3[255];
|
||||||
|
uint8_t read_buf4[255];
|
||||||
|
uint8_t read_buf5[255];
|
||||||
|
uint8_t read_buf6[255];
|
||||||
|
uint8_t read_buf7[255];
|
||||||
|
uint8_t read_buf8[255];
|
||||||
|
uint8_t read_buf9[255];
|
||||||
|
uint8_t read_buf10[255];
|
||||||
|
uint8_t read_buf11[255];
|
||||||
|
uint8_t read_buf12[255];
|
||||||
|
uint8_t read_buf13[255];
|
||||||
|
uint8_t read_buf14[255];
|
||||||
|
uint8_t read_buf15[255];
|
||||||
|
uint8_t read_buf16[255];
|
||||||
|
uint8_t read_buf17[255];
|
||||||
|
uint8_t read_buf18[255];
|
||||||
|
uint8_t read_buf19[255];
|
||||||
|
uint8_t read_buf20[255];
|
||||||
|
uint8_t read_buf21[255];
|
||||||
|
uint8_t read_buf22[255];
|
||||||
|
uint8_t read_buf23[255];
|
||||||
|
uint8_t read_buf24[255];
|
||||||
|
uint8_t read_buf25[255];
|
||||||
|
uint8_t read_buf26[255];
|
||||||
|
uint8_t read_buf27[255];
|
||||||
|
uint8_t read_buf28[255];
|
||||||
|
uint8_t read_buf29[255];
|
||||||
|
uint8_t read_buf30[255];
|
||||||
|
uint8_t read_buf31[90];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_DEVICEHANDLER_ARDUINOCOMIF_H_ */
|
#endif /* MISSION_DEVICEHANDLER_ARDUINOCOMIF_H_ */
|
||||||
|
@ -1,16 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ArduinoCookie.cpp
|
* Title: ArduinoCookie.cpp
|
||||||
*
|
|
||||||
* Last Modify: 20/09/2021
|
|
||||||
* Author: Marco Modè
|
* Author: Marco Modè
|
||||||
|
* Last version: 24/09/2021
|
||||||
|
* Project: ESBO-DS
|
||||||
|
*-------------------------------------------------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <mission/DeviceHandler/ArduinoCookie.h>
|
#include <mission/DeviceHandler/ArduinoCookie.h>
|
||||||
|
|
||||||
//The cookie tells to device handler which is the device to communicate with, if more
|
/*In this case only one device is connected to the controller,
|
||||||
// devices are connected. In this case only one device, the Arduino board, is
|
* for this reason the adress is unique and there is no need
|
||||||
// connected.
|
* to define it to distinguish with others.
|
||||||
|
* The constructor is therefore empty.
|
||||||
|
*/
|
||||||
|
|
||||||
ArduinoCookie::ArduinoCookie() {
|
ArduinoCookie::ArduinoCookie() {
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* ArduinoCookie.h
|
* Title: ArduinoCookie.h
|
||||||
*
|
|
||||||
* Last Modify: 20/09/2021
|
|
||||||
* Author: Marco Modè
|
* Author: Marco Modè
|
||||||
|
* Last version: 24/09/2021
|
||||||
|
* Project: ESBO-DS
|
||||||
|
*
|
||||||
|
* @ brief: Simple cookie which initializes the variables
|
||||||
|
* for the Linux serial port.
|
||||||
|
* The cookie tells to device handler which is the device
|
||||||
|
* to communicate with, if more devices are connected.
|
||||||
|
* In this case only one device, the Arduino board, is connected.
|
||||||
|
* @ details: The ArduinoCookie is instantiated in the generic factory.
|
||||||
|
* @ ingroup: mission/DeviceHandler
|
||||||
|
*-------------------------------------------------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -12,20 +21,15 @@
|
|||||||
#include <fsfw/devicehandlers/CookieIF.h>
|
#include <fsfw/devicehandlers/CookieIF.h>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Simple cookie which initialize the variables
|
|
||||||
* for the Linux serial port.
|
|
||||||
* @details The ArduinoCookie is instantiated in the generic factory.
|
|
||||||
* @author: Marco Modè
|
|
||||||
* @ingroup mission/DeviceHandler
|
|
||||||
*/
|
|
||||||
class ArduinoCookie: public CookieIF {
|
class ArduinoCookie: public CookieIF {
|
||||||
public:
|
public:
|
||||||
ArduinoCookie();
|
ArduinoCookie();
|
||||||
virtual ~ArduinoCookie();
|
virtual ~ArduinoCookie();
|
||||||
|
|
||||||
// Serial port for the communication with Arduino board is here initialized.
|
/* Serial port for the communication with Arduino board is here initialized.
|
||||||
// It will be exploited in the ComIF to manage the computer serial port.
|
* It will be exploited in the ComIF and DH to manage the computer serial port.
|
||||||
|
*/
|
||||||
int Serial_port_number;
|
int Serial_port_number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,35 +1,31 @@
|
|||||||
/*
|
/*
|
||||||
* DeviceHandler.cpp
|
* Title: ArduinoDeviceHandler.cpp
|
||||||
*
|
|
||||||
* Last Modify: 20/09/2021
|
|
||||||
* Author: Marco Modè
|
* Author: Marco Modè
|
||||||
|
* Last version: 24/09/2021
|
||||||
|
* Project: ESBO-DS
|
||||||
|
*-------------------------------------------------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <mission/DeviceHandler/ArduinoDeviceHandler.h>
|
#include <mission/DeviceHandler/ArduinoDeviceHandler.h>
|
||||||
#include <OBSWConfig.h>
|
|
||||||
#include <fsfw/datapool/DataSet.h>
|
|
||||||
#include <fsfw/datapool/PoolVector.h>
|
|
||||||
#include <bsp_linux/fsfwconfig/datapool/dataPoolInit.h>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <map>
|
|
||||||
//#include <iostream>
|
|
||||||
|
|
||||||
|
|
||||||
ArduinoDH::ArduinoDH(object_id_t objectId, object_id_t comIF, CookieIF *cookie) :
|
ArduinoDH::ArduinoDH(object_id_t objectId, object_id_t comIF, CookieIF *cookie) :
|
||||||
DeviceHandlerBase(objectId, comIF, cookie) {
|
DeviceHandlerBase(objectId, comIF, cookie),
|
||||||
|
TempValueVec(datapool::Temperature_value, &ArduinoDataSet, PoolVariableIF::VAR_WRITE),
|
||||||
|
TempTimeVec(datapool::Temperature_Timestamp, &ArduinoDataSet, PoolVariableIF::VAR_WRITE) {
|
||||||
mode = _MODE_START_UP;
|
mode = _MODE_START_UP;
|
||||||
}
|
}
|
||||||
ArduinoDH::~ArduinoDH() {}
|
ArduinoDH::~ArduinoDH() {
|
||||||
|
}
|
||||||
|
|
||||||
void ArduinoDH::doStartUp() {
|
void ArduinoDH::doStartUp() {
|
||||||
std::cout<<"Arduino device -> Switching-ON"<<std::endl;
|
std::cout << "Arduino device -> Switching-ON" << std::endl;
|
||||||
setMode(_MODE_TO_ON);
|
setMode(_MODE_TO_ON);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArduinoDH::doShutDown() {
|
void ArduinoDH::doShutDown() {
|
||||||
std::cout<<"Arduino device -> Switching-OFF"<<std::endl;
|
std::cout << "Arduino device -> Switching-OFF" << std::endl;
|
||||||
setMode(_MODE_SHUT_DOWN);
|
setMode(_MODE_SHUT_DOWN);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -44,7 +40,7 @@ ReturnValue_t ArduinoDH::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
|||||||
void ArduinoDH::doTransition(Mode_t modeFrom, Submode_t submodeFrom) {
|
void ArduinoDH::doTransition(Mode_t modeFrom, Submode_t submodeFrom) {
|
||||||
if (mode == _MODE_TO_NORMAL) {
|
if (mode == _MODE_TO_NORMAL) {
|
||||||
setMode(_MODE_TO_NORMAL);
|
setMode(_MODE_TO_NORMAL);
|
||||||
std::cout<<"Arduino device is in Normal mode"<<std::endl;
|
std::cout << "Arduino device is in Normal mode" << std::endl;
|
||||||
} else {
|
} else {
|
||||||
setMode(_MODE_TO_NORMAL);
|
setMode(_MODE_TO_NORMAL);
|
||||||
}
|
}
|
||||||
@ -56,53 +52,40 @@ ReturnValue_t ArduinoDH::buildCommandFromCommand(
|
|||||||
return HasActionsIF::EXECUTION_FINISHED;
|
return HasActionsIF::EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArduinoDH::fillCommandAndReplyMap() {}
|
void ArduinoDH::fillCommandAndReplyMap() {
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoDH::scanForReply(const uint8_t *start, size_t len,
|
ReturnValue_t ArduinoDH::scanForReply(const uint8_t *start, size_t len,
|
||||||
DeviceCommandId_t *foundId, size_t *foundLen) {
|
DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||||
|
|
||||||
// In this case the data are sent from the Arduino board without any command.
|
/* In this case the data are sent from the Arduino board without any command.
|
||||||
// No replies of data received are required.
|
* No replies of data received are required.
|
||||||
// This function checks the validity of the data packet received.
|
* This function checks the validity of the data packet received.
|
||||||
|
*/
|
||||||
|
|
||||||
//*foundLen = 2580;
|
|
||||||
//*foundId = 0xFFFFFF; // assigned here as test
|
|
||||||
*foundLen = len;
|
*foundLen = len;
|
||||||
//DeviceCommandId_t *foundId = 0xFFFFFF;
|
// The ID is defined as a macro. It includes info about the array size.
|
||||||
std::map <DeviceCommandId_t, size_t> id {{*foundId, len}};
|
std::map<DeviceCommandId_t, size_t> id { { *foundId, len } };
|
||||||
//*foundId = id;
|
|
||||||
|
|
||||||
// check validity
|
/* Check validity of the packet in terms of length (the data have
|
||||||
if (len == *foundLen){
|
* been already checked in ArduinoComIF.cpp in order to provide the
|
||||||
// start character: '['
|
* start of the data buffer.
|
||||||
if (*start == 91 ){
|
*/
|
||||||
// fourth character: 'S' (First variable is the char [ChStr])
|
if (*foundLen == 7740) {
|
||||||
if (*(start + 3) == 83) {
|
|
||||||
// first channel must be channel 1 (SPCChNumber: 1)
|
|
||||||
if (*(start + 9) == 1) {
|
|
||||||
return APERIODIC_REPLY;
|
return APERIODIC_REPLY;
|
||||||
} else {
|
} else {
|
||||||
return DeviceHandlerIF::LENGTH_MISSMATCH;
|
return DeviceHandlerIF::LENGTH_MISSMATCH;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return DeviceHandlerIF::LENGTH_MISSMATCH;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return DeviceHandlerIF::LENGTH_MISSMATCH;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return IGNORE_REPLY_DATA;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoDH::interpretDeviceReply(DeviceCommandId_t id,
|
ReturnValue_t ArduinoDH::interpretDeviceReply(DeviceCommandId_t id,
|
||||||
const uint8_t *packet) {
|
const uint8_t *packet) {
|
||||||
|
|
||||||
DataSet ArduinoDataSet;
|
/* The data stored in the read buffer are here copied in the variables with the SPC format.
|
||||||
|
* (The structures are defined in the header)
|
||||||
//sif::debug<<"DEBUG_DH: interprete for reply"<<std::endl;
|
* The data of temperature, environment and orientation are then stored in three separated vectors.
|
||||||
// The data stored in the read buffer are here copied in the variables with the SPC format.
|
* These vectors will be then saved in the framework datapool in order to be used by the controller.
|
||||||
// After copying, the data of temperature, environment and accelerometer are stored in three separated vectors.
|
*/
|
||||||
printf(
|
printf(
|
||||||
"\n***********************************************************************************************\n");
|
"\n***********************************************************************************************\n");
|
||||||
printf("TEMPERATURE parameters are: ");
|
printf("TEMPERATURE parameters are: ");
|
||||||
@ -114,6 +97,11 @@ ReturnValue_t ArduinoDH::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
memcpy(&Temp_ch.temperature, &packet[27 * i + 11], 4);
|
memcpy(&Temp_ch.temperature, &packet[27 * i + 11], 4);
|
||||||
memcpy(&Temp_ch.Timestamp, &packet[27 * i + 15], 4);
|
memcpy(&Temp_ch.Timestamp, &packet[27 * i + 15], 4);
|
||||||
memcpy(&Temp_ch.end_string, &packet[27 * i + 19], 8);
|
memcpy(&Temp_ch.end_string, &packet[27 * i + 19], 8);
|
||||||
|
/* The data (temperature, timestamp) are here saved in the datapool.
|
||||||
|
* They will be exploited by the thermal controller.
|
||||||
|
*/
|
||||||
|
memcpy(&TempValueVec[i], &Temp_ch.temperature, 4);
|
||||||
|
memcpy(&TempTimeVec[i], &Temp_ch.Timestamp, 4);
|
||||||
// The data are here printed (useful for tests).
|
// The data are here printed (useful for tests).
|
||||||
printf("\n\nStart: %7s", Temp_ch.start_string);
|
printf("\n\nStart: %7s", Temp_ch.start_string);
|
||||||
printf("\nTyp: %u", Temp_ch.Typ);
|
printf("\nTyp: %u", Temp_ch.Typ);
|
||||||
@ -124,7 +112,13 @@ ReturnValue_t ArduinoDH::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
printf("\nEnd: %7s", Temp_ch.end_string);
|
printf("\nEnd: %7s", Temp_ch.end_string);
|
||||||
vecTemp.emplace_back(Temp_ch);
|
vecTemp.emplace_back(Temp_ch);
|
||||||
}
|
}
|
||||||
printf(
|
ArduinoDataSet.commit(PoolVariableIF::VALID);
|
||||||
|
/* The environment and orientation data reading and printing
|
||||||
|
* are currently commented out because they are not needed.
|
||||||
|
* Anyway they are available and they can be used if necessary.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*printf(
|
||||||
"\n\n***********************************************************************************************\n");
|
"\n\n***********************************************************************************************\n");
|
||||||
printf("ENVIRONMENTAL parameters are: ");
|
printf("ENVIRONMENTAL parameters are: ");
|
||||||
for (int j = 0; j < 9; j++) {
|
for (int j = 0; j < 9; j++) {
|
||||||
@ -136,13 +130,11 @@ ReturnValue_t ArduinoDH::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
memcpy(&Env_ch.Timestamp, &packet[27 * (36 + j) + 15], 4);
|
memcpy(&Env_ch.Timestamp, &packet[27 * (36 + j) + 15], 4);
|
||||||
memcpy(&Env_ch.end_string, &packet[27 * (36 + j) + 19], 8);
|
memcpy(&Env_ch.end_string, &packet[27 * (36 + j) + 19], 8);
|
||||||
// The data are here printed (useful for tests).
|
// The data are here printed (useful for tests).
|
||||||
if (j == 0 || j == 3 || j == 6){
|
if (j == 0 || j == 3 || j == 6) {
|
||||||
printf("\n\nHUMIDITY: ");
|
printf("\n\nHUMIDITY: ");
|
||||||
}
|
} else if (j == 1 || j == 4 || j == 7) {
|
||||||
else if (j == 1 || j == 4 || j == 7) {
|
|
||||||
printf("\n\nPRESSURE: ");
|
printf("\n\nPRESSURE: ");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
printf("\n\nTEMPERATURE: ");
|
printf("\n\nTEMPERATURE: ");
|
||||||
}
|
}
|
||||||
printf("\n\nStart: %7s", Env_ch.start_string);
|
printf("\n\nStart: %7s", Env_ch.start_string);
|
||||||
@ -183,13 +175,11 @@ ReturnValue_t ArduinoDH::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
printf("\n\nEULER ANGLES: ");
|
printf("\n\nEULER ANGLES: ");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (k == 0 || k == 3 || k == 6 || k == 9 || k == 12){
|
if (k == 0 || k == 3 || k == 6 || k == 9 || k == 12) {
|
||||||
printf("\n\nX ==> ");
|
printf("\n\nX ==> ");
|
||||||
}
|
} else if (k == 1 || k == 4 || k == 7 || k == 10 || k == 13) {
|
||||||
else if (k == 1 || k == 4 || k == 7 || k == 10 || k == 13) {
|
|
||||||
printf("\n\nY ==> ");
|
printf("\n\nY ==> ");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
printf("\n\nZ ==> ");
|
printf("\n\nZ ==> ");
|
||||||
}
|
}
|
||||||
printf("\nStart: %7s", Ornt_ch.start_string);
|
printf("\nStart: %7s", Ornt_ch.start_string);
|
||||||
@ -207,54 +197,8 @@ ReturnValue_t ArduinoDH::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
|
|
||||||
std::cout << "\n\nEnd reading data.\n" << std::endl;
|
std::cout << "\n\nEnd reading data.\n" << std::endl;
|
||||||
|
|
||||||
// The data are here written to the data pool where they would be available to be used for other objects
|
|
||||||
|
|
||||||
/*PoolVector <float, 36> TempValueVec(datapool::Temperature_value, &ArduinoDataSet, PoolVariableIF::VAR_WRITE);
|
|
||||||
for (int i = 0; i < 36; i++) {
|
|
||||||
memcpy(&TempValueVec[i], &vecTemp[i].temperature, 4);
|
|
||||||
}
|
|
||||||
ArduinoDataSet.commit(PoolVariableIF::VALID);*/
|
|
||||||
|
|
||||||
|
|
||||||
/*PoolVector <unsigned int, 36> TempTimeVec(datapool::Temperature_Timestamp, &ArduinoDataSet, PoolVariableIF::VAR_WRITE);
|
|
||||||
for (int i = 0; i < 36; i++) {
|
|
||||||
memcpy(&TempTimeVec[i], &vecTemp[i].Timestamp, 4);
|
|
||||||
}
|
|
||||||
ArduinoDataSet.commit(PoolVariableIF::VALID);
|
|
||||||
|
|
||||||
sif::debug<<"\nDEBUG_DHi: End of copy to datapool"<<std::endl;
|
|
||||||
|
|
||||||
PoolVector <float, 9> EnvValueVec(datapool::Environmental_value, &ArduinoDataSet, PoolVariableIF::VAR_WRITE);
|
|
||||||
for (int j = 0; j < 9; j++) {
|
|
||||||
memcpy(&EnvValueVec[j], &vecEnv[j].Value, 4);
|
|
||||||
}
|
|
||||||
ArduinoDataSet.commit(PoolVariableIF::VALID);
|
|
||||||
|
|
||||||
PoolVector <unsigned int, 9> EnvTimeVec(datapool::Environmental_Timestamp, &ArduinoDataSet, PoolVariableIF::VAR_WRITE);
|
|
||||||
for (int j = 0; j < 9; j++) {
|
|
||||||
memcpy(&EnvTimeVec[j], &vecEnv[j].Timestamp, 4);
|
|
||||||
}
|
|
||||||
ArduinoDataSet.commit(PoolVariableIF::VALID);
|
|
||||||
|
|
||||||
sif::debug<<"\nDEBUG_DHj: End of copy to datapool"<<std::endl;
|
|
||||||
|
|
||||||
PoolVector <float, 15> AccValueVec(datapool::Accelerometer_value, &ArduinoDataSet, PoolVariableIF::VAR_WRITE);
|
|
||||||
for (int k = 0; k < 15; k++) {
|
|
||||||
memcpy(&AccValueVec[k], &vecOrnt[k].Value, 36);
|
|
||||||
}
|
|
||||||
ArduinoDataSet.commit(PoolVariableIF::VALID);
|
|
||||||
sif::debug<<"\nDEBUG_DHk1: End of copy to datapool"<<std::endl;
|
|
||||||
|
|
||||||
PoolVector <unsigned int, 15> AccTimeVec(datapool::Accelerometer_Timestamp, &ArduinoDataSet, PoolVariableIF::VAR_WRITE);
|
|
||||||
for (int k = 0; k < 15; k++) {
|
|
||||||
memcpy(&AccTimeVec[k], &vecOrnt[k].Timestamp, 36);
|
|
||||||
}
|
|
||||||
ArduinoDataSet.commit(PoolVariableIF::VALID);
|
|
||||||
sif::debug<<"\nDEBUG_DHk2: End of copy to datapool"<<std::endl;*/
|
|
||||||
|
|
||||||
sif::debug<<"DEBUG_DH: End of copy to datapool"<<std::endl;
|
|
||||||
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArduinoDH::setNormalDatapoolEntriesInvalid() {}
|
void ArduinoDH::setNormalDatapoolEntriesInvalid() {
|
||||||
|
}
|
||||||
|
@ -1,28 +1,85 @@
|
|||||||
/*
|
/*
|
||||||
* DeviceHandler.h
|
* Title: ArduinoDeviceHandler.h
|
||||||
*
|
|
||||||
* Last Modify: 20/09/2021
|
|
||||||
* Author: Marco Modè
|
* Author: Marco Modè
|
||||||
|
* Last version: 24/09/2021
|
||||||
|
* Project: ESBO-DS
|
||||||
|
*
|
||||||
|
* @ brief: Basic device handler to manage the communication with the Arduino sensor board.
|
||||||
|
* The data are sent to the serial port of the computer from the Arduino board.
|
||||||
|
* The device handler read and manages these data exploiting the ComIF and the
|
||||||
|
* DeviceHandlerBase functions.
|
||||||
|
* @ details: The ArduinoDH object is instantiated in the generic factory.
|
||||||
|
* @ author: Marco Modè
|
||||||
|
* @ ingroup: mission/DeviceHandler
|
||||||
|
*-------------------------------------------------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The structure of data sent is in SPC format, required by the
|
||||||
|
* On-Board Computer.
|
||||||
|
* The structure format is defined below in the class.
|
||||||
|
*
|
||||||
|
* Hereafter, the sensor boards connected to the Arduino Micro are described
|
||||||
|
* with board name, associated pin on the Arduino board and related channels.
|
||||||
|
* This is done to give a clearer understanding of the reading process.
|
||||||
|
*
|
||||||
|
* TEMPERATURE DATA - STRUCTURE
|
||||||
|
* TMB 1, SS = pin 4
|
||||||
|
* Temperature Temp_ch1; Temperature Temp_ch2; Temperature Temp_ch3;
|
||||||
|
* Temperature Temp_ch4; Temperature Temp_ch5; Temperature Temp_ch6;
|
||||||
|
* Temperature Temp_ch7; Temperature Temp_ch8; Temperature Temp_ch9;
|
||||||
|
* TMB 2, SS = pin 5
|
||||||
|
* Temperature Temp_ch11; Temperature Temp_ch12; Temperature Temp_ch13;
|
||||||
|
* Temperature Temp_ch14; Temperature Temp_ch15; Temperature Temp_ch16;
|
||||||
|
* Temperature Temp_ch17; Temperature Temp_ch18; Temperature Temp_ch19;
|
||||||
|
* TMB 3, SS = pin 6
|
||||||
|
* Temperature Temp_ch21; Temperature Temp_ch22; Temperature Temp_ch23;
|
||||||
|
* Temperature Temp_ch24; Temperature Temp_ch25; Temperature Temp_ch26;
|
||||||
|
* Temperature Temp_ch27; Temperature Temp_ch28; Temperature Temp_ch29;
|
||||||
|
* TMB 4, SS = pin 7
|
||||||
|
* Temperature Temp_ch31; Temperature Temp_ch32; Temperature Temp_ch33;
|
||||||
|
* Temperature Temp_ch34; Temperature Temp_ch35; Temperature Temp_ch36;
|
||||||
|
* Temperature Temp_ch37; Temperature Temp_ch38; Temperature Temp_ch39;
|
||||||
|
*
|
||||||
|
* ENVIRONMENTAL DATA - STRUCTURE
|
||||||
|
* BME280_1, SS = pin 8 (pressure, humidity, temperature)
|
||||||
|
* Environmental Env_ch41; Environmental Env_ch42; Environmental Env_ch43;
|
||||||
|
* BME280_2, SS = pin 9 (pressure, humidity, temperature)
|
||||||
|
* Environmental Env_ch51; Environmental Env_ch52; Environmental Env_ch53;
|
||||||
|
* BME280_3, SS = pin 10 (pressure, humidity, temperature)
|
||||||
|
* Environmental Env_ch61; Environmental Env_ch62; Environmental Env_ch63;
|
||||||
|
*
|
||||||
|
* ORIENTATION DATA - STRUCTURE
|
||||||
|
* BNO055_1
|
||||||
|
* ACCELERATION
|
||||||
|
* Orientation Ornt_ch81; Orientation Ornt_ch82; Orientation Ornt_ch83;
|
||||||
|
* GYROSCOPE
|
||||||
|
* Orientation Ornt_ch91; Orientation Ornt_ch92; Orientation Ornt_ch93;
|
||||||
|
* MAGNETOMETER
|
||||||
|
* Orientation Ornt_ch101; Orientation Ornt_ch102; Orientation Ornt_ch103;
|
||||||
|
* LINEAR ACCELERATION
|
||||||
|
* Orientation Ornt_ch111; Orientation Ornt_ch112; Orientation Ornt_ch113;
|
||||||
|
* EULER ANGLES
|
||||||
|
* Orientation Ornt_ch121; Orientation Ornt_ch122; Orientation Ornt_ch123;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MISSION_DEVICEHANDLER_ARDUINODEVICEHANDLER_H_
|
#ifndef MISSION_DEVICEHANDLER_ARDUINODEVICEHANDLER_H_
|
||||||
#define MISSION_DEVICEHANDLER_ARDUINODEVICEHANDLER_H_
|
#define MISSION_DEVICEHANDLER_ARDUINODEVICEHANDLER_H_
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||||
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||||
#include <fsfw/timemanager/Countdown.h>
|
#include <fsfw/timemanager/Countdown.h>
|
||||||
|
#include <fsfw/datapool/DataSet.h>
|
||||||
|
#include <fsfw/datapool/PoolVector.h>
|
||||||
|
#include <bsp_linux/fsfwconfig/datapool/dataPoolInit.h>
|
||||||
|
#include <OBSWConfig.h>
|
||||||
|
#include <vector>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Basic device handler to manage the communication with the Arduino sensor board.
|
|
||||||
* The data are sent to the serial port of the computer from the Arduino board.
|
|
||||||
* The device handler read and manages these data exploiting the ComIF and the
|
|
||||||
* DeviceHandlerBase functions.
|
|
||||||
* @details The ArduinoDH object is instantiated in the generic factory.
|
|
||||||
* @author Marco Modè
|
|
||||||
* @ingroup mission/DeviceHandler
|
|
||||||
*/
|
|
||||||
class ArduinoDH: public DeviceHandlerBase {
|
class ArduinoDH: public DeviceHandlerBase {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -31,13 +88,18 @@ public:
|
|||||||
* @param comIF The ID of the Communication IF used by test device handler.
|
* @param comIF The ID of the Communication IF used by test device handler.
|
||||||
* @param cookie Cookie object used by the test device handler. This is
|
* @param cookie Cookie object used by the test device handler. This is
|
||||||
* also used and passed to the comIF object.
|
* also used and passed to the comIF object.
|
||||||
* @param onImmediately This will start a transition to MODE_ON immediately
|
|
||||||
* so the device handler jumps into #doStartUp. Should only be used
|
|
||||||
* in development to reduce need of commanding while debugging.
|
|
||||||
*/
|
*/
|
||||||
ArduinoDH(object_id_t objectId, object_id_t comIF, CookieIF *cookie);
|
ArduinoDH(object_id_t objectId, object_id_t comIF, CookieIF *cookie);
|
||||||
virtual ~ ArduinoDH();
|
virtual ~ ArduinoDH();
|
||||||
|
|
||||||
|
/* This header code contains the definition of the structures of data
|
||||||
|
* (Temperature, Environemntal, Orientation) in which the sensors data are stored.
|
||||||
|
* These structures are defined in the Arduino IDE code developed for the sensor board.
|
||||||
|
* The Arduino is the responsible of the management of sensors devices and data.
|
||||||
|
* Furthermore, the vectors and arrays necessary for the code execution are here
|
||||||
|
* defined.
|
||||||
|
*/
|
||||||
|
|
||||||
/* Definiton of data structure for SPC communication. Three different structures are defined for measurements of:
|
/* Definiton of data structure for SPC communication. Three different structures are defined for measurements of:
|
||||||
* - Temperature data,
|
* - Temperature data,
|
||||||
* - Environmental data,
|
* - Environmental data,
|
||||||
@ -99,26 +161,26 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Three vectors are defined to store the three type of classes sequentially
|
/* Three vectors are defined to store the three type of classes sequentially
|
||||||
// during the phase of reading copying data from the buffers
|
* during the phase of reading copying data from the buffers
|
||||||
|
*/
|
||||||
std::vector<Temperature> vecTemp;
|
std::vector<Temperature> vecTemp;
|
||||||
std::vector<Environmental> vecEnv;
|
std::vector<Environmental> vecEnv;
|
||||||
std::vector<Orientation> vecOrnt;
|
std::vector<Orientation> vecOrnt;
|
||||||
|
|
||||||
// Three dummy child structures are defined. They are used to store the three
|
/* Three dummy child structures are defined. They are used to store the three
|
||||||
// different types of data during the measurement loop and then the data are
|
* different types of data during the measurement loop and then the data are
|
||||||
// copied in the vectors above.
|
* copied in the vectors above.
|
||||||
// Then, they are overwritten by the data of next iteration and the process is
|
* Then, they are overwritten by the data of next iteration and the process is
|
||||||
// repeated ,until all the data from the buffer are copied to the three vectors
|
* repeated ,until all the data from the buffer are copied to the three vectors
|
||||||
// using the three different structures.
|
* using the three different structures.
|
||||||
|
*/
|
||||||
Temperature Temp_ch;
|
Temperature Temp_ch;
|
||||||
Environmental Env_ch;
|
Environmental Env_ch;
|
||||||
Orientation Ornt_ch;
|
Orientation Ornt_ch;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//#define BUFFER_ID(id, value, msg);
|
|
||||||
|
|
||||||
// DeviceHandlerBase inherited functions.
|
// DeviceHandlerBase inherited functions.
|
||||||
virtual void doStartUp() override;
|
virtual void doStartUp() override;
|
||||||
virtual void doShutDown() override;
|
virtual void doShutDown() override;
|
||||||
@ -137,6 +199,11 @@ protected:
|
|||||||
const uint8_t *packet) override;
|
const uint8_t *packet) override;
|
||||||
virtual void setNormalDatapoolEntriesInvalid() override;
|
virtual void setNormalDatapoolEntriesInvalid() override;
|
||||||
|
|
||||||
|
// Dataset initialized. It is used for copying the data to the datapool.
|
||||||
|
DataSet ArduinoDataSet;
|
||||||
|
// Here the datapool variables are defined. The needed data will be stored inside them.
|
||||||
|
PoolVector <float, 36> TempValueVec;
|
||||||
|
PoolVector <unsigned int, 36> TempTimeVec;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_DEVICEHANDLER_ARDUINODEVICEHANDLER_H_ */
|
#endif /* MISSION_DEVICEHANDLER_ARDUINODEVICEHANDLER_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user