IGSTK
|
This class simulates serial communication via a file. More...
#include <igstkSerialCommunicationSimulator.h>
Public Member Functions | |
const char * | GetFileName () const |
Get the file name for the recorded data. More... | |
![]() | |
igstkStandardClassBasicTraitsMacro (SerialCommunication, Communication) | |
Standard traits of a basic class. More... | |
virtual void | SetPortNumber (PortNumberType _arg) |
Specify which serial port to use. More... | |
virtual PortNumberType | GetPortNumber () |
Get the serial port, where the ports are numbered 0 through 3. More... | |
virtual void | SetBaudRate (BaudRateType _arg) |
Set the baud rate to use. More... | |
virtual BaudRateType | GetBaudRate () |
Get the baud rate. More... | |
virtual void | SetDataBits (DataBitsType _arg) |
Set the number of bits per character. More... | |
virtual DataBitsType | GetDataBits () |
Get the number of bits per character. More... | |
virtual void | SetParity (ParityType _arg) |
Set the parity. More... | |
virtual ParityType | GetParity () |
Get the parity. More... | |
virtual void | SetStopBits (StopBitsType _arg) |
Set the number of stop bits. More... | |
virtual StopBitsType | GetStopBits () |
Get the number of stop bits. More... | |
virtual void | SetHardwareHandshake (HandshakeType _arg) |
Set whether to use hardware handshaking. More... | |
virtual HandshakeType | GetHardwareHandshake () |
Get whether hardware handshaking is enabled. More... | |
void | SetCaptureFileName (const char *filename) |
Set the name of the file into which the data stream is recorded. More... | |
const char * | GetCaptureFileName () const |
Get the filename into which the data stream is recorded. More... | |
virtual void | SetCapture (bool _arg) |
Set whether to record the data. More... | |
virtual bool | GetCapture () |
Get whether the data is being recorded. More... | |
ResultType | UpdateParameters (void) |
Update the communication parameters, in case you need to change the baud rate, handshaking, timeout, etc. More... | |
ResultType | OpenCommunication (void) |
The method OpenCommunication sets up communication as per the data provided. More... | |
ResultType | CloseCommunication (void) |
The method CloseCommunication closes the communication. More... | |
ResultType | SetRTS (unsigned int signal) |
Set the RTS value 0 : Clear the RTS (request-to-send) signal 1 : Sends the RTS signal. More... | |
ResultType | Write (const char *message, unsigned int numberOfBytes) |
Write method sends the string via the communication link. More... | |
ResultType | Read (char *data, unsigned int numberOfBytes, unsigned int &bytesRead) |
Read method receives the string via the communication link. More... | |
ResultType | SendBreak (void) |
Send a break in the serial communication, which by definition is a series of zeroes that lasts for a 0.3 second duration. More... | |
ResultType | PurgeBuffers (void) |
Purge the contents of the buffers. More... | |
void | Sleep (unsigned int milliseconds) |
Sleep for the specified number of milliseconds. More... | |
void | ExportStateMachineDescription (OutputStreamType &ostr, bool skipLoops=false) const |
Declarations related to the State Machine. More... | |
void | SetLogger (LoggerType *logger) |
![]() | |
virtual void | SetTimeoutPeriod (unsigned int _arg) |
The method SetTimeoutPeriod sets the amount of time, in milliseconds to wait on a reply from the device before generating a timeout event. More... | |
virtual unsigned int | GetTimeoutPeriod () |
virtual void | SetReadTerminationCharacter (char _arg) |
The method SetReadTerminationCharacter sets a special character that the device uses to mark the end of a reply (defaults to end-of-file character, ascii 255). More... | |
virtual char | GetReadTerminationCharacter () |
virtual void | SetUseReadTerminationCharacter (bool _arg) |
The method SetUseReadTerminationCharacter sets whether to use the termination character, or not use a termination character. More... | |
virtual bool | GetUseReadTerminationCharacter () |
![]() | |
virtual const char * | GetNameOfClass () const |
void | SetLogger (LoggerType *logger) |
Connect the Logger for this class. More... | |
void | RemoveObserver (unsigned long tag) const |
Protected Types | |
typedef SerialCommunication::ResultType | ResultType |
Protected Member Functions | |
SerialCommunicationSimulator () | |
Constructor. More... | |
~SerialCommunicationSimulator () | |
Destructor. More... | |
virtual ResultType | InternalOpenPort (void) |
Opens serial port for communication;. More... | |
virtual ResultType | InternalUpdateParameters (void) |
Sets up communication on the open port as per the communication parameters. More... | |
virtual ResultType | InternalClosePort (void) |
Closes serial port. More... | |
virtual ResultType | InternalSendBreak (void) |
Send a serial break. More... | |
virtual void | InternalSleep (unsigned int milliseconds) |
Sleep for the amount of time specified in milliseconds. More... | |
virtual ResultType | InternalPurgeBuffers (void) |
Purge the input and output buffers. More... | |
virtual ResultType | InternalWrite (const char *message, unsigned int numberOfBytes) |
Write data. More... | |
virtual ResultType | InternalRead (char *data, unsigned int numberOfBytes, unsigned int &bytesRead) |
Read data. More... | |
virtual void | PrintSelf (std::ostream &os, itk::Indent indent) const |
Print object information. More... | |
![]() | |
LoggerType * | GetLogger () const |
Declarations related to the Logger. More... | |
SerialCommunication () | |
~SerialCommunication () | |
virtual ResultType | InternalSetRTS (unsigned int) |
Closes serial port. More... | |
![]() | |
Communication (void) | |
Constructor is protected in order to enforce the use of the New() operator. More... | |
virtual | ~Communication (void) |
![]() | |
LoggerType * | GetLogger () const |
Object (void) | |
Constructor is protected in order to enforce the use of the New() operator. More... | |
virtual | ~Object (void) |
void | RegisterObservedObject (const ::igstk::Object *object, unsigned long tag) |
Register observed objects in an internal array so that they can be disconnected upon destruction. More... | |
void | RemoveFromObservedObjects () |
Remove observers that this object may have connected to other objects. More... | |
Additional Inherited Members | |
![]() | |
enum | PortNumberType { PortNumber0 = 0, PortNumber1 = 1, PortNumber2 = 2, PortNumber3 = 3, PortNumber4 = 4, PortNumber5 = 5, PortNumber6 = 6, PortNumber7 = 7 } |
Available port numbers. More... | |
enum | BaudRateType { BaudRate9600 = 9600, BaudRate19200 = 19200, BaudRate38400 = 38400, BaudRate57600 = 57600, BaudRate115200 = 115200 } |
Available baud rates. More... | |
enum | DataBitsType { DataBits7 = 7, DataBits8 = 8 } |
Available data bits settings. More... | |
enum | ParityType { NoParity = 'N', OddParity = 'O', EvenParity = 'E' } |
Available parity settings. More... | |
enum | StopBitsType { StopBits1 = 1, StopBits2 = 2 } |
Available stop bits settings. More... | |
enum | HandshakeType { HandshakeOff = 0, HandshakeOn = 1 } |
Available hardware handshaking settings. More... | |
typedef Communication::ResultType | ResultType |
![]() | |
typedef Object | Self |
General Typedefs. More... | |
typedef ::itk::Object | Superclass |
typedef ::itk::SmartPointer< Self > | Pointer |
typedef ::itk::SmartPointer < const Self > | ConstPointer |
typedef igstk::Logger | LoggerType |
![]() | |
static Pointer | New (void) |
Customized New method that will return the implementation of SerialCommunication that is appropriate for this platform. More... | |
![]() | |
static Pointer | New (void) |
This class simulates serial communication via a file.
Definition at line 39 of file igstkSerialCommunicationSimulator.h.
Definition at line 60 of file igstkSerialCommunicationSimulator.h.
|
protected |
Constructor.
|
protected |
Destructor.
const char* igstk::SerialCommunicationSimulator::GetFileName | ( | ) | const |
Get the file name for the recorded data.
|
protectedvirtual |
Opens serial port for communication;.
Reimplemented from igstk::SerialCommunication.
|
protectedvirtual |
Sets up communication on the open port as per the communication parameters.
Reimplemented from igstk::SerialCommunication.
|
protectedvirtual |
Closes serial port.
Reimplemented from igstk::SerialCommunication.
|
protectedvirtual |
Send a serial break.
Reimplemented from igstk::SerialCommunication.
|
protectedvirtual |
Sleep for the amount of time specified in milliseconds.
Reimplemented from igstk::SerialCommunication.
|
protectedvirtual |
Purge the input and output buffers.
Reimplemented from igstk::SerialCommunication.
|
protectedvirtual |
Write data.
Reimplemented from igstk::SerialCommunication.
|
protectedvirtual |
Read data.
Reimplemented from igstk::SerialCommunication.
|
protectedvirtual |
Print object information.
Reimplemented from igstk::SerialCommunication.