This commit is contained in:
parent
1f616a101d
commit
24cb555849
@ -1,6 +1,6 @@
|
||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||
#include "InitMission.h"
|
||||
|
||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <linux/devices/Max31865RtdLowlevelHandler.h>
|
||||
#include <mission/devices/Max31865EiveHandler.h>
|
||||
#include <mission/devices/Max31865PT1000Handler.h>
|
||||
#include <mission/devices/ScexDeviceHandler.h>
|
||||
#include <mission/devices/SusHandler.h>
|
||||
#include <mission/system/SusAssembly.h>
|
||||
#include <mission/system/TcsBoardAssembly.h>
|
||||
@ -319,7 +320,13 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
|
||||
#endif // OBSW_ADD_RTD_DEVICES == 1
|
||||
}
|
||||
|
||||
void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF *pwrSwitcher) {
|
||||
void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF* pwrSwitcher) {
|
||||
// objekte anlegen
|
||||
SdCardMountedIF* sdcMan = nullptr;
|
||||
CookieIF* cookie = new CookieIF;
|
||||
|
||||
auto scexUartReader = new ScexUartReader(objects::SCEX_UART_READER);
|
||||
new ScexDeviceHandler(objects::SCEX, *scexUartReader, cookie, sdcMan);
|
||||
}
|
||||
|
||||
void ObjectFactory::gpioChecker(ReturnValue_t result, std::string output) {
|
||||
@ -327,4 +334,3 @@ void ObjectFactory::gpioChecker(ReturnValue_t result, std::string output) {
|
||||
sif::error << "ObjectFactory: Adding GPIOs failed for " << output << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "ScexDleParser.h"
|
||||
|
||||
ScexDleParser::ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder,
|
||||
BufPair encodedBuf, BufPair decodedBuf, UserHandler handler,
|
||||
void *args)
|
||||
: DleParser(decodeRingBuf, decoder, encodedBuf, decodedBuf, handler, args) {}
|
||||
ScexDleParser::ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder, BufPair encodedBuf, BufPair decodedBuf, UserHandler handler,
|
||||
void *args) : DleParser(decodeRingBuf, decoder, encodedBuf, decodedBuf, handler, args) {};
|
||||
ScexDleParser::~ScexDleParser() {};
|
||||
|
@ -3,10 +3,18 @@
|
||||
|
||||
#include <fsfw/globalfunctions/DleParser.h>
|
||||
|
||||
|
||||
class ScexDleParser : public DleParser {
|
||||
public:
|
||||
ScexDleParser(SimpleRingBuffer& decodeRingBuf, DleEncoder& decoder, BufPair encodedBuf,
|
||||
BufPair decodedBuf, UserHandler handler, void* args);
|
||||
ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder,
|
||||
BufPair encodedBuf, BufPair decodedBuf, UserHandler handler,
|
||||
void *args);
|
||||
// ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder,
|
||||
// BufPair encodedBuf, BufPair decodedBuf, UserHandler handler,
|
||||
// void *args) : DleParser(decodeRingBuf, decoder, encodedBuf, decodedBuf, handler, args){}
|
||||
|
||||
virtual ~ScexDleParser();
|
||||
private:
|
||||
};
|
||||
|
||||
#endif /* LINUX_DEVICES_SCEXDLEPARSER_H_ */
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "PdecHandler.h"
|
||||
#include "OBSWConfig.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
@ -7,6 +6,7 @@
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "fsfw/ipc/QueueFactory.h"
|
||||
#include "fsfw/objectmanager/ObjectManager.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "fsfw/globalfunctions/CRC.h"
|
||||
#include "mission/devices/devicedefinitions/ScexDefinitions.h"
|
||||
#include <random>
|
||||
|
||||
using std::ofstream;
|
||||
|
||||
@ -47,7 +48,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic
|
||||
|
||||
switch (deviceCommand) {
|
||||
case (PING): {
|
||||
rawPacket = cmdBuf.data();
|
||||
//rawPacket = cmdBuf.data();
|
||||
prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
|
||||
{nullptr, 0});
|
||||
return RETURN_OK;
|
||||
@ -220,4 +221,23 @@ ReturnValue_t ScexDeviceHandler::initializeLocalDataPool(localpool::DataPool& lo
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
std::string ScexDeviceHandler::random_string(std::string::size_type length) {
|
||||
static auto& chrs =
|
||||
"0123456789"
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
thread_local static std::mt19937 rg{std::random_device{}()};
|
||||
thread_local static std::uniform_int_distribution<std::string::size_type> pick(0,
|
||||
sizeof(chrs) - 2);
|
||||
|
||||
std::string s;
|
||||
|
||||
s.reserve(length);
|
||||
|
||||
while (length--) s += chrs[pick(rg)];
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
void ScexDeviceHandler::modeChanged() {}
|
||||
|
@ -8,7 +8,7 @@ uint8_t scex::createCmdByte(Cmds cmd, bool tempCheck) {
|
||||
return (IDLE_BIT_0_DEF_STATE << 7) | (IDLE_BIT_1_DEF_STATE << 6) | (cmd << 1) | tempCheck;
|
||||
}
|
||||
|
||||
ReturnValue_t scex::prepareScexCmd(scex::Cmds cmd, bool tempCheck,
|
||||
ReturnValue_t scex::prepareScexCmd(Cmds cmd, bool tempCheck,
|
||||
std::pair<uint8_t*, size_t> cmdBufPair, size_t& cmdLen,
|
||||
std::pair<const uint8_t*, size_t> usrDataPair) {
|
||||
using namespace scex;
|
||||
@ -20,7 +20,7 @@ ReturnValue_t scex::prepareScexCmd(scex::Cmds cmd, bool tempCheck,
|
||||
cmdLen = 0;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
cmdBuf[0] = scex::createCmdByte(cmd, tempCheck);
|
||||
cmdBuf[0] = createCmdByte(cmd, tempCheck);
|
||||
// These two fields are the packet counter and the total packet count. Those are 1 and 1 for each
|
||||
// telecommand so far
|
||||
cmdBuf[1] = 1;
|
||||
|
@ -39,7 +39,8 @@ static constexpr uint8_t IDLE_BIT_0_DEF_STATE = 0;
|
||||
static constexpr uint8_t IDLE_BIT_1_DEF_STATE = 1;
|
||||
|
||||
uint8_t createCmdByte(Cmds cmd, bool tempCheck);
|
||||
ReturnValue_t prepareScexCmd(scex::Cmds cmd, bool tempCheck, std::pair<uint8_t*, size_t> cmdBufPair,
|
||||
|
||||
ReturnValue_t prepareScexCmd(Cmds cmd, bool tempCheck, std::pair<uint8_t*, size_t> cmdBufPair,
|
||||
size_t& cmdLen, std::pair<const uint8_t*, size_t> usrDataPair);
|
||||
|
||||
} // namespace scex
|
||||
|
Loading…
Reference in New Issue
Block a user