RequestFrameCommand can now be configured individually for each command
If the return value equals nullptr, a retransmit is not performed
This commit is contained in:
parent
c35f12c7be
commit
a73707380f
@ -243,12 +243,13 @@ void HoymilesRadio::sendEsbPacket(CommandAbstract* cmd)
|
||||
|
||||
void HoymilesRadio::sendRetransmitPacket(uint8_t fragment_id)
|
||||
{
|
||||
RequestFrameCommand cmd(
|
||||
_commandQueue.front().get()->getTargetAddress(),
|
||||
DtuSerial().u64,
|
||||
fragment_id);
|
||||
CommandAbstract* cmd = _commandQueue.front().get();
|
||||
|
||||
sendEsbPacket(&cmd);
|
||||
CommandAbstract* requestCmd = cmd->getRequestFrameCommand(fragment_id);
|
||||
|
||||
if (requestCmd != nullptr) {
|
||||
sendEsbPacket(requestCmd);
|
||||
}
|
||||
}
|
||||
|
||||
void HoymilesRadio::sendLastPacketAgain()
|
||||
|
||||
@ -10,6 +10,7 @@ CommandAbstract::CommandAbstract(uint64_t target_address, uint64_t router_addres
|
||||
setTargetAddress(target_address);
|
||||
setRouterAddress(router_address);
|
||||
setSendCount(0);
|
||||
setTimeout(0);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -85,6 +86,11 @@ uint8_t CommandAbstract::incrementSendCount()
|
||||
return _sendCount++;
|
||||
}
|
||||
|
||||
CommandAbstract* CommandAbstract::getRequestFrameCommand(uint8_t frame_no)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CommandAbstract::convertSerialToPacketId(uint8_t buffer[], uint64_t serial)
|
||||
{
|
||||
serial_u s;
|
||||
|
||||
@ -32,6 +32,8 @@ public:
|
||||
uint8_t getSendCount();
|
||||
uint8_t incrementSendCount();
|
||||
|
||||
virtual CommandAbstract* getRequestFrameCommand(uint8_t frame_no);
|
||||
|
||||
virtual RequestType getRequestType() = 0;
|
||||
|
||||
protected:
|
||||
|
||||
@ -50,6 +50,14 @@ time_t MultiDataCommand::getTime()
|
||||
| (time_t)(_payload[15]);
|
||||
}
|
||||
|
||||
CommandAbstract* MultiDataCommand::getRequestFrameCommand(uint8_t frame_no)
|
||||
{
|
||||
_cmdRequestFrame.setTargetAddress(getTargetAddress());
|
||||
_cmdRequestFrame.setFrameNo(frame_no);
|
||||
|
||||
return &_cmdRequestFrame;
|
||||
}
|
||||
|
||||
void MultiDataCommand::udpateCRC()
|
||||
{
|
||||
uint16_t crc = crc16(&_payload[10], 14); // From data_type till password
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CommandAbstract.h"
|
||||
#include "RequestFrameCommand.h"
|
||||
#include <sys/time.h>
|
||||
|
||||
class MultiDataCommand : public CommandAbstract {
|
||||
@ -10,8 +11,12 @@ public:
|
||||
void setTime(time_t time);
|
||||
time_t getTime();
|
||||
|
||||
CommandAbstract* getRequestFrameCommand(uint8_t frame_no);
|
||||
|
||||
protected:
|
||||
void setDataType(uint8_t data_type);
|
||||
uint8_t getDataType();
|
||||
void udpateCRC();
|
||||
|
||||
RequestFrameCommand _cmdRequestFrame;
|
||||
};
|
||||
@ -4,4 +4,5 @@ SingleDataCommand::SingleDataCommand(uint64_t target_address, uint64_t router_ad
|
||||
: CommandAbstract(target_address, router_address)
|
||||
{
|
||||
_payload[0] = 0x15;
|
||||
setTimeout(100);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user