eive-obsw/bsp_q7s/devices/StrImageLoader.h

57 lines
1.8 KiB
C
Raw Normal View History

2021-11-30 16:01:02 +01:00
#ifndef BSP_Q7S_DEVICES_STRIMAGELOADER_H_
#define BSP_Q7S_DEVICES_STRIMAGELOADER_H_
#include <string>
#include "fsfw/osal/linux/BinarySemaphore.h"
#include "bsp_q7s/memory/SdCardManager.h"
/**
* @brief An object of this class runs in a separate task and is responsible for uploading and
* downloading images to/from the star tracker. This is required because uploading and
* downloading via the star tracker handler takes a lot of time because each upload or
* download packet can transport a maximum of 1024 bytes.
*/
class StrImageLoader: public SystemObject, public ExecutableObjectIF {
public:
StrImageLoader(object_id_t objectId);
virtual ~StrImageLoader();
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
void setComIF(DeviceCommunicationIF* communicationInterface_);
void setComCookie(CookieIF* comCookie_);
private:
static const uint8_t INTERFACE_ID = CLASS_ID::STR_IMG_LOADER;
//! [EXPORT] : [COMMENT] SD card specified in path string not mounted
static const ReturnValue_t SD_NOT_MOUNTED = MAKE_RETURN_CODE(0xA0);
//! [EXPORT] : [COMMENT] Specified file does not exist on filesystem
static const ReturnValue_t FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xA1);
enum class InternalState {
IDLE,
UPLOAD_IMAGE,
DOWNLOAD_IMAGE
};
InternalState internalState = InternalState::IDLE;
BinarySemaphore semaphore;
// Absolute path and name to image to upload
std::string uploadImage;
SdCardManager* sdcMan = nullptr;
/**
* Communication object responsible for low level access of star tracker
* Must be set by star tracker handler
*/
DeviceCommunicationIF * communicationInterface = nullptr;
};
#endif /* BSP_Q7S_DEVICES_STRIMAGELOADER_H_ */