示例#1
0
 private void ProcessManufacturerLabel(IPEndPoint endpoint, RdmPacket packet)
 {
     ManufacturerLabel.GetReply reply = packet as ManufacturerLabel.GetReply;
     if (reply != null)
     {
         foreach (RdmNetEndPoint port in DiscoveredEndpoints)
         {
             if (port.Id.Equals(packet.Header.SourceId))
             {
                 port.ManufacturerLabel = reply.Label;
             }
         }
     }
 }
示例#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");
            }
        }