knx/tpuart_data_link_layer.h

41 lines
1.3 KiB
C
Raw Normal View History

#pragma once
#include <stdint.h>
#include "data_link_layer.h"
class TpUartDataLinkLayer: public DataLinkLayer
{
using DataLinkLayer::_deviceObject;
using DataLinkLayer::_platform;
2018-08-14 23:40:47 +02:00
using DataLinkLayer::_groupAddressTable;
public:
TpUartDataLinkLayer(DeviceObject& devObj, AddressTableObject& addrTab, NetworkLayer& layer,
Platform& platform);
void loop();
void enabled(bool value);
bool enabled() const;
private:
bool _enabled = false;
2018-07-14 01:15:26 +02:00
uint8_t* _sendBuffer = 0;
bool _sendResult = false;
uint16_t _sendBufferLength = 0;
bool sendFrame(CemiFrame& frame);
2018-07-14 01:15:26 +02:00
bool checkDataInd(uint8_t firstByte);
bool checkDataCon(uint8_t firstByte);
bool checkPollDataInd(uint8_t firstByte);
bool checkAckNackInd(uint8_t firstByte);
bool checkResetInd(uint8_t firstByte);
bool checkStateInd(uint8_t firstByte);
bool checkFrameStateInd(uint8_t firstByte);
bool checkConfigureInd(uint8_t firstByte);
bool checkFrameEndInd(uint8_t firstByte);
bool checkStopModeInd(uint8_t firstByte);
bool checkSystemStatInd(uint8_t firstByte);
void handleUnexpected(uint8_t firstByte);
void sendBytes(uint8_t* buffer, uint16_t length);
void frameBytesReceived(uint8_t* buffer, uint16_t length);
void resetChip();
void stopChip();
2018-09-07 23:25:16 +02:00
void sendAck(AddressType type, uint16_t address);
};