2012-08-20 18:37:21 -03:00
|
|
|
|
|
|
|
#ifndef __AP_HAL_UTILITY_STREAM_H__
|
|
|
|
#define __AP_HAL_UTILITY_STREAM_H__
|
|
|
|
|
2012-08-20 20:54:01 -03:00
|
|
|
#include "../AP_HAL_Namespace.h"
|
2012-08-20 18:37:21 -03:00
|
|
|
#include "Print.h"
|
|
|
|
|
|
|
|
/* A simple Stream library modeled after the bits we actually use
|
|
|
|
* from Arduino Stream */
|
|
|
|
|
|
|
|
class AP_HAL::Stream : public AP_HAL::Print {
|
|
|
|
public:
|
2012-12-06 14:55:13 -04:00
|
|
|
virtual int16_t available() = 0;
|
2012-09-13 20:45:26 -03:00
|
|
|
/* NB txspace was traditionally a member of BetterStream in the
|
|
|
|
* FastSerial library. As far as concerns go, it belongs with available() */
|
2012-12-06 14:55:13 -04:00
|
|
|
virtual int16_t txspace() = 0;
|
2012-09-13 20:45:26 -03:00
|
|
|
|
2013-01-15 23:43:18 -04:00
|
|
|
/* return value for read():
|
2012-08-20 18:37:21 -03:00
|
|
|
* -1 if nothing available, uint8_t value otherwise. */
|
2012-12-06 14:55:13 -04:00
|
|
|
virtual int16_t read() = 0;
|
2012-09-13 20:45:26 -03:00
|
|
|
|
2012-08-20 18:37:21 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __AP_HAL_UTILITY_STREAM_H__
|
|
|
|
|