IGSTK
Protected Types | Protected Member Functions | List of all members
igstk::SerialCommunicationForWindows Class Reference

This class implements Windows specific methods for 32-bit communication over a Serial Port(RS-232 connection). More...

#include <igstkSerialCommunicationForWindows.h>

Inheritance diagram for igstk::SerialCommunicationForWindows:
Inheritance graph
[legend]
Collaboration diagram for igstk::SerialCommunicationForWindows:
Collaboration graph
[legend]

Protected Types

typedef HANDLE HandleType
 Macro with standard traits declarations.

Protected Member Functions

 SerialCommunicationForWindows ()
 Constructor.
 ~SerialCommunicationForWindows ()
 Destructor.
virtual ResultType InternalOpenPort (void)
 Opens serial port for communication;.
virtual ResultType InternalUpdateParameters (void)
 Sets up communication on the open port as per the communication parameters.
virtual ResultType InternalClosePort (void)
 Closes serial port.
virtual ResultType InternalSendBreak (void)
 Send a serial break.
virtual void InternalSleep (int milliseconds)
 Sleep for the number of milliseconds specified.
virtual ResultType InternalPurgeBuffers (void)
 Purge the input and output buffers.
virtual ResultType InternalWrite (const char *message, unsigned int numberOfBytes)
 Write data.
virtual ResultType InternalRead (char *data, unsigned int numberOfBytes, unsigned int &bytesRead)
 Read data.
virtual ResultType InternalSetRTS (unsigned int signal)
 Set the RTS value 0 : Clear the RTS (request-to-send) signal 1 : Sends the RTS signal.
virtual ResultType InternalSetTimeout (unsigned int timeoutPeriod)
 Set the timeout.
virtual void PrintSelf (std::ostream &os, itk::Indent indent) const
 Print object information.
- Protected Member Functions inherited from igstk::SerialCommunication
LoggerTypeGetLogger () const
 Declarations related to the Logger.
 SerialCommunication ()
 ~SerialCommunication ()
virtual void InternalSleep (unsigned int)
 Sleep for the period of time specified, in milliseconds.
- Protected Member Functions inherited from igstk::Communication
 Communication (void)
 Constructor is protected in order to enforce the use of the New() operator.
virtual ~Communication (void)
- Protected Member Functions inherited from igstk::Object
 Object (void)
 Constructor is protected in order to enforce the use of the New() operator.
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.
void RemoveFromObservedObjects ()
 Remove observers that this object may have connected to other objects.

Additional Inherited Members

- Public Types inherited from igstk::SerialCommunication
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
- Public Member Functions inherited from igstk::SerialCommunication
 igstkStandardClassBasicTraitsMacro (SerialCommunication, Communication)
 Standard traits of a basic class.
virtual void SetPortNumber (PortNumberType _arg)
 Specify which serial port to use.
virtual PortNumberType GetPortNumber ()
 Get the serial port, where the ports are numbered 0 through 3.
virtual void SetBaudRate (BaudRateType _arg)
 Set the baud rate to use.
virtual BaudRateType GetBaudRate ()
 Get the baud rate.
virtual void SetDataBits (DataBitsType _arg)
 Set the number of bits per character.
virtual DataBitsType GetDataBits ()
 Get the number of bits per character.
virtual void SetParity (ParityType _arg)
 Set the parity.
virtual ParityType GetParity ()
 Get the parity.
virtual void SetStopBits (StopBitsType _arg)
 Set the number of stop bits.
virtual StopBitsType GetStopBits ()
 Get the number of stop bits.
virtual void SetHardwareHandshake (HandshakeType _arg)
 Set whether to use hardware handshaking.
virtual HandshakeType GetHardwareHandshake ()
 Get whether hardware handshaking is enabled.
void SetCaptureFileName (const char *filename)
 Set the name of the file into which the data stream is recorded.
const char * GetCaptureFileName () const
 Get the filename into which the data stream is recorded.
virtual void SetCapture (bool _arg)
 Set whether to record the data.
virtual bool GetCapture ()
 Get whether the data is being recorded.
ResultType UpdateParameters (void)
 Update the communication parameters, in case you need to change the baud rate, handshaking, timeout, etc.
ResultType OpenCommunication (void)
 The method OpenCommunication sets up communication as per the data provided.
ResultType CloseCommunication (void)
 The method CloseCommunication closes the communication.
ResultType SetRTS (unsigned int signal)
 Set the RTS value 0 : Clear the RTS (request-to-send) signal 1 : Sends the RTS signal.
ResultType Write (const char *message, unsigned int numberOfBytes)
 Write method sends the string via the communication link.
ResultType Read (char *data, unsigned int numberOfBytes, unsigned int &bytesRead)
 Read method receives the string via the communication link.
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.
ResultType PurgeBuffers (void)
 Purge the contents of the buffers.
void Sleep (unsigned int milliseconds)
 Sleep for the specified number of milliseconds.
void ExportStateMachineDescription (OutputStreamType &ostr, bool skipLoops=false) const
 Declarations related to the State Machine.
void SetLogger (LoggerType *logger)
 Connect the Logger for this class.
- Static Public Member Functions inherited from igstk::SerialCommunication
static Pointer New (void)
 Customized New method that will return the implementation of SerialCommunication that is appropriate for this platform.
- Public Attributes inherited from igstk::Communication
 ResultType

Detailed Description

This class implements Windows specific methods for 32-bit communication over a Serial Port(RS-232 connection).

igstkSerialCommunicationForWindows.png

"SerialCommunicationForWindows State Machine Diagram" "SerialCommunicationForWindows State Machine Diagram"

Definition at line 44 of file igstkSerialCommunicationForWindows.h.

Member Typedef Documentation

Macro with standard traits declarations.

Return value type for interface functions Windows file handle type

Definition at line 49 of file igstkSerialCommunicationForWindows.h.

Constructor & Destructor Documentation

igstk::SerialCommunicationForWindows::SerialCommunicationForWindows ( )
protected

Constructor.

igstk::SerialCommunicationForWindows::~SerialCommunicationForWindows ( )
protected

Destructor.

Member Function Documentation

virtual ResultType igstk::SerialCommunicationForWindows::InternalOpenPort ( void  )
protectedvirtual

Opens serial port for communication;.

Reimplemented from igstk::SerialCommunication.

virtual ResultType igstk::SerialCommunicationForWindows::InternalUpdateParameters ( void  )
protectedvirtual

Sets up communication on the open port as per the communication parameters.

Reimplemented from igstk::SerialCommunication.

virtual ResultType igstk::SerialCommunicationForWindows::InternalClosePort ( void  )
protectedvirtual

Closes serial port.

Reimplemented from igstk::SerialCommunication.

virtual ResultType igstk::SerialCommunicationForWindows::InternalSendBreak ( void  )
protectedvirtual

Send a serial break.

Reimplemented from igstk::SerialCommunication.

virtual void igstk::SerialCommunicationForWindows::InternalSleep ( int  milliseconds)
protectedvirtual

Sleep for the number of milliseconds specified.

virtual ResultType igstk::SerialCommunicationForWindows::InternalPurgeBuffers ( void  )
protectedvirtual

Purge the input and output buffers.

Reimplemented from igstk::SerialCommunication.

virtual ResultType igstk::SerialCommunicationForWindows::InternalWrite ( const char *  message,
unsigned int  numberOfBytes 
)
protectedvirtual

Write data.

Reimplemented from igstk::SerialCommunication.

virtual ResultType igstk::SerialCommunicationForWindows::InternalRead ( char *  data,
unsigned int  numberOfBytes,
unsigned int &  bytesRead 
)
protectedvirtual

Read data.

Reimplemented from igstk::SerialCommunication.

virtual ResultType igstk::SerialCommunicationForWindows::InternalSetRTS ( unsigned int  signal)
protectedvirtual

Set the RTS value 0 : Clear the RTS (request-to-send) signal 1 : Sends the RTS signal.

Reimplemented from igstk::SerialCommunication.

virtual ResultType igstk::SerialCommunicationForWindows::InternalSetTimeout ( unsigned int  timeoutPeriod)
protectedvirtual

Set the timeout.

virtual void igstk::SerialCommunicationForWindows::PrintSelf ( std::ostream &  os,
itk::Indent  indent 
) const
protectedvirtual

Print object information.

Reimplemented from igstk::SerialCommunication.


The documentation for this class was generated from the following file: