Files
ThermometerPro/meterBusClientFrames.cpp
2014-04-02 22:50:17 +02:00

45 lines
665 B
C++

/*
* meterBusClientFrames.cpp
*
* Created on: 09.03.2014
* Author: wn
*/
#include "meterBusClient.h"
inline void MeterBusClient::aSB(unsigned char c) {
sendBuffer[sendBufferLen++] = c;
}
unsigned char MeterBusClient::calcSendChecksum() {
unsigned char checksum = 0;
for (unsigned int i = 4; i < sendBufferLen; i++) {
checksum += sendBuffer[i];
}
return checksum;
}
void MeterBusClient::SND_NKE() {
sendBufferLen = 0;
aSB(0xE5);
}
void MeterBusClient::REQ_UD2() {
sendBufferLen = 0;
aSB(0x68);
aSB(0x03);
aSB(0x03);
aSB(0x68);
aSB(0x01);
aSB(getAddress());
aSB(0x03);
aSB(calcSendChecksum());
aSB(0x16);
}