Exemplo n.º 1
0
        public UpnpEngineDevice(UpnpBaseDevice device, UpnpEngine engine)
        {
            Device           = device;
            LastNotification = DateTime.MinValue;
            Engine           = engine;

            this.Device._enableChanged += OnDeviceEnableChange;
        }
Exemplo n.º 2
0
        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));
            }
        }
Exemplo n.º 3
0
 public static PowerLineEndPoint GetEndpoint(UpnpEngine engine) =>
 new PowerLineEndPoint("UPnP", null,
                       new PowerLineEndPoint[] {
     new PowerLineEndPoint("DyanmicUpnpHttpHandler",
                           new PowerLineHandler[] { new PowerLineUpnpHttpHandle(engine) }, true)
 });
Exemplo n.º 4
0
 public PowerLineUpnpHttpHandle(UpnpEngine engine) : base("GET")
 {
     Engine = engine;
 }