Serial Framework C++ Edition
Public Member Functions | Protected Member Functions | List of all members
CwclSerialClient Class Reference

The component represents a Serial Client connection. More...

#include <wclSerialClients.h>

Public Member Functions

 CwclSerialClient ()
 Create a new component.
 
virtual ~CwclSerialClient ()
 Frees the component.
 
int Connect ()
 Connects to a Serial Device (COM port).
 
int Disconnect ()
 Disconnects from the connected remote device.
 
int GetReadBufferSize (unsigned long &Size) const
 Reads the read buffer size.
 
int GetWriteBufferSize (unsigned long &Size) const
 Reads the write buffer size.
 
int SetReadBufferSize (const unsigned long Size) const
 Sets the read buffer size.
 
int SetWriteBufferSize (const unsigned long Size) const
 Sets the write buffer size.
 
int Write (const void *const Data, const unsigned long Size, unsigned long &Written) const
 Sends data to the connected device.
 
int GetFeatures (wclSerialFeatures &Features) const
 Gets the Serial port features.
 
int GetConfig (wclSerialConfig &Config) const
 Gets the current serial port settings.
 
int SetConfig (const wclSerialConfig &Config) const
 Sets the new serial port configuration.
 
int GetTimeouts (wclSerialTimeouts &Timeouts) const
 Gets the current serial port timeouts.
 
int SetTimeouts (const wclSerialTimeouts &Timeouts) const
 Sets the serial port timeouts.
 
int ClearCommBreak () const
 Restores character transmission for a specified communications device and places the transmission line in a nonbreak state.
 
int EscapeCommFunction (const wclSerialEscapeFunction Func) const
 Directs the specified communications device to perform an extended function.
 
int FlushBuffers () const
 Flushes the buffers and causes all buffered data to be sent to the COM port.
 
int GetModemStatus (wclModemStatuses &Status) const
 Retrieves the modem control-register values.
 
int PurgeComm (const wclSerialPurgeFlags &Flags) const
 Discards all characters from the output or input buffer of a specified communications resource. It can also terminate pending read or write operations on the resource.
 
int SetCommBreak () const
 Suspends character transmission for a specified communications device and places the transmission line in a break state until the ClearCommBreak function is called.
 
int TransmitCommChar (const char Ch) const
 Transmits a specified character ahead of any pending data in the output buffer of the specified communications device.
 
CwclCustomClientDataProcessorGetProcessor () const
 Gets the Data Processor created for the connection.
 
 __declspec (property(get=GetProcessor)) CwclCustomClientDataProcessor *Processor
 Gets the Data Processor created for the connection.
 
wclClientState GetState () const
 Gets the connection state.
 
 __declspec (property(get=GetState)) wclClientState State
 Gets the connection state.
 
tstring GetDeviceName () const
 Gets the serial device name.
 
void SetDeviceName (const tstring &value)
 Sets the serial device name.
 
 __declspec (property(get=GetDeviceName, put=SetDeviceName)) tstring DeviceName
 Gets and sets the serial device name.
 
unsigned long GetWriteTimeout () const
 Gets the write operation timeout.
 
void SetWriteTimeout (const unsigned long value) const
 Sets the write operation timeout.
 
 __declspec (property(get=GetWriteTimeout, put=SetWriteTimeout)) unsigned long WriteTimeout
 Gets and sets the write operation timeout.
 
__event void OnConnect (void *Sender, const int Error)
 The event fires when a connection to a remote device has been completed (with or without success).
 
__event void OnCreateProcessor (void *Sender, CwclClientDataConnection *const Connection)
 The event fires when connection to a remote device has been established with success to allow application provide a data processor for the connection.
 
__event void OnData (void *Sender, const void *const Data, const unsigned long Size)
 The event fires when new data is received from the connected remote device.
 
__event void OnDestroyProcessor (void *Sender, CwclClientDataConnection *const Connection)
 The event fires when connection to a remote device has been terminated. An application must destroy the Data Processor created for the connection.
 
__event void OnDisconnect (void *Sender, const int Reason)
 The event fires when the remote connected device has been disconnected.
 
__event void OnError (void *Sender, const wclSerialErrors &Errors, const wclSerialCommunicationStates &States)
 The event fires when a error occurred during communication.
 
__event void OnEvents (void *Sender, const wclSerialEvents &Events)
 The event fires when a serial device event occurs.
 
__event void OnReadError (void *Sender, const int Error)
 The event fires when the error occurred during read operation.
 

Protected Member Functions

virtual void DoConnect (const int Error)
 Fires the OnConnect event.
 
virtual void DoCreateProcessor (CwclClientDataConnection *const Connection)
 Fires the OnCreateProcessor event.
 
virtual void DoData (const void *const Data, const unsigned long Size)
 Fires the OnData event.
 
virtual void DoDestroyProcessor (CwclClientDataConnection *const Connection)
 Fires the OnDestroyProcessor event.
 
virtual void DoDisconnect (const int Reason)
 Fires the OnDisconnect event.
 
virtual void DoError (const wclSerialErrors &Errors, const wclSerialCommunicationStates &States)
 Fires the OnError event.
 
virtual void DoEvents (const wclSerialEvents &Events)
 Fires the OnEvent event.
 
virtual void DoReadError (const int Error)
 Fires the OnReadError event.
 

Detailed Description

The component represents a Serial Client connection.