Exemplo n.º 1
0
 void IGXDLMSBase.Load(GXXmlReader reader)
 {
     Operator            = reader.ReadElementContentAsString("Operator");
     Status              = (GsmStatus)reader.ReadElementContentAsInt("Status");
     CircuitSwitchStatus = (GsmCircuitSwitchStatus)reader.ReadElementContentAsInt("CircuitSwitchStatus");
     PacketSwitchStatus  = (GsmPacketSwitchStatus)reader.ReadElementContentAsInt("PacketSwitchStatus");
     if (reader.IsStartElement("CellInfo", true))
     {
         CellInfo.CellId        = (UInt16)reader.ReadElementContentAsInt("CellId");
         CellInfo.LocationId    = (UInt16)reader.ReadElementContentAsInt("LocationId");
         CellInfo.SignalQuality = (byte)reader.ReadElementContentAsInt("SignalQuality");
         CellInfo.Ber           = (byte)reader.ReadElementContentAsInt("Ber");
         reader.ReadEndElement("CellInfo");
     }
     AdjacentCells.Clear();
     if (reader.IsStartElement("AdjacentCells", true))
     {
         while (reader.IsStartElement("Item", true))
         {
             AdjacentCell it = new Objects.AdjacentCell();
             it.CellId        = (UInt32)reader.ReadElementContentAsInt("CellId");
             it.SignalQuality = (byte)reader.ReadElementContentAsInt("SignalQuality");
             AdjacentCells.Add(it);
         }
         reader.ReadEndElement("AdjacentCells");
     }
     CaptureTime = new GXDateTime(reader.ReadElementContentAsString("CaptureTime"), System.Globalization.CultureInfo.InvariantCulture);
 }
 void IGXDLMSBase.SetValue(GXDLMSSettings settings, ValueEventArgs e)
 {
     if (e.Index == 1)
     {
         LogicalName = GXCommon.ToLogicalName(e.Value);
     }
     else if (e.Index == 2)
     {
         Operator = (string)e.Value;
     }
     else if (e.Index == 3)
     {
         Status = (GsmStatus)e.Value;
     }
     else if (e.Index == 4)
     {
         CircuitSwitchStatus = (GsmCircuitSwitchStatus)e.Value;
     }
     else if (e.Index == 5)
     {
         PacketSwitchStatus = (GsmPacketSwitchStatus)e.Value;
     }
     else if (e.Index == 6)
     {
         if (e.Value != null)
         {
             object[] tmp = (object[])e.Value;
             CellInfo.CellId        = (string)tmp[0];
             CellInfo.LocationId    = (ushort)tmp[1];
             CellInfo.SignalQuality = (byte)tmp[2];
             CellInfo.Ber           = (byte)tmp[3];
         }
     }
     else if (e.Index == 7)
     {
         AdjacentCells.Clear();
         if (e.Value != null)
         {
             foreach (object it in (object[])e.Value)
             {
                 object[]     tmp = (object[])it;
                 AdjacentCell ac  = new Objects.AdjacentCell();
                 ac.CellId        = (string)tmp[0];
                 ac.SignalQuality = (byte)tmp[1];
                 AdjacentCells.Add(ac);
             }
         }
     }
     else if (e.Index == 8)
     {
         CaptureTime = (GXDateTime)e.Value;
     }
     else
     {
         e.Error = ErrorCode.ReadWriteDenied;
     }
 }
Exemplo n.º 3
0
        void IGXDLMSBase.SetValue(GXDLMSSettings settings, ValueEventArgs e)
        {
            switch (e.Index)
            {
            case 1:
                LogicalName = GXCommon.ToLogicalName(e.Value);
                break;

            case 2:
                if (e.Value is byte[])
                {
                    Operator = ASCIIEncoding.ASCII.GetString((byte[])e.Value);
                }
                else
                {
                    Operator = (string)e.Value;
                }
                break;

            case 3:
                Status = (GsmStatus)Convert.ToByte(e.Value);
                break;

            case 4:
                CircuitSwitchStatus = (GsmCircuitSwitchStatus)Convert.ToByte(e.Value);
                break;

            case 5:
                PacketSwitchStatus = (GsmPacketSwitchStatus)Convert.ToByte(e.Value);
                break;

            case 6:
                if (e.Value != null)
                {
                    List <object> tmp;
                    if (e.Value is List <object> )
                    {
                        tmp = (List <object>)e.Value;
                    }
                    else
                    {
                        tmp = new List <object>((object[])e.Value);
                    }
                    CellInfo.CellId        = Convert.ToUInt32(tmp[0]);
                    CellInfo.LocationId    = (UInt16)tmp[1];
                    CellInfo.SignalQuality = (byte)tmp[2];
                    CellInfo.Ber           = (byte)tmp[3];
                    if (Version > 0)
                    {
                        CellInfo.MobileCountryCode = (UInt16)tmp[4];
                        CellInfo.MobileNetworkCode = (UInt16)tmp[5];
                        CellInfo.ChannelNumber     = (UInt32)tmp[6];
                    }
                }
                break;

            case 7:
                AdjacentCells.Clear();
                if (e.Value != null)
                {
                    foreach (object tmp in (IEnumerable <object>)e.Value)
                    {
                        List <object> it;
                        if (tmp is List <object> )
                        {
                            it = (List <object>)tmp;
                        }
                        else
                        {
                            it = new List <object>((object[])tmp);
                        }
                        AdjacentCell ac = new Objects.AdjacentCell();
                        ac.CellId        = Convert.ToUInt32(it[0]);
                        ac.SignalQuality = (byte)it[1];
                        AdjacentCells.Add(ac);
                    }
                }
                break;

            case 8:
                if (e.Value is byte[])
                {
                    e.Value = GXDLMSClient.ChangeType((byte[])e.Value, DataType.DateTime, settings.UseUtc2NormalTime);
                }
                else if (e.Value is string)
                {
                    e.Value = new GXDateTime((string)e.Value);
                }
                CaptureTime = (GXDateTime)e.Value;
                break;

            default:
                e.Error = ErrorCode.ReadWriteDenied;
                break;
            }
        }
Exemplo n.º 4
0
        void IGXDLMSBase.SetValue(GXDLMSSettings settings, ValueEventArgs e)
        {
            switch (e.Index)
            {
            case 1:
                LogicalName = GXCommon.ToLogicalName(e.Value);
                break;

            case 2:
                if (e.Value is byte[])
                {
                    Operator = ASCIIEncoding.ASCII.GetString((byte[])e.Value);
                }
                else
                {
                    Operator = (string)e.Value;
                }
                break;

            case 3:
                Status = (GsmStatus)(byte)e.Value;
                break;

            case 4:
                CircuitSwitchStatus = (GsmCircuitSwitchStatus)(byte)e.Value;
                break;

            case 5:
                PacketSwitchStatus = (GsmPacketSwitchStatus)(byte)e.Value;
                break;

            case 6:
                if (e.Value != null)
                {
                    object[] tmp = (object[])e.Value;
                    CellInfo.CellId        = (UInt16)tmp[0];
                    CellInfo.LocationId    = (UInt16)tmp[1];
                    CellInfo.SignalQuality = (byte)tmp[2];
                    CellInfo.Ber           = (byte)tmp[3];
                }
                break;

            case 7:
                AdjacentCells.Clear();
                if (e.Value != null)
                {
                    foreach (object it in (object[])e.Value)
                    {
                        object[]     tmp = (object[])it;
                        AdjacentCell ac  = new Objects.AdjacentCell();
                        ac.CellId        = (string)tmp[0];
                        ac.SignalQuality = (byte)tmp[1];
                        AdjacentCells.Add(ac);
                    }
                }
                break;

            case 8:
                if (e.Value is byte[])
                {
                    CaptureTime = (GXDateTime)GXDLMSClient.ChangeType((byte[])e.Value, DataType.DateTime);
                }
                else
                {
                    CaptureTime = (GXDateTime)e.Value;
                }
                break;

            default:
                e.Error = ErrorCode.ReadWriteDenied;
                break;
            }
        }