KnxRouterInterface
open class KnxRouterInterface: NSObject
Class representing the interface towards the KNX router.
-
Property to set for selecting connetion type
Declaration
Swift
open static var connectionType: ConnectionType = .none -
Property for setting the IP address of the KNX router
Declaration
Swift
open static var routerIp: String? -
Property for setting the port to connect to the KNX router on (defaults to port 6720.)
Declaration
Swift
open static var routerPort: UInt16 = 6720 -
Property for setting the multicast group to join
Declaration
Swift
open static var multicastGroup: String? -
Property for setting the port for the multicast group
Declaration
Swift
open static var multicastPort: UInt16 = 3671 -
Factory function to return an instance of a KnxRouterInterface.
- In tcpDirect mode each call returns a new instance, while - in udpMulticast mode every call returns the same shared instance.Declaration
Swift
open static func getKnxRouterInstance() -> KnxRouterInterface? -
Connect to a KNX router.
Throws
UnableToConnectToRouterDeclaration
Swift
open func connect() throws -
Disconnect from a KNX.
Declaration
Swift
open func disconnect() -
Subscribe for a group address.
Declaration
Swift
open func subscribeFor(address: KnxGroupAddress, responseHandler: KnxTelegramResponseHandlerDelegate)Parameters
addressThe group address to subscrive to.
-
Send a write request telegram to a group address.
Declaration
Swift
open func sendWriteRequest(to: KnxGroupAddress, type: KnxTelegramType, value:Any)Parameters
toThe group address to send to
typeThe DPT to send
valueThe value to send
-
Send a read request telegram to a group address.
Declaration
Swift
open func sendReadRequest(to: KnxGroupAddress)
-
Response handler, called from the CocoaAsyncSocket framework upon connection.
Declaration
Swift
@objc open func socket(_ socket: GCDAsyncSocket, didConnectToHost host: String, port: UInt16)Parameters
socketThe socket that did connect.
didConnectToHostThe name of the host that it has connected to.
portThe port that was connected on.
-
Response handler, called from the CocoaAsyncSocket framework upon reception of data.
Declaration
Swift
@objc open func socket(_ socket: GCDAsyncSocket, didRead data: Data, withTag tag: Int)Parameters
socketThe socket that did connect.
didReadDataThe received data.
withTagThe tag value supplied in the request to read.
-
Response handler, called from the CocoaAsyncSocket framework upon reception of data.
Declaration
Swift
@objc open func socketDidDisconnect(_ sock: GCDAsyncSocket, withError err: Error?)Parameters
socketThe socket that did connect.
errIf the socket disconneted because of an error.
-
Response handler, called from the CocoaAsyncSocket framework upon reception of data.
Declaration
Swift
open func udpSocket(_ sock: GCDAsyncUdpSocket, didReceive data: Data, fromAddress address: Data, withFilterContext filterContext: Any?)Parameters
sockThe socket that the data was received on.
dataThe received data.
addressThe source address.
filterContextThe filter context used.
errIf the socket disconneted because of an error.
KnxRouterInterface Class Reference