flash read command
This commit is contained in:
parent
76f840f137
commit
8cddbf86d9
@ -1009,11 +1009,11 @@ ReturnValue_t StarTrackerHandler::executeReadCommand(const uint8_t* commandData,
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uint16_t length;
|
uint32_t length;
|
||||||
size = sizeof(length);
|
size = sizeof(length);
|
||||||
const uint8_t* lengthPtr = commandData + ReadCmd::LENGTH_OFFSET;
|
const uint8_t* lengthPtr = commandData + ReadCmd::LENGTH_OFFSET;
|
||||||
result = SerializeAdapter::deSerialize(&address, lengthPtr, &size,
|
result = SerializeAdapter::deSerialize(&length, lengthPtr, &size,
|
||||||
SerializeIF::Endianness::LITTLE);
|
SerializeIF::Endianness::BIG);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::debug << "StarTrackerHandler::executeReadCommand: Deserialization of length failed"
|
sif::debug << "StarTrackerHandler::executeReadCommand: Deserialization of length failed"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
@ -151,9 +151,9 @@ private:
|
|||||||
public:
|
public:
|
||||||
static const uint8_t ADDRESS_OFFSET = 1;
|
static const uint8_t ADDRESS_OFFSET = 1;
|
||||||
static const uint8_t LENGTH_OFFSET = 5;
|
static const uint8_t LENGTH_OFFSET = 5;
|
||||||
static const uint8_t FILE_OFFSET = 7;
|
static const uint8_t FILE_OFFSET = 9;
|
||||||
// Minimum length of a read command (region, address, length and filename)
|
// Minimum length of a read command (region, address, length and filename)
|
||||||
static const size_t MIN_LENGTH = 9;
|
static const size_t MIN_LENGTH = 11;
|
||||||
};
|
};
|
||||||
|
|
||||||
class UnlockCmd {
|
class UnlockCmd {
|
||||||
|
@ -154,14 +154,14 @@ ReturnValue_t StrHelper::startFlashWrite(std::string flashWriteFile_, uint8_t re
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StrHelper::startFlashRead(std::string flashReadFile_, uint8_t region,
|
ReturnValue_t StrHelper::startFlashRead(std::string flashReadPath_, uint8_t region,
|
||||||
uint32_t address, uint16_t length) {
|
uint32_t address, uint32_t length) {
|
||||||
ReturnValue_t result = checkPath(flashReadFile_);
|
ReturnValue_t result = checkPath(flashReadPath_);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
flashReadFile = flashReadFile_;
|
flashReadPath = flashReadPath_;
|
||||||
if(not std::filesystem::exists(flashReadFile)) {
|
if(not std::filesystem::exists(flashReadPath)) {
|
||||||
return FILE_NOT_EXISTS;
|
return FILE_NOT_EXISTS;
|
||||||
}
|
}
|
||||||
flashReadAddress = address;
|
flashReadAddress = address;
|
||||||
@ -456,14 +456,13 @@ ReturnValue_t StrHelper::checkReply() {
|
|||||||
if (type != TMTC_ACTIONREPLY) {
|
if (type != TMTC_ACTIONREPLY) {
|
||||||
sif::warning << "StrHelper::checkReply: Received reply with invalid type ID"
|
sif::warning << "StrHelper::checkReply: Received reply with invalid type ID"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
triggerEvent(INVALID_TYPE_ID);
|
return INVALID_TYPE_ID;
|
||||||
return RETURN_FAILED;
|
|
||||||
}
|
}
|
||||||
uint8_t status = datalinkLayer.getStatusField();
|
uint8_t status = datalinkLayer.getStatusField();
|
||||||
if (status != ArcsecDatalinkLayer::STATUS_OK) {
|
if (status != ArcsecDatalinkLayer::STATUS_OK) {
|
||||||
triggerEvent(STATUS_ERROR);
|
sif::warning << "StrHelper::checkReply: Status failure: "
|
||||||
sif::warning << "StrHelper::checkReply: Status failure" << std::endl;
|
<< static_cast<unsigned int>(status) << std::endl;
|
||||||
return RETURN_FAILED;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
@ -511,7 +510,7 @@ ReturnValue_t StrHelper::checkFlashActionReply(uint8_t region_, uint32_t address
|
|||||||
if (address != address_) {
|
if (address != address_) {
|
||||||
return ADDRESS_MISMATCH;
|
return ADDRESS_MISMATCH;
|
||||||
}
|
}
|
||||||
if (region != length_) {
|
if (length != length_) {
|
||||||
return LENGTH_MISMATCH;
|
return LENGTH_MISMATCH;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
|
@ -51,28 +51,24 @@ public:
|
|||||||
//! [EXPORT] : [COMMENT] Star tracker did not send replies (maybe device is powered off)
|
//! [EXPORT] : [COMMENT] Star tracker did not send replies (maybe device is powered off)
|
||||||
//!P1: Position of upload or download packet for which no reply was sent
|
//!P1: Position of upload or download packet for which no reply was sent
|
||||||
static const Event STR_HELPER_NO_REPLY = MAKE_EVENT(10, severity::LOW);
|
static const Event STR_HELPER_NO_REPLY = MAKE_EVENT(10, severity::LOW);
|
||||||
//! [EXPORT] : [COMMENT] Received reply with invalid type ID
|
|
||||||
static const Event INVALID_TYPE_ID = MAKE_EVENT(11, severity::LOW);
|
|
||||||
//! [EXPORT] : [COMMENT] Status field in reply signals error
|
|
||||||
static const Event STATUS_ERROR = MAKE_EVENT(12, severity::LOW);
|
|
||||||
//! [EXPORT] : [COMMENT] Error during decoding of received reply occurred
|
//! [EXPORT] : [COMMENT] Error during decoding of received reply occurred
|
||||||
//P1: Return value of decoding function
|
//P1: Return value of decoding function
|
||||||
//P2: Position of upload/download packet, or address of flash write/read request
|
//P2: Position of upload/download packet, or address of flash write/read request
|
||||||
static const Event STR_HELPER_DEC_ERROR = MAKE_EVENT(13, severity::LOW);
|
static const Event STR_HELPER_DEC_ERROR = MAKE_EVENT(11, severity::LOW);
|
||||||
//! [EXPORT] : [COMMENT] Position mismatch
|
//! [EXPORT] : [COMMENT] Position mismatch
|
||||||
//! P1: The expected position and thus the position for which the image upload/download failed
|
//! P1: The expected position and thus the position for which the image upload/download failed
|
||||||
static const Event POSITION_MISMATCH = MAKE_EVENT(14, severity::LOW);
|
static const Event POSITION_MISMATCH = MAKE_EVENT(12, severity::LOW);
|
||||||
//! [EXPORT] : [COMMENT] Specified file does not exist
|
//! [EXPORT] : [COMMENT] Specified file does not exist
|
||||||
//!P1: Internal state of str helper
|
//!P1: Internal state of str helper
|
||||||
static const Event STR_HELPER_FILE_NOT_EXISTS = MAKE_EVENT(15, severity::LOW);
|
static const Event STR_HELPER_FILE_NOT_EXISTS = MAKE_EVENT(13, severity::LOW);
|
||||||
//! [EXPORT] : [COMMENT] Sending packet to star tracker failed
|
//! [EXPORT] : [COMMENT] Sending packet to star tracker failed
|
||||||
//!P1: Return code of communication interface sendMessage function
|
//!P1: Return code of communication interface sendMessage function
|
||||||
//!P2: Position of upload/download packet, or address of flash write/read request for which sending failed
|
//!P2: Position of upload/download packet, or address of flash write/read request for which sending failed
|
||||||
static const Event STR_HELPER_SENDING_PACKET_FAILED = MAKE_EVENT(16, severity::LOW);
|
static const Event STR_HELPER_SENDING_PACKET_FAILED = MAKE_EVENT(14, severity::LOW);
|
||||||
//! [EXPORT] : [COMMENT] Communication interface requesting reply failed
|
//! [EXPORT] : [COMMENT] Communication interface requesting reply failed
|
||||||
//!P1: Return code of failed request
|
//!P1: Return code of failed request
|
||||||
//!P1: Upload/download position, or address of flash write/read request for which transmission failed
|
//!P1: Upload/download position, or address of flash write/read request for which transmission failed
|
||||||
static const Event STR_HELPER_REQUESTING_MSG_FAILED = MAKE_EVENT(17, severity::LOW);
|
static const Event STR_HELPER_REQUESTING_MSG_FAILED = MAKE_EVENT(15, severity::LOW);
|
||||||
|
|
||||||
StrHelper(object_id_t objectId);
|
StrHelper(object_id_t objectId);
|
||||||
virtual ~StrHelper();
|
virtual ~StrHelper();
|
||||||
@ -116,8 +112,8 @@ public:
|
|||||||
* @param flashWriteAddress Start address of flash section to read
|
* @param flashWriteAddress Start address of flash section to read
|
||||||
* @param length Number of bytes to read from flash
|
* @param length Number of bytes to read from flash
|
||||||
*/
|
*/
|
||||||
ReturnValue_t startFlashRead(std::string flashReadFile_, uint8_t region,
|
ReturnValue_t startFlashRead(std::string flashReadPath_, uint8_t region,
|
||||||
uint32_t address, uint16_t length);
|
uint32_t address, uint32_t length);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Can be used to interrupt a running data transfer.
|
* @brief Can be used to interrupt a running data transfer.
|
||||||
@ -152,6 +148,10 @@ private:
|
|||||||
static const ReturnValue_t ADDRESS_MISMATCH = MAKE_RETURN_CODE(0xA5);
|
static const ReturnValue_t ADDRESS_MISMATCH = MAKE_RETURN_CODE(0xA5);
|
||||||
//! [EXPORT] : [COMMENT] Length in flash write/read reply does not match expected length
|
//! [EXPORT] : [COMMENT] Length in flash write/read reply does not match expected length
|
||||||
static const ReturnValue_t LENGTH_MISMATCH = MAKE_RETURN_CODE(0xA6);
|
static const ReturnValue_t LENGTH_MISMATCH = MAKE_RETURN_CODE(0xA6);
|
||||||
|
//! [EXPORT] : [COMMENT] Status field in reply signals error
|
||||||
|
static const ReturnValue_t STATUS_ERROR = MAKE_RETURN_CODE(0xA7);
|
||||||
|
//! [EXPORT] : [COMMENT] Reply has invalid type ID (should be of action reply type)
|
||||||
|
static const ReturnValue_t INVALID_TYPE_ID = MAKE_RETURN_CODE(0xA8);
|
||||||
|
|
||||||
// Size of one image part which can be sent per action request
|
// Size of one image part which can be sent per action request
|
||||||
static const size_t SIZE_IMAGE_PART = 1024;
|
static const size_t SIZE_IMAGE_PART = 1024;
|
||||||
|
@ -12,8 +12,17 @@ Timestamp::~Timestamp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string Timestamp::str() {
|
std::string Timestamp::str() {
|
||||||
return std::to_string(time.year) + "-" + std::to_string(time.month) + "-"
|
timestamp << std::to_string(time.year) << "-"
|
||||||
+ std::to_string(time.day) + "--" + std::to_string(time.hour) + "-"
|
<< std::setw(2) << std::setfill('0')
|
||||||
+ std::to_string(time.minute) + "-" + std::to_string(time.second) + "-";
|
<< std::to_string(time.month) << "-"
|
||||||
|
<< std::setw(2) << std::setfill('0')
|
||||||
|
<< std::to_string(time.day) << "--"
|
||||||
|
<< std::setw(2) << std::setfill('0')
|
||||||
|
<< std::to_string(time.hour) << "-"
|
||||||
|
<< std::setw(2) << std::setfill('0')
|
||||||
|
<< std::to_string(time.minute) << "-"
|
||||||
|
<< std::setw(2) << std::setfill('0')
|
||||||
|
<< std::to_string(time.second) << "--";
|
||||||
|
return timestamp.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#define MISSION_UTILITY_TIMESTAMP_H_
|
#define MISSION_UTILITY_TIMESTAMP_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
|
#include <iomanip>
|
||||||
#include "fsfw/timemanager/Clock.h"
|
#include "fsfw/timemanager/Clock.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
|
||||||
@ -21,6 +23,7 @@ public:
|
|||||||
std::string str();
|
std::string str();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::stringstream timestamp;
|
||||||
Clock::TimeOfDay_t time;
|
Clock::TimeOfDay_t time;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user