Identation and handling of the pincode and incoming connection events
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26012 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -16,6 +16,8 @@
|
|||||||
#include <bluetooth/HCI/btHCI_event.h>
|
#include <bluetooth/HCI/btHCI_event.h>
|
||||||
|
|
||||||
#include <bluetoothserver_p.h>
|
#include <bluetoothserver_p.h>
|
||||||
|
#include <ConnectionIncoming.h>
|
||||||
|
#include <PincodeWindow.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@@ -78,6 +80,16 @@ printf("### \n");
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case HCI_EVENT_CONN_COMPLETE:
|
||||||
|
ConnectionComplete((struct hci_ev_conn_complete*)(event+1), NULL); // should belong to a request?
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HCI_EVENT_PIN_CODE_REQ:
|
||||||
|
PinCodeRequest((struct hci_ev_pin_code_req*)(event+1), NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// lets go on
|
// lets go on
|
||||||
break;
|
break;
|
||||||
@@ -118,10 +130,8 @@ printf("### \n");
|
|||||||
InquiryResult((uint8*)(event+1), request);
|
InquiryResult((uint8*)(event+1), request);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HCI_EVENT_CONN_COMPLETE:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HCI_EVENT_DISCONNECTION_COMPLETE:
|
case HCI_EVENT_DISCONNECTION_COMPLETE:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HCI_EVENT_AUTH_COMPLETE:
|
case HCI_EVENT_AUTH_COMPLETE:
|
||||||
@@ -172,9 +182,6 @@ printf("### \n");
|
|||||||
case HCI_EVENT_RETURN_LINK_KEYS:
|
case HCI_EVENT_RETURN_LINK_KEYS:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HCI_EVENT_PIN_CODE_REQ:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HCI_EVENT_LINK_KEY_REQ:
|
case HCI_EVENT_LINK_KEY_REQ:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -240,7 +247,6 @@ LocalDeviceImpl::CommandComplete(struct hci_ev_cmd_complete* event, BMessage* re
|
|||||||
if (request->IsSourceWaiting() == false)
|
if (request->IsSourceWaiting() == false)
|
||||||
Output::Instance()->Post("Nobody waiting for the event\n", BLACKBOARD_KIT);
|
Output::Instance()->Post("Nobody waiting for the event\n", BLACKBOARD_KIT);
|
||||||
|
|
||||||
|
|
||||||
switch (opcodeExpected) {
|
switch (opcodeExpected) {
|
||||||
|
|
||||||
case PACK_OPCODE(OGF_INFORMATIONAL_PARAM, OCF_READ_BD_ADDR):
|
case PACK_OPCODE(OGF_INFORMATIONAL_PARAM, OCF_READ_BD_ADDR):
|
||||||
@@ -249,14 +255,12 @@ LocalDeviceImpl::CommandComplete(struct hci_ev_cmd_complete* event, BMessage* re
|
|||||||
|
|
||||||
if (readbdaddr->status == BT_OK) {
|
if (readbdaddr->status == BT_OK) {
|
||||||
|
|
||||||
|
|
||||||
reply.AddData("bdaddr", B_ANY_TYPE, &readbdaddr->bdaddr, sizeof(bdaddr_t));
|
reply.AddData("bdaddr", B_ANY_TYPE, &readbdaddr->bdaddr, sizeof(bdaddr_t));
|
||||||
reply.AddInt32("status", readbdaddr->status);
|
reply.AddInt32("status", readbdaddr->status);
|
||||||
|
|
||||||
printf("Sending reply ... %ld\n",request->SendReply(&reply));
|
printf("Sending reply ... %ld\n",request->SendReply(&reply));
|
||||||
reply.PrintToStream();
|
reply.PrintToStream();
|
||||||
|
|
||||||
|
|
||||||
Output::Instance()->Post("Positive reply for getAdress\n", BLACKBOARD_KIT);
|
Output::Instance()->Post("Positive reply for getAdress\n", BLACKBOARD_KIT);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -323,7 +327,6 @@ LocalDeviceImpl::CommandComplete(struct hci_ev_cmd_complete* event, BMessage* re
|
|||||||
Output::Instance()->Post("Command Complete not handled\n", BLACKBOARD_KIT);
|
Output::Instance()->Post("Command Complete not handled\n", BLACKBOARD_KIT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -425,12 +428,29 @@ LocalDeviceImpl::RemoteNameRequestComplete(struct hci_remote_name_request_comple
|
|||||||
reply.PrintToStream();
|
reply.PrintToStream();
|
||||||
|
|
||||||
// This request is not genna be used anymore
|
// This request is not genna be used anymore
|
||||||
// Although there are many middle events that should be tracked
|
// Although there are many middle events that should be tracked todo: ticket 2377
|
||||||
ClearWantedEvent(request);
|
ClearWantedEvent(request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
LocalDeviceImpl::ConnectionComplete(struct hci_ev_conn_complete* event, BMessage* request)
|
||||||
|
{
|
||||||
|
ConnectionIncoming* iConnection = new ConnectionIncoming(NULL);
|
||||||
|
iConnection->Show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
LocalDeviceImpl::PinCodeRequest(struct hci_ev_pin_code_req* event, BMessage* request)
|
||||||
|
{
|
||||||
|
PincodeWindow* iPincode = new PincodeWindow(NULL);
|
||||||
|
iPincode->Show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#pragma mark - Request Methods -
|
#pragma mark - Request Methods -
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ public:
|
|||||||
void InquiryResult(uint8* numberOfResponses, BMessage* request);
|
void InquiryResult(uint8* numberOfResponses, BMessage* request);
|
||||||
void InquiryComplete(uint8* status, BMessage* request);
|
void InquiryComplete(uint8* status, BMessage* request);
|
||||||
void RemoteNameRequestComplete(struct hci_remote_name_request_complete_reply* remotename, BMessage* request);
|
void RemoteNameRequestComplete(struct hci_remote_name_request_complete_reply* remotename, BMessage* request);
|
||||||
|
|
||||||
|
// Connection
|
||||||
|
void ConnectionComplete(struct hci_ev_conn_complete* event, BMessage* request);
|
||||||
|
void PinCodeRequest(struct hci_ev_pin_code_req* event, BMessage* request);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user