Changes between Version 4 and Version 5 of Docs/Prog/Manual/ApplicationLibraries/lib825ev/Comm/CCommSerial


Ignore:
Timestamp:
04/09/18 14:55:58 (7 years ago)
Author:
Don Wilson
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Docs/Prog/Manual/ApplicationLibraries/lib825ev/Comm/CCommSerial

    v4 v5  
    2727// Creates a CCommSerial instance that does not have a port specified yet. Method SetPort() must be called before calling Open().
    2828}}}
    29 
    30 == Member Functions ==
    31 
    32 === SetPort ===
    33 Sets the communications port to be used when Open() is called.
    34 
    35 {{{
    36 void SetPort(int port);
    37 }}}
    38 
    39 ==== Parameters ====
    40  * port - the port number
    41 
    42 ==== Return Value ====
    43 
    44 Function does not return any parameters
    45 
    46 === Open ===
    47 Opens a specified file, or using the filename already stored in the object.
    48 
    49 {{{
    50 int Open(void);
    51 }}}
    52 
    53 ==== Parameters ====
    54  * void - no parameters
    55 
    56 ==== Return Value ====
    57 
    58 Returns 1 if successful or 0 if unsuccessful.
    59 
    60 ==== Remarks ====
    61 
    62 ==== Example ====
    63 
    64 {{{
    65 }}}
    66 
    67 === Close ===
    68 Closes the connection
    69 {{{
    70 int Close(void);
    71 }}}
    72 
    73 ==== Parameters ====
    74 
    75 Function does not accept any parameters
    76 
    77 ==== Return Value ====
    78  
    79 Function always returns zero.
    80 
    81 ==== Remarks ====
    82 
    83 For serial ports it may be necessary to provide some delay to allow all of the buffered data to be sent out of the port before closing the port.
    84 
    85 ==== Example ====
    86 
    87 === SetParameters ===
    88 Set the baud rate, number of data bits, parity, and number of stop bits for serial ports.
    89 {{{
    90 bool SetParameters(baud_index baud, data_bit_index = data8, parity_index = parityNone, stop_bit_index = stopOne);
    91 }}}
    92 
    93 ==== Parameters ====
    94  * baud_index - baud1200, baud2400, baud4800, baud9600, baud19200, baud38400, baud57600, or baud115200
    95  * data_bit_index - data7 or data8
    96  * parity_index - parityNone, parityEven, or parityOdd
    97  * stop_bit_index - stopOne or stopTwo
    98 
    99 ==== Return Value ====
    100 
    101 Returns true if successful, false if not successful.
    102 
    103 ==== Remarks ====
    104 
    105 ==== Examples ====
    106 
    107 {{{
    108 CCommSerial* pSerial = new CCommSerial(2);
    109 if(pSerial->Open())
    110 {
    111    pSerial->SetParameters(CCommSerial::baud9600, CCommSerial::data7, CCommSerial::parityEven, CCommSerial::stopOne);
    112 }
    113 }}}
    114 
    115 {{{
    116 CCommSerial* pSerial = new CCommSerial(2);
    117 if(pSerial->Open())
    118 {
    119    pSerial->SetParameters(CCommSerial::baud19200);
    120 }
    121 }}}
    122 
    123 === IsReady ===
    124 Check the state of the serial CTS input (for serial ports that are equipped with CTS input)
    125 {{{
    126 bool IsReady(void);
    127 }}}
    128 ==== Parameters ====
    129 
    130 Function does not accept any parameters.
    131 
    132 ==== Return Value ====
    133 
    134 Function returns true if CTS is active, false if CTS is inactive.
    135 
    136 ==== Remarks ====
    137 
    138 IsReady() will return false if the CTS line is unconnected. Printers or other devices must be wired correctly for applications to be able to use this function to determine their readiness. '''The main board COM3 is not currently supported by this function.'''
    139 
    140 ==== Example ====
    141 
    142 {{{
    143 CCommSerial *pSerial = new CCommSerial(2);
    144 if(pSerial->Open())
    145 {
    146    pSerial->SetRTS(true);
    147    if(pSerial->IsReady() == false)
    148    {
    149       DisplayText(0, 0, "Device offline, or disconnected");
    150    }
    151 }
    152 }}}
    153 
    154 
    155 === SetRTS ===
    156 Set the state of the serial RTS output
    157 
    158 {{{
    159 bool SetRTS(bool bRTSOn = true);
    160 }}}
    161 
    162 ==== Parameters ====
    163 
    164  * bRTSOn - true to turn on RTS output, false to turn off RTS output
    165 
    166 ==== Return Value ====
    167 
    168 Returns true if successfully set RTS state, false otherwise.
    169 
    170 ==== Remarks ====
    171 
    172 ==== Example ====
    173 
    174 {{{
    175 CCommSerial* pSerial = new CCommSerial(2);
    176 if(pSerial->Open())
    177 {
    178    pSerial->SetRTS(true);
    179 }
    180 }}}
    181 
    182 
    183 
    184 
    185 
    18629
    18730==== Example ====
     
    23881}}}
    23982
     83== Member Functions ==
     84
     85=== SetPort ===
     86Sets the communications port to be used when Open() is called.
     87
     88{{{
     89void SetPort(int port);
     90}}}
     91
     92==== Parameters ====
     93 * port - the port number
     94
     95==== Return Value ====
     96
     97Function does not return any parameters
     98
     99=== Open ===
     100Opens a specified file, or using the filename already stored in the object.
     101
     102{{{
     103int Open(void);
     104}}}
     105
     106==== Parameters ====
     107 * void - no parameters
     108
     109==== Return Value ====
     110
     111Returns 1 if successful or 0 if unsuccessful.
     112
     113==== Remarks ====
     114
     115==== Example ====
     116
     117{{{
     118}}}
     119
     120=== Close ===
     121Closes the connection
     122{{{
     123int Close(void);
     124}}}
     125
     126==== Parameters ====
     127
     128Function does not accept any parameters
     129
     130==== Return Value ====
     131 
     132Function always returns zero.
     133
     134==== Remarks ====
     135
     136For serial ports it may be necessary to provide some delay to allow all of the buffered data to be sent out of the port before closing the port.
     137
     138==== Example ====
     139
     140=== SetParameters ===
     141Set the baud rate, number of data bits, parity, and number of stop bits for serial ports.
     142{{{
     143bool SetParameters(baud_index baud, data_bit_index = data8, parity_index = parityNone, stop_bit_index = stopOne);
     144}}}
     145
     146==== Parameters ====
     147 * baud_index - baud1200, baud2400, baud4800, baud9600, baud19200, baud38400, baud57600, or baud115200
     148 * data_bit_index - data7 or data8
     149 * parity_index - parityNone, parityEven, or parityOdd
     150 * stop_bit_index - stopOne or stopTwo
     151
     152==== Return Value ====
     153
     154Returns true if successful, false if not successful.
     155
     156==== Remarks ====
     157
     158==== Examples ====
     159
     160{{{
     161CCommSerial* pSerial = new CCommSerial(2);
     162if(pSerial->Open())
     163{
     164   pSerial->SetParameters(CCommSerial::baud9600, CCommSerial::data7, CCommSerial::parityEven, CCommSerial::stopOne);
     165}
     166}}}
     167
     168{{{
     169CCommSerial* pSerial = new CCommSerial(2);
     170if(pSerial->Open())
     171{
     172   pSerial->SetParameters(CCommSerial::baud19200);
     173}
     174}}}
     175
     176=== IsReady ===
     177Check the state of the serial CTS input (for serial ports that are equipped with CTS input)
     178{{{
     179bool IsReady(void);
     180}}}
     181==== Parameters ====
     182
     183Function does not accept any parameters.
     184
     185==== Return Value ====
     186
     187Function returns true if CTS is active, false if CTS is inactive.
     188
     189==== Remarks ====
     190
     191IsReady() will return false if the CTS line is unconnected. Printers or other devices must be wired correctly for applications to be able to use this function to determine their readiness. '''The main board COM3 is not currently supported by this function.'''
     192
     193==== Example ====
     194
     195{{{
     196CCommSerial *pSerial = new CCommSerial(2);
     197if(pSerial->Open())
     198{
     199   pSerial->SetRTS(true);
     200   if(pSerial->IsReady() == false)
     201   {
     202      DisplayText(0, 0, "Device offline, or disconnected");
     203   }
     204}
     205}}}
     206
     207
     208=== SetRTS ===
     209Set the state of the serial RTS output
     210
     211{{{
     212bool SetRTS(bool bRTSOn = true);
     213}}}
     214
     215==== Parameters ====
     216
     217 * bRTSOn - true to turn on RTS output, false to turn off RTS output
     218
     219==== Return Value ====
     220
     221Returns true if successfully set RTS state, false otherwise.
     222
     223==== Remarks ====
     224
     225==== Example ====
     226
     227{{{
     228CCommSerial* pSerial = new CCommSerial(2);
     229if(pSerial->Open())
     230{
     231   pSerial->SetRTS(true);
     232}
     233}}}
     234
     235
     236
     237
     238
     239
     240
    240241== See Also ==
    241242