Ejemplo n.º 1
0
        public RemoteConnection(GetUsbDeviceHandler getDevice)
        {
            getUsbHandler = getDevice;
            socket.Options.AddSubProtocol("chat");

            for (int i = 0; i < 256; i++)
            {
                Responses.Add(i, null);
            }
        }
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());
        }