Пример #1
0
        public Device DecodePacket()
        {
            Device device = new Device ();
            _Index = 4;

            while (_Index < PacketData.Length) {
                byte i = PacketData [_Index];
                _ValueLength = Utils.UInt16FromBytes (PacketData, _Index + 1);
                _Index += 3;

                switch (i) {
                    case 1: //Binary Data
                        break;
                    case 2: //Address
                        device.Addresses.Add (DecodeAddresses ());
                        break;
                    case 3: //Firmware Version
                        device.Firmware = new FirmWare (DecodeString ());
                        break;
                    case 10: // Uptime
                        device.Uptime = DecodeTime ();
                        break;
                    case 11: // Hostname
                        device.Hostname = DecodeString ();
                        break;
                    case 12: // Platform
                        device.Platform = DecodeString ();
                        break;
                    case 13: // SSID
                        device.SSID = DecodeString ();
                        break;
                    case 14: // Wireless Mode
                        if (_ValueLength != 1)
                            throw new Exception ("Longitud no válida para el modo inalámbrico.");
                        device.WirelessMode = PacketData [_Index];
                        break;
                    case 16: // Binary Data
                        break;
                    default:
                        break;
                }
                _Index += _ValueLength;
            }
            return device;
        }
Пример #2
0
        public DeviceDialog(Device device)
        {
            Title = string.Empty;
            //Icon = Image.FromResource ("UbntTools.Resources.icon-64x64.png");

            Table table = new Table ();

            table.Add (new Label ("HW Address: ") { TextAlignment = Alignment.End }, 0, 0);
            table.Add (new Label (device.FormatedMacAddress), 1, 0);
            table.Add (new Label ("Ip Address: ") { TextAlignment = Alignment.End }, 0, 1);
            table.Add (new Label (device.FirstAddress.ToString ()), 1, 1);
            table.Add (new Label ("Version: ") { TextAlignment = Alignment.End }, 0, 2);
            table.Add (new Label (device.Firmware.Version), 1, 2);
            table.Add (new Label ("Build Number: ") { TextAlignment = Alignment.End }, 0, 3);
            table.Add (new Label (device.Firmware.Build), 1, 3);
            table.Add (new Label ("Uptime: ") { TextAlignment = Alignment.End }, 0, 4);
            table.Add (new Label ( string.Format ("{0:%d} dias {1:hh\\:mm\\:ss}", device.Uptime, device.Uptime)), 1, 4);

            Buttons.Add (new DialogButton ("Close", Command.Close)  );

            Content = table;
        }