From d081e691a0b4858c78af5955b5de5cf94e8d0f35 Mon Sep 17 00:00:00 2001 From: Oliver Ruiz Dorantes Date: Sat, 28 Mar 2009 01:03:05 +0000 Subject: [PATCH] - Add Strings for bluetooth events - Use then in bluetooth server output git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29750 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/bluetooth/HCI/btHCI_command.h | 1 + src/kits/bluetooth/CommandManager.cpp | 76 ++++++++++++++++++++++- src/servers/bluetooth/LocalDeviceImpl.cpp | 3 + 3 files changed, 79 insertions(+), 1 deletion(-) diff --git a/headers/os/bluetooth/HCI/btHCI_command.h b/headers/os/bluetooth/HCI/btHCI_command.h index 84dc1d6ae6..575fe15a89 100644 --- a/headers/os/bluetooth/HCI/btHCI_command.h +++ b/headers/os/bluetooth/HCI/btHCI_command.h @@ -11,6 +11,7 @@ #define HCI_COMMAND_HDR_SIZE 3 const char* GetCommand(uint16 command); +const char* GetEvent(uint8 event); const char* GetManufacturer(uint16 manufacturer); const char* GetHciVersion(uint16 ver); const char* GetLmpVersion(uint16 ver); diff --git a/src/kits/bluetooth/CommandManager.cpp b/src/kits/bluetooth/CommandManager.cpp index 544eea27ed..565f9a4fea 100644 --- a/src/kits/bluetooth/CommandManager.cpp +++ b/src/kits/bluetooth/CommandManager.cpp @@ -548,6 +548,71 @@ const char* testingCommands[] = { }; +const char* bluetoothEvents[] = { +"Inquiry Complete", +"Inquiry Result", +"Conn Complete", +"Conn Request", +"Disconnection Complete", +"Auth Complete", +"Remote Name Request Complete", +"Encrypt Change", +"Change Conn Link Key Complete", +"Master Link Key Compl", +"Rmt Features", +"Rmt Version", +"Qos Setup Complete", +"Command Complete", +"Command Status", +"Hardware Error", +"Flush Occur", +"Role Change", +"Num Comp Pkts", +"Mode Change", +"Return Link Keys", +"Pin Code Req", +"Link Key Req", +"Link Key Notify", +"Loopback Command", +"Data Buffer Overflow", +"Max Slot Change", +"Read Clock Offset Compl", +"Con Pkt Type Changed", +"Qos Violation", +"Reserved", +"Page Scan Rep Mode Change", +"Flow Specification", +"Inquiry Result With Rssi", +"Remote Extended Features", +"Reserved", +"Reserved", +"Reserved", +"Reserved", +"Reserved", +"Reserved", +"Reserved", +"Reserved", +"Synchronous Connection Completed", +"Synchronous Connection Changed", +"Reserved", +"Extended Inquiry Result", +"Encryption Key Refersh Complete", +"Io Capability Request", +"Io Capability Response", +"User Confirmation Request", +"User Passkey Request", +"Oob Data Request", +"Simple Pairing Complete", +"Reserved", +"Link Supervision Timeout Changed", +"Enhanced Flush Complete", +"Reserved", +"Reserved", +"Keypress Notification", +"Remote Host Supported Features Notification" +}; + + const char* hciVersion[] = { "1.0B" , "1.1 " , "1.2 " , "2.0 " , "2.1 "}; const char* lmpVersion[] = { "1.0 " , "1.1 " , "1.2 " , "2.0 " , "2.1 "}; @@ -610,6 +675,16 @@ GetCommand(uint16 command) } +const char* +GetEvent(uint8 event) { + if (event < sizeof(bluetoothEvents)/sizeof(const char*)) { + return bluetoothEvents[event-1]; + } else { + return "Event out of Range!"; + } +} + + const char* GetManufacturer(uint16 manufacturer) { if (manufacturer < sizeof(bluetoothManufacturers)/sizeof(const char*)) { @@ -620,4 +695,3 @@ GetManufacturer(uint16 manufacturer) { return "not assigned"; } } - diff --git a/src/servers/bluetooth/LocalDeviceImpl.cpp b/src/servers/bluetooth/LocalDeviceImpl.cpp index 01c54efda7..9b2fa96a72 100644 --- a/src/servers/bluetooth/LocalDeviceImpl.cpp +++ b/src/servers/bluetooth/LocalDeviceImpl.cpp @@ -73,6 +73,9 @@ LocalDeviceImpl::HandleEvent(struct hci_event_header* event) } printf("### \n"); + Output::Instance()->Postf(BLACKBOARD_LD(GetID()),"Incomming %s event\n", + GetEvent(event->ecode)); + // Events here might have not been initated by us // TODO: ML mark as handled pass a reply by parameter and reply in common switch (event->ecode) {