Table of Contents

Class FileDownloadResponder

Namespace
TechnologySolutions.Rfid.AsciiProtocol
Assembly
TechnologySolutions.Rfid.AsciiProtocol.Core.dll

An implementation of the IAsciiCommandResponder to capture the Autorun and Log files from a device. This responder should be inserted at the top of the responder chain as this responder is high traffic and will consume all the file (marking each line as processed) so it does not have to 'visit' all the responders in the chain. On seeing the start of a download a temporary file is created. All the lines are written out to the file until the download is complete. Then an event is raised with the filename to be copied to a sensible location

public class FileDownloadResponder : IAsciiCommandResponder, IDisposable
Inheritance
FileDownloadResponder
Implements
Inherited Members
Extension Methods

Constructors

FileDownloadResponder(string, string)

Initializes a new instance of the FileDownloadResponder class

public FileDownloadResponder(string fileBeginHeader, string fileEndHeader)

Parameters

fileBeginHeader string

The header that indicates the start of the file contents e.g. "AB" or "LB"

fileEndHeader string

The header that indicates the end of the file contents e.g. "AE" or "LE"

Properties

FileBeginHeader

Gets the header that indicates the start of the file download

public string FileBeginHeader { get; }

Property Value

string

FileEndHeader

Gets the header that indicates the end of the file download

public string FileEndHeader { get; }

Property Value

string

FileName

Gets the name of the last file that was downloaded from the unit

public string FileName { get; }

Property Value

string

Remarks

This provides the name of the file created when the DownloadComplete event is raised

LineCount

Gets the number of lines downloaded

public int LineCount { get; }

Property Value

int

Methods

AutorunFileDownloader()

Returns a FileDownloadResponder to capture an autorun file

public static FileDownloadResponder AutorunFileDownloader()

Returns

FileDownloadResponder

The instance to capture an Autorun file to a file

Dispose()

Disposes an instance of the FileDownloadResponder class

public void Dispose()

Dispose(bool)

Disposes an instance of the FileDownloadResponder class

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

True to dispose managed and well as native resources

LogFileDownloader()

Returns a FileDownloadResponder to capture a log file

public static FileDownloadResponder LogFileDownloader()

Returns

FileDownloadResponder

The instance to capture a log from the device to a file

OnDownloadComplete()

Raises the DownloadComplete event

protected virtual void OnDownloadComplete()

OnDownloadStarted()

Raises the DownloadStarted event

protected virtual void OnDownloadStarted()

OnDownloading()

Raises the Downloading event

protected virtual void OnDownloading()

ProcessReceivedLine(IAsciiResponseLine, bool)

Captures output from the file download command to a temporary file. Raises an event as the file is closed

public bool ProcessReceivedLine(IAsciiResponseLine line, bool moreLinesAvailable)

Parameters

line IAsciiResponseLine

The line to record

moreLinesAvailable bool

True if more lines are going to be passed to this method

Returns

bool

False to allow other IAsciiCommandResponders to process the responses also

Events

DownloadComplete

Event raised when a file download is completed

public event EventHandler DownloadComplete

Event Type

EventHandler

DownloadStarted

Event raised when a file download is started

public event EventHandler DownloadStarted

Event Type

EventHandler

Downloading

Event raised periodically while a file is downloading

public event EventHandler Downloading

Event Type

EventHandler