xref: /haiku/src/servers/bluetooth/HCITransportAccessor.cpp (revision d04eb939af076fdf8632bde41960d10bbd2e76c1)
1009fac99SOliver Ruiz Dorantes /*
2009fac99SOliver Ruiz Dorantes  * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
3009fac99SOliver Ruiz Dorantes  *
4009fac99SOliver Ruiz Dorantes  * All rights reserved. Distributed under the terms of the MIT License.
5009fac99SOliver Ruiz Dorantes  *
6009fac99SOliver Ruiz Dorantes  */
7009fac99SOliver Ruiz Dorantes 
830f1d1f3SOliver Ruiz Dorantes 
930f1d1f3SOliver Ruiz Dorantes #include <String.h>
1030f1d1f3SOliver Ruiz Dorantes 
1130f1d1f3SOliver Ruiz Dorantes #include "BluetoothServer.h"
1230f1d1f3SOliver Ruiz Dorantes #include "HCITransportAccessor.h"
1330f1d1f3SOliver Ruiz Dorantes #include "Output.h"
1430f1d1f3SOliver Ruiz Dorantes 
1530f1d1f3SOliver Ruiz Dorantes HCITransportAccessor::HCITransportAccessor(BPath* path) : HCIDelegate(path)
1630f1d1f3SOliver Ruiz Dorantes {
1730f1d1f3SOliver Ruiz Dorantes 
1830f1d1f3SOliver Ruiz Dorantes 
1930f1d1f3SOliver Ruiz Dorantes }
2030f1d1f3SOliver Ruiz Dorantes 
2130f1d1f3SOliver Ruiz Dorantes status_t
2230f1d1f3SOliver Ruiz Dorantes HCITransportAccessor::IssueCommand(raw_command rc, size_t size)
2330f1d1f3SOliver Ruiz Dorantes {
2430f1d1f3SOliver Ruiz Dorantes 	if (GetID() < 0 || fFD < 0)
2530f1d1f3SOliver Ruiz Dorantes 		return B_ERROR;
2630f1d1f3SOliver Ruiz Dorantes 
27009fac99SOliver Ruiz Dorantes printf("### Command going: len = %ld\n", size);
28009fac99SOliver Ruiz Dorantes for (uint16 index = 0 ; index < size; index++ ) {
2930f1d1f3SOliver Ruiz Dorantes 	printf("%x:",((uint8*)rc)[index]);
3030f1d1f3SOliver Ruiz Dorantes }
31009fac99SOliver Ruiz Dorantes printf("### \n");
3230f1d1f3SOliver Ruiz Dorantes 
3330f1d1f3SOliver Ruiz Dorantes 
3430f1d1f3SOliver Ruiz Dorantes 	return ioctl(fFD, ISSUE_BT_COMMAND, rc, size);
3530f1d1f3SOliver Ruiz Dorantes }
3648cca06aSOliver Ruiz Dorantes 
3748cca06aSOliver Ruiz Dorantes 
3848cca06aSOliver Ruiz Dorantes status_t
3948cca06aSOliver Ruiz Dorantes HCITransportAccessor::Launch() {
4048cca06aSOliver Ruiz Dorantes 
41*d04eb939SOliver Ruiz Dorantes 	uint32 dummy;
42*d04eb939SOliver Ruiz Dorantes 	return ioctl(fFD, BT_UP, &dummy, sizeof(uint32));
4348cca06aSOliver Ruiz Dorantes 
4448cca06aSOliver Ruiz Dorantes }
45