Pulse Oximeter (NONIN) communicates with mbed via Bluetooth dongle and sends Heart Rate and Oxygen Saturation via GPRS module
Dependencies: C12832 GPS GSM mbed
Fork of myBlueUSB_localfix by
btserial.h@3:55a622e3dbb5, 2015-04-14 (annotated)
- Committer:
- samialshorman
- Date:
- Tue Apr 14 21:48:07 2015 +0000
- Revision:
- 3:55a622e3dbb5
- Parent:
- 0:003889bc474f
Nonin (Pulse Oximeter) connected to mbed lpc 1768 by Bluetooth dongle and sends SMS including Heart Rate and Oxygen saturation by GPRS module
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nobukuma | 0:003889bc474f | 1 | #ifndef BTSERIAL_H |
nobukuma | 0:003889bc474f | 2 | #define BTSERIAL_H |
nobukuma | 0:003889bc474f | 3 | #include "mbed.h" |
nobukuma | 0:003889bc474f | 4 | #include "RFCOMM.h" |
nobukuma | 0:003889bc474f | 5 | |
nobukuma | 0:003889bc474f | 6 | class btserial { |
samialshorman | 3:55a622e3dbb5 | 7 | static const int bufsize = 4; |
nobukuma | 0:003889bc474f | 8 | int recbufsize, sndbufsize; |
nobukuma | 0:003889bc474f | 9 | int sock; |
nobukuma | 0:003889bc474f | 10 | unsigned char sendbuf[bufsize], recbuf[bufsize]; |
nobukuma | 0:003889bc474f | 11 | int sendptr, recptrin, recptrout, free; |
nobukuma | 0:003889bc474f | 12 | static void cb(int socket, SocketState state, const unsigned char *data, int len, void* userData); |
nobukuma | 0:003889bc474f | 13 | void stash(const unsigned char *data, int len); |
nobukuma | 0:003889bc474f | 14 | bool open; |
nobukuma | 0:003889bc474f | 15 | public: |
nobukuma | 0:003889bc474f | 16 | btserial(char ba[6], char ch);//outgoing |
nobukuma | 0:003889bc474f | 17 | btserial(char ch);//incoming |
nobukuma | 0:003889bc474f | 18 | void baud(int); |
nobukuma | 0:003889bc474f | 19 | void format(int, Serial::Parity, int); |
nobukuma | 0:003889bc474f | 20 | int putc(int); |
nobukuma | 0:003889bc474f | 21 | int getc(); |
nobukuma | 0:003889bc474f | 22 | int readable() { |
nobukuma | 0:003889bc474f | 23 | if (!open) return -1; |
nobukuma | 0:003889bc474f | 24 | return bufsize-free; |
nobukuma | 0:003889bc474f | 25 | } |
nobukuma | 0:003889bc474f | 26 | int writeable() { |
nobukuma | 0:003889bc474f | 27 | if (!open) return -1; |
nobukuma | 0:003889bc474f | 28 | return bufsize - sendptr; |
nobukuma | 0:003889bc474f | 29 | } |
nobukuma | 0:003889bc474f | 30 | }; |
nobukuma | 0:003889bc474f | 31 | |
nobukuma | 0:003889bc474f | 32 | #endif |