示例#1
0
 /// <summary>
 /// Reserved for internal use.
 /// </summary>
 /// <param name="data"></param>
 internal void CodeData(List <byte> data)
 {
     data.Add(0xBE);                    //Tag
     data.Add(0x10);                    //Length for AARQ user field
     data.Add(0x04);                    //Coding the choice for user-information (Octet STRING, universal)
     data.Add(0x0E);                    //Length
     data.Add(GXCommon.InitialRequest); // Tag for xDLMS-Initiate request
     data.Add(0x00);                    // Usage field for dedicated-key component � not used
     data.Add(0x00);                    // Usage field for the response allowed component � not used
     data.Add(0x00);                    // Usage field of the proposed-quality-of-service component � not used
     data.Add(DLMSVersioNumber);        // Tag for conformance block
     data.Add(0x5F);
     data.Add(0x1F);
     data.Add(0x04); // length of the conformance block
     data.Add(0x00); // encoding the number of unused bits in the bit string
     data.AddRange(ConformanceBlock);
     GXCommon.SetUInt16(MaxReceivePDUSize, data);
 }
示例#2
0
 object IGXDLMSBase.GetValue(int index, int selector, object parameters)
 {
     if (index == 1)
     {
         return(this.LogicalName);
     }
     if (index == 2)
     {
         return(GetObjects());
     }
     if (index == 3)
     {
         List <byte> data = new List <byte>();
         data.Add((byte)DataType.Array);
         //Add count
         data.Add(2);
         data.Add((byte)DataType.UInt8);
         data.Add(ClientSAP);
         data.Add((byte)DataType.UInt16);
         GXCommon.SetUInt16(ServerSAP, data);
         return(data.ToArray());
     }
     if (index == 4)
     {
         List <byte> data = new List <byte>();
         data.Add((byte)DataType.Structure);
         //Add count
         data.Add(0x7);
         GXCommon.SetData(data, DataType.UInt8, ApplicationContextName.JointIsoCtt);
         GXCommon.SetData(data, DataType.UInt8, ApplicationContextName.Country);
         GXCommon.SetData(data, DataType.UInt16, ApplicationContextName.CountryName);
         GXCommon.SetData(data, DataType.UInt8, ApplicationContextName.IdentifiedOrganization);
         GXCommon.SetData(data, DataType.UInt8, ApplicationContextName.DlmsUA);
         GXCommon.SetData(data, DataType.UInt8, ApplicationContextName.ApplicationContext);
         GXCommon.SetData(data, DataType.UInt8, ApplicationContextName.ContextId);
         return(data.ToArray());
     }
     if (index == 5)
     {
         List <byte> data = new List <byte>();
         data.Add((byte)DataType.Structure);
         data.Add(6);
         GXCommon.SetData(data, DataType.BitString, XDLMSContextInfo.Conformance);
         GXCommon.SetData(data, DataType.UInt16, XDLMSContextInfo.MaxReceivePduSize);
         GXCommon.SetData(data, DataType.UInt16, XDLMSContextInfo.MaxSendPpuSize);
         GXCommon.SetData(data, DataType.UInt8, XDLMSContextInfo.DlmsVersionNumber);
         GXCommon.SetData(data, DataType.Int8, XDLMSContextInfo.QualityOfService);
         GXCommon.SetData(data, DataType.OctetString, XDLMSContextInfo.CypheringInfo);
         return(data.ToArray());
     }
     if (index == 6)
     {
         List <byte> data = new List <byte>();
         data.Add((byte)DataType.Structure);
         //Add count
         data.Add(0x7);
         GXCommon.SetData(data, DataType.UInt8, AuthenticationMechanismMame.JointIsoCtt);
         GXCommon.SetData(data, DataType.UInt8, AuthenticationMechanismMame.Country);
         GXCommon.SetData(data, DataType.UInt16, AuthenticationMechanismMame.CountryName);
         GXCommon.SetData(data, DataType.UInt8, AuthenticationMechanismMame.IdentifiedOrganization);
         GXCommon.SetData(data, DataType.UInt8, AuthenticationMechanismMame.DlmsUA);
         GXCommon.SetData(data, DataType.UInt8, AuthenticationMechanismMame.AuthenticationMechanismName);
         GXCommon.SetData(data, DataType.UInt8, AuthenticationMechanismMame.MechanismId);
         return(data.ToArray());
     }
     if (index == 7)
     {
         return(Secret);
     }
     if (index == 8)
     {
         return(AssociationStatus);
     }
     if (index == 9)
     {
         if (SecuritySetupReference == null)
         {
             return(null);
         }
         return(ASCIIEncoding.ASCII.GetBytes(SecuritySetupReference));
     }
     throw new ArgumentException("GetValue failed. Invalid attribute index.");
 }