IDC.Drivers.KNX
TIDCKNXDriver Component
Unit overview
This unit provides the implementation of the KNXnet/IP protocol in tunnel mode. The primary purpose of the component is to enable communication with KNX devices using KNXnet/IP via UDP. The component allows sending and receiving KNX telegrams, discovering KNX devices, and handling group addresses.
Get Started
To get started with this component, follow these steps:
Create an instance of
TIDCKNXDriver
.Set the necessary properties such as IP, multicast addresses, and ports.
Attach event handlers for events like
OnKNXDeviceFound
andOnKNXGroupAddressEvent
.Call the
StartKNXDiscovery
method to begin KNX device discovery.Use
WriteBytesToGroupAddress
andReadBytesFromGroupAddress
to interact with KNX group addresses.
Usage Example
var
KNXDriver: TIDCKNXDriver;
begin
KNXDriver := TIDCKNXDriver.Create(nil);
KNXDriver.OnKNXDeviceFound := MyDeviceFoundEvent;
KNXDriver.OnKNXGroupAddressEvent := MyGroupAddressEvent;
KNXDriver.StartKNXDiscovery;
end;
TIDCKNXDriver
Properties
DiscoveryTimeout
: Sets the timeout (in milliseconds) for KNX device discovery. This is part of theTIDCKNXConnectionOptions
.Active
: Controls whether the driver is active.OnKNXDeviceFound
: Event triggered when a KNX device is found during discovery.OnKNXGroupAddressEvent
: Event triggered when a group address message is received.
Events
OnKNXDeviceFound
:procedure (Driver: TIDCCustomKNXDriver; IPRouter: TKNXIPRouterDevice; var AutoConnect: boolean) of object;
This event is triggered when a KNX device is discovered.
OnKNXGroupAddressEvent
:procedure (Driver: TIDCCustomKNXDriver; DataType: TKNXDataTypes; GroupValueType: TKNXGroupValueType; const GroupAddress, IndividualAddress: string; const AData: TIDCBytes) of object;
This event is triggered when a KNX group address telegram is received.
OnKNXDeviceConnected
:procedure (Driver: TIDCCustomKNXDriver; IPRouter: TKNXIPRouterDevice; const ConnectedChannel: Word) of object;
This event is triggered when a KNX device successfully connects.
Methods
StartKNXDiscovery
: Starts the KNX device discovery process.StopKNXDiscovery
: Stops the KNX device discovery process.WriteBytesToGroupAddress
: Sends a write request to a KNX group address.procedure WriteBytesToGroupAddress(const ADestAddress: string; const Value: TIDCBytes);
ReadBytesFromGroupAddress
: Sends a read request to a KNX group address.procedure ReadBytesFromGroupAddress(const ADestAddress: string);
HandleIncomingUDPData
: Handles incoming UDP packets and processes them as KNX telegrams.ProcessKNXTelegram
: Processes a KNX telegram received via UDP.
Usage Examples
Last updated
Was this helpful?