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
Dependents: mbed_TANK_Kinect myBlueUSB_ros ftusbClass
Diff: ftclasslibusbdevbt.h
- Revision:
- 6:567607a9a79f
- Parent:
- 1:0dde58e0cccf
diff -r 378c208637e3 -r 567607a9a79f ftclasslibusbdevbt.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ftclasslibusbdevbt.h Sat Jun 11 19:45:42 2011 +0000
@@ -0,0 +1,47 @@
+#ifndef FTCLASSLIBUSBDEVBT_H
+#define FTCLASSLIBUSBDEVBT_H
+
+
+class ftbtdev {//small object for ft BT enumeration
+ inquiry_info info;
+public:
+ ftbtdev(inquiry_info* ii) {
+ info = *ii;
+ }
+ BD_ADDR* BtAddr() {
+ return &info.bdaddr;
+ }
+};
+
+class ftdev {//this should in the future encapsulate the real TXC
+ int sock;
+ int parseState;
+ unsigned short X1_crc, X1_len, X1_pos;
+ unsigned char *X1_pkt;
+ unsigned short chksum();
+ void parse(const unsigned char *, unsigned);
+public:
+ ftdev(): sock(0) { parseState = 0;}
+ int Open(BD_ADDR *bt_addr, int chan=1, SocketCallback cb=&ftdev::recv) {
+ L2CAPAddr s;
+ s.bdaddr = *bt_addr;
+ s.psm = chan;//abuse the psm for the channelID
+ sock = Socket_Open(SOCKET_RFCOM, &s.hdr, cb, this);//Open the serial connection via RFCOMM
+ if (sock<=0)
+ printf("Opening of RFCOMM socket for ftdevice failed (%d)\n", sock);
+ return sock;
+ }
+ static void recv(int socket, SocketState state, const u8* data, int len, void* userData) {
+ if (userData) ((ftdev*)userData)->receive(socket, state, data, len);
+ }
+ void receive(int socket, SocketState state, const u8* data, int len);// {printf("ftdev::receive was called: socket %d, state=%d, length=%d\n", socket, state, len);}
+};
+
+extern ftdev _ftdev;
+
+unsigned InitFtBtDeviceList();
+int GetNrOfFtBtDevices();
+ftbtdev* GetFtUsbDeviceHandle(unsigned Num);
+unsigned OpenFtBtDevice(ftbtdev* d);
+
+#endif