Ejemplo n.º 1
0
        public async Task Init(KnxInterfaceHelper.GetUsbDeviceHandler getDevice)
        {
            IKnxInterface inter = _conn.GetInterface(Hash);

            Debug.WriteLine("Request to Connect to: " + inter.Name);
            _knxConn = await KnxInterfaceHelper.GetConnection(inter, _conn, getDevice);

            _knxConn.OnTunnelResponse += OnTunnelActivity;
            _knxConn.OnTunnelRequest  += OnTunnelActivity;
        }
Ejemplo n.º 2
0
        public static async Task <IKnxConnection> GetConnection(IKnxInterface inter, RemoteConnection conn, GetUsbDeviceHandler getDevice)
        {
            switch (inter)
            {
            case KnxInterfaceUsb interUsb:
                IDevice dev = await getDevice(interUsb);

                return(new KnxUsbTunneling(dev));

            case KnxInterfaceIp interIp:
                return(new KnxIpTunneling(interIp.Endpoint));    //TODO check for Routing

            case KnxInterfaceRemote interRem:
                KnxRemote rconn = new KnxRemote(interRem.RemoteHash, conn);
                await rconn.Init(getDevice);

                return(rconn);    // TODO check if needed
            }

            throw new Exception("Für das Interface gibt es keine Connection " + inter.ToString());
        }
Ejemplo n.º 3
0
        public IKnxInterface GetInterface(string hash)
        {
            IKnxInterface inter = OnRequestInterface?.Invoke(hash);

            return(inter);
        }