This commit is contained in:
parent
1f616a101d
commit
24cb555849
@ -1,6 +1,6 @@
|
|||||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
|
||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
|
|
||||||
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <linux/devices/Max31865RtdLowlevelHandler.h>
|
#include <linux/devices/Max31865RtdLowlevelHandler.h>
|
||||||
#include <mission/devices/Max31865EiveHandler.h>
|
#include <mission/devices/Max31865EiveHandler.h>
|
||||||
#include <mission/devices/Max31865PT1000Handler.h>
|
#include <mission/devices/Max31865PT1000Handler.h>
|
||||||
|
#include <mission/devices/ScexDeviceHandler.h>
|
||||||
#include <mission/devices/SusHandler.h>
|
#include <mission/devices/SusHandler.h>
|
||||||
#include <mission/system/SusAssembly.h>
|
#include <mission/system/SusAssembly.h>
|
||||||
#include <mission/system/TcsBoardAssembly.h>
|
#include <mission/system/TcsBoardAssembly.h>
|
||||||
@ -319,7 +320,13 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
|
|||||||
#endif // OBSW_ADD_RTD_DEVICES == 1
|
#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) {
|
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;
|
sif::error << "ObjectFactory: Adding GPIOs failed for " << output << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "ScexDleParser.h"
|
#include "ScexDleParser.h"
|
||||||
|
|
||||||
ScexDleParser::ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder,
|
ScexDleParser::ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder, BufPair encodedBuf, BufPair decodedBuf, UserHandler handler,
|
||||||
BufPair encodedBuf, BufPair decodedBuf, UserHandler handler,
|
void *args) : DleParser(decodeRingBuf, decoder, encodedBuf, decodedBuf, handler, args) {};
|
||||||
void *args)
|
ScexDleParser::~ScexDleParser() {};
|
||||||
: DleParser(decodeRingBuf, decoder, encodedBuf, decodedBuf, handler, args) {}
|
|
||||||
|
@ -3,10 +3,18 @@
|
|||||||
|
|
||||||
#include <fsfw/globalfunctions/DleParser.h>
|
#include <fsfw/globalfunctions/DleParser.h>
|
||||||
|
|
||||||
|
|
||||||
class ScexDleParser : public DleParser {
|
class ScexDleParser : public DleParser {
|
||||||
public:
|
public:
|
||||||
ScexDleParser(SimpleRingBuffer& decodeRingBuf, DleEncoder& decoder, BufPair encodedBuf,
|
ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder,
|
||||||
BufPair decodedBuf, UserHandler handler, void* args);
|
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_ */
|
#endif /* LINUX_DEVICES_SCEXDLEPARSER_H_ */
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#include "PdecHandler.h"
|
#include "PdecHandler.h"
|
||||||
#include "OBSWConfig.h"
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
@ -7,6 +6,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
#include "fsfw/ipc/QueueFactory.h"
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "fsfw/globalfunctions/CRC.h"
|
#include "fsfw/globalfunctions/CRC.h"
|
||||||
#include "mission/devices/devicedefinitions/ScexDefinitions.h"
|
#include "mission/devices/devicedefinitions/ScexDefinitions.h"
|
||||||
|
#include <random>
|
||||||
|
|
||||||
using std::ofstream;
|
using std::ofstream;
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic
|
|||||||
|
|
||||||
switch (deviceCommand) {
|
switch (deviceCommand) {
|
||||||
case (PING): {
|
case (PING): {
|
||||||
rawPacket = cmdBuf.data();
|
//rawPacket = cmdBuf.data();
|
||||||
prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
|
prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
|
||||||
{nullptr, 0});
|
{nullptr, 0});
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
@ -220,4 +221,23 @@ ReturnValue_t ScexDeviceHandler::initializeLocalDataPool(localpool::DataPool& lo
|
|||||||
return RETURN_OK;
|
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() {}
|
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;
|
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<uint8_t*, size_t> cmdBufPair, size_t& cmdLen,
|
||||||
std::pair<const uint8_t*, size_t> usrDataPair) {
|
std::pair<const uint8_t*, size_t> usrDataPair) {
|
||||||
using namespace scex;
|
using namespace scex;
|
||||||
@ -20,7 +20,7 @@ ReturnValue_t scex::prepareScexCmd(scex::Cmds cmd, bool tempCheck,
|
|||||||
cmdLen = 0;
|
cmdLen = 0;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
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
|
// These two fields are the packet counter and the total packet count. Those are 1 and 1 for each
|
||||||
// telecommand so far
|
// telecommand so far
|
||||||
cmdBuf[1] = 1;
|
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;
|
static constexpr uint8_t IDLE_BIT_1_DEF_STATE = 1;
|
||||||
|
|
||||||
uint8_t createCmdByte(Cmds cmd, bool tempCheck);
|
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);
|
size_t& cmdLen, std::pair<const uint8_t*, size_t> usrDataPair);
|
||||||
|
|
||||||
} // namespace scex
|
} // namespace scex
|
||||||
|
Loading…
Reference in New Issue
Block a user