2 * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
3 * All rights reserved. Distributed under the terms of the MIT License.
9 #include "BluetoothServer.h"
10 #include "HCITransportAccessor.h"
13 HCITransportAccessor::HCITransportAccessor(BPath
* path
) : HCIDelegate(path
)
17 fDescriptor
= open (path
->Path(), O_RDWR
);
18 if (fDescriptor
> 0) {
19 // find out which ID was assigned
20 status
= ioctl(fDescriptor
, GET_HCI_ID
, &fIdentifier
, 0);
21 printf("%s: hid retrieved %" B_PRIx32
" status=%" B_PRId32
"\n",
22 __FUNCTION__
, fIdentifier
, status
);
24 printf("%s: Device driver %s could not be opened %" B_PRId32
"\n",
25 __FUNCTION__
, path
->Path(), fIdentifier
);
26 fIdentifier
= B_ERROR
;
32 HCITransportAccessor::~HCITransportAccessor()
38 fIdentifier
= B_ERROR
;
44 HCITransportAccessor::IssueCommand(raw_command rc
, size_t size
)
46 if (Id() < 0 || fDescriptor
< 0)
49 printf("### Command going: len = %ld\n", size);
50 for (uint16 index = 0 ; index < size; index++ ) {
51 printf("%x:",((uint8*)rc)[index]);
56 return ioctl(fDescriptor
, ISSUE_BT_COMMAND
, rc
, size
);
61 HCITransportAccessor::Launch() {
64 return ioctl(fDescriptor
, BT_UP
, &dummy
, sizeof(uint32
));