mirror of
https://github.com/thelsing/knx.git
synced 2025-10-02 17:52:04 +02:00
fixed typo: induvidualAddress
This commit is contained in:
parent
66d862f599
commit
ed20f394c1
@ -51,7 +51,7 @@ void setup()
|
|||||||
srand((unsigned int)time(NULL));
|
srand((unsigned int)time(NULL));
|
||||||
knx.readMemory();
|
knx.readMemory();
|
||||||
|
|
||||||
if (knx.induvidualAddress() == 0)
|
if (knx.individualAddress() == 0)
|
||||||
knx.progMode(true);
|
knx.progMode(true);
|
||||||
|
|
||||||
if (knx.configured())
|
if (knx.configured())
|
||||||
|
@ -97,7 +97,7 @@ void setup()
|
|||||||
srand((unsigned int)time(NULL));
|
srand((unsigned int)time(NULL));
|
||||||
knx.readMemory();
|
knx.readMemory();
|
||||||
|
|
||||||
if (knx.induvidualAddress() == 0)
|
if (knx.individualAddress() == 0)
|
||||||
knx.progMode(true);
|
knx.progMode(true);
|
||||||
|
|
||||||
if (knx.configured())
|
if (knx.configured())
|
||||||
|
@ -75,7 +75,7 @@ void setup(void)
|
|||||||
// read adress table, association table, groupobject table and parameters from eeprom
|
// read adress table, association table, groupobject table and parameters from eeprom
|
||||||
knx.readMemory();
|
knx.readMemory();
|
||||||
|
|
||||||
if (knx.induvidualAddress() == 0)
|
if (knx.individualAddress() == 0)
|
||||||
knx.progMode(true);
|
knx.progMode(true);
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ bool Bau07B0::isAckRequired(uint16_t address, bool isGrpAddr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Also ACK for our own individual address
|
// Also ACK for our own individual address
|
||||||
if (address == _deviceObj.induvidualAddress())
|
if (address == _deviceObj.individualAddress())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -441,7 +441,7 @@ void BauSystemB::individualAddressReadIndication(HopCountType hopType, const Sec
|
|||||||
void BauSystemB::individualAddressWriteIndication(HopCountType hopType, const SecurityControl &secCtrl, uint16_t newaddress)
|
void BauSystemB::individualAddressWriteIndication(HopCountType hopType, const SecurityControl &secCtrl, uint16_t newaddress)
|
||||||
{
|
{
|
||||||
if (_deviceObj.progMode())
|
if (_deviceObj.progMode())
|
||||||
_deviceObj.induvidualAddress(newaddress);
|
_deviceObj.individualAddress(newaddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BauSystemB::individualAddressSerialNumberWriteIndication(Priority priority, HopCountType hopType, const SecurityControl &secCtrl, uint16_t newIndividualAddress,
|
void BauSystemB::individualAddressSerialNumberWriteIndication(Priority priority, HopCountType hopType, const SecurityControl &secCtrl, uint16_t newIndividualAddress,
|
||||||
@ -450,7 +450,7 @@ void BauSystemB::individualAddressSerialNumberWriteIndication(Priority priority,
|
|||||||
// If the received serial number matches our serial number
|
// If the received serial number matches our serial number
|
||||||
// then store the received new individual address in the device object
|
// then store the received new individual address in the device object
|
||||||
if (!memcmp(knxSerialNumber, _deviceObj.propertyData(PID_SERIAL_NUMBER), 6))
|
if (!memcmp(knxSerialNumber, _deviceObj.propertyData(PID_SERIAL_NUMBER), 6))
|
||||||
_deviceObj.induvidualAddress(newIndividualAddress);
|
_deviceObj.individualAddress(newIndividualAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BauSystemB::individualAddressSerialNumberReadIndication(Priority priority, HopCountType hopType, const SecurityControl &secCtrl, uint8_t* knxSerialNumber)
|
void BauSystemB::individualAddressSerialNumberReadIndication(Priority priority, HopCountType hopType, const SecurityControl &secCtrl, uint8_t* knxSerialNumber)
|
||||||
|
@ -18,7 +18,7 @@ CemiServer::CemiServer(BauSystemB& bau)
|
|||||||
{
|
{
|
||||||
// The cEMI server will hand out the device address + 1 to the cEMI client (e.g. ETS),
|
// The cEMI server will hand out the device address + 1 to the cEMI client (e.g. ETS),
|
||||||
// so that the device and the cEMI client/server connection(tunnel) can operate simultaneously.
|
// so that the device and the cEMI client/server connection(tunnel) can operate simultaneously.
|
||||||
_clientAddress = _bau.deviceObject().induvidualAddress() + 1;
|
_clientAddress = _bau.deviceObject().individualAddress() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CemiServer::dataLinkLayer(DataLinkLayer& layer)
|
void CemiServer::dataLinkLayer(DataLinkLayer& layer)
|
||||||
|
@ -91,7 +91,7 @@ void DataLinkLayer::frameReceived(CemiFrame& frame)
|
|||||||
FrameFormat type = frame.frameType();
|
FrameFormat type = frame.frameType();
|
||||||
Priority priority = frame.priority();
|
Priority priority = frame.priority();
|
||||||
NPDU& npdu = frame.npdu();
|
NPDU& npdu = frame.npdu();
|
||||||
uint16_t ownAddr = _deviceObject.induvidualAddress();
|
uint16_t ownAddr = _deviceObject.individualAddress();
|
||||||
SystemBroadcast systemBroadcast = frame.systemBroadcast();
|
SystemBroadcast systemBroadcast = frame.systemBroadcast();
|
||||||
|
|
||||||
#ifdef USE_CEMI_SERVER
|
#ifdef USE_CEMI_SERVER
|
||||||
|
@ -113,12 +113,12 @@ uint16_t DeviceObject::saveSize()
|
|||||||
return 2 + InterfaceObject::saveSize();
|
return 2 + InterfaceObject::saveSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t DeviceObject::induvidualAddress()
|
uint16_t DeviceObject::individualAddress()
|
||||||
{
|
{
|
||||||
return _ownAddress;
|
return _ownAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceObject::induvidualAddress(uint16_t value)
|
void DeviceObject::individualAddress(uint16_t value)
|
||||||
{
|
{
|
||||||
_ownAddress = value;
|
_ownAddress = value;
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ public:
|
|||||||
const uint8_t* restore(const uint8_t* buffer) override;
|
const uint8_t* restore(const uint8_t* buffer) override;
|
||||||
uint16_t saveSize() override;
|
uint16_t saveSize() override;
|
||||||
|
|
||||||
uint16_t induvidualAddress();
|
uint16_t individualAddress();
|
||||||
void induvidualAddress(uint16_t value);
|
void individualAddress(uint16_t value);
|
||||||
|
|
||||||
void individualAddressDuplication(bool value);
|
void individualAddressDuplication(bool value);
|
||||||
bool verifyMode();
|
bool verifyMode();
|
||||||
|
@ -79,7 +79,7 @@ void IpDataLinkLayer::loop()
|
|||||||
void IpDataLinkLayer::enabled(bool value)
|
void IpDataLinkLayer::enabled(bool value)
|
||||||
{
|
{
|
||||||
// _print("own address: ");
|
// _print("own address: ");
|
||||||
// _println(_deviceObject.induvidualAddress());
|
// _println(_deviceObject.individualAddress());
|
||||||
if (value && !_enabled)
|
if (value && !_enabled)
|
||||||
{
|
{
|
||||||
_platform.setupMultiCast(_ipParameters.propertyValue<uint32_t>(PID_ROUTING_MULTICAST_ADDRESS), KNXIP_MULTICAST_PORT);
|
_platform.setupMultiCast(_ipParameters.propertyValue<uint32_t>(PID_ROUTING_MULTICAST_ADDRESS), KNXIP_MULTICAST_PORT);
|
||||||
|
@ -26,12 +26,12 @@ IpParameterObject::IpParameterObject(DeviceObject& deviceObject, Platform& platf
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// TODO: get property of deviceobject and use it
|
// TODO: get property of deviceobject and use it
|
||||||
pushWord(io->_deviceObject.induvidualAddress(), data);
|
pushWord(io->_deviceObject.individualAddress(), data);
|
||||||
return 1;
|
return 1;
|
||||||
},
|
},
|
||||||
[](IpParameterObject* io, uint16_t start, uint8_t count, const uint8_t* data) -> uint8_t
|
[](IpParameterObject* io, uint16_t start, uint8_t count, const uint8_t* data) -> uint8_t
|
||||||
{
|
{
|
||||||
io->_deviceObject.induvidualAddress(getWord(data));
|
io->_deviceObject.individualAddress(getWord(data));
|
||||||
return 1;
|
return 1;
|
||||||
}),
|
}),
|
||||||
new DataProperty(PID_IP_ASSIGNMENT_METHOD, true, PDT_UNSIGNED_CHAR, 1, ReadLv3 | WriteLv3),
|
new DataProperty(PID_IP_ASSIGNMENT_METHOD, true, PDT_UNSIGNED_CHAR, 1, ReadLv3 | WriteLv3),
|
||||||
|
@ -10,7 +10,7 @@ NetworkLayerCoupler::NetworkLayerCoupler(DeviceObject &deviceObj,
|
|||||||
NetworkLayer(deviceObj, layer),
|
NetworkLayer(deviceObj, layer),
|
||||||
_netLayerEntities { {*this, kPrimaryIfIndex}, {*this, kSecondaryIfIndex} }
|
_netLayerEntities { {*this, kPrimaryIfIndex}, {*this, kSecondaryIfIndex} }
|
||||||
{
|
{
|
||||||
_currentAddress = deviceObj.induvidualAddress();
|
_currentAddress = deviceObj.individualAddress();
|
||||||
evaluateCouplerType();
|
evaluateCouplerType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ void NetworkLayerCoupler::rtObjSecondary(RouterObject& rtObjSecondary)
|
|||||||
void NetworkLayerCoupler::evaluateCouplerType()
|
void NetworkLayerCoupler::evaluateCouplerType()
|
||||||
{
|
{
|
||||||
// Check coupler mode
|
// Check coupler mode
|
||||||
if ((_deviceObj.induvidualAddress() & 0x00FF) == 0x00)
|
if ((_deviceObj.individualAddress() & 0x00FF) == 0x00)
|
||||||
{
|
{
|
||||||
// Device is a router
|
// Device is a router
|
||||||
// Check if line coupler or backbone coupler
|
// Check if line coupler or backbone coupler
|
||||||
if ((_deviceObj.induvidualAddress() & 0x0F00) == 0x0)
|
if ((_deviceObj.individualAddress() & 0x0F00) == 0x0)
|
||||||
{
|
{
|
||||||
// Device is a backbone coupler -> individual address: x.0.0
|
// Device is a backbone coupler -> individual address: x.0.0
|
||||||
_couplerType = BackboneCoupler;
|
_couplerType = BackboneCoupler;
|
||||||
@ -99,7 +99,7 @@ bool NetworkLayerCoupler::isRoutedIndividualAddress(uint16_t individualAddress)
|
|||||||
// too. A typical use case is the protection of a Subnetwork that is located outside a building)
|
// too. A typical use case is the protection of a Subnetwork that is located outside a building)
|
||||||
|
|
||||||
// Also ACK for our own individual address
|
// Also ACK for our own individual address
|
||||||
if (individualAddress == _deviceObj.induvidualAddress())
|
if (individualAddress == _deviceObj.individualAddress())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// use 2 for now
|
// use 2 for now
|
||||||
@ -158,7 +158,7 @@ void NetworkLayerCoupler::routeDataIndividual(AckType ack, uint16_t destination,
|
|||||||
{
|
{
|
||||||
// TODO: improve: we have to be notified about anything that might affect routing decision
|
// TODO: improve: we have to be notified about anything that might affect routing decision
|
||||||
// Ugly: we could ALWAYS evaluate coupler type for every received frame
|
// Ugly: we could ALWAYS evaluate coupler type for every received frame
|
||||||
if (_currentAddress != _deviceObj.induvidualAddress())
|
if (_currentAddress != _deviceObj.individualAddress())
|
||||||
{
|
{
|
||||||
evaluateCouplerType();
|
evaluateCouplerType();
|
||||||
}
|
}
|
||||||
@ -172,8 +172,8 @@ void NetworkLayerCoupler::routeDataIndividual(AckType ack, uint16_t destination,
|
|||||||
* Z high nibble of high order octet of the Destination Address, i.e. Area Address
|
* Z high nibble of high order octet of the Destination Address, i.e. Area Address
|
||||||
* ZS high order octet of the Destination Address, i.e. hierarchy information part: Area Address + Line Address
|
* ZS high order octet of the Destination Address, i.e. hierarchy information part: Area Address + Line Address
|
||||||
*/
|
*/
|
||||||
uint16_t ownSNA = _deviceObj.induvidualAddress() & 0xFF00; // Own subnetwork address (area + line)
|
uint16_t ownSNA = _deviceObj.individualAddress() & 0xFF00; // Own subnetwork address (area + line)
|
||||||
uint16_t ownAA = _deviceObj.induvidualAddress() & 0xF000; // Own area address
|
uint16_t ownAA = _deviceObj.individualAddress() & 0xF000; // Own area address
|
||||||
uint16_t ZS = destination & 0xFF00; // destination subnetwork address (area + line)
|
uint16_t ZS = destination & 0xFF00; // destination subnetwork address (area + line)
|
||||||
uint16_t Z = destination & 0xF000; // destination area address
|
uint16_t Z = destination & 0xF000; // destination area address
|
||||||
uint16_t D = destination & 0x00FF; // destination device address (without subnetwork part)
|
uint16_t D = destination & 0x00FF; // destination device address (without subnetwork part)
|
||||||
@ -324,7 +324,7 @@ void NetworkLayerCoupler::dataConfirm(AckType ack, AddressType addrType, uint16_
|
|||||||
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
|
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
|
||||||
|
|
||||||
// Check if received frame is an echo from our sent frame, we are a normal device in this case
|
// Check if received frame is an echo from our sent frame, we are a normal device in this case
|
||||||
if (source == _deviceObj.induvidualAddress())
|
if (source == _deviceObj.individualAddress())
|
||||||
{
|
{
|
||||||
if (addrType == InduvidualAddress)
|
if (addrType == InduvidualAddress)
|
||||||
{
|
{
|
||||||
@ -365,7 +365,7 @@ void NetworkLayerCoupler::broadcastConfirm(AckType ack, FrameFormat format, Prio
|
|||||||
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
|
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
|
||||||
|
|
||||||
// Check if received frame is an echo from our sent frame, we are a normal device in this case
|
// Check if received frame is an echo from our sent frame, we are a normal device in this case
|
||||||
if (source == _deviceObj.induvidualAddress())
|
if (source == _deviceObj.individualAddress())
|
||||||
{
|
{
|
||||||
_transportLayer.dataBroadcastConfirm(ack, hopType, priority, npdu.tpdu(), status);
|
_transportLayer.dataBroadcastConfirm(ack, hopType, priority, npdu.tpdu(), status);
|
||||||
}
|
}
|
||||||
@ -386,7 +386,7 @@ void NetworkLayerCoupler::systemBroadcastIndication(AckType ack, FrameFormat for
|
|||||||
void NetworkLayerCoupler::systemBroadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status, uint8_t srcIfIdx)
|
void NetworkLayerCoupler::systemBroadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status, uint8_t srcIfIdx)
|
||||||
{
|
{
|
||||||
// Check if received frame is an echo from our sent frame, we are a normal device in this case
|
// Check if received frame is an echo from our sent frame, we are a normal device in this case
|
||||||
if (source == _deviceObj.induvidualAddress())
|
if (source == _deviceObj.individualAddress())
|
||||||
{
|
{
|
||||||
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
|
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
|
||||||
_transportLayer.dataSystemBroadcastConfirm(ack, hopType, npdu.tpdu(), priority, status);
|
_transportLayer.dataSystemBroadcastConfirm(ack, hopType, npdu.tpdu(), priority, status);
|
||||||
@ -408,7 +408,7 @@ void NetworkLayerCoupler::dataIndividualRequest(AckType ack, uint16_t destinatio
|
|||||||
// print.print("-> NL ");
|
// print.print("-> NL ");
|
||||||
// tpdu.apdu().printPDU();
|
// tpdu.apdu().printPDU();
|
||||||
//}
|
//}
|
||||||
routeDataIndividual(ack, destination, npdu, priority, _deviceObj.induvidualAddress(), kLocalIfIndex);
|
routeDataIndividual(ack, destination, npdu, priority, _deviceObj.individualAddress(), kLocalIfIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkLayerCoupler::dataGroupRequest(AckType ack, uint16_t destination, HopCountType hopType, Priority priority, TPDU& tpdu)
|
void NetworkLayerCoupler::dataGroupRequest(AckType ack, uint16_t destination, HopCountType hopType, Priority priority, TPDU& tpdu)
|
||||||
@ -423,10 +423,10 @@ void NetworkLayerCoupler::dataGroupRequest(AckType ack, uint16_t destination, Ho
|
|||||||
// If the group address is in the filter table, then we route it to the primary side too
|
// If the group address is in the filter table, then we route it to the primary side too
|
||||||
if (isGroupAddressInFilterTable(destination))
|
if (isGroupAddressInFilterTable(destination))
|
||||||
{
|
{
|
||||||
_netLayerEntities[kPrimaryIfIndex].sendDataRequest(npdu, ack, destination, _deviceObj.induvidualAddress(), priority, GroupAddress, Broadcast);
|
_netLayerEntities[kPrimaryIfIndex].sendDataRequest(npdu, ack, destination, _deviceObj.individualAddress(), priority, GroupAddress, Broadcast);
|
||||||
}
|
}
|
||||||
// We send it to our sub line in any case
|
// We send it to our sub line in any case
|
||||||
_netLayerEntities[kSecondaryIfIndex].sendDataRequest(npdu, ack, destination, _deviceObj.induvidualAddress(), priority, GroupAddress, Broadcast);
|
_netLayerEntities[kSecondaryIfIndex].sendDataRequest(npdu, ack, destination, _deviceObj.individualAddress(), priority, GroupAddress, Broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkLayerCoupler::dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu)
|
void NetworkLayerCoupler::dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu)
|
||||||
@ -438,8 +438,8 @@ void NetworkLayerCoupler::dataBroadcastRequest(AckType ack, HopCountType hopType
|
|||||||
else
|
else
|
||||||
npdu.hopCount(hopCount());
|
npdu.hopCount(hopCount());
|
||||||
|
|
||||||
_netLayerEntities[kPrimaryIfIndex].sendDataRequest(npdu, ack, 0, _deviceObj.induvidualAddress(), priority, GroupAddress, Broadcast);
|
_netLayerEntities[kPrimaryIfIndex].sendDataRequest(npdu, ack, 0, _deviceObj.individualAddress(), priority, GroupAddress, Broadcast);
|
||||||
_netLayerEntities[kSecondaryIfIndex].sendDataRequest(npdu, ack, 0, _deviceObj.induvidualAddress(), priority, GroupAddress, Broadcast);
|
_netLayerEntities[kSecondaryIfIndex].sendDataRequest(npdu, ack, 0, _deviceObj.individualAddress(), priority, GroupAddress, Broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkLayerCoupler::dataSystemBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu)
|
void NetworkLayerCoupler::dataSystemBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu)
|
||||||
@ -451,6 +451,6 @@ void NetworkLayerCoupler::dataSystemBroadcastRequest(AckType ack, HopCountType h
|
|||||||
else
|
else
|
||||||
npdu.hopCount(hopCount());
|
npdu.hopCount(hopCount());
|
||||||
|
|
||||||
_netLayerEntities[kPrimaryIfIndex].sendDataRequest(npdu, ack, 0, _deviceObj.induvidualAddress(), priority, GroupAddress, SysBroadcast);
|
_netLayerEntities[kPrimaryIfIndex].sendDataRequest(npdu, ack, 0, _deviceObj.individualAddress(), priority, GroupAddress, SysBroadcast);
|
||||||
_netLayerEntities[kSecondaryIfIndex].sendDataRequest(npdu, ack, 0, _deviceObj.induvidualAddress(), priority, GroupAddress, SysBroadcast);
|
_netLayerEntities[kSecondaryIfIndex].sendDataRequest(npdu, ack, 0, _deviceObj.individualAddress(), priority, GroupAddress, SysBroadcast);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ void NetworkLayerDevice::dataIndividualRequest(AckType ack, uint16_t destination
|
|||||||
// print.print("-> NL ");
|
// print.print("-> NL ");
|
||||||
// tpdu.apdu().printPDU();
|
// tpdu.apdu().printPDU();
|
||||||
//}
|
//}
|
||||||
_netLayerEntities[kInterfaceIndex].sendDataRequest(npdu, ack, destination, _deviceObj.induvidualAddress(), priority, InduvidualAddress, Broadcast);
|
_netLayerEntities[kInterfaceIndex].sendDataRequest(npdu, ack, destination, _deviceObj.individualAddress(), priority, InduvidualAddress, Broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkLayerDevice::dataGroupRequest(AckType ack, uint16_t destination, HopCountType hopType, Priority priority, TPDU& tpdu)
|
void NetworkLayerDevice::dataGroupRequest(AckType ack, uint16_t destination, HopCountType hopType, Priority priority, TPDU& tpdu)
|
||||||
@ -41,7 +41,7 @@ void NetworkLayerDevice::dataGroupRequest(AckType ack, uint16_t destination, Hop
|
|||||||
else
|
else
|
||||||
npdu.hopCount(hopCount());
|
npdu.hopCount(hopCount());
|
||||||
|
|
||||||
_netLayerEntities[kInterfaceIndex].sendDataRequest(npdu, ack, destination, _deviceObj.induvidualAddress(), priority, GroupAddress, Broadcast);
|
_netLayerEntities[kInterfaceIndex].sendDataRequest(npdu, ack, destination, _deviceObj.individualAddress(), priority, GroupAddress, Broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkLayerDevice::dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu)
|
void NetworkLayerDevice::dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu)
|
||||||
@ -53,7 +53,7 @@ void NetworkLayerDevice::dataBroadcastRequest(AckType ack, HopCountType hopType,
|
|||||||
else
|
else
|
||||||
npdu.hopCount(hopCount());
|
npdu.hopCount(hopCount());
|
||||||
|
|
||||||
_netLayerEntities[kInterfaceIndex].sendDataRequest(npdu, ack, 0, _deviceObj.induvidualAddress(), priority, GroupAddress, Broadcast);
|
_netLayerEntities[kInterfaceIndex].sendDataRequest(npdu, ack, 0, _deviceObj.individualAddress(), priority, GroupAddress, Broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkLayerDevice::dataSystemBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu)
|
void NetworkLayerDevice::dataSystemBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu)
|
||||||
@ -69,7 +69,7 @@ void NetworkLayerDevice::dataSystemBroadcastRequest(AckType ack, HopCountType ho
|
|||||||
else
|
else
|
||||||
npdu.hopCount(hopCount());
|
npdu.hopCount(hopCount());
|
||||||
|
|
||||||
_netLayerEntities[kInterfaceIndex].sendDataRequest(npdu, ack, 0, _deviceObj.induvidualAddress(), priority, GroupAddress, broadcastType);
|
_netLayerEntities[kInterfaceIndex].sendDataRequest(npdu, ack, 0, _deviceObj.individualAddress(), priority, GroupAddress, broadcastType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkLayerDevice::dataIndication(AckType ack, AddressType addrType, uint16_t destination, FrameFormat format, NPDU& npdu, Priority priority, uint16_t source, uint8_t srcIfIdx)
|
void NetworkLayerDevice::dataIndication(AckType ack, AddressType addrType, uint16_t destination, FrameFormat format, NPDU& npdu, Priority priority, uint16_t source, uint8_t srcIfIdx)
|
||||||
@ -78,7 +78,7 @@ void NetworkLayerDevice::dataIndication(AckType ack, AddressType addrType, uint1
|
|||||||
|
|
||||||
if (addrType == InduvidualAddress)
|
if (addrType == InduvidualAddress)
|
||||||
{
|
{
|
||||||
if (destination != _deviceObj.induvidualAddress())
|
if (destination != _deviceObj.individualAddress())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_transportLayer.dataIndividualIndication(destination, hopType, priority, source, npdu.tpdu());
|
_transportLayer.dataIndividualIndication(destination, hopType, priority, source, npdu.tpdu());
|
||||||
|
@ -246,7 +246,7 @@ void RfDataLinkLayer::enabled(bool value)
|
|||||||
{
|
{
|
||||||
_enabled = true;
|
_enabled = true;
|
||||||
print("ownaddr ");
|
print("ownaddr ");
|
||||||
println(_deviceObject.induvidualAddress(), HEX);
|
println(_deviceObject.individualAddress(), HEX);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -307,7 +307,7 @@ void SecureApplicationLayer::dataGroupRequest(AckType ack, HopCountType hopType,
|
|||||||
|
|
||||||
if (secCtrl.dataSecurity != DataSecurity::none)
|
if (secCtrl.dataSecurity != DataSecurity::none)
|
||||||
{
|
{
|
||||||
apdu.frame().sourceAddress(_deviceObj.induvidualAddress());
|
apdu.frame().sourceAddress(_deviceObj.individualAddress());
|
||||||
apdu.frame().destinationAddress(_addrTab->getGroupAddress(tsap));
|
apdu.frame().destinationAddress(_addrTab->getGroupAddress(tsap));
|
||||||
apdu.frame().addressType(GroupAddress);
|
apdu.frame().addressType(GroupAddress);
|
||||||
|
|
||||||
@ -330,7 +330,7 @@ void SecureApplicationLayer::dataBroadcastRequest(AckType ack, HopCountType hopT
|
|||||||
|
|
||||||
if (secCtrl.dataSecurity != DataSecurity::none)
|
if (secCtrl.dataSecurity != DataSecurity::none)
|
||||||
{
|
{
|
||||||
apdu.frame().sourceAddress(_deviceObj.induvidualAddress());
|
apdu.frame().sourceAddress(_deviceObj.individualAddress());
|
||||||
apdu.frame().destinationAddress(0x0000);
|
apdu.frame().destinationAddress(0x0000);
|
||||||
apdu.frame().addressType(GroupAddress);
|
apdu.frame().addressType(GroupAddress);
|
||||||
apdu.frame().systemBroadcast(Broadcast);
|
apdu.frame().systemBroadcast(Broadcast);
|
||||||
@ -354,7 +354,7 @@ void SecureApplicationLayer::dataSystemBroadcastRequest(AckType ack, HopCountTyp
|
|||||||
|
|
||||||
if (secCtrl.dataSecurity != DataSecurity::none)
|
if (secCtrl.dataSecurity != DataSecurity::none)
|
||||||
{
|
{
|
||||||
apdu.frame().sourceAddress(_deviceObj.induvidualAddress());
|
apdu.frame().sourceAddress(_deviceObj.individualAddress());
|
||||||
apdu.frame().destinationAddress(0x0000);
|
apdu.frame().destinationAddress(0x0000);
|
||||||
apdu.frame().addressType(GroupAddress);
|
apdu.frame().addressType(GroupAddress);
|
||||||
apdu.frame().systemBroadcast(SysBroadcast);
|
apdu.frame().systemBroadcast(SysBroadcast);
|
||||||
@ -378,7 +378,7 @@ void SecureApplicationLayer::dataIndividualRequest(AckType ack, HopCountType hop
|
|||||||
|
|
||||||
if (secCtrl.dataSecurity != DataSecurity::none)
|
if (secCtrl.dataSecurity != DataSecurity::none)
|
||||||
{
|
{
|
||||||
apdu.frame().sourceAddress(_deviceObj.induvidualAddress());
|
apdu.frame().sourceAddress(_deviceObj.individualAddress());
|
||||||
apdu.frame().destinationAddress(destination);
|
apdu.frame().destinationAddress(destination);
|
||||||
apdu.frame().addressType(InduvidualAddress);
|
apdu.frame().addressType(InduvidualAddress);
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ void SecureApplicationLayer::dataConnectedRequest(uint16_t tsap, Priority priori
|
|||||||
|
|
||||||
if (secCtrl.dataSecurity != DataSecurity::none)
|
if (secCtrl.dataSecurity != DataSecurity::none)
|
||||||
{
|
{
|
||||||
apdu.frame().sourceAddress(_deviceObj.induvidualAddress());
|
apdu.frame().sourceAddress(_deviceObj.individualAddress());
|
||||||
apdu.frame().destinationAddress(_transportLayer->getConnectionAddress());
|
apdu.frame().destinationAddress(_transportLayer->getConnectionAddress());
|
||||||
apdu.frame().addressType(InduvidualAddress);
|
apdu.frame().addressType(InduvidualAddress);
|
||||||
|
|
||||||
@ -568,7 +568,7 @@ uint64_t SecureApplicationLayer::lastValidSequenceNumber(bool toolAccess, uint16
|
|||||||
if (toolAccess)
|
if (toolAccess)
|
||||||
{
|
{
|
||||||
// TODO: check if we really have to support multiple tools at the same time
|
// TODO: check if we really have to support multiple tools at the same time
|
||||||
if (srcAddr == _deviceObj.induvidualAddress())
|
if (srcAddr == _deviceObj.individualAddress())
|
||||||
return _sequenceNumberToolAccess;
|
return _sequenceNumberToolAccess;
|
||||||
return _lastValidSequenceNumberTool;
|
return _lastValidSequenceNumberTool;
|
||||||
}
|
}
|
||||||
@ -621,7 +621,7 @@ void SecureApplicationLayer::sendSyncRequest(uint16_t dstAddr, bool dstAddrIsGro
|
|||||||
print("sendSyncRequest: TPCI: ");
|
print("sendSyncRequest: TPCI: ");
|
||||||
println(tpci, HEX);
|
println(tpci, HEX);
|
||||||
|
|
||||||
if(secure(request.data() + APDU_LPDU_DIFF, kSecureSyncRequest, _deviceObj.induvidualAddress(), dstAddr, dstAddrIsGroupAddr, tpci, asdu, sizeof(asdu), secCtrl, systemBcast))
|
if(secure(request.data() + APDU_LPDU_DIFF, kSecureSyncRequest, _deviceObj.individualAddress(), dstAddr, dstAddrIsGroupAddr, tpci, asdu, sizeof(asdu), secCtrl, systemBcast))
|
||||||
{
|
{
|
||||||
println("SyncRequest: ");
|
println("SyncRequest: ");
|
||||||
request.apdu().printPDU();
|
request.apdu().printPDU();
|
||||||
@ -681,7 +681,7 @@ void SecureApplicationLayer::sendSyncResponse(uint16_t dstAddr, bool dstAddrIsGr
|
|||||||
print("sendSyncResponse: TPCI: ");
|
print("sendSyncResponse: TPCI: ");
|
||||||
println(tpci, HEX);
|
println(tpci, HEX);
|
||||||
|
|
||||||
if(secure(response.data() + APDU_LPDU_DIFF, kSecureSyncResponse, _deviceObj.induvidualAddress(), dstAddr, dstAddrIsGroupAddr, tpci, asdu, sizeof(asdu), secCtrl, systemBcast))
|
if(secure(response.data() + APDU_LPDU_DIFF, kSecureSyncResponse, _deviceObj.individualAddress(), dstAddr, dstAddrIsGroupAddr, tpci, asdu, sizeof(asdu), secCtrl, systemBcast))
|
||||||
{
|
{
|
||||||
_lastSyncRes = millis();
|
_lastSyncRes = millis();
|
||||||
|
|
||||||
@ -823,7 +823,7 @@ bool SecureApplicationLayer::decrypt(uint8_t* plainApdu, uint16_t plainApduLengt
|
|||||||
|
|
||||||
if (service == kSecureDataPdu)
|
if (service == kSecureDataPdu)
|
||||||
{
|
{
|
||||||
if (srcAddr != _deviceObj.induvidualAddress())
|
if (srcAddr != _deviceObj.individualAddress())
|
||||||
{
|
{
|
||||||
uint64_t expectedSeqNumber = lastValidSequenceNumber(toolAccess, srcAddr) + 1;
|
uint64_t expectedSeqNumber = lastValidSequenceNumber(toolAccess, srcAddr) + 1;
|
||||||
|
|
||||||
@ -847,7 +847,7 @@ bool SecureApplicationLayer::decrypt(uint8_t* plainApdu, uint16_t plainApduLengt
|
|||||||
if (!memcmp(knxSerialNumber, _deviceObj.propertyData(PID_SERIAL_NUMBER), 6))
|
if (!memcmp(knxSerialNumber, _deviceObj.propertyData(PID_SERIAL_NUMBER), 6))
|
||||||
{
|
{
|
||||||
uint8_t emptySerialNumber[6] = {0};
|
uint8_t emptySerialNumber[6] = {0};
|
||||||
if (systemBroadcast || dstAddr != _deviceObj.induvidualAddress() || !memcmp(knxSerialNumber, emptySerialNumber, 6))
|
if (systemBroadcast || dstAddr != _deviceObj.individualAddress() || !memcmp(knxSerialNumber, emptySerialNumber, 6))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -970,7 +970,7 @@ bool SecureApplicationLayer::decrypt(uint8_t* plainApdu, uint16_t plainApduLengt
|
|||||||
|
|
||||||
// prevent a sync.req sent by us to trigger sync notification, this happens if we provide our own tool key
|
// prevent a sync.req sent by us to trigger sync notification, this happens if we provide our own tool key
|
||||||
// for decryption above
|
// for decryption above
|
||||||
if (syncReq && (srcAddr == _deviceObj.induvidualAddress()))
|
if (syncReq && (srcAddr == _deviceObj.individualAddress()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (syncReq)
|
if (syncReq)
|
||||||
@ -986,7 +986,7 @@ bool SecureApplicationLayer::decrypt(uint8_t* plainApdu, uint16_t plainApduLengt
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (srcAddr == _deviceObj.induvidualAddress())
|
if (srcAddr == _deviceObj.individualAddress())
|
||||||
{
|
{
|
||||||
print("Update our next ");
|
print("Update our next ");
|
||||||
print(toolAccess ? "tool access" : "");
|
print(toolAccess ? "tool access" : "");
|
||||||
|
@ -444,7 +444,7 @@ void TpUartDataLinkLayer::enabled(bool value)
|
|||||||
{
|
{
|
||||||
_enabled = true;
|
_enabled = true;
|
||||||
print("ownaddr ");
|
print("ownaddr ");
|
||||||
println(_deviceObject.induvidualAddress(), HEX);
|
println(_deviceObject.individualAddress(), HEX);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -160,9 +160,9 @@ template <class P, class B> class KnxFacade : private SaveRestore
|
|||||||
_bau.writeMemory();
|
_bau.writeMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t induvidualAddress()
|
uint16_t individualAddress()
|
||||||
{
|
{
|
||||||
return _bau.deviceObject().induvidualAddress();
|
return _bau.deviceObject().individualAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
|
Loading…
Reference in New Issue
Block a user