meier/syrlinks #199
@ -11,7 +11,7 @@ SyrlinksHkHandler::SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, Co
|
|||||||
txDataset(this),
|
txDataset(this),
|
||||||
temperatureSet(this),
|
temperatureSet(this),
|
||||||
powerSwitch(powerSwitch) {
|
powerSwitch(powerSwitch) {
|
||||||
if (comCookie == NULL) {
|
if (comCookie == nullptr) {
|
||||||
sif::warning << "SyrlinksHkHandler: Invalid com cookie" << std::endl;
|
sif::warning << "SyrlinksHkHandler: Invalid com cookie" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,14 +78,14 @@ ReturnValue_t SyrlinksHkHandler::buildNormalDeviceCommand(DeviceCommandId_t* id)
|
|||||||
<< "command id" << std::endl;
|
<< "command id" << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return buildCommandFromCommand(*id, NULL, 0);
|
return buildCommandFromCommand(*id, nullptr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SyrlinksHkHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
ReturnValue_t SyrlinksHkHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
||||||
switch (startupState) {
|
switch (startupState) {
|
||||||
case StartupState::ENABLE_TEMPERATURE_PROTECTION: {
|
case StartupState::ENABLE_TEMPERATURE_PROTECTION: {
|
||||||
*id = syrlinks::WRITE_LCL_CONFIG;
|
*id = syrlinks::WRITE_LCL_CONFIG;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return buildCommandFromCommand(*id, nullptr, 0);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -167,10 +167,12 @@ ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(DeviceCommandId_t devic
|
|||||||
}
|
}
|
||||||
case (syrlinks::ENABLE_DEBUG): {
|
case (syrlinks::ENABLE_DEBUG): {
|
||||||
debug = true;
|
debug = true;
|
||||||
|
rawPacketLen = 0;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
case (syrlinks::DISABLE_DEBUG): {
|
case (syrlinks::DISABLE_DEBUG): {
|
||||||
debug = false;
|
debug = false;
|
||||||
|
rawPacketLen = 0;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -469,7 +471,7 @@ ReturnValue_t SyrlinksHkHandler::parseReplyStatus(const char* status) {
|
|||||||
case '0':
|
case '0':
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
case '1':
|
case '1':
|
||||||
sif::debug << "SyrlinksHkHandler::parseReplyStatus: Uart faming or parity error" << std::endl;
|
sif::debug << "SyrlinksHkHandler::parseReplyStatus: Uart framing or parity error" << std::endl;
|
||||||
return UART_FRAMIN_OR_PARITY_ERROR_ACK;
|
return UART_FRAMIN_OR_PARITY_ERROR_ACK;
|
||||||
case '2':
|
case '2':
|
||||||
sif::debug << "SyrlinksHkHandler::parseReplyStatus: Bad character detected" << std::endl;
|
sif::debug << "SyrlinksHkHandler::parseReplyStatus: Bad character detected" << std::endl;
|
||||||
@ -555,8 +557,10 @@ void SyrlinksHkHandler::parseRxStatusRegistersReply(const uint8_t* packet) {
|
|||||||
void SyrlinksHkHandler::parseLclConfigReply(const uint8_t* packet) {
|
void SyrlinksHkHandler::parseLclConfigReply(const uint8_t* packet) {
|
||||||
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
|
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
|
||||||
uint8_t lclConfig = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
|
uint8_t lclConfig = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
|
||||||
sif::info << "SyrlinksHkHandler::parseRxStatusRegistersReply: Lcl config: "
|
if (debug) {
|
||||||
<< static_cast<unsigned int>(lclConfig) << std::endl;
|
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) {
|
||||||
@ -564,8 +568,10 @@ void SyrlinksHkHandler::parseTxStatusReply(const uint8_t* packet) {
|
|||||||
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
|
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
|
||||||
txDataset.txStatus = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
|
txDataset.txStatus = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
|
||||||
#if OBSW_DEBUG_SYRLINKS == 1
|
#if OBSW_DEBUG_SYRLINKS == 1
|
||||||
|
if (debug) {
|
||||||
sif::info << "Syrlinks TX Status: 0x" << std::hex << (unsigned int)txDataset.txStatus.value
|
sif::info << "Syrlinks TX Status: 0x" << std::hex << (unsigned int)txDataset.txStatus.value
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,8 +580,10 @@ void SyrlinksHkHandler::parseTxWaveformReply(const uint8_t* packet) {
|
|||||||
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
|
uint16_t offset = syrlinks::MESSAGE_HEADER_SIZE;
|
||||||
txDataset.txWaveform = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
|
txDataset.txWaveform = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
|
||||||
#if OBSW_DEBUG_SYRLINKS == 1
|
#if OBSW_DEBUG_SYRLINKS == 1
|
||||||
|
if (debug) {
|
||||||
sif::info << "Syrlinks TX Waveform: 0x" << std::hex << (unsigned int)txDataset.txWaveform.value
|
sif::info << "Syrlinks TX Waveform: 0x" << std::hex << (unsigned int)txDataset.txWaveform.value
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -585,7 +593,9 @@ void SyrlinksHkHandler::parseAgcLowByte(const uint8_t* packet) {
|
|||||||
txDataset.txAgcValue = agcValueHighByte << 8 |
|
txDataset.txAgcValue = agcValueHighByte << 8 |
|
||||||
convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
|
convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
|
||||||
#if OBSW_DEBUG_SYRLINKS == 1
|
#if OBSW_DEBUG_SYRLINKS == 1
|
||||||
sif::info << "Syrlinks TX AGC Value: " << txDataset.txAgcValue << std::endl;
|
if (debug) {
|
||||||
|
sif::info << "Syrlinks TX AGC Value: " << txDataset.txAgcValue << std::endl;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -597,7 +607,7 @@ void SyrlinksHkHandler::parseAgcHighByte(const uint8_t* packet) {
|
|||||||
|
|
||||||
void SyrlinksHkHandler::setNormalDatapoolEntriesInvalid() {}
|
void SyrlinksHkHandler::setNormalDatapoolEntriesInvalid() {}
|
||||||
|
|
||||||
uint32_t SyrlinksHkHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 5000; }
|
uint32_t SyrlinksHkHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
|
||||||
|
|
||||||
ReturnValue_t SyrlinksHkHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t SyrlinksHkHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) {
|
LocalDataPoolManager& poolManager) {
|
||||||
@ -635,7 +645,7 @@ ReturnValue_t SyrlinksHkHandler::handleAckReply(const uint8_t* packet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SyrlinksHkHandler::prepareCommand(std::string command, DeviceCommandId_t commandId) {
|
void SyrlinksHkHandler::prepareCommand(std::string command, DeviceCommandId_t commandId) {
|
||||||
command.copy(reinterpret_cast<char*>(commandBuffer), readTxWaveform.size(), 0);
|
command.copy(reinterpret_cast<char*>(commandBuffer), command.size(), 0);
|
||||||
rawPacketLen = command.size();
|
rawPacketLen = command.size();
|
||||||
rememberCommandId = commandId;
|
rememberCommandId = commandId;
|
||||||
rawPacket = commandBuffer;
|
rawPacket = commandBuffer;
|
||||||
|
Loading…
Reference in New Issue
Block a user