get commanded dipole wip
This commit is contained in:
parent
a92e99c1c4
commit
84a0935f63
@ -85,9 +85,10 @@ ReturnValue_t pst::pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence)
|
|||||||
thisSequence->addSlot(objects::RTD_IC16, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::RTD_IC16, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||||
thisSequence->addSlot(objects::RTD_IC17, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::RTD_IC17, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||||
thisSequence->addSlot(objects::RTD_IC18, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::RTD_IC18, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||||
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
|
||||||
#endif /* Q7S_ADD_RTD_DEVICES */
|
#endif /* Q7S_ADD_RTD_DEVICES */
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||||
|
|
||||||
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.6, DeviceHandlerIF::SEND_READ);
|
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||||
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.6, DeviceHandlerIF::SEND_READ);
|
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||||
|
|
||||||
|
@ -42,12 +42,6 @@ ReturnValue_t IMTQHandler::buildCommandFromCommand(
|
|||||||
DeviceCommandId_t deviceCommand, const uint8_t * commandData,
|
DeviceCommandId_t deviceCommand, const uint8_t * commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
switch(deviceCommand) {
|
switch(deviceCommand) {
|
||||||
case(IMTQ::GET_ENG_HK_DATA): {
|
|
||||||
commandBuffer[0] = IMTQ::CC::GET_ENG_HK_DATA;
|
|
||||||
rawPacket = commandBuffer;
|
|
||||||
rawPacketLen = 1;
|
|
||||||
return RETURN_OK;
|
|
||||||
}
|
|
||||||
case(IMTQ::START_ACTUATION_DIPOLE): {
|
case(IMTQ::START_ACTUATION_DIPOLE): {
|
||||||
/* IMTQ expects low byte first */
|
/* IMTQ expects low byte first */
|
||||||
commandBuffer[0] = IMTQ::CC::START_ACTUATION_DIPOLE;
|
commandBuffer[0] = IMTQ::CC::START_ACTUATION_DIPOLE;
|
||||||
@ -62,6 +56,18 @@ ReturnValue_t IMTQHandler::buildCommandFromCommand(
|
|||||||
rawPacket = commandBuffer;
|
rawPacket = commandBuffer;
|
||||||
rawPacketLen = 9;
|
rawPacketLen = 9;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
case(IMTQ::GET_ENG_HK_DATA): {
|
||||||
|
commandBuffer[0] = IMTQ::CC::GET_ENG_HK_DATA;
|
||||||
|
rawPacket = commandBuffer;
|
||||||
|
rawPacketLen = 1;
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
case(IMTQ::GET_COMMANDED_DIPOLE): {
|
||||||
|
commandBuffer[0] = IMTQ::CC::GET_COMMANDED_DIPOLE;
|
||||||
|
rawPacket = commandBuffer;
|
||||||
|
rawPacketLen = 1;
|
||||||
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
||||||
@ -70,8 +76,12 @@ ReturnValue_t IMTQHandler::buildCommandFromCommand(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IMTQHandler::fillCommandAndReplyMap() {
|
void IMTQHandler::fillCommandAndReplyMap() {
|
||||||
|
this->insertInCommandAndReplyMap(IMTQ::START_ACTUATION_DIPOLE, 1, nullptr,
|
||||||
|
IMTQ::SIZE_STATUS_REPLY);
|
||||||
this->insertInCommandAndReplyMap(IMTQ::GET_ENG_HK_DATA, 1, &engHkDataset,
|
this->insertInCommandAndReplyMap(IMTQ::GET_ENG_HK_DATA, 1, &engHkDataset,
|
||||||
IMTQ::SIZE_ENG_HK_DATA_REPLY, false, true, IMTQ::SIZE_ENG_HK_DATA_REPLY);
|
IMTQ::SIZE_ENG_HK_DATA_REPLY);
|
||||||
|
this->insertInCommandAndReplyMap(IMTQ::GET_COMMANDED_DIPOLE, 1, nullptr,
|
||||||
|
IMTQ::SIZE_ENG_HK_DATA_REPLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t IMTQHandler::scanForReply(const uint8_t *start,
|
ReturnValue_t IMTQHandler::scanForReply(const uint8_t *start,
|
||||||
@ -80,10 +90,18 @@ ReturnValue_t IMTQHandler::scanForReply(const uint8_t *start,
|
|||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
switch(*start) {
|
switch(*start) {
|
||||||
|
case(IMTQ::CC::START_ACTUATION_DIPOLE):
|
||||||
|
*foundLen = IMTQ::SIZE_STATUS_REPLY;
|
||||||
|
*foundId = IMTQ::START_ACTUATION_DIPOLE;
|
||||||
|
break;
|
||||||
case(IMTQ::CC::GET_ENG_HK_DATA):
|
case(IMTQ::CC::GET_ENG_HK_DATA):
|
||||||
*foundLen = IMTQ::SIZE_ENG_HK_DATA_REPLY;
|
*foundLen = IMTQ::SIZE_ENG_HK_DATA_REPLY;
|
||||||
*foundId = IMTQ::GET_ENG_HK_DATA;
|
*foundId = IMTQ::GET_ENG_HK_DATA;
|
||||||
break;
|
break;
|
||||||
|
case(IMTQ::CC::GET_COMMANDED_DIPOLE):
|
||||||
|
*foundLen = IMTQ::SIZE_GET_COMMANDED_DIPOLE_REPLY;
|
||||||
|
*foundId = IMTQ::GET_COMMANDED_DIPOLE;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
sif::debug << "IMTQHandler::scanForReply: Reply contains invalid command code" << std::endl;
|
sif::debug << "IMTQHandler::scanForReply: Reply contains invalid command code" << std::endl;
|
||||||
result = IGNORE_REPLY_DATA;
|
result = IGNORE_REPLY_DATA;
|
||||||
@ -105,9 +123,15 @@ ReturnValue_t IMTQHandler::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
|
case (IMTQ::START_ACTUATION_DIPOLE):
|
||||||
|
// Replies only the status byte which is already handled with parseStatusByte
|
||||||
|
break;
|
||||||
case (IMTQ::GET_ENG_HK_DATA):
|
case (IMTQ::GET_ENG_HK_DATA):
|
||||||
fillEngHkDataset(packet);
|
fillEngHkDataset(packet);
|
||||||
break;
|
break;
|
||||||
|
case (IMTQ::GET_COMMANDED_DIPOLE):
|
||||||
|
handleGetCommandedDipoleReply(packet);
|
||||||
|
break;
|
||||||
default: {
|
default: {
|
||||||
sif::debug << "IMTQHandler::interpretDeviceReply: Unknown device reply id" << std::endl;
|
sif::debug << "IMTQHandler::interpretDeviceReply: Unknown device reply id" << std::endl;
|
||||||
return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY;
|
return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY;
|
||||||
@ -143,31 +167,29 @@ ReturnValue_t IMTQHandler::initializeLocalDataPool(localpool::DataPool& localDat
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t DeviceHandlerBase::getNextReplyLength(DeviceCommandId_t commandId){
|
|
||||||
DeviceReplyIter iter = deviceReplyMap.find(commandId);
|
|
||||||
if(iter != deviceReplyMap.end()) {
|
|
||||||
return iter->second.replyLen;
|
|
||||||
}else{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t IMTQHandler::parseStatusByte(const uint8_t* packet) {
|
ReturnValue_t IMTQHandler::parseStatusByte(const uint8_t* packet) {
|
||||||
uint8_t cmdErrorField = *(packet + 1) & 0xF;
|
uint8_t cmdErrorField = *(packet + 1) & 0xF;
|
||||||
switch (cmdErrorField) {
|
switch (cmdErrorField) {
|
||||||
case 0:
|
case 0:
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
case 1:
|
case 1:
|
||||||
|
sif::error << "IMTQHandler::parseStatusByte: Command rejected without reason" << std::endl;
|
||||||
return REJECTED_WITHOUT_REASON;
|
return REJECTED_WITHOUT_REASON;
|
||||||
case 2:
|
case 2:
|
||||||
|
sif::error << "IMTQHandler::parseStatusByte: Command has invalid command code" << std::endl;
|
||||||
return INVALID_COMMAND_CODE;
|
return INVALID_COMMAND_CODE;
|
||||||
case 3:
|
case 3:
|
||||||
|
sif::error << "IMTQHandler::parseStatusByte: Command has missing parameter" << std::endl;
|
||||||
return PARAMETER_MISSING;
|
return PARAMETER_MISSING;
|
||||||
case 4:
|
case 4:
|
||||||
|
sif::error << "IMTQHandler::parseStatusByte: Command has invalid parameter" << std::endl;
|
||||||
return PARAMETER_INVALID;
|
return PARAMETER_INVALID;
|
||||||
case 5:
|
case 5:
|
||||||
|
sif::error << "IMTQHandler::parseStatusByte: CC unavailable" << std::endl;
|
||||||
return CC_UNAVAILABLE;
|
return CC_UNAVAILABLE;
|
||||||
case 7:
|
case 7:
|
||||||
|
sif::error << "IMTQHandler::parseStatusByte: IMQT replied internal processing error"
|
||||||
|
<< std::endl;
|
||||||
return INTERNAL_PROCESSING_ERROR;
|
return INTERNAL_PROCESSING_ERROR;
|
||||||
default:
|
default:
|
||||||
sif::error << "IMTQHandler::parseStatusByte: CMD Error field contains unknown error code "
|
sif::error << "IMTQHandler::parseStatusByte: CMD Error field contains unknown error code "
|
||||||
@ -223,3 +245,30 @@ void IMTQHandler::setModeNormal() {
|
|||||||
mode = MODE_NORMAL;
|
mode = MODE_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void IMTQHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId) {
|
||||||
|
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
|
if (wiretappingMode == RAW) {
|
||||||
|
/* Data already sent in doGetRead() */
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceReplyMap::iterator iter = deviceReplyMap.find(replyId);
|
||||||
|
if (iter == deviceReplyMap.end()) {
|
||||||
|
sif::debug << "IMTQHandler::handleDeviceTM: Unknown reply id" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MessageQueueId_t queueId = iter->second.command->second.sendReplyTo;
|
||||||
|
|
||||||
|
if (queueId == NO_COMMANDER) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = actionHelper.reportData(queueId, replyId, data, dataSize);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::debug << "IMTQHandler::handleDeviceTM: Failed to report data" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -37,7 +37,6 @@ protected:
|
|||||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) override;
|
LocalDataPoolManager& poolManager) override;
|
||||||
virtual size_t getNextReplyLength(DeviceCommandId_t commandId) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ namespace IMTQ {
|
|||||||
static const DeviceCommandId_t NONE = 0x0;
|
static const DeviceCommandId_t NONE = 0x0;
|
||||||
static const DeviceCommandId_t GET_ENG_HK_DATA = 0x1;
|
static const DeviceCommandId_t GET_ENG_HK_DATA = 0x1;
|
||||||
static const DeviceCommandId_t START_ACTUATION_DIPOLE = 0x2;
|
static const DeviceCommandId_t START_ACTUATION_DIPOLE = 0x2;
|
||||||
|
static const DeviceCommandId_t GET_COMMANDED_DIPOLE = 0x3;
|
||||||
|
|
||||||
static const uint8_t GET_TEMP_REPLY_SIZE = 2;
|
static const uint8_t GET_TEMP_REPLY_SIZE = 2;
|
||||||
static const uint8_t CFGR_CMD_SIZE = 3;
|
static const uint8_t CFGR_CMD_SIZE = 3;
|
||||||
@ -13,7 +14,9 @@ namespace IMTQ {
|
|||||||
|
|
||||||
static const uint32_t ENG_HK_DATA_SET_ID = GET_ENG_HK_DATA;
|
static const uint32_t ENG_HK_DATA_SET_ID = GET_ENG_HK_DATA;
|
||||||
static const uint8_t SIZE_ENG_HK_COMMAND = 1;
|
static const uint8_t SIZE_ENG_HK_COMMAND = 1;
|
||||||
|
static const uint8_t SIZE_STATUS_REPLY = 2;
|
||||||
static const uint8_t SIZE_ENG_HK_DATA_REPLY = 24;
|
static const uint8_t SIZE_ENG_HK_DATA_REPLY = 24;
|
||||||
|
static const uint8_t SIZE_GET_COMMANDED_DIPOLE_REPLY = 8;
|
||||||
|
|
||||||
static const uint8_t MAX_REPLY_SIZE = SIZE_ENG_HK_DATA_REPLY;
|
static const uint8_t MAX_REPLY_SIZE = SIZE_ENG_HK_DATA_REPLY;
|
||||||
static const uint8_t MAX_COMMAND_SIZE = 9;
|
static const uint8_t MAX_COMMAND_SIZE = 9;
|
||||||
@ -28,6 +31,7 @@ namespace IMTQ {
|
|||||||
static const uint8_t START_ACTUATION_DIPOLE = 0x6;
|
static const uint8_t START_ACTUATION_DIPOLE = 0x6;
|
||||||
static const uint8_t SOFTWARE_RESET = 0xAA;
|
static const uint8_t SOFTWARE_RESET = 0xAA;
|
||||||
static const uint8_t GET_ENG_HK_DATA = 0x4A;
|
static const uint8_t GET_ENG_HK_DATA = 0x4A;
|
||||||
|
static const uint8_t GET_COMMANDED_DIPOLE = 0x46;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum IMTQPoolIds: lp_id_t {
|
enum IMTQPoolIds: lp_id_t {
|
||||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
|||||||
Subproject commit 986f88e2908c6bc555a279b53f11e82d9a8a851c
|
Subproject commit 3e466f06ef7737f2f1bab8c3d68feb633da76dbc
|
Loading…
Reference in New Issue
Block a user