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
Revision 2:9f25a7fa1a54, committed 2013-12-08
- Comitter:
- nobukuma
- Date:
- Sun Dec 08 21:52:09 2013 +0000
- Parent:
- 1:4a639fa342bc
- Commit message:
- ???BT??????????????????; ?????????????????
Changed in this revision
TestShell.cpp | Show annotated file Show diff for this revision Revisions of this file |
hci.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 4a639fa342bc -r 9f25a7fa1a54 TestShell.cpp --- 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;
diff -r 4a639fa342bc -r 9f25a7fa1a54 hci.cpp --- a/hci.cpp Sat Dec 07 14:20:19 2013 +0000 +++ b/hci.cpp Sun Dec 08 21:52:09 2013 +0000 @@ -55,9 +55,9 @@ MASK_CREATE_CONNECTION = 64 }; -//static const u8 local_name[] = "MBED"; +static const u8 local_name[] = "MBED"; //static const u8 local_name[] = "ROBO TX-599"; -static const u8 local_name[] = "mbed-WP8 RFCOMM"; +//static const u8 local_name[] = "mbed-WP8 RFCOMM"; int HCI::Open(HCITransport* transport, HCICallback callback) { _transport = transport;