示例#1
0
        public IResponse Build(Match match)
        {
            Status status = match.ReadGroupAs<Status>(StatusGroup, value => (Status)Enum.Parse(typeof(Status), value, true));
            string firmware = match.ReadGroupValue(FirmwareGroup);
            string version = match.ReadGroupValue(VersionGroup);
            string build = match.ReadGroupValue(BuildGroup);

            return new Command.Response.Version(status, firmware, version, build);
        }
        public IResponse Build(Match match)
        {
            Status status = match.ReadGroupAs<Status>(StatusGroup, value => (Status)Enum.Parse(typeof(Status), value, true));
            int index = match.ReadGroupAs<int>(IndexGroup, Int32.Parse);
            string deviceAddress = match.ReadGroupValue(DeviceAddressGroup);
            string deviceType = match.ReadGroupValue(DeviceTypeGroup);
            int secondsSinceListPacketReceived = match.ReadGroupAs<int>(SecondsSinceLastPacketReceivedGroup, Int32.Parse);
            string deviceState = match.ReadGroupValue(DeviceStateGroup);
            Values.SignalStrength signalStrength = match.ReadGroupAs<Values.SignalStrength>(SignalStrengthGroup, Values.SignalStrength.Parse);
            Values.LinkQuality linkQuality = match.ReadGroupAs<Values.LinkQuality>(LinkQualityGroup, Values.LinkQuality.Parse);
            Values.BatteryState batteryState = match.ReadGroupAs<Values.BatteryState>(BatteryStateGroup, Values.BatteryState.Parse);
            int receivedPackets = match.ReadGroupAs<int>(ReceivedPacketsGroup, Int32.Parse);
            int sentPackets = match.ReadGroupAs<int>(SentPacketsGroup, Int32.Parse);
            string unknown1 = match.ReadGroupValue(Unknown1Group);
            string unknown2 = match.ReadGroupValue(Unknown2Group);
            string unknown3 = match.ReadGroupValue(Unknown3Group);
            string unknown4 = match.ReadGroupValue(Unknown4Group);
            string unknown5 = match.ReadGroupValue(Unknown5Group);
            string unknown6 = match.ReadGroupValue(Unknown6Group);

            return new Command.Response.Device(status, index, deviceAddress, deviceType, deviceState, signalStrength, linkQuality, batteryState, TimeSpan.FromSeconds(secondsSinceListPacketReceived), receivedPackets, sentPackets, unknown1, unknown2, unknown3, unknown4, unknown5, unknown6);
        }