Example #1
0
        ///<summary>
        ///Generates disconnect request.
        /// </summary>
        ///<returns>
        ///Disconnect request.
        ///</returns>
        private byte[][] GenerateDisconnectRequest()
        {
            GXByteBuffer buff;

            if (this.InterfaceType == InterfaceType.WRAPPER)
            {
                buff = new GXByteBuffer(2);
                buff.SetUInt8(0x63);
                buff.SetUInt8(0x0);
                return(GXDLMS.SplitToWrapperFrames(Settings, buff));
            }
            else
            {
                buff = new GXByteBuffer(22);
                buff.SetUInt8(0x81); // FromatID
                buff.SetUInt8(0x80); // GroupID
                buff.SetUInt8(0);    // Length

                buff.SetUInt8(HDLCInfo.MaxInfoTX);
                buff.SetUInt8(GXCommon.GetSize(Limits.MaxInfoTX));
                buff.Add(Limits.MaxInfoTX);

                buff.SetUInt8(HDLCInfo.MaxInfoRX);
                buff.SetUInt8(GXCommon.GetSize(Limits.MaxInfoRX));
                buff.Add(Limits.MaxInfoRX);

                buff.SetUInt8(HDLCInfo.WindowSizeTX);
                buff.SetUInt8(GXCommon.GetSize(Limits.WindowSizeTX));
                buff.Add(Limits.WindowSizeTX);

                buff.SetUInt8(HDLCInfo.WindowSizeRX);
                buff.SetUInt8(GXCommon.GetSize(Limits.WindowSizeRX));
                buff.Add(Limits.WindowSizeRX);

                int len = buff.Position - 3;
                buff.SetUInt8(2, (byte)len); // Length.
            }
            return(GXDLMS.SplitToHdlcFrames(Settings, (byte)Command.Ua, buff));
        }