Bluetooth HCI Terminal Final Presentation By : Ofri Rahat & Moti Zeltser Supervisor:Ilan Hazan
Project Goals Implementation of a HCI terminal, which based on the Ericsson – PC Reference stack, in order to help debugging of future BT implementations. The application will support the following features: Operating the Bluetooth device through the HCI layer, using HCI commands. Monitoring all HCI events. Convenience for future extension of the project
Project Phases Study the MFC and Windows programming. Study the Bluetooth specification Dig into Ericsson BT Stack’s open source in order to learn how to integrate with it. Design the HCI Terminal application. Implement the HCI Terminal application. Application Testing. Application and project documentation.
A Brief Description of The Bluetooth Technology And Its Lower Components.
The BT Lower Level Layers
Point to Point HW/SW Layers Model
The HCI Layer The HCI layer purpose HCI commands HCI events
HCI Command Packet Structure HCI Event Packet Structure
Windows Programming and MFC Fundamentals
Event Driven Applications What is event driven applications ? Why use event driven applications ? Who create those events ? What information passed on those events ? How does Windows (the Win32 API) support event (message) handling ? How does MFC support event (message) handling ?
Default Window Procedure Messages in The Win 32 API Message Loop System Queue (Windows OS) App2 Message Queue App3 Message Queue Window Procedure 1 Application 1 Default Window Procedure Windows (OS) Window Procedure 2 App1 Message Queue Hardware Events Post Message Send Message
Events in MFC MFC - general architecture The CCmdTarget class The CWin class Message maps Types of messages (Windows, Command, User Interface Update, Event Notification) User defined messages
A Few Words About COM Technology The Component Object Model Benefits of COM COM objects Client of COM objects COM Server How COM clients communicates with COM servers
Ericsson’s Bluetooth PC Reference Stack
BT Stack Higher Layers (BT API) RF COMM SCM L2CAP HCI HCI Driver SDP Service Discovery Protocol Stack Connection Manager Host Controller Interface HCI lower Level Application or Higher Protocols Transport Protocol, RS-232 Emulation Logical Link Control and Adaptation Protocol BT Stack API OSI stack components Ericsson stack components To USB Driver
Data Flow Between 2 Layers Layer A Layer B Request (Req) Command (Cmd) Confirm (Cnf/CnfNeg) Indication (Ind) Response (Rsp/RspNeg) Air Remote Host Function Event (Message)
Other Interfaces BT COM Server VOS TIM Other h files SendMsg () MsgReceived () GetCurrentProcessID () GetExternalProcessID ()
Host Data Flow - General Description Data from the application to the Bluetooth device – function calls (using any of the BT stack API) Data from the BT device to the application – H/W events and Windows messages (using the COM Server) Application BT Interface H/W VOS USB Driver Windows COM Server
Summery of Stack Interfaces COM Server, VOS and other interfaces (BT_COMServer.exe & vos2com.lib) BT_COMserver.h bstr.h global.h vos.h vos2com.h nt-thread.h safearray.h tim.h standards.h BT Interface (BTinterface.lib) com.h scm.h sd.h, sds.h l2ca.h hci.h hci_drv.h bt.h msg.h Product.h dbm.h, dbg.h
Communication Procedure - HCI Initialization Host HCI HCI_ReqStart HCI_START_CNF tSeqNr = N HCI_CmdRegister tMessageGroup = HCI_CONNECT_GROUP tMessageGroup = HCI_DATA_GROUP
Communication Procedure - Inquiry Host HCI HCI_ReqInquiry HCI_INQUIRY_EVT tSeqNr = N, tLap = (0x9E,0x8B,0x33), tInquiryLength = 5, tNrOfResponses = 10 tSeqNr = N, BT_TAddress = 0x11 22 33 44 55 66, … HCI_INQUIRY_CNF tSeqNr = N, BT_TAddress = 0xAA BB CC DD EE FF, … tSeqNr = N, tNrOfResponses = 2
Communication Procedure – ACL Connection Host HCI Remote HCI_ReqConnect HCI_CONNECT_COMPLETE_EVT HCI_CONNECT_IND HCI_RspConnect Air tSeqNr = N , tAddress = 0xAABBCCDDEEFF, tPacketType = HCI_DM1, …., tAcceptRoleSwitch = HCI_ACCEPT_ROLE_SWITCH tAddress = 0x112233445566, tCOD, tLinkType = ACL tSeqNr = N , tHandle = 1, tAddress = 0xAABBCCDDEEFF, tLinkType, tEncryptionMode tSeqNr = N , tHandle = 1, tAddress = 0x112233445566, tLinkType, tEncryptionMode tSeqNr = N, tErrorCode, HCI_Troll = HCI_SLAVE
Communication Procedure – Data Send Host HCI Remote HCI_DataAlloc (a pointer is returned) HCI_DATA_CNF HCI_DATA_IND HCI_RspData Air uiLength = N tSeqNr = N, tHandle = 1 HCI_DataExtract (a pointer is returned) tSeqNr = N , tHandle = 1 ptDataMsg, ptHandle, puiLength, ptPacketBoundary tSeqNr = N, tErrorCode, tHandle = 1 HCI_DataSend tSeqNr = N, pucData, tHandle = 1, uiLength = N, tPacketBoundary
The HCI Terminal Application
The Application Main Window
Detail’s Window
Software Block Diagram USB Driver GUI Logic DB Main Application Ericsson Interface COM Server HCI Commands BT Messages BT Events BT API Other Messages Other Output
Software Logical View
Sending HCI Command Edit Command Parse Command Execute Command BT API Function Create Detail Object Add to Monitor Add to Log File Show Parameters Lower Layers Unknown Command or Bad Parameters Send Button Known Command Return Void Event
HCI Event Sequence Message Map Extract Parameters BT API Function Create Detail Object Add to Monitor Add to Log File Messages Handlers Lower Layers BT Event Msg Other Messages Return Value - Void Event Respond (or Init Sequence)
?
The End Thank you all