local fix version of myBlueUSB (http://mbed.org/users/networker/code/myBlueUSB/). - merge deleted files which are required to compile. - enable echo back of received data via RFCOMM.
Dependencies: AvailableMemory FatFileSystem mbed myUSBHost
Diff: TestShell.cpp
- Revision:
- 2:9f25a7fa1a54
- Parent:
- 0:003889bc474f
--- a/TestShell.cpp Sat Dec 07 14:20:19 2013 +0000 +++ b/TestShell.cpp Sun Dec 08 21:52:09 2013 +0000 @@ -70,7 +70,8 @@ RemoteNameRequest(a); for (i++; i < count; i++) {//find the next device to open printfBytes("DEVICE CLASS",devs[i]->_info.dev_class,3); - if (devs[i]->_handle == 0 && memcmp(devs[i]->_info.dev_class, FtDevClass, 3)==0) {//or some other way to connect to RFCOMM devices + //if (devs[i]->_handle == 0 && memcmp(devs[i]->_info.dev_class, FtDevClass, 3)==0) {//or some other way to connect to RFCOMM devices + if (devs[i]->_handle == 0) { // BD_ADDR* bd = &devs[i]->_info.bdaddr; printf("Connecting to "); printf(bd); @@ -256,7 +257,8 @@ printf("Sending CONN_ACK\n"); Socket_Send(socket, connack, sizeof(connack)); } else { - //Socket_Send(socket, data, len); + printf("echo back: len=%d, data[0]=%x\n", len, data[0]); + Socket_Send(socket, data, len); // uncomment printfBytes("echo:", data, len); } } @@ -280,17 +282,17 @@ int sock = OpenFtBtDevice(d); } state = 2; - //comm = Socket_Listen(SOCKET_RFCOM, 1, echo, 0); + comm = Socket_Listen(SOCKET_RFCOM, 1, echo, 0); // uncomment //incoming = new btserial(1); } break; case 2://main loop - /* if (incoming->readable()>0){ + /*if (incoming->readable()>0){ int c= incoming->getc(); putc(c, stderr); incoming->putc(c); } - else if (incoming->readable()<0){ + else if (incoming->readable()<0){ state = 3; printf("end of session"); delete incoming;