knx/tpuart_data_link_layer.h
2018-07-14 01:15:26 +02:00

34 lines
1.1 KiB
C++

#pragma once
#include <stdint.h>
#include "data_link_layer.h"
class TpUartDataLinkLayer: public DataLinkLayer
{
using DataLinkLayer::_deviceObject;
public:
TpUartDataLinkLayer(DeviceObject& devObj, AddressTableObject& addrTab, NetworkLayer& layer,
Platform& platform);
void loop();
void enabled(bool value);
bool enabled() const;
private:
bool _enabled = false;
uint8_t* _sendBuffer = 0;
bool _sendResult = false;
bool sendFrame(CemiFrame& frame);
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);
};