XBee and XBee-PRO ZigBee RF modules provide cost-effective wireless connectivity to electronic devices. They are interoperable with other ZigBee PRO feature set devices, including devices from other vendors.
Core/ISerial.h@6:5f31ddc17239, 2015-11-14 (annotated)
- Committer:
- yangcq88517
- Date:
- Sat Nov 14 16:42:36 2015 +0000
- Revision:
- 6:5f31ddc17239
- Parent:
- 1:3dc0ec2f9fd6
change to unsigned char array
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yangcq88517 | 0:837e6c48e90d | 1 | #ifndef UK_AC_HERTS_SMARTLAB_XBEE_ISerial |
yangcq88517 | 0:837e6c48e90d | 2 | #define UK_AC_HERTS_SMARTLAB_XBEE_ISerial |
yangcq88517 | 0:837e6c48e90d | 3 | |
yangcq88517 | 1:3dc0ec2f9fd6 | 4 | /// Serial data interface. |
yangcq88517 | 0:837e6c48e90d | 5 | class ISerial |
yangcq88517 | 0:837e6c48e90d | 6 | { |
yangcq88517 | 0:837e6c48e90d | 7 | public: |
yangcq88517 | 1:3dc0ec2f9fd6 | 8 | /** Read one byte data from the serila port. |
yangcq88517 | 1:3dc0ec2f9fd6 | 9 | * @returns if success return non zero [0x00-0xFF], -1 means something is wrong |
yangcq88517 | 1:3dc0ec2f9fd6 | 10 | */ |
yangcq88517 | 0:837e6c48e90d | 11 | virtual int readByte() = 0; |
yangcq88517 | 0:837e6c48e90d | 12 | |
yangcq88517 | 1:3dc0ec2f9fd6 | 13 | /** write one byte data to the serila port. |
yangcq88517 | 1:3dc0ec2f9fd6 | 14 | * @param data [0x00-0xFF] |
yangcq88517 | 1:3dc0ec2f9fd6 | 15 | */ |
yangcq88517 | 0:837e6c48e90d | 16 | virtual void writeByte(char data) = 0; |
yangcq88517 | 0:837e6c48e90d | 17 | |
yangcq88517 | 1:3dc0ec2f9fd6 | 18 | /// Check if the serial port is already open. |
yangcq88517 | 0:837e6c48e90d | 19 | virtual bool isOpen() = 0; |
yangcq88517 | 0:837e6c48e90d | 20 | |
yangcq88517 | 1:3dc0ec2f9fd6 | 21 | /// Open the serila port. |
yangcq88517 | 0:837e6c48e90d | 22 | virtual void open() = 0; |
yangcq88517 | 0:837e6c48e90d | 23 | |
yangcq88517 | 1:3dc0ec2f9fd6 | 24 | /// Close the serila port. |
yangcq88517 | 0:837e6c48e90d | 25 | virtual void close() = 0; |
yangcq88517 | 1:3dc0ec2f9fd6 | 26 | |
yangcq88517 | 1:3dc0ec2f9fd6 | 27 | /// Check if data is avaliable to read. |
yangcq88517 | 1:3dc0ec2f9fd6 | 28 | virtual bool peek() = 0; |
yangcq88517 | 0:837e6c48e90d | 29 | }; |
yangcq88517 | 0:837e6c48e90d | 30 | |
yangcq88517 | 0:837e6c48e90d | 31 | #endif |