Name - The name passed in to the Open() function.
BOOL CancelWaitFor( void )
BOOL ClearBreak( void )
BOOL Close( void )
BOOL ConfigurationDialog( CCommunicationsConfiguration& configuration, BOOL save_changes = TRUE, HWND parent_window_handle = NULL )
DWORD GetBaudRate( void )
BOOL GetConfiguration( CCommunicationsConfiguration& configuration )
DWORD GetFlowControl( void )
DWORD GetInputBufferSize( void ) const
DWORD GetModemStatus( void )
WINBASE.H
to see if that status is true:
MS_CTS_ON
- To see if the Clear to Send (CTS) pin is high
MS_DSR_ON
- To see if the Data Set Ready (DSR) pin is high
MS_RING_ON
- To see if the modem has detected a ring
MS_RLSD_ON
- To see if the Receive Line Signal Detect (RLSD) signal is on
DWORD GetOutputBufferSize( void ) const
BOOL GetProperties( CCommunicationProperties& properties )
BOOL GetState( CDeviceControlBlock& device_control_block )
BOOL GetTimeouts( COMMTIMEOUTS& timeouts )
BOOL IsDataWaiting( void )
DWORD NumberOfBytesWaitingToBeRead( void )
DWORD NumberOfBytesWaitingToBeWritten( void )
BOOL Open( void ) BOOL Open( LPCTSTR channel_name, UINT flags = 0, CFileException * exception_p = NULL )
BOOL Purge( DWORD what_to_purge = purgeAll )
what_to_purge
can be
one or a combination of the following:
UINT Read( void *buffer, UINT length )
BOOL ReplaceGarbledCharacter( yes_or_no = TRUE, BYTE replacement_character = ' ' )
BOOL SetBaudRate( DWORD baud_rate )
baud_rate
.
BOOL SetBreak( void )
BOOL SetCharacterToWaitFor( BYTE character_to_wait_for )
waitParticularCharacterReceived
flag.
BOOL SetDataTerminalReady( BOOL set_DTR_on = TRUE )
void SetFlowControl( DWORD flow_control )
void SetInputBufferSize( DWORD buffer_size )
void SetOutputBufferSize( DWORD buffer_size )
BOOL SetPurgeBufferOnError( BOOL purge_buffer = TRUE )
BOOL SetRequestToSend( BOOL set_RTS_on = TRUE )
BOOL SetState( CDeviceControlBlock& device_control_block )
BOOL SetTimeouts( COMMTIMEOUTS * timeouts_p = NULL )
BOOL TransmitCharacter( char character_to_transmit )
character_to_transmit
immediately. This is kind of dangerous
to do.
BOOL WaitFor( DWORD& stuff_you_can_wait_for )
stuff_you_can_wait_for
parameter can be one of the following:
BOOL WaitForString( const CString& string_to_wait_for, DWORD timeout_seconds = 5, CString * what_was_read )
void Write( BYTE byte_to_write ) void Write( const CByteArray& array_of_bytes ) void Write( CString& string_to_write ) void Write( const void * buffer, UINT number_of_bytes )
void wait_for_ring( void )
{
WFCTRACEINIT( TEXT( "wait_for_ring()" ) );
CSerialFile serial;
while( 1 )
{
_tprintf( TEXT( "Opening serial port\n" ) );
if ( serial.Open( TEXT( "COM1:57600,n,8,1" ) ) != FALSE )
{
CString response;
response = TEXT( "ATM0\r\n" );
serial.Write( response );
// See if the phone rang
while ( serial.WaitForString( TEXT( "RING" ), 2, &response ) == FALSE )
{
if ( response.GetLength() > 0 )
{
_tprintf( TEXT( "Didn't get RING, going to sleep \"%s\"\n" ), (LPCTSTR) response );
}
Sleep( 10000 );
}
_tprintf( TEXT( "Received a RING, waiting for them to end\n" ) );
while( serial.WaitForString( TEXT( "RING" ), 7 ) != FALSE )
{
// Do Nothing
}
_tprintf( TEXT( "Closing serial port\n" ) );
serial.Close();
CTime time_now( CTime::GetCurrentTime() );
Sleep( 1000 );
CString message;
message.Format( TEXT( "The phone rang at %s" ), (LPCTSTR) time_now.Format( "%H:%M:%S %d %b %y" ) );
CSprintSpectrum pager;
pager.SetAccount( TEXT( "4101234567" ) );
pager.SetMessage( message );
_tprintf( TEXT( "Calling pager.Send()\n" ) );
pager.Send();
}
else
{
_tprintf( TEXT( "Can't open serial port\n" ) );
}
Sleep( 1000 );
}
}