Ejemplo n.º 1
0
        public override bool Deserialise(TlvReader reader)
        {
            bool result = false;

            while (reader.Read())
            {
                if ((reader.TlvRecord.TypeIdentifier != TTlvTypeIdentifier.ObjectInstance) && (reader.TlvRecord.TypeIdentifier != TTlvTypeIdentifier.NotSet))
                {
                    switch ((ResourceID)reader.TlvRecord.Identifier)
                    {
                    case ResourceID.ObjectID:
                        this.ObjectID = reader.TlvRecord.ValueAsInt64();
                        result        = true;
                        break;

                    case ResourceID.ObjectInstanceID:
                        this.ObjectInstanceID = reader.TlvRecord.ValueAsInt64();
                        result = true;
                        break;

                    case ResourceID.ACLs:
                        this.ACLs = IntegerResources.Deserialise(reader);
                        result    = true;
                        break;

                    case ResourceID.AccessControlOwner:
                        this.AccessControlOwner = reader.TlvRecord.ValueAsInt64();
                        result = true;
                        break;

                    default:
                        break;
                    }
                }
            }
            return(result);
        }
        public override bool Deserialise(TlvReader reader)
        {
            bool result = false;

            while (reader.Read())
            {
                if (reader.TlvRecord.TypeIdentifier == TTlvTypeIdentifier.ObjectInstance)
                {
                    if (string.Compare(this.Name, reader.TlvRecord.Identifier.ToString()) != 0)
                    {
                        this.Name = reader.TlvRecord.Identifier.ToString();
                    }
                    reader = new TlvReader(reader.TlvRecord.Value);
                }
                else if ((reader.TlvRecord.TypeIdentifier != TTlvTypeIdentifier.ObjectInstance) && (reader.TlvRecord.TypeIdentifier != TTlvTypeIdentifier.NotSet))
                {
                    switch ((ResourceID)reader.TlvRecord.Identifier)
                    {
                    case ResourceID.NetworkBearer:
                        this.NetworkBearer = reader.TlvRecord.ValueAsInt64();
                        result             = true;
                        break;

                    case ResourceID.AvailableNetworkBearers:
                        this.AvailableNetworkBearers = IntegerResources.Deserialise(reader);
                        result = true;
                        break;

                    case ResourceID.RadioSignalStrength:
                        this.RadioSignalStrength = reader.TlvRecord.ValueAsInt64();
                        result = true;
                        break;

                    case ResourceID.LinkQuality:
                        this.LinkQuality = reader.TlvRecord.ValueAsInt64();
                        result           = true;
                        break;

                    case ResourceID.IPAddresses:
                        this.IPAddresses = StringResources.Deserialise(reader);
                        result           = true;
                        break;

                    case ResourceID.RouterIPAddresses:
                        this.RouterIPAddresses = StringResources.Deserialise(reader);
                        result = true;
                        break;

                    case ResourceID.LinkUtilization:
                        this.LinkUtilization = reader.TlvRecord.ValueAsInt64();
                        result = true;
                        break;

                    case ResourceID.APNs:
                        this.APNs = StringResources.Deserialise(reader);
                        result    = true;
                        break;

                    case ResourceID.CellID:
                        this.CellID = reader.TlvRecord.ValueAsInt64();
                        result      = true;
                        break;

                    case ResourceID.SMNC:
                        this.SMNC = reader.TlvRecord.ValueAsInt64();
                        result    = true;
                        break;

                    case ResourceID.SMCC:
                        this.SMCC = reader.TlvRecord.ValueAsInt64();
                        result    = true;
                        break;

                    default:
                        break;
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 3
0
        public override bool Deserialise(TlvReader reader)
        {
            bool result = false;

            while (reader.Read())
            {
                if (reader.TlvRecord.TypeIdentifier == TTlvTypeIdentifier.ObjectInstance)
                {
                    if (string.Compare(this.Name, reader.TlvRecord.Identifier.ToString()) != 0)
                    {
                        this.Name = reader.TlvRecord.Identifier.ToString();
                    }
                    reader = new TlvReader(reader.TlvRecord.Value);
                }
                else if ((reader.TlvRecord.TypeIdentifier != TTlvTypeIdentifier.ObjectInstance) && (reader.TlvRecord.TypeIdentifier != TTlvTypeIdentifier.NotSet))
                {
                    switch ((ResourceID)reader.TlvRecord.Identifier)
                    {
                    case ResourceID.Manufacturer:
                        this.Manufacturer = reader.TlvRecord.ValueAsString();
                        result            = true;
                        break;

                    case ResourceID.ModelNumber:
                        this.ModelNumber = reader.TlvRecord.ValueAsString();
                        result           = true;
                        break;

                    case ResourceID.SerialNumber:
                        this.SerialNumber = reader.TlvRecord.ValueAsString();
                        result            = true;
                        break;

                    case ResourceID.FirmwareVersion:
                        this.FirmwareVersion = reader.TlvRecord.ValueAsString();
                        result = true;
                        break;

                    case ResourceID.AvailablePowerSources:
                        this.AvailablePowerSources = IntegerResources.Deserialise(reader);
                        result = true;
                        break;

                    case ResourceID.PowerSourceVoltages:
                        this.PowerSourceVoltages = IntegerResources.Deserialise(reader);
                        result = true;
                        break;

                    case ResourceID.PowerSourceCurrents:
                        this.PowerSourceCurrents = IntegerResources.Deserialise(reader);
                        result = true;
                        break;

                    case ResourceID.BatteryLevel:
                        this.BatteryLevel = reader.TlvRecord.ValueAsInt64();
                        result            = true;
                        break;

                    case ResourceID.MemoryFree:
                        this.MemoryFree = reader.TlvRecord.ValueAsInt64();
                        result          = true;
                        break;

                    case ResourceID.ErrorCodes:
                        this.ErrorCodes = IntegerResources.Deserialise(reader);
                        result          = true;
                        break;

                    case ResourceID.CurrentTime:
                        this.CurrentTime = reader.TlvRecord.ValueAsDateTime();
                        result           = true;
                        break;

                    case ResourceID.UTCOffset:
                        this.UTCOffset = reader.TlvRecord.ValueAsString();
                        result         = true;
                        break;

                    case ResourceID.Timezone:
                        this.Timezone = reader.TlvRecord.ValueAsString();
                        result        = true;
                        break;

                    case ResourceID.SupportedBindingandModes:
                        this.SupportedBindingandModes = reader.TlvRecord.ValueAsString();
                        result = true;
                        break;

                    case ResourceID.DeviceType:
                        this.DeviceType = reader.TlvRecord.ValueAsString();
                        result          = true;
                        break;

                    case ResourceID.HardwareVersion:
                        this.HardwareVersion = reader.TlvRecord.ValueAsString();
                        result = true;
                        break;

                    case ResourceID.SoftwareVersion:
                        this.SoftwareVersion = reader.TlvRecord.ValueAsString();
                        result = true;
                        break;

                    case ResourceID.BatteryStatus:
                        this.BatteryStatus = reader.TlvRecord.ValueAsInt64();
                        result             = true;
                        break;

                    case ResourceID.MemoryTotal:
                        this.MemoryTotal = reader.TlvRecord.ValueAsInt64();
                        result           = true;
                        break;

                    default:
                        break;
                    }
                }
            }
            return(result);
        }