Beispiel #1
0
        public FIleWriteActCon(ApplicationLayerParameters parameters, byte[] msg, int startIndex) : base(parameters, msg, startIndex)
        {
            startIndex += 2; /* skip IOA */
            startIndex += 1; /* skip AdditionalPacketType */

            if ((msg.Length - startIndex) < GetEncodedSize())
            {
                throw new ASDUParsingException("Message too small");
            }

            startIndex += 1; /* skip OPT */

            _result = (WriteFileActConResult)msg[startIndex++];

            _fileNameLength = msg[startIndex++];

            _fileName = "";
            for (int i = 0; i < _fileNameLength; i++)
            {
                _fileName += (char)msg[startIndex++];
            }

            _fileId  = msg[startIndex++];
            _fileId += msg[startIndex++] * 0x100;
            _fileId += msg[startIndex++] * 0x10000;
            _fileId += msg[startIndex++] * 0x1000000;

            _fileSize  = msg[startIndex++];
            _fileSize += (uint)msg[startIndex++] * 0x100;
            _fileSize += (uint)msg[startIndex++] * 0x10000;
            _fileSize += (uint)msg[startIndex++] * 0x100000;
        }
Beispiel #2
0
 public FIleWriteActCon(int objectAddress, WriteFileActConResult result, string fileName, int fileId, uint fileSize) : base(objectAddress, AdditionalPacketType.FILE_TRANSFER, OptionID.WRITE_FILE_ACT_CON)
 {
     _result         = result;
     _fileNameLength = (byte)(fileName == null ? 0 : fileName.Length);
     _fileName       = fileName;
     _fileId         = fileId;
     _fileSize       = fileSize;
 }