WIP: SCEX Init #272
@ -25,7 +25,7 @@ UartTestClass::UartTestClass(object_id_t objectId, ScexUartReader* reader)
|
||||
: TestTask(objectId), reader(reader) {
|
||||
mode = TestModes::SCEX;
|
||||
scexMode = ScexModes::READER_TASK;
|
||||
currCmd = scex::ScexCmds::PING;
|
||||
currCmd = scex::ScexCmds::FRAM;
|
||||
if (scexMode == ScexModes::SIMPLE) {
|
||||
auto encodingBuf = new std::array<uint8_t, 4096>;
|
||||
DleParser::BufPair encodingBufPair{encodingBuf->data(), encodingBuf->size()};
|
||||
@ -178,7 +178,7 @@ void UartTestClass::scexPeriodic() {
|
||||
} else {
|
||||
if (not cmdSent) {
|
||||
size_t len = 0;
|
||||
prepareScexCmd(scex::ScexCmds::PING, false, cmdBuf.data(), &len);
|
||||
prepareScexCmd(currCmd, false, cmdBuf.data(), &len);
|
||||
reader->sendMessage(uartCookie, cmdBuf.data(), len);
|
||||
cmdSent = true;
|
||||
cmdDone = false;
|
||||
@ -199,21 +199,24 @@ void UartTestClass::scexPeriodic() {
|
||||
|
||||
//ping
|
||||
//if ping cmd
|
||||
if(helper.getCmd() == PING) {
|
||||
ofstream out("/tmp/scex-ping.bin", ofstream::binary );
|
||||
if (out.bad()) {
|
||||
sif::warning << "bad" <<std::endl;
|
||||
}
|
||||
out << helper;
|
||||
}
|
||||
//fram
|
||||
//packetcounter eins höher, wenn mehr packet verloren ->
|
||||
//countdown (max 2min), wenn nicht if (helper.getPacketCounter() == helper.getTotalPacketCounter()) { nach 2min reader->finish();
|
||||
if(helper.getCmd() == FRAM) {
|
||||
if(helper.getPacketCounter() == 0) {
|
||||
// neues file anlegen wie oben ping
|
||||
ofstream out("/tmp/scex-fram.bin", ofstream::binary ); // neues file anlegen wie oben ping
|
||||
} else {
|
||||
// an bestehendes file hinzufügen
|
||||
}
|
||||
}
|
||||
ofstream out("/tmp/scex-fram.bin", ofstream::binary | ofstream::app );// an bestehendes file hinzufügen
|
||||
out << helper;
|
||||
}
|
||||
}
|
||||
|
||||
if (helper.getPacketCounter() == helper.getTotalPacketCounter()) {
|
||||
reader->finish();
|
||||
@ -326,7 +329,7 @@ void UartTestClass::scexSimplePeriodic() {
|
||||
int UartTestClass::prepareScexCmd(scex::ScexCmds cmd, bool tempCheck, uint8_t* cmdBuf,
|
||||
size_t* len) {
|
||||
using namespace scex;
|
||||
// Send ping command
|
||||
// Send command
|
||||
cmdBuf[0] = scex::createCmdByte(cmd, false);
|
||||
// These two fields are the packet counter and the total packet count. Those are 1 and 1 for each
|
||||
// telecommand so far
|
||||
|
Loading…
Reference in New Issue
Block a user