Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
212 dhylands 1
/****************************************************************************
2
*
3
*     Copyright (c) 2003 Dave Hylands
4
*           All Rights Reserved
5
*
6
*   Permission is granted to any individual or institution to use, copy, or
7
*   redistribute this software so long as it is not sold for profit, and that
8
*   this copyright notice is retained.
9
*
10
****************************************************************************/
11
/**
12
*
13
*   @file   CommDev.cpp
14
*
15
*   @brief  Implements the abstract communications device class.
16
*
17
****************************************************************************/
18
 
19
// ---- Include Files -------------------------------------------------------
20
 
21
#include "CommDev.h"
22
#include "Str.h"
23
 
24
/**
25
 * @addtogroup CommDev
26
 * @{
27
 */
28
 
29
// ---- Public Variables ----------------------------------------------------
30
// ---- Private Constants and Types -----------------------------------------
31
// ---- Private Variables ---------------------------------------------------
32
// ---- Private Function Prototypes -----------------------------------------
33
// ---- Functions -----------------------------------------------------------
34
 
35
//***************************************************************************
36
/**
37
*   Default Constructor.
38
*/
39
 
40
CommDev::CommDev()
41
{
42
}
43
 
44
//***************************************************************************
45
/**
46
*   Destructor.
47
*
48
* virtual
49
*/
50
 
51
CommDev::~CommDev()
52
{
53
}
54
 
55
//***************************************************************************
56
/**
57
*   Returns connection information (for display purposes)
58
*
59
* virtual
60
*/
61
 
62
const char *CommDev::ConnectionInfo() const
63
{
64
    return "";
65
}
66
 
67
//***************************************************************************
68
/**
69
*   Enable line input/editing mode, if supported by the device.
70
*
71
* virtual
72
*/
73
 
74
void CommDev::EnableLineMode( bool enable )
75
{
76
    // Nothing to do
77
 
78
} // EnableLineMode
79
 
80
//***************************************************************************
81
/**
82
*   Returns true if the device is in an EOF condition. Not all devices
83
*   are capable of detecting this condition.
84
*
85
* virtual
86
*/
87
 
88
bool CommDev::Eof() const
89
{
90
   return false;
91
 
92
} // Eof
93
 
94
//***************************************************************************
95
/**
96
*   Return the name of this device (only valid when open)
97
*
98
*   Derived classes can override this, if desired.
99
*
100
*   @return A pointer to a string containing the name of this device.
101
*
102
* virtual
103
*/
104
 
105
const char *CommDev::Name() const
106
{
107
    return m_name.c_str();
108
 
109
} // Name
110
 
111
//***************************************************************************
112
/**
113
*   Prints a string to the communication device.
114
*
115
* virtual
116
*/
117
 
118
void CommDev::Printf( const char *fmt, ... )
119
{
120
    va_list args;
121
 
122
    va_start( args, fmt );
123
    vPrintf( fmt, args );
124
    va_end( args );
125
 
126
} // Printf
127
 
128
void CommDev::vPrintf( const char *fmt, va_list args )
129
{
130
    char    buf[ 512 ];
131
 
132
    vStrPrintf( buf, sizeof( buf ), fmt, args );
133
 
134
    size_t  bytesWritten;
135
 
136
    Write( buf, strlen( buf ), &bytesWritten );
137
 
138
} // vPrintf
139
 
140
//***************************************************************************
141
/**
142
*   Returns true if the device has detected a quit indication. This is
143
*   typically only implemented by a console device.
144
*
145
* virtual
146
*/
147
 
148
bool CommDev::QuitDetected() const
149
{
150
    return false;
151
 
152
} // QuitDetected
153
 
154