Gurux.DLMS.GXByteBuffer.SetUInt16 C# (CSharp) Method

SetUInt16() public method

Push the given UInt16 into this buffer at the current position, and then increments the position.
public SetUInt16 ( UInt16 value ) : void
value System.UInt16 The value to be added.
return void
        public void SetUInt16(UInt16 value)
        {
            SetUInt16(Size, value);
            Size += 2;
        }

Same methods

GXByteBuffer::SetUInt16 ( int index, UInt16 value ) : void

Usage Example

        /// <summary>
        /// Sends Information Report Request.
        /// </summary>
        /// <param name="time">Send time.</param>
        /// <param name="list">List of COSEM object and attribute index to report.</param>
        /// <returns>Report request as byte array.</returns>
        public byte[][] GenerateInformationReport(DateTime time, List <KeyValuePair <GXDLMSObject, int> > list)
        {
            if (list == null || list.Count == 0)
            {
                throw new ArgumentNullException("list");
            }
            GXByteBuffer buff = new GXByteBuffer();

            byte[][] reply;
            if (UseLogicalNameReferencing)
            {
                throw new Exception("Use GenerateEventNotification when Logical Name referencing is used.");
            }
            else
            {
                GXDLMSSNParameters p = new GXDLMSSNParameters(Settings, Command.InformationReport, list.Count, 0xFF, null, buff);
                foreach (KeyValuePair <GXDLMSObject, int> it in list)
                {
                    // Add variable type.
                    buff.SetUInt8(VariableAccessSpecification.VariableName);
                    int sn = it.Key.ShortName;
                    sn += (it.Value - 1) * 8;
                    buff.SetUInt16((UInt16)sn);
                }
                GXCommon.SetObjectCount(list.Count, buff);
                foreach (KeyValuePair <GXDLMSObject, int> it in list)
                {
                    AddData(it.Key, it.Value, buff);
                }
                reply = GXDLMS.GetSnMessages(p);
            }
            return(reply);
        }
All Usage Examples Of Gurux.DLMS.GXByteBuffer::SetUInt16