public UpnpEngineDevice(UpnpBaseDevice device, UpnpEngine engine) { Device = device; LastNotification = DateTime.MinValue; Engine = engine; this.Device._enableChanged += OnDeviceEnableChange; }
public PowerLineServer(IPAddress bindAddress, int bindPort, bool allowEvents = false, IEnumerable <PowerLineEndPoint> endpoints = null) { this.BindAddress = bindAddress; this.BindPort = bindPort; this.endpointsLock = new object(); this.upnpEngine = new Upnp.UpnpEngine(this); this.upnpEndpoint = Upnp.PowerLineUpnpHttpHandle.GetEndpoint(this.upnpEngine); this.websocketEventLock = new object(); this.websocketEvents = new Dictionary <string, PowerLineEvent>(); this.websocketClientLock = new object(); this.websocketClients = new List <PowerLineWebsocketClient>(); this.serverStopped = new EventWaitHandle(true, EventResetMode.ManualReset); this.mainListener = new HttpListener(); this.mainListener.Prefixes.Add(this.BuildBindUrl()); this.endPoints = (endpoints == null) ? new Dictionary <string, PowerLineEndPoint>() : new Dictionary <string, PowerLineEndPoint>(endpoints.Select((item) => new KeyValuePair <string, PowerLineEndPoint>(item.EndPointName, item))); if (allowEvents) { this.AddEndpoint(PowerLineEventHandler.GetEndPoint(this)); } }
public static PowerLineEndPoint GetEndpoint(UpnpEngine engine) => new PowerLineEndPoint("UPnP", null, new PowerLineEndPoint[] { new PowerLineEndPoint("DyanmicUpnpHttpHandler", new PowerLineHandler[] { new PowerLineUpnpHttpHandle(engine) }, true) });
public PowerLineUpnpHttpHandle(UpnpEngine engine) : base("GET") { Engine = engine; }