Ejemplo n.º 1
0
        private IGateway HandleGatewayPacket(byte[] mac, string ipAddress)
        {
            var isNewGateway = GatewayService.AddOrUpdate(mac, ipAddress);
            var gateway      = GatewayService.Get(mac, ipAddress);

            if (isNewGateway)
            {
                this.ScanGateway(gateway);
            }
            return(gateway);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Search for gateways. If a new gateway is found, it will be scanned for new bulbs.
        /// </summary>
        public static void ScanNetwork(this ILifxNetwork network, string ipAddress)
        {
            var gateways = GatewayService.Get();

            foreach (var g in gateways)
            {
                ScanGateway(network, g);
            }

            var command = PacketFactory.GetCommand(CommandType.GetPanGateway);
            var gateway = new Gateway(new byte[6], ipAddress);

            ((LifxNetwork)network).SendCommand(gateway, command);
        }
Ejemplo n.º 3
0
 public IEnumerable <IGateway> GetGateways()
 {
     return(new ReadOnlyCollection <IGateway>(GatewayService.Get().ToList()));
 }