| 350 | } |
| 351 | |
| 352 | size_t Serial::getNumBytesAvailable() const |
| 353 | { |
| 354 | int result; |
| 355 | |
| 356 | #if defined( CINDER_MAC ) || defined( CINDER_LINUX ) |
| 357 | ::ioctl( mImpl->mFd, FIONREAD, &result ); |
| 358 | #elif defined( CINDER_MSW ) |
| 359 | ::COMSTAT status; |
| 360 | ::DWORD error; |
| 361 | if( ! ::ClearCommError( mImpl->mDeviceHandle, &error, &status ) ) |
| 362 | throw SerialExc( "Serial failure upon attempt to retrieve information on device handle" ); |
| 363 | else |
| 364 | result = status.cbInQue; |
| 365 | #endif |
| 366 | |
| 367 | return result; |
| 368 | } |
| 369 | |
| 370 | void Serial::flush( bool input, bool output ) |
| 371 | { |