WIP: SCEX Init #272
@ -52,36 +52,57 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic
|
|||||||
|
|
||||||
switch (deviceCommand) {
|
switch (deviceCommand) {
|
||||||
case (PING): {
|
case (PING): {
|
||||||
|
finishCountdown.setTimeout(SHORT_CD);
|
||||||
|
// countdown starten
|
||||||
|
finishCountdown.resetTimer();
|
||||||
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0},
|
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0},
|
||||||
tempCheck);
|
tempCheck);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (EXP_STATUS_CMD): {
|
case (EXP_STATUS_CMD): {
|
||||||
|
finishCountdown.setTimeout(SHORT_CD);
|
||||||
|
// countdown starten
|
||||||
|
finishCountdown.resetTimer();
|
||||||
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0},
|
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0},
|
||||||
tempCheck);
|
tempCheck);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (ION_CMD): {
|
case (ION_CMD): {
|
||||||
|
finishCountdown.setTimeout(SHORT_CD);
|
||||||
|
// countdown starten
|
||||||
|
finishCountdown.resetTimer();
|
||||||
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0},
|
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0},
|
||||||
tempCheck);
|
tempCheck);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (TEMP_CMD): {
|
case (TEMP_CMD): {
|
||||||
|
finishCountdown.setTimeout(SHORT_CD);
|
||||||
|
// countdown starten
|
||||||
|
finishCountdown.resetTimer();
|
||||||
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0},
|
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0},
|
||||||
tempCheck);
|
tempCheck);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (FRAM): {
|
case (FRAM): {
|
||||||
|
finishCountdown.setTimeout(SHORT_CD);
|
||||||
|
// countdown starten
|
||||||
|
finishCountdown.resetTimer();
|
||||||
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
|
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
|
||||||
{commandData + 1, commandDataLen - 1}, tempCheck);
|
{commandData + 1, commandDataLen - 1}, tempCheck);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (ONE_CELL): {
|
case (ONE_CELL): {
|
||||||
|
finishCountdown.setTimeout(LONG_CD);
|
||||||
|
// countdown starts
|
||||||
|
finishCountdown.resetTimer();
|
||||||
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
|
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
|
||||||
{commandData + 1, commandDataLen - 1}, tempCheck);
|
{commandData + 1, commandDataLen - 1}, tempCheck);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (ALL_CELLS_CMD): {
|
case (ALL_CELLS_CMD): {
|
||||||
|
finishCountdown.setTimeout(LONG_CD);
|
||||||
|
// countdown starts
|
||||||
|
finishCountdown.resetTimer();
|
||||||
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
|
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
|
||||||
{commandData + 1, commandDataLen - 1}, tempCheck);
|
{commandData + 1, commandDataLen - 1}, tempCheck);
|
||||||
break;
|
break;
|
||||||
@ -130,9 +151,6 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
|||||||
ReturnValue_t status = RETURN_OK;
|
ReturnValue_t status = RETURN_OK;
|
||||||
auto oneFileHandler = [&](std::string cmdName) {
|
auto oneFileHandler = [&](std::string cmdName) {
|
||||||
fileId = random_string(6);
|
fileId = random_string(6);
|
||||||
finishCountdown.setTimeout(SHORT_CD);
|
|
||||||
// countdown starten
|
|
||||||
finishCountdown.resetTimer();
|
|
||||||
std::ostringstream oss("/tmp/scex-");
|
std::ostringstream oss("/tmp/scex-");
|
||||||
oss << cmdName << fileId << ".bin";
|
oss << cmdName << fileId << ".bin";
|
||||||
fileName = oss.str();
|
fileName = oss.str();
|
||||||
@ -149,9 +167,6 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
|||||||
};
|
};
|
||||||
auto multiFileHandler = [&](std::string cmdName) {
|
auto multiFileHandler = [&](std::string cmdName) {
|
||||||
if ((helper.getPacketCounter() == 1) or (not fileNameSet)) {
|
if ((helper.getPacketCounter() == 1) or (not fileNameSet)) {
|
||||||
finishCountdown.setTimeout(LONG_CD);
|
|
||||||
// countdown starts
|
|
||||||
finishCountdown.resetTimer();
|
|
||||||
|
|
||||||
fileId = random_string(6);
|
fileId = random_string(6);
|
||||||
std::ostringstream oss("/tmp/scex-");
|
std::ostringstream oss("/tmp/scex-");
|
||||||
|
Loading…
Reference in New Issue
Block a user