meier/deviceHandlerUpdate #192

Merged
muellerr merged 16 commits from meier/deviceHandlerUpdate into develop 2022-04-01 14:05:05 +02:00
4 changed files with 35 additions and 3 deletions
Showing only changes of commit 53aca633b8 - Show all commits

View File

@ -326,6 +326,7 @@ void PdecHandler::handleNewTc() {
printTC(tcLength); printTC(tcLength);
#endif /* OBSW_DEBUG_PDEC_HANDLER */ #endif /* OBSW_DEBUG_PDEC_HANDLER */
#if OBSW_TC_FROM_PDEC == 1
store_address_t storeId; store_address_t storeId;
result = tcStore->addData(&storeId, tcSegment + 1, tcLength - 1); result = tcStore->addData(&storeId, tcSegment + 1, tcLength - 1);
if (result != RETURN_OK) { if (result != RETURN_OK) {
@ -343,6 +344,7 @@ void PdecHandler::handleNewTc() {
tcStore->deleteData(storeId); tcStore->deleteData(storeId);
return; return;
} }
#endif /* OBSW_TC_FROM_PDEC == 1 */
return; return;
} }

View File

@ -101,6 +101,14 @@ ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(DeviceCommandId_t devic
rawPacket = commandBuffer; rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
} }
case (SYRLINKS::READ_LCL_CONFIG): {
readLclConfig.copy(reinterpret_cast<char*>(commandBuffer),
readLclConfig.size(), 0);
rawPacketLen = readLclConfig.size();
rawPacket = commandBuffer;
rememberCommandId = SYRLINKS::READ_LCL_CONFIG;
return RETURN_OK;
}
case (SYRLINKS::READ_TX_STATUS): { case (SYRLINKS::READ_TX_STATUS): {
readTxStatus.copy(reinterpret_cast<char*>(commandBuffer), readTxStatus.size(), 0); readTxStatus.copy(reinterpret_cast<char*>(commandBuffer), readTxStatus.size(), 0);
rawPacketLen = readTxStatus.size(); rawPacketLen = readTxStatus.size();
@ -144,8 +152,10 @@ void SyrlinksHkHandler::fillCommandAndReplyMap() {
false, true, SYRLINKS::ACK_REPLY); false, true, SYRLINKS::ACK_REPLY);
this->insertInCommandAndReplyMap(SYRLINKS::SET_TX_MODE_CW, 1, nullptr, SYRLINKS::ACK_SIZE, false, this->insertInCommandAndReplyMap(SYRLINKS::SET_TX_MODE_CW, 1, nullptr, SYRLINKS::ACK_SIZE, false,
true, SYRLINKS::ACK_REPLY); true, SYRLINKS::ACK_REPLY);
this->insertInCommandAndReplyMap(SYRLINKS::WRITE_LCL_CONFIG, 2, nullptr, SYRLINKS::ACK_SIZE, false, this->insertInCommandAndReplyMap(SYRLINKS::WRITE_LCL_CONFIG, 1, nullptr, SYRLINKS::ACK_SIZE, false,
true, SYRLINKS::ACK_REPLY); true, SYRLINKS::ACK_REPLY);
this->insertInCommandAndReplyMap(SYRLINKS::READ_LCL_CONFIG, 1, nullptr,
SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
this->insertInCommandAndReplyMap(SYRLINKS::READ_TX_STATUS, 1, &txDataset, this->insertInCommandAndReplyMap(SYRLINKS::READ_TX_STATUS, 1, &txDataset,
SYRLINKS::READ_ONE_REGISTER_REPLY_SIE); SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
this->insertInCommandAndReplyMap(SYRLINKS::READ_TX_WAVEFORM, 1, &txDataset, this->insertInCommandAndReplyMap(SYRLINKS::READ_TX_WAVEFORM, 1, &txDataset,
@ -241,6 +251,15 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
} }
parseRxStatusRegistersReply(packet); parseRxStatusRegistersReply(packet);
break; break;
case (SYRLINKS::READ_LCL_CONFIG):
result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
if (result != RETURN_OK) {
sif::error << "SyrlinksHkHandler::interpretDeviceReply: Read config lcl reply "
<< "has invalid crc" << std::endl;
return CRC_FAILURE;
}
parseLclConfigReply(packet);
break;
case (SYRLINKS::READ_TX_STATUS): case (SYRLINKS::READ_TX_STATUS):
result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE); result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
if (result != RETURN_OK) { if (result != RETURN_OK) {
@ -427,6 +446,13 @@ void SyrlinksHkHandler::parseRxStatusRegistersReply(const uint8_t* packet) {
#endif #endif
} }
void SyrlinksHkHandler::parseLclConfigReply(const uint8_t* packet) {
uint16_t offset = SYRLINKS::MESSAGE_HEADER_SIZE;
uint8_t lclConfig = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
sif::info << "SyrlinksHkHandler::parseRxStatusRegistersReply: Lcl config: "
<< static_cast<unsigned int>(lclConfig) << std::endl;
}
void SyrlinksHkHandler::parseTxStatusReply(const uint8_t* packet) { void SyrlinksHkHandler::parseTxStatusReply(const uint8_t* packet) {
PoolReadGuard readHelper(&txDataset); PoolReadGuard readHelper(&txDataset);
uint16_t offset = SYRLINKS::MESSAGE_HEADER_SIZE; uint16_t offset = SYRLINKS::MESSAGE_HEADER_SIZE;

View File

@ -68,11 +68,12 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
/** W - write, 04 - 4 bytes in data field, 01 - value, 40 register to write value */ /** W - write, 04 - 4 bytes in data field, 01 - value, 40 register to write value */
std::string setTxModeModulation = "<W04:4001:4D69>"; std::string setTxModeModulation = "<W04:4001:4D69>";
std::string setTxModeCw = "<W04:4010:4968>"; std::string setTxModeCw = "<W04:4010:4968>";
std::string writeLclConfig = "<W04:0703:F320>"; std::string writeLclConfig = "<W04:0707:3FE4>";
std::string readTxStatus = "<R02:40:7555>"; std::string readTxStatus = "<R02:40:7555>";
std::string readTxWaveform = "<R02:44:B991>"; std::string readTxWaveform = "<R02:44:B991>";
std::string readTxAgcValueHighByte = "<R02:46:DFF3>"; std::string readTxAgcValueHighByte = "<R02:46:DFF3>";
std::string readTxAgcValueLowByte = "<R02:47:ECC2>"; std::string readTxAgcValueLowByte = "<R02:47:ECC2>";
std::string readLclConfig = "<R02:07:3002>";
/** /**
* In some cases it is not possible to extract from the received reply the information about * In some cases it is not possible to extract from the received reply the information about
@ -162,6 +163,8 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
*/ */
void parseRxStatusRegistersReply(const uint8_t* packet); void parseRxStatusRegistersReply(const uint8_t* packet);
void parseLclConfigReply(const uint8_t* packet);
/** /**
* @brief This function writes the read tx status register to the txStatusDataset. * @brief This function writes the read tx status register to the txStatusDataset.
* @param packet Pointer to the received packet. * @param packet Pointer to the received packet.

View File

@ -18,7 +18,8 @@ static const DeviceCommandId_t READ_TX_STATUS = 0x07;
static const DeviceCommandId_t READ_TX_WAVEFORM = 0x08; static const DeviceCommandId_t READ_TX_WAVEFORM = 0x08;
static const DeviceCommandId_t READ_TX_AGC_VALUE_HIGH_BYTE = 0x09; static const DeviceCommandId_t READ_TX_AGC_VALUE_HIGH_BYTE = 0x09;
static const DeviceCommandId_t READ_TX_AGC_VALUE_LOW_BYTE = 0x0A; static const DeviceCommandId_t READ_TX_AGC_VALUE_LOW_BYTE = 0x0A;
static const DeviceCommandId_t WRITE_LCL_CONFIG = 0x0B; static const DeviceCommandId_t WRITE_LCL_CONFIG = 11;
static const DeviceCommandId_t READ_LCL_CONFIG = 12;
/** Size of a simple transmission success response */ /** Size of a simple transmission success response */
static const uint8_t ACK_SIZE = 12; static const uint8_t ACK_SIZE = 12;