Example #1
0
 private void ProcessDeviceLabel(IPEndPoint endpoint, RdmPacket packet)
 {
     DeviceLabel.GetReply reply = packet as DeviceLabel.GetReply;
     if (reply != null)
     {
         foreach (RdmNetEndPoint port in DiscoveredEndpoints)
         {
             if (port.Id.Equals(packet.Header.SourceId))
             {
                 port.DeviceLabel = reply.Label;
             }
         }
     }
 }
Example #2
0
        void socket_NewRdmPacket(object sender, NewPacketEventArgs <RdmPacket> e)
        {
            //Exit if not from the target device or correct sub device.
            if (!SubDeviceUId.IsMatch(Id, e.Packet.Header.SourceId, e.Packet.Header.SubDevice))
            {
                return;
            }

            RdmPacket replyPacket = ProcessPacket(e.Packet);

            SetParameterStatus(e.Packet.Header.ParameterId, ParameterStatus.Valid);

            if (replyPacket != null)
            {
                socket.SendRdm(replyPacket, Address, Id);
            }


            DeviceInfo.GetReply info = e.Packet as DeviceInfo.GetReply;
            if (info != null)
            {
                DeviceInformation = info;

                RequestDetails();
                RequestLabel();
                RequestConfiguration();
                RequestHistory();
                RequestPersonality();
                RequestParameters();

                if (!SubDeviceUId.IsSubDevice(Id))
                {
                    if (SubDevices.Count != info.SubDeviceCount)
                    {
                        SubDevices.Clear();
                        for (short n = 1; n <= info.SubDeviceCount; n++)
                        {
                            RdmDeviceBroker subDeviceBroker = new RdmDeviceBroker(socket, new SubDeviceUId(Id, n), Address);
                            SubDevices.Add(subDeviceBroker);
                            subDeviceBroker.Interogate();
                        }
                    }

                    RaisePropertyChanged("SubDevices");
                }
            }

            ManufacturerLabel.GetReply manufacturer = e.Packet as ManufacturerLabel.GetReply;
            if (manufacturer != null)
            {
                Manufacturer = manufacturer.Label;
            }

            DeviceModelDescription.GetReply model = e.Packet as DeviceModelDescription.GetReply;
            if (model != null)
            {
                Model = model.Description;
            }

            DeviceLabel.GetReply label = e.Packet as DeviceLabel.GetReply;
            if (label != null)
            {
                this.label = label.Label;
                RaisePropertyChanged("Label");
            }
        }