Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed myUSBHost AvailableMemory rfcomm myBlueUSB sdp
btserial.h
00001 #ifndef BTSERIAL_H 00002 #define BTSERIAL_H 00003 #include "mbed.h" 00004 #include "RFCOMM.h" 00005 00006 class btserial { 00007 static const int bufsize = 127; 00008 int sock; 00009 unsigned char sendbuf[bufsize], recbuf[bufsize]; 00010 int sendptr, recptrin, recptrout, free; 00011 static void cb(int socket, SocketState state, const unsigned char *data, int len, void* userData); 00012 void stash(const unsigned char *data, int len); 00013 bool open; 00014 public: 00015 btserial(char ba[6], char ch);//outgoing 00016 btserial(char ch);//incoming 00017 void baud(int); 00018 void format(int, Serial::Parity, int); 00019 int putc(int); 00020 int getc(); 00021 int readable() { 00022 if (!open) return -1; 00023 return bufsize-free; 00024 } 00025 int writeable() { 00026 if (!open) return -1; 00027 return bufsize - sendptr; 00028 } 00029 }; 00030 00031 #endif
Generated on Tue Jul 19 2022 19:13:50 by
1.7.2