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 Nobuaki Aoki

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?

UserRevisionLine numberNew contents of line
nobukuma 0:003889bc474f 1 #ifndef RFCOMM_H
nobukuma 0:003889bc474f 2 #define RFCOMM_H
nobukuma 0:003889bc474f 3 #include "USBHost.h"
nobukuma 0:003889bc474f 4 #include "hci.h"
nobukuma 0:003889bc474f 5 #include "Utils.h"
nobukuma 0:003889bc474f 6
nobukuma 0:003889bc474f 7 #define MAX_RFCOMM_SCKTS 4
nobukuma 0:003889bc474f 8 //#define MAX_FRAME_SIZE 350 //ACL buffer - some headroom
nobukuma 0:003889bc474f 9 #define MAX_FRAME_SIZE 127 //ft size
nobukuma 0:003889bc474f 10
nobukuma 0:003889bc474f 11 /*
nobukuma 0:003889bc474f 12 template <class T>
nobukuma 0:003889bc474f 13 T min(T a, T b) {
nobukuma 0:003889bc474f 14 return a<b ? a : b;
nobukuma 0:003889bc474f 15 }
nobukuma 0:003889bc474f 16 */
nobukuma 0:003889bc474f 17
nobukuma 0:003889bc474f 18 #define MASK_BITRATE 0X0001
nobukuma 0:003889bc474f 19 #define MASK_DATABITS 0X0002
nobukuma 0:003889bc474f 20 #define MASK_STOPBITS 0X0004
nobukuma 0:003889bc474f 21 #define MASK_PARITYBITS 0X0008
nobukuma 0:003889bc474f 22 #define MASK_PARITYTYPE 0X0010
nobukuma 0:003889bc474f 23 #define MASK_XONCHAR 0X0020
nobukuma 0:003889bc474f 24 #define MASK_XOFFCHAR 0X0040
nobukuma 0:003889bc474f 25 #define MASK_XONXOFFIN 0X0100
nobukuma 0:003889bc474f 26 #define MASK_XONXOFFOUT 0X0200
nobukuma 0:003889bc474f 27 #define MASK_RTRIN 0X0400
nobukuma 0:003889bc474f 28 #define MASK_RTROUT 0X0800
nobukuma 0:003889bc474f 29 #define MASK_RTCIN 0X1000
nobukuma 0:003889bc474f 30 #define MASK_RTCOUT 0X2000
nobukuma 0:003889bc474f 31
nobukuma 0:003889bc474f 32 struct port_settings {
nobukuma 0:003889bc474f 33 unsigned char baud;
nobukuma 0:003889bc474f 34 unsigned char bits:
nobukuma 0:003889bc474f 35 2;
nobukuma 0:003889bc474f 36 unsigned char stop:
nobukuma 0:003889bc474f 37 1;
nobukuma 0:003889bc474f 38 unsigned char par:
nobukuma 0:003889bc474f 39 1;
nobukuma 0:003889bc474f 40 unsigned char par_t:
nobukuma 0:003889bc474f 41 2;
nobukuma 0:003889bc474f 42 unsigned char :
nobukuma 0:003889bc474f 43 2;
nobukuma 0:003889bc474f 44 unsigned char flow:
nobukuma 0:003889bc474f 45 6;
nobukuma 0:003889bc474f 46 unsigned char :
nobukuma 0:003889bc474f 47 2;
nobukuma 0:003889bc474f 48 unsigned char xon;
nobukuma 0:003889bc474f 49 unsigned char xoff;
nobukuma 0:003889bc474f 50 unsigned short mask;
nobukuma 0:003889bc474f 51 };
nobukuma 0:003889bc474f 52
nobukuma 0:003889bc474f 53 class rfcomm;
nobukuma 0:003889bc474f 54 class RFCOMMManager;
nobukuma 0:003889bc474f 55 #define MAX_RFCOMM_DEVICES 8 //physical devices
nobukuma 0:003889bc474f 56
nobukuma 0:003889bc474f 57 class RFCOMMSocket: public SocketInternal {//this object must not be larger than SocketInternalPad (socketinternal + 8 bytes)
nobukuma 0:003889bc474f 58 public:
nobukuma 0:003889bc474f 59 rfcomm* serdevice;
nobukuma 0:003889bc474f 60 u8 dlci; //channel + D bit, D bit is inverted initiator bit
nobukuma 0:003889bc474f 61 u8 my_credits, peer_credits;
nobukuma 0:003889bc474f 62 };
nobukuma 0:003889bc474f 63
nobukuma 0:003889bc474f 64 class rfcomm: public SocketHandler {
nobukuma 0:003889bc474f 65 int _l2cap; //socket to the l2cap layer
nobukuma 0:003889bc474f 66 int _devClass;
nobukuma 0:003889bc474f 67 BD_ADDR _addr;
nobukuma 0:003889bc474f 68 u8 initiator;
nobukuma 0:003889bc474f 69 u8 _pad[0]; // Struct align
nobukuma 0:003889bc474f 70 char sckts[MAX_RFCOMM_SCKTS];
nobukuma 0:003889bc474f 71 //static
nobukuma 0:003889bc474f 72 unsigned maxframesize;
nobukuma 0:003889bc474f 73 int find_slot(unsigned ch);
nobukuma 0:003889bc474f 74 RFCOMMSocket* find_socket(unsigned dlci);
nobukuma 0:003889bc474f 75 void initChannels(int socket);
nobukuma 0:003889bc474f 76 unsigned release_channel(unsigned dlci);
nobukuma 0:003889bc474f 77 static void OnRfCommControl(int socket, SocketState state, const u8* data, int len, void* userData);//I guess this is called when data comes out of the socket
nobukuma 0:003889bc474f 78 int Disconnect(RFCOMMSocket*);
nobukuma 0:003889bc474f 79 public:
nobukuma 0:003889bc474f 80 rfcomm() : _l2cap(0), _devClass(0) {
nobukuma 0:003889bc474f 81 for (int i = 0; i < MAX_RFCOMM_SCKTS; i++) sckts[i] = 0;
nobukuma 0:003889bc474f 82 maxframesize = MAX_FRAME_SIZE;
nobukuma 0:003889bc474f 83 }
nobukuma 0:003889bc474f 84
nobukuma 0:003889bc474f 85 bool InUse() {
nobukuma 0:003889bc474f 86 return _l2cap != 0;
nobukuma 0:003889bc474f 87 }
nobukuma 0:003889bc474f 88 virtual int Open(SocketInternal* sock, SocketAddrHdr* addr);
nobukuma 0:003889bc474f 89 virtual int Send(SocketInternal* sock, const u8* data, int len);//wrap data in RFCOMM frame and dispatch
nobukuma 0:003889bc474f 90 virtual int SetOpt(SocketInternal *sock, int so, int* data, int len);
nobukuma 0:003889bc474f 91 virtual int GetOpt(SocketInternal *sock, int so, int* data, int len);
nobukuma 0:003889bc474f 92 virtual int Close(SocketInternal* sock);
nobukuma 0:003889bc474f 93 virtual char* Name() {
nobukuma 0:003889bc474f 94 return "rfcomm SocketHandler";
nobukuma 0:003889bc474f 95 }
nobukuma 0:003889bc474f 96 void Recv(const u8* data, int len) {
nobukuma 0:003889bc474f 97 printf("rfcomm::Recv was called\n");
nobukuma 0:003889bc474f 98 }
nobukuma 0:003889bc474f 99 #if 0
nobukuma 0:003889bc474f 100 int Listen(unsigned char ch=0) {//passive open, similar semantics to 'Open' but connection is only made at request of the peer
nobukuma 0:003889bc474f 101 RFCOMMSocket *s = 0;//this entity may or may not be bound to a remote entity
nobukuma 0:003889bc474f 102 if (ch>0) {//specific channel
nobukuma 0:003889bc474f 103 s = find_socket(ch<<1);
nobukuma 0:003889bc474f 104 if (s) { //socket for this channel already in use
nobukuma 0:003889bc474f 105 printf("rfcomm::Listen: channel %d already in use\n", ch);
nobukuma 0:003889bc474f 106 return 0;
nobukuma 0:003889bc474f 107 } //else s==0, no socket for channel ch
nobukuma 0:003889bc474f 108 }//else listen to any channel
nobukuma 0:003889bc474f 109 int sn = find_slot(ch);
nobukuma 0:003889bc474f 110 if (sn<0) {
nobukuma 0:003889bc474f 111 printf("No socket could be found for channel %d\n", ch);
nobukuma 0:003889bc474f 112 return 0;
nobukuma 0:003889bc474f 113 } //else use slot 'sn' for the new rfcomm socket
nobukuma 0:003889bc474f 114 int sock = Socket_Create(SOCKET_RFCOM, OnRfCommControl, this);//allocate an rfcomm socket
nobukuma 0:003889bc474f 115 sckts[sn] = sock; //claim the socket
nobukuma 0:003889bc474f 116 RFCOMMSocket *rs = (RFCOMMSocket*)GetSocketInternal(sock);
nobukuma 0:003889bc474f 117 rs->serdevice = this;
nobukuma 0:003889bc474f 118 rs->dlci = (ch<<1)|1;//server socket
nobukuma 0:003889bc474f 119 //initiator = 0; what to do if already connected actively on different channel???
nobukuma 0:003889bc474f 120 /*l2cap is already present or is created when accepting the connection
nobukuma 0:003889bc474f 121 if (_l2cap == 0) { //no rfcomm -> l2cap connection yet
nobukuma 0:003889bc474f 122 printf("Need to open L2CAP channel first before opening RFCOMM channel %d\n", rs->dlci);
nobukuma 0:003889bc474f 123 ((L2CAPAddr*)addr)->psm = L2CAP_PSM_RFCOMM;//open the l2cap channel and the rfcomm_ch channel
nobukuma 0:003889bc474f 124 initiator = 0;
nobukuma 0:003889bc474f 125 _l2cap = Socket_Create(SOCKET_L2CAP, addr, OnRfCommControl, this);//this is the socket between the RFCOMM and the L2CAP layer
nobukuma 0:003889bc474f 126 if (_l2cap)
nobukuma 0:003889bc474f 127 printf("Successfully opened L2CAP channel on socket %d\n", _l2cap);
nobukuma 0:003889bc474f 128 else {
nobukuma 0:003889bc474f 129 printf("Opening L2CAP channel failed\n");
nobukuma 0:003889bc474f 130 return 0;
nobukuma 0:003889bc474f 131 }
nobukuma 0:003889bc474f 132 }
nobukuma 0:003889bc474f 133 */
nobukuma 0:003889bc474f 134 return sock;
nobukuma 0:003889bc474f 135 }
nobukuma 0:003889bc474f 136 #endif
nobukuma 0:003889bc474f 137 //int Open(BD_ADDR* bdAddr, inquiry_info* info);
nobukuma 0:003889bc474f 138 int set_remote_port_parameters(unsigned char dlci, port_settings *p);
nobukuma 0:003889bc474f 139 friend RFCOMMManager;
nobukuma 0:003889bc474f 140 };
nobukuma 0:003889bc474f 141
nobukuma 0:003889bc474f 142 class RFCOMMManager: public SocketHandler {
nobukuma 0:003889bc474f 143 rfcomm _devs[MAX_RFCOMM_DEVICES];
nobukuma 0:003889bc474f 144 int serverSock;
nobukuma 0:003889bc474f 145 char sckts[MAX_RFCOMM_SCKTS];//listening sockets
nobukuma 0:003889bc474f 146 public:
nobukuma 0:003889bc474f 147 virtual int Open(SocketInternal* sock, SocketAddrHdr* addr) {
nobukuma 0:003889bc474f 148 L2CAPAddr* ad = (L2CAPAddr*)addr;
nobukuma 0:003889bc474f 149 BD_ADDR* a = &ad->bdaddr;
nobukuma 0:003889bc474f 150 rfcomm *r = FindRfCommDevice(a);
nobukuma 0:003889bc474f 151 if (r==0)
nobukuma 0:003889bc474f 152 r = NewRfCommDevice();
nobukuma 0:003889bc474f 153 if (r==0)
nobukuma 0:003889bc474f 154 return 0;
nobukuma 0:003889bc474f 155 return r->Open(sock, addr);
nobukuma 0:003889bc474f 156 }
nobukuma 0:003889bc474f 157
nobukuma 0:003889bc474f 158 int FindSocket(BTDevice* dev) {//finds the l2cap socket for a certain rfcomm-btdevice connection
nobukuma 0:003889bc474f 159 for (int i = 0; i < MAX_RFCOMM_DEVICES; i++) {
nobukuma 0:003889bc474f 160 rfcomm *r = _devs+i;
nobukuma 0:003889bc474f 161 int l2cap = r->_l2cap;
nobukuma 0:003889bc474f 162 if (l2cap) {
nobukuma 0:003889bc474f 163 L2CAPSocket *p = (L2CAPSocket*)GetSocketInternal(l2cap);
nobukuma 0:003889bc474f 164 if (p->btdevice == dev)
nobukuma 0:003889bc474f 165 return l2cap;
nobukuma 0:003889bc474f 166 }
nobukuma 0:003889bc474f 167 }
nobukuma 0:003889bc474f 168 return 0;
nobukuma 0:003889bc474f 169 }
nobukuma 0:003889bc474f 170
nobukuma 0:003889bc474f 171 rfcomm* FindDev(BTDevice* dev) {//finds the rfcomm entity for a certain rfcomm-btdevice connection
nobukuma 0:003889bc474f 172 for (int i = 0; i < MAX_RFCOMM_DEVICES; i++) {
nobukuma 0:003889bc474f 173 rfcomm *r = _devs+i;
nobukuma 0:003889bc474f 174 int l2cap = r->_l2cap;
nobukuma 0:003889bc474f 175 if (l2cap) {
nobukuma 0:003889bc474f 176 L2CAPSocket *p = (L2CAPSocket*)GetSocketInternal(l2cap);
nobukuma 0:003889bc474f 177 if (p->btdevice == dev)
nobukuma 0:003889bc474f 178 return r;
nobukuma 0:003889bc474f 179 }
nobukuma 0:003889bc474f 180 }
nobukuma 0:003889bc474f 181 return 0;
nobukuma 0:003889bc474f 182 }
nobukuma 0:003889bc474f 183
nobukuma 0:003889bc474f 184 int BindSocket(int s) {
nobukuma 0:003889bc474f 185 L2CAPSocket *ls = (L2CAPSocket*)GetSocketInternal(s);
nobukuma 0:003889bc474f 186 printf("Binding l2cap socket %d to a new rfcomm server entity\n", s);
nobukuma 0:003889bc474f 187 rfcomm *r = NewRfCommDevice();
nobukuma 0:003889bc474f 188 r->_l2cap = s;
nobukuma 0:003889bc474f 189 r->initiator = 0;//we are server
nobukuma 0:003889bc474f 190 ls->si.userData = r;//was BTDevice, make rfcomm
nobukuma 0:003889bc474f 191 return 0;
nobukuma 0:003889bc474f 192 }
nobukuma 0:003889bc474f 193
nobukuma 0:003889bc474f 194 int new_slot(unsigned ch) {
nobukuma 0:003889bc474f 195 for (int i = 0; i < MAX_RFCOMM_SCKTS; i++) {
nobukuma 0:003889bc474f 196 if (sckts[i] != 0) { //socket is in use
nobukuma 0:003889bc474f 197 RFCOMMSocket *s = (RFCOMMSocket*)GetSocketInternal(sckts[i]);
nobukuma 0:003889bc474f 198 if (s==0) {
nobukuma 0:003889bc474f 199 printf("find_slot: socket %d not found\n", sckts[i]);
nobukuma 0:003889bc474f 200 continue;
nobukuma 0:003889bc474f 201 }
nobukuma 0:003889bc474f 202 if ((s->dlci >> 1) == ch) {
nobukuma 0:003889bc474f 203 printf("Channel %d is already in use on socket %d\n", ch, sckts[i]);
nobukuma 0:003889bc474f 204 return -1;
nobukuma 0:003889bc474f 205 }
nobukuma 0:003889bc474f 206 } else //slot is free
nobukuma 0:003889bc474f 207 return i;
nobukuma 0:003889bc474f 208 }
nobukuma 0:003889bc474f 209 return -2; //no free slots
nobukuma 0:003889bc474f 210 }
nobukuma 0:003889bc474f 211
nobukuma 0:003889bc474f 212 int find_socket(unsigned ch) {
nobukuma 0:003889bc474f 213 for (int i = 0; i < MAX_RFCOMM_SCKTS; i++) {
nobukuma 0:003889bc474f 214 if (sckts[i] != 0) { //socket is in use
nobukuma 0:003889bc474f 215 RFCOMMSocket *s = (RFCOMMSocket*)GetSocketInternal(sckts[i]);
nobukuma 0:003889bc474f 216 if (s==0) {
nobukuma 0:003889bc474f 217 printf("find_slot: socket %d not found\n", sckts[i]);
nobukuma 0:003889bc474f 218 continue;
nobukuma 0:003889bc474f 219 }
nobukuma 0:003889bc474f 220 if ((s->dlci >> 1) == ch) {
nobukuma 0:003889bc474f 221 printf("Found Channel %d on socket %d\n", ch, sckts[i]);
nobukuma 0:003889bc474f 222 return sckts[i];
nobukuma 0:003889bc474f 223 }
nobukuma 0:003889bc474f 224 else
nobukuma 0:003889bc474f 225 printf("slot %d has socket %d has dlci %d\n", i, sckts[i], s->dlci);
nobukuma 0:003889bc474f 226 }
nobukuma 0:003889bc474f 227 else
nobukuma 0:003889bc474f 228 printf("Slot %d is free\n", i);
nobukuma 0:003889bc474f 229 }
nobukuma 0:003889bc474f 230 printf("channel %d not found\n", ch);
nobukuma 0:003889bc474f 231 return 0; //channel not found
nobukuma 0:003889bc474f 232 }
nobukuma 0:003889bc474f 233
nobukuma 0:003889bc474f 234 int remove_socket(int sock) {
nobukuma 0:003889bc474f 235 for (int i = 0; i < MAX_RFCOMM_SCKTS; i++) {
nobukuma 0:003889bc474f 236 if (sckts[i] == sock) {
nobukuma 0:003889bc474f 237 sckts[i] = 0;
nobukuma 0:003889bc474f 238 return 0;
nobukuma 0:003889bc474f 239 }
nobukuma 0:003889bc474f 240 }
nobukuma 0:003889bc474f 241 return -1;
nobukuma 0:003889bc474f 242 }
nobukuma 0:003889bc474f 243
nobukuma 0:003889bc474f 244 virtual int Listen(SocketInternal* sock, int ch) {//called by Socket_Listen(SOCKET_RFCOM, channel, callback, userData)
nobukuma 0:003889bc474f 245 int slot = new_slot(ch);
nobukuma 0:003889bc474f 246 switch (slot) {
nobukuma 0:003889bc474f 247 case -1:
nobukuma 0:003889bc474f 248 printf("There is already someone listening on ch %d\n", ch);
nobukuma 0:003889bc474f 249 return ERR_SOCKET_CANT_LISTEN;//channel is occupied
nobukuma 0:003889bc474f 250 case -2:
nobukuma 0:003889bc474f 251 printf("All listener sockets are in use\n");
nobukuma 0:003889bc474f 252 return ERR_SOCKET_NONE_LEFT;
nobukuma 0:003889bc474f 253 }
nobukuma 0:003889bc474f 254 RFCOMMSocket *rs = (RFCOMMSocket*)sock;
nobukuma 0:003889bc474f 255 const char dir = 0;
nobukuma 0:003889bc474f 256 rs->dlci = (ch<<1)|dir;
nobukuma 0:003889bc474f 257 rs->State = SocketState_Listen;
nobukuma 0:003889bc474f 258 rs->serdevice = 0;//don't know yet
nobukuma 0:003889bc474f 259 sckts[slot] = rs->ID;
nobukuma 0:003889bc474f 260 printf("RFCOMM listener socket %d for ch %d (dlci 0x%02X) is assigned to slot %d\n", rs->ID, ch, rs->dlci, slot);
nobukuma 0:003889bc474f 261 return rs->ID;
nobukuma 0:003889bc474f 262 }
nobukuma 0:003889bc474f 263 /*
nobukuma 0:003889bc474f 264 virtual int Accept(SocketInternal *sock, int scid, int rxid) { //called indirectly from BTDevice::Control
nobukuma 0:003889bc474f 265 //sock is registered as an RFCOMM sock but we use it as an L2CAP sock
nobukuma 0:003889bc474f 266 //sock->type=RFCOM, meaning open/close/send/accept go to RFCOMMManager first
nobukuma 0:003889bc474f 267 //sock->userData = BTDevice, necessary to make the call back to BTDevice::Accept
nobukuma 0:003889bc474f 268 //Internal = L2CAPSocket, for scid, dcid
nobukuma 0:003889bc474f 269 BTDevice *l2cap = (BTDevice*)sock->userData;
nobukuma 0:003889bc474f 270 //sock->si.dcid = scid
nobukuma 0:003889bc474f 271 //sock->si.scid = something based on sock->ID
nobukuma 0:003889bc474f 272 serverSock = sock->ID;
nobukuma 0:003889bc474f 273 printf("Invoking accept on %p (%s) for sock %d and scid=%d\n", l2cap, l2cap->Name(), sock->ID, scid);
nobukuma 0:003889bc474f 274 return l2cap->Accept(sock, scid, rxid); //connect 'serverSock' to the remote RFCOMM client
nobukuma 0:003889bc474f 275 }
nobukuma 0:003889bc474f 276 */
nobukuma 0:003889bc474f 277 virtual int Send(SocketInternal* sock, const u8* data, int len) {
nobukuma 0:003889bc474f 278 RFCOMMSocket *s = (RFCOMMSocket*)sock;
nobukuma 0:003889bc474f 279 return s->serdevice->Send(sock, data, len);
nobukuma 0:003889bc474f 280 }
nobukuma 0:003889bc474f 281
nobukuma 0:003889bc474f 282 virtual int Close(SocketInternal* sock) {
nobukuma 0:003889bc474f 283 RFCOMMSocket *s = (RFCOMMSocket*)sock;
nobukuma 0:003889bc474f 284 return s->serdevice->Close(sock);
nobukuma 0:003889bc474f 285 }
nobukuma 0:003889bc474f 286
nobukuma 0:003889bc474f 287 virtual int SetOpt(SocketInternal* sock, int so, int* data, int len) {
nobukuma 0:003889bc474f 288 RFCOMMSocket *s = (RFCOMMSocket*)sock;
nobukuma 0:003889bc474f 289 return s->serdevice->SetOpt(sock, so, data, len);
nobukuma 0:003889bc474f 290 }
nobukuma 0:003889bc474f 291
nobukuma 0:003889bc474f 292 virtual int GetOpt(SocketInternal* sock, int so, int* data, int len) {
nobukuma 0:003889bc474f 293 RFCOMMSocket *s = (RFCOMMSocket*)sock;
nobukuma 0:003889bc474f 294 return s->serdevice->GetOpt(sock, so, data, len);
nobukuma 0:003889bc474f 295 }
nobukuma 0:003889bc474f 296
nobukuma 0:003889bc474f 297 virtual char* Name() {
nobukuma 0:003889bc474f 298 return "RFCOMMManager SocketHandler";
nobukuma 0:003889bc474f 299 }
nobukuma 0:003889bc474f 300
nobukuma 0:003889bc474f 301 rfcomm* NewRfCommDevice() {//allocate a new RFCOMM device from the pool
nobukuma 0:003889bc474f 302 for (int i = 0; i < MAX_RFCOMM_DEVICES; i++)
nobukuma 0:003889bc474f 303 if (!_devs[i].InUse())
nobukuma 0:003889bc474f 304 return _devs+i;
nobukuma 0:003889bc474f 305 return 0;
nobukuma 0:003889bc474f 306 }
nobukuma 0:003889bc474f 307
nobukuma 0:003889bc474f 308 rfcomm* FindRfCommDevice(BD_ADDR* ad) {//get a specific RFCOMM device from the pool
nobukuma 0:003889bc474f 309 for (int i = 0; i < MAX_RFCOMM_DEVICES; i++)
nobukuma 0:003889bc474f 310 if (_devs[i].InUse() && memcmp(ad, &_devs[i]._addr, 6)==0)
nobukuma 0:003889bc474f 311 return _devs+i;
nobukuma 0:003889bc474f 312 return 0;
nobukuma 0:003889bc474f 313 }
nobukuma 0:003889bc474f 314
nobukuma 0:003889bc474f 315 static void SerServer(int socket, SocketState state, const u8* data, int len, void* userData) {
nobukuma 0:003889bc474f 316 printfBytes("SerServer: ", data, len);
nobukuma 0:003889bc474f 317 //userData is the rfcomm
nobukuma 0:003889bc474f 318 rfcomm::OnRfCommControl(socket, state, data, len, userData);
nobukuma 0:003889bc474f 319 }
nobukuma 0:003889bc474f 320 //friend rfcomm;
nobukuma 0:003889bc474f 321 };
nobukuma 0:003889bc474f 322
nobukuma 0:003889bc474f 323 int set_remote_port_parameters(int socket, port_settings *p);
nobukuma 0:003889bc474f 324 extern RFCOMMManager rfcomm_manager;
nobukuma 0:003889bc474f 325
nobukuma 0:003889bc474f 326 #endif