Syrlinks Update #353

Merged
muellerr merged 24 commits from refactor_syrlinks into develop 2023-01-26 19:18:33 +01:00
4 changed files with 27 additions and 20 deletions
Showing only changes of commit 4ad6584782 - Show all commits

View File

@ -3,7 +3,11 @@
namespace com { namespace com {
enum class Datarate: uint8_t { LOW_RATE_MODULATION_BPSK, HIGH_RATE_MODULATION_0QPSK, NUM_DATARATES }; enum class Datarate : uint8_t {
LOW_RATE_MODULATION_BPSK,
HIGH_RATE_MODULATION_0QPSK,
NUM_DATARATES
};
} }

View File

@ -649,10 +649,12 @@ ReturnValue_t SyrlinksHandler::handleAckReply(const uint8_t* packet) {
parseReplyStatus(reinterpret_cast<const char*>(packet + syrlinks::MESSAGE_HEADER_SIZE)); parseReplyStatus(reinterpret_cast<const char*>(packet + syrlinks::MESSAGE_HEADER_SIZE));
switch (rememberCommandId) { switch (rememberCommandId) {
case (syrlinks::WRITE_LCL_CONFIG): { case (syrlinks::WRITE_LCL_CONFIG): {
if (result != returnvalue::OK) { if (isTransitionalMode()) {
internalState = InternalState::OFF; if (result != returnvalue::OK) {
} else if (result == returnvalue::OK) { internalState = InternalState::OFF;
commandExecuted = true; } else if (result == returnvalue::OK) {
commandExecuted = true;
}
} }
break; break;
} }
@ -681,22 +683,25 @@ ReturnValue_t SyrlinksHandler::isModeCombinationValid(Mode_t mode, Submode_t sub
} }
ReturnValue_t SyrlinksHandler::getParameter(uint8_t domainId, uint8_t uniqueId, ReturnValue_t SyrlinksHandler::getParameter(uint8_t domainId, uint8_t uniqueId,
ParameterWrapper *parameterWrapper, const ParameterWrapper *newValues, uint16_t startAtIndex) { ParameterWrapper* parameterWrapper,
if((domainId == 0) and (uniqueId == static_cast<uint8_t>(syrlinks::ParameterId::DATARATE))) { const ParameterWrapper* newValues,
if(newValues->getSerializedSize() != 1) { uint16_t startAtIndex) {
if ((domainId == 0) and (uniqueId == static_cast<uint8_t>(syrlinks::ParameterId::DATARATE))) {
if (newValues->getSerializedSize() != 1) {
return HasParametersIF::INVALID_VALUE; return HasParametersIF::INVALID_VALUE;
} }
uint8_t newVal = 0; uint8_t newVal = 0;
ReturnValue_t result = newValues->getElement(&newVal); ReturnValue_t result = newValues->getElement(&newVal);
if(result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if(newVal >= static_cast<uint8_t>(com::Datarate::NUM_DATARATES)) { if (newVal >= static_cast<uint8_t>(com::Datarate::NUM_DATARATES)) {
return HasParametersIF::INVALID_VALUE; return HasParametersIF::INVALID_VALUE;
} }
parameterWrapper->set(&datarateCfgRaw); parameterWrapper->set(&datarateCfgRaw);
} }
return DeviceHandlerBase::getParameter(domainId, uniqueId, parameterWrapper, newValues, startAtIndex); return DeviceHandlerBase::getParameter(domainId, uniqueId, parameterWrapper, newValues,
startAtIndex);
} }
void SyrlinksHandler::prepareCommand(std::string command, DeviceCommandId_t commandId) { void SyrlinksHandler::prepareCommand(std::string command, DeviceCommandId_t commandId) {
@ -742,7 +747,8 @@ void SyrlinksHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
if (txOnHandler(InternalState::SELECT_MODULATION_BPSK)) { if (txOnHandler(InternalState::SELECT_MODULATION_BPSK)) {
return; return;
} }
} else if (datarateCfgRaw == static_cast<uint8_t>(com::Datarate::HIGH_RATE_MODULATION_0QPSK)) { } else if (datarateCfgRaw ==
static_cast<uint8_t>(com::Datarate::HIGH_RATE_MODULATION_0QPSK)) {
if (txOnHandler(InternalState::SELECT_MODULATION_0QPSK)) { if (txOnHandler(InternalState::SELECT_MODULATION_0QPSK)) {
return; return;
} }

View File

@ -53,10 +53,9 @@ class SyrlinksHandler : public DeviceHandlerBase {
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
// Parameter IF // Parameter IF
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper* parameterWrapper,
ParameterWrapper *parameterWrapper, const ParameterWrapper* newValues, uint16_t startAtIndex) override;
const ParameterWrapper *newValues,
uint16_t startAtIndex) override;
private: private:
static const uint8_t INTERFACE_ID = CLASS_ID::SYRLINKS_HANDLER; static const uint8_t INTERFACE_ID = CLASS_ID::SYRLINKS_HANDLER;
@ -107,7 +106,7 @@ class SyrlinksHandler : public DeviceHandlerBase {
const power::Switch_t powerSwitch = power::NO_SWITCH; const power::Switch_t powerSwitch = power::NO_SWITCH;
// Use uint8_t for compatibility with parameter interface // Use uint8_t for compatibility with parameter interface
uint8_t datarateCfgRaw = static_cast<uint8_t>(com::Datarate::LOW_RATE_MODULATION_BPSK); uint8_t datarateCfgRaw = static_cast<uint8_t>(com::Datarate::LOW_RATE_MODULATION_BPSK);
//com::Datarate datarateCfg = com::Datarate::LOW_RATE_MODULATION_BPSK; // com::Datarate datarateCfg = com::Datarate::LOW_RATE_MODULATION_BPSK;
bool debugMode = false; bool debugMode = false;
uint8_t agcValueHighByte = 0; uint8_t agcValueHighByte = 0;

View File

@ -6,9 +6,7 @@
namespace syrlinks { namespace syrlinks {
enum class ParameterId: uint8_t { enum class ParameterId : uint8_t { DATARATE = 0 };
DATARATE = 0
};
enum Submode { enum Submode {
DEFAULT, DEFAULT,