add uart reception handler
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
2023-03-21 20:35:28 +01:00
parent 24fb8e34f2
commit 0256824e37
14 changed files with 490 additions and 422 deletions

View File

@ -3,19 +3,19 @@
#include <fsfw/datapool/PoolReadGuard.h>
#include <linux/devices/startracker/StarTrackerJsonCommands.h>
#include <linux/devices/startracker/StrComHandler.h>
#include <thread>
#include "ArcsecDatalinkLayer.h"
#include "ArcsecJsonParamBase.h"
#include "OBSWConfig.h"
#include "StrHelper.h"
#include "arcsec/common/SLIP.h"
#include "devices/powerSwitcherList.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
#include "fsfw/src/fsfw/serialize/SerializeAdapter.h"
#include "fsfw/timemanager/Countdown.h"
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
#include "thirdparty/arcsec_star_tracker/common/SLIP.h"
/**
* @brief This is the device handler for the star tracker from arcsec.
@ -38,7 +38,8 @@ class StarTrackerHandler : public DeviceHandlerBase {
* to high to enable the device.
*/
StarTrackerHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
const char* jsonFileStr, StrHelper* strHelper, power::Switch_t powerSwitch);
const char* jsonFileStr, StrComHandler* strHelper,
power::Switch_t powerSwitch);
virtual ~StarTrackerHandler();
ReturnValue_t initialize() override;
@ -149,14 +150,14 @@ class StarTrackerHandler : public DeviceHandlerBase {
static const size_t MAX_PATH_SIZE = 50;
static const size_t MAX_FILE_NAME = 30;
static const uint8_t STATUS_OFFSET = 1;
static const uint8_t PARAMS_OFFSET = 1;
static const uint8_t TICKS_OFFSET = 2;
static const uint8_t TIME_OFFSET = 6;
static const uint8_t TM_DATA_FIELD_OFFSET = 14;
static const uint8_t PARAMETER_ID_OFFSET = 0;
static const uint8_t ACTION_ID_OFFSET = 0;
static const uint8_t ACTION_DATA_OFFSET = 2;
static const uint8_t STATUS_OFFSET = 2;
static const uint8_t PARAMS_OFFSET = 2;
static const uint8_t TICKS_OFFSET = 3;
static const uint8_t TIME_OFFSET = 7;
static const uint8_t PARAMETER_ID_OFFSET = 1;
static const uint8_t ACTION_ID_OFFSET = 1;
static const uint8_t ACTION_DATA_OFFSET = 3;
// Ping request will reply ping with this ID (data field)
static const uint32_t PING_ID = 0x55;
static const uint32_t BOOT_REGION_ID = 1;
@ -184,7 +185,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
MessageQueueIF* eventQueue = nullptr;
ArcsecDatalinkLayer dataLinkLayer;
// ArcsecDatalinkLayer dataLinkLayer;
startracker::TemperatureSet temperatureSet;
startracker::VersionSet versionSet;
@ -210,7 +211,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
startracker::DebugCameraSet debugCameraSet;
// Pointer to object responsible for uploading and downloading images to/from the star tracker
StrHelper* strHelper = nullptr;
StrComHandler* strHelper = nullptr;
uint8_t commandBuffer[startracker::MAX_FRAME_SIZE];
@ -312,10 +313,10 @@ class StarTrackerHandler : public DeviceHandlerBase {
*/
void slipInit();
ReturnValue_t scanForActionReply(DeviceCommandId_t* foundId);
ReturnValue_t scanForSetParameterReply(DeviceCommandId_t* foundId);
ReturnValue_t scanForGetParameterReply(DeviceCommandId_t* foundId);
ReturnValue_t scanForTmReply(DeviceCommandId_t* foundId);
ReturnValue_t scanForActionReply(uint8_t replyId, DeviceCommandId_t* foundId);
ReturnValue_t scanForSetParameterReply(uint8_t replyId, DeviceCommandId_t* foundId);
ReturnValue_t scanForGetParameterReply(uint8_t replyId, DeviceCommandId_t* foundId);
ReturnValue_t scanForTmReply(uint8_t replyId, DeviceCommandId_t* foundId);
/**
* @brief Fills command buffer with data to ping the star tracker
@ -437,12 +438,13 @@ class StarTrackerHandler : public DeviceHandlerBase {
/**
* @brief Handles action replies with datasets.
*/
ReturnValue_t handleActionReplySet(LocalPoolDataSetBase& dataset, size_t size);
ReturnValue_t handleActionReplySet(const uint8_t* rawFrame, LocalPoolDataSetBase& dataset,
size_t size);
/**
* @brief Default function to handle action replies
*/
ReturnValue_t handleActionReply();
ReturnValue_t handleActionReply(const uint8_t* rawFrame);
/**
* @brief Handles reply to upload centroid command
@ -452,16 +454,17 @@ class StarTrackerHandler : public DeviceHandlerBase {
/**
* @brief Handles reply to checksum command
*/
ReturnValue_t handleChecksumReply();
ReturnValue_t handleChecksumReply(const uint8_t* rawFrame);
/**
* @brief Handles all set parameter replies
*/
ReturnValue_t handleSetParamReply();
ReturnValue_t handleSetParamReply(const uint8_t* rawFrame);
ReturnValue_t handlePingReply();
ReturnValue_t handlePingReply(const uint8_t* rawFrame);
ReturnValue_t handleParamRequest(LocalPoolDataSetBase& dataset, size_t size);
ReturnValue_t handleParamRequest(const uint8_t* rawFrame, LocalPoolDataSetBase& dataset,
size_t size);
/**
* @brief Checks the loaded program by means of the version set
@ -481,7 +484,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
*
* @return returnvalue::OK if successful, otherwise error return value
*/
ReturnValue_t handleTm(LocalPoolDataSetBase& dataset, size_t size);
ReturnValue_t handleTm(const uint8_t* rawFrame, LocalPoolDataSetBase& dataset, size_t size);
/**
* @brief Checks if star tracker is in valid mode for executing the received command.