mirror of
https://github.com/thelsing/knx.git
synced 2025-08-03 13:48:15 +02:00
added adc response
This commit is contained in:
parent
434f619b63
commit
51e83c8210
@ -623,6 +623,25 @@ void ApplicationLayer::propertyValueWriteRequest(AckType ack, Priority priority,
|
||||
startIndex, data, length);
|
||||
}
|
||||
|
||||
void ApplicationLayer::adcReadResponse(AckType ack, Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl& secCtrl,
|
||||
uint8_t channelNr, uint8_t readCount, int16_t value)
|
||||
{
|
||||
CemiFrame frame(4);
|
||||
APDU& apdu = frame.apdu();
|
||||
apdu.type(ADCResponse);
|
||||
uint8_t* data = apdu.data();
|
||||
|
||||
data[0] |= (channelNr & 0b111111);
|
||||
data[1] = readCount;
|
||||
data[2] = value >> 8;
|
||||
data[3] = value & 0xFF;
|
||||
|
||||
if (asap == _connectedTsap)
|
||||
dataConnectedRequest(asap, priority, apdu, secCtrl);
|
||||
else
|
||||
dataIndividualRequest(ack, hopType, priority, asap, apdu, secCtrl);
|
||||
}
|
||||
|
||||
void ApplicationLayer::functionPropertyStateResponse(AckType ack, Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl& secCtrl,
|
||||
uint8_t objectIndex, uint8_t propertyId, uint8_t* resultData, uint8_t resultLength)
|
||||
{
|
||||
@ -1128,6 +1147,11 @@ void ApplicationLayer::individualIndication(HopCountType hopType, Priority prior
|
||||
case KeyResponse:
|
||||
_bau.keyWriteAppLayerConfirm(priority, hopType, tsap, secCtrl, data[1]);
|
||||
break;
|
||||
case ADCRead:
|
||||
//Since we don't have an adc for bus voltage, we just send zero as readCount
|
||||
uint8_t channelNr = tsap & 0b111111;
|
||||
this->adcReadResponse(AckRequested, priority, hopType, tsap, secCtrl, channelNr, 0, 0);
|
||||
break;
|
||||
default:
|
||||
print("Individual-indication: unhandled APDU-Type: ");
|
||||
println(apdu.type());
|
||||
|
@ -114,6 +114,8 @@ class ApplicationLayer
|
||||
uint16_t objectType, uint8_t objectInstance, uint8_t propertyId, uint8_t numberOfElements, uint16_t startIndex, uint8_t returnCode);
|
||||
void propertyValueWriteRequest(AckType ack, Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl& secCtrl, uint8_t objectIndex,
|
||||
uint8_t propertyId, uint8_t numberOfElements, uint16_t startIndex, uint8_t* data, uint8_t length);
|
||||
void adcReadResponse(AckType ack, Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl& secCtrl,
|
||||
uint8_t channelNr, uint8_t readCount, int16_t value);
|
||||
void functionPropertyStateResponse(AckType ack, Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl &secCtrl,
|
||||
uint8_t objectIndex, uint8_t propertyId, uint8_t *resultData, uint8_t resultLength);
|
||||
void functionPropertyExtStateResponse(AckType ack, Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl& secCtrl,
|
||||
|
@ -159,6 +159,8 @@ enum ApduType
|
||||
|
||||
// Application Layer Services on Point-to-point Connection-Oriented Communication Mode (mandatory)
|
||||
// Application Layer Services on Point-to-point Connectionless Communication Mode (either optional or mandatory)
|
||||
ADCRead = 0x0180,
|
||||
ADCResponse = 0x01C0,
|
||||
PropertyValueExtRead = 0x1CC,
|
||||
PropertyValueExtResponse = 0x1CD,
|
||||
PropertyValueExtWriteCon = 0x1CE,
|
||||
|
Loading…
Reference in New Issue
Block a user