- First steps for SCO connections

- Some styling 
(Mika Lindqvist)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26799 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Ruiz Dorantes
2008-08-04 17:14:06 +00:00
parent 2c0c5e6c21
commit 8976dbe878
2 changed files with 98 additions and 72 deletions
+17
View File
@@ -0,0 +1,17 @@
/*
* Copyright 2008 Mika Lindqvist, monni1995_at_gmail.com
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _BTHCI_SCO_H_
#define _BTHCI_SCO_H_
#include <bluetooth/HCI/btHCI.h>
#define HCI_SCO_HDR_SIZE 3
struct hci_sco_header {
uint16 handle;
uint8 slen;
} __attribute__((packed));
#endif // _BTHCI_SCO_H_
@@ -1,8 +1,7 @@
/*
* Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
*
* Copyright 2008 Mika Lindqvist, monni1995_at_gmail.com
* All rights reserved. Distributed under the terms of the MIT License.
*
*/
#include <malloc.h>
@@ -14,6 +13,7 @@
#include <bluetooth/HCI/btHCI_acl.h>
#include <bluetooth/HCI/btHCI_command.h>
#include <bluetooth/HCI/btHCI_event.h>
#include <bluetooth/HCI/btHCI_sco.h>
#define BT_DEBUG_THIS_MODULE
#include <btDebug.h>
@@ -75,7 +75,10 @@ nb_destroy(net_buffer* nbuf)
}
/* Check from the completition if the queue is empty */
// Extract the expected size of the packet
// TODO: This might be inefficient as at the moment of the creation of the net_buffer
// this information is known and it could be stored in any of the net_buffer fields
// but I still dont know how many of those am i gonna have free....
size_t
get_expected_size(net_buffer* nbuf)
{
@@ -85,11 +88,6 @@ get_expected_size(net_buffer* nbuf)
switch (nbuf->protocol) {
case BT_ACL: {
struct hci_acl_header* header = nb_get_whole_buffer(nbuf);
return header->alen + sizeof(struct hci_acl_header);
}
case BT_COMMAND: {
struct hci_command_header* header = nb_get_whole_buffer(nbuf);
return header->clen + sizeof(struct hci_command_header);
@@ -99,8 +97,19 @@ get_expected_size(net_buffer* nbuf)
struct hci_event_header* header = nb_get_whole_buffer(nbuf);
return header->elen + sizeof(struct hci_event_header);
}
case BT_ACL: {
struct hci_acl_header* header = nb_get_whole_buffer(nbuf);
return header->alen + sizeof(struct hci_acl_header);
}
case BT_SCO: {
struct hci_sco_header* header = nb_get_whole_buffer(nbuf);
return header->slen + sizeof(struct hci_sco_header);
}
default:
panic("h2geneirc:no protocol specifiel for get expected size");
panic(BLUETOOTH_DEVICE_DEVFS_NAME "no protocol specified for " __FUNCTION__);
break;
}