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