public FileCallOrSelect(int objectAddress, NameOfFile nof, byte nameOfSection, SelectAndCallQualifier scq) : base(objectAddress) { this.nof = nof; this.nameOfSection = nameOfSection; this.scq = scq; }
internal FileLastSegmentOrSection(ApplicationLayerParameters parameters, byte[] msg, int startIndex, bool isSequence) : base(parameters, msg, startIndex, isSequence) { if (!isSequence) { startIndex += parameters.SizeOfIOA; /* skip IOA */ } if ((msg.Length - startIndex) < GetEncodedSize()) { throw new ASDUParsingException("Message too small"); } int nofValue; nofValue = msg[startIndex++]; nofValue += (msg[startIndex++] * 0x100); nof = (NameOfFile)nofValue; nameOfSection = msg[startIndex++]; /* parse LSQ (last section or segment qualifier) */ lsq = (LastSectionOrSegmentQualifier)msg[startIndex++]; chs = msg[startIndex++]; }
public FileDirectory(int objectAddress, NameOfFile nof, int lengthOfFile, int status, bool LFD, bool FOR, bool FA, CP56Time2a creationTime) : base(objectAddress) { this.nof = nof; this.lengthOfFile = lengthOfFile; if (status < 0) { status = 0; } else if (status > 31) { status = 31; } byte sof = (byte)status; if (LFD) { sof += 0x20; } if (FOR) { sof += 0x40; } if (FA) { sof += 0x80; } this.sof = sof; this.creationTime = creationTime; }
internal FileDirectory(ApplicationLayerParameters parameters, byte[] msg, int startIndex, bool isSequence) : base(parameters, msg, startIndex, isSequence) { if (!isSequence) { startIndex += parameters.SizeOfIOA; /* skip IOA */ } if ((msg.Length - startIndex) < GetEncodedSize()) { throw new ASDUParsingException("Message too small"); } int nofValue; nofValue = msg[startIndex++]; nofValue += (msg[startIndex++] * 0x100); nof = (NameOfFile)nofValue; lengthOfFile = msg[startIndex++]; lengthOfFile += (msg[startIndex++] * 0x100); lengthOfFile += (msg[startIndex++] * 0x10000); sof = msg[startIndex++]; /* parse CP56Time2a (creation time of file) */ creationTime = new CP56Time2a(msg, startIndex); }
internal SectionReady(ApplicationLayerParameters parameters, byte[] msg, int startIndex, bool isSequence) : base(parameters, msg, startIndex, isSequence) { if (!isSequence) { startIndex += parameters.SizeOfIOA; /* skip IOA */ } if ((msg.Length - startIndex) < GetEncodedSize()) { throw new ASDUParsingException("Message too small"); } int nofValue; nofValue = msg[startIndex++]; nofValue += (msg[startIndex++] * 0x100); nof = (NameOfFile)nofValue; nameOfSection = msg[startIndex++]; lengthOfSection = msg[startIndex++]; lengthOfSection += (msg[startIndex++] * 0x100); lengthOfSection += (msg[startIndex++] * 0x10000); /* parse SRQ (section read qualifier) */ srq = msg[startIndex++]; }
public TransparentFile(int ca, int ioa, NameOfFile nof) { this.ca = ca; this.ioa = ioa; this.nof = nof; time = DateTime.Now; }
internal CS101n104File GetFile(int ca, int ioa, NameOfFile nof) { lock (availableFiles) { foreach (CS101n104File file in availableFiles) { if ((file.provider.GetCA() == ca) && (file.provider.GetIOA() == ioa)) { if (nof == NameOfFile.DEFAULT) { return(file); } else { if (nof == file.provider.GetNameOfFile()) { return(file); } } } } } return(null); }
public FileSegment(int objectAddress, NameOfFile nof, byte nameOfSection, byte[] data) : base(objectAddress) { this.nof = nof; this.nameOfSection = nameOfSection; this.data = data; this.los = (byte)data.Length; }
public FileLastSegmentOrSection(int objectAddress, NameOfFile nof, byte nameOfSection, LastSectionOrSegmentQualifier lsq, byte checksum) : base(objectAddress) { this.nof = nof; this.nameOfSection = nameOfSection; this.lsq = lsq; this.chs = checksum; }
public FileACK(int objectAddress, NameOfFile nof, byte nameOfSection, AcknowledgeQualifier qualifier, FileError errorCode) : base(objectAddress) { this.nof = nof; this.nameOfSection = nameOfSection; this.AckQualifier = qualifier; this.ErrorCode = errorCode; }
public FileDirectory(int objectAddress, NameOfFile nof, int lengthOfFile, byte sof, CP56Time2a creationTime) : base(objectAddress) { this.nof = nof; this.lengthOfFile = lengthOfFile; this.sof = sof; this.creationTime = creationTime; }
public override void SendFile(int ca, int ioa, NameOfFile nof, IFileProvider fileProvider) { if (fileClient == null) { fileClient = new FileClient(this, DebugLog); } fileClient.SendFile(ca, ioa, nof, fileProvider); }
public override void GetFile(int ca, int ioa, NameOfFile nof, IFileReceiver receiver) { if (fileClient == null) { fileClient = new FileClient(this, DebugLog); } fileClient.RequestFile(ca, ioa, nof, receiver); }
public void RequestFile(int ca, int ioa, NameOfFile nof, IFileReceiver fileReceiver) { this.ca = ca; this.ioa = ioa; this.nof = nof; this.fileReceiver = fileReceiver; ASDU selectFile = NewAsdu(new FileCallOrSelect(ioa, nof, 0, SelectAndCallQualifier.SELECT_FILE)); master.SendASDU(selectFile); state = FileClientState.WAITING_FOR_FILE_READY; }
/// <summary> /// Initializes a new instance of the <see cref="lib60870.CS101.FileReady"/> class. /// </summary> /// <param name="objectAddress">information object address (IOA)</param> /// <param name="nof">NOF (file type)</param> /// <param name="lengthOfFile">Length of file.</param> /// <param name="positive">If set to <c>true</c> positive ACK.</param> public FileReady(int objectAddress, NameOfFile nof, int lengthOfFile, bool positive) : base(objectAddress) { this.nof = nof; this.lengthOfFile = lengthOfFile; if (positive) { frq = 0x00; } else { frq = 0x80; } }
public SectionReady(int objectAddress, NameOfFile nof, byte nameOfSection, int lengthOfSection, bool notReady) : base(objectAddress) { this.nof = nof; this.nameOfSection = nameOfSection; this.lengthOfSection = lengthOfSection; if (notReady) { srq = 0x80; } else { srq = 0; } }
internal FileSegment(ApplicationLayerParameters parameters, byte[] msg, int startIndex, bool isSequence) : base(parameters, msg, startIndex, isSequence) { if (!isSequence) { startIndex += parameters.SizeOfIOA; /* skip IOA */ } if ((msg.Length - startIndex) < GetEncodedSize()) { throw new ASDUParsingException("Message too small"); } int nofValue; nofValue = msg[startIndex++]; nofValue += (msg[startIndex++] * 0x100); nof = (NameOfFile)nofValue; nameOfSection = msg[startIndex++]; los = msg[startIndex++]; if (los > GetMaxDataSize(parameters)) { throw new ASDUParsingException("Payload data too large"); } if ((msg.Length - startIndex) < los) { throw new ASDUParsingException("Message too small"); } data = new byte[los]; for (int i = 0; i < los; i++) { data[i] = msg[startIndex++]; } }
internal FileCallOrSelect(ApplicationLayerParameters parameters, byte[] msg, int startIndex, bool isSequence) : base(parameters, msg, startIndex, isSequence) { if (!isSequence) { startIndex += parameters.SizeOfIOA; /* skip IOA */ } if ((msg.Length - startIndex) < GetEncodedSize()) { throw new ASDUParsingException("Message too small"); } int nofValue; nofValue = msg[startIndex++]; nofValue += (msg[startIndex++] * 0x100); nof = (NameOfFile)nofValue; nameOfSection = msg[startIndex++]; /* parse SCQ (select and call qualifier) */ scq = (SelectAndCallQualifier)msg[startIndex++]; }
internal FileACK(ApplicationLayerParameters parameters, byte[] msg, int startIndex, bool isSequence) : base(parameters, msg, startIndex, isSequence) { if (!isSequence) { startIndex += parameters.SizeOfIOA; /* skip IOA */ } if ((msg.Length - startIndex) < GetEncodedSize()) { throw new ASDUParsingException("Message too small"); } int nofValue; nofValue = msg[startIndex++]; nofValue += (msg[startIndex++] * 0x100); nof = (NameOfFile)nofValue; nameOfSection = msg[startIndex++]; /* parse AFQ (acknowledge file or section qualifier) */ afq = msg[startIndex++]; }
public SimpleFile(int ca, int ioa, NameOfFile nof) : base(ca, ioa, nof) { }
/// <summary> /// Sends the file to slave (download file) /// </summary> /// <param name="ca">CA</param> /// <param name="ioa">IOA</param> /// <param name="nof">Name of file (file type)</param> /// <param name="fileProvider">File provider instance</param> public abstract void SendFile(int ca, int ioa, NameOfFile nof, IFileProvider fileProvider);
/// <summary> /// Read the file from slave (upload file) /// </summary> /// <param name="ca">CA</param> /// <param name="ioa">IOA</param> /// <param name="nof">Name of file (file type)</param> /// <param name="receiver">file receiver instance</param> public abstract void GetFile(int ca, int ioa, NameOfFile nof, IFileReceiver receiver);