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:
Oliver Ruiz Dorantes 2008-06-18 21:05:33 +00:00
parent 24f4a20d25
commit 14ea910db6
2 changed files with 75 additions and 51 deletions

View File

@ -16,6 +16,8 @@
#include <bluetooth/HCI/btHCI_event.h>
#include <bluetoothserver_p.h>
#include <ConnectionIncoming.h>
#include <PincodeWindow.h>
#include <stdio.h>
@ -78,6 +80,16 @@ printf("### \n");
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:
// lets go on
break;
@ -118,10 +130,8 @@ printf("### \n");
InquiryResult((uint8*)(event+1), request);
break;
case HCI_EVENT_CONN_COMPLETE:
break;
case HCI_EVENT_DISCONNECTION_COMPLETE:
break;
case HCI_EVENT_AUTH_COMPLETE:
@ -172,9 +182,6 @@ printf("### \n");
case HCI_EVENT_RETURN_LINK_KEYS:
break;
case HCI_EVENT_PIN_CODE_REQ:
break;
case HCI_EVENT_LINK_KEY_REQ:
break;
@ -240,7 +247,6 @@ LocalDeviceImpl::CommandComplete(struct hci_ev_cmd_complete* event, BMessage* re
if (request->IsSourceWaiting() == false)
Output::Instance()->Post("Nobody waiting for the event\n", BLACKBOARD_KIT);
switch (opcodeExpected) {
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) {
reply.AddData("bdaddr", B_ANY_TYPE, &readbdaddr->bdaddr, sizeof(bdaddr_t));
reply.AddInt32("status", readbdaddr->status);
printf("Sending reply ... %ld\n",request->SendReply(&reply));
reply.PrintToStream();
Output::Instance()->Post("Positive reply for getAdress\n", BLACKBOARD_KIT);
} 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);
break;
}
}
@ -425,12 +428,29 @@ LocalDeviceImpl::RemoteNameRequestComplete(struct hci_remote_name_request_comple
reply.PrintToStream();
// 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);
}
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
#pragma mark - Request Methods -
#endif

View File

@ -44,6 +44,10 @@ public:
void InquiryResult(uint8* numberOfResponses, BMessage* request);
void InquiryComplete(uint8* status, 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