Exemple #1
0
        private Bulb HandleBulbPacket(IGateway gateway, AnswerPacketBase packet)
        {
            Bulb bulb;

            if (!_bulbs.TryGetValue(packet.TargetMacAddress, out bulb))
            {
                lock (_bulbCollectionLock)
                {
                    if (!_bulbs.TryGetValue(packet.TargetMacAddress, out bulb))
                    {
                        bulb = new Bulb(packet.TargetMacAddress, gateway);
                        _bulbs.Add(bulb.Mac, bulb);
                        OnBulbCollectionChanged();
                    }
                }
            }

            packet.Apply(bulb);
            return(bulb);
        }
Exemple #2
0
 protected bool Equals(Bulb other)
 {
     return(_mac.SequenceEqual(other._mac));
 }