BLE demo for mbed Ported RunningElectronics's SBDBT firmware for BLE. It can communicate with iOS
Dependencies: FatFileSystem mbed
Fork of BTstack by
usbbt.h
00001 #ifndef USBBT_H 00002 #define USBBT_H 00003 #include "UsbHostMgr.h" 00004 #include "UsbEndpoint.h" 00005 #include "UsbBaseClass.h" 00006 00007 #define HCI_COMMAND_DATA_PACKET 0x01 00008 #define HCI_ACL_DATA_PACKET 0x02 00009 #define HCI_SCO_DATA_PACKET 0x03 00010 #define HCI_EVENT_PACKET 0x04 00011 00012 class usbbt : public UsbBaseClass { 00013 public: 00014 usbbt(int dongle = 0); 00015 int setup(int timeout = 9000); 00016 int send_packet(uint8_t packet_type, uint8_t* packet, int size); 00017 void poll(); 00018 ///Setups the result callback 00019 /** 00020 @param pMethod : callback function 00021 */ 00022 void setOnPacket( void (*pMethod)(uint8_t, uint8_t*, uint16_t) ); 00023 00024 ///Setups the result callback 00025 /** 00026 @param pItem : instance of class on which to execute the callback method 00027 @param pMethod : callback method 00028 */ 00029 class CDummy; 00030 template<class T> 00031 void setOnPacket( T* pItem, void (T::*pMethod)(uint8_t, uint8_t*, uint16_t) ) 00032 { 00033 m_pCb = NULL; 00034 m_pCbItem = (CDummy*) pItem; 00035 m_pCbMeth = (void (CDummy::*)(uint8_t, uint8_t*, uint16_t)) pMethod; 00036 } 00037 void clearOnPacket(); 00038 private: 00039 int ParseConfiguration(); 00040 void onPacket(uint8_t packet_type, uint8_t* packet, uint16_t size); 00041 int m_dongle; 00042 UsbDevice* m_pDev; 00043 UsbEndpoint* m_pEpIntIn; 00044 UsbEndpoint* m_pEpBulkIn; 00045 UsbEndpoint* m_pEpBulkOut; 00046 Timer m_timer; 00047 int m_int_seq; 00048 uint8_t m_int_buf[64]; 00049 int m_bulk_seq; 00050 uint8_t m_bulk_buf[64]; 00051 CDummy* m_pCbItem; 00052 void (CDummy::*m_pCbMeth)(uint8_t, uint8_t*, uint16_t); 00053 void (*m_pCb)(uint8_t, uint8_t*, uint16_t); 00054 }; 00055 #endif //USBBT_H
Generated on Thu Jul 14 2022 15:03:49 by 1.7.2