1 #include "ResetLocalDevice.h"
5 #include <bluetooth/bluetooth_error.h>
6 #include <bluetooth/HCI/btHCI_command.h>
7 #include <bluetooth/HCI/btHCI_event.h>
9 #include <bluetoothserver_p.h>
10 #include <CommandManager.h>
13 ResetLocalDeviceAddOn::ResetLocalDeviceAddOn()
20 ResetLocalDeviceAddOn::GetName()
22 return "Reset LocalDevice";
27 ResetLocalDeviceAddOn::InitCheck(LocalDevice
* lDevice
)
29 // you can perform a Reset in all Devices
36 ResetLocalDeviceAddOn::GetActionDescription()
38 return "Perform a Reset command to the LocalDevice";
43 ResetLocalDeviceAddOn::TakeAction(LocalDevice
* lDevice
)
45 int8 btStatus
= BT_ERROR
;
47 BMessenger
* fMessenger
= new BMessenger(BLUETOOTH_SIGNATURE
);
49 if (fMessenger
== NULL
|| !fMessenger
->IsValid())
52 BluetoothCommand
<> Reset(OGF_CONTROL_BASEBAND
, OCF_RESET
);
54 BMessage
request(BT_MSG_HANDLE_SIMPLE_REQUEST
);
57 request
.AddInt32("hci_id", lDevice
->ID());
58 request
.AddData("raw command", B_ANY_TYPE
, Reset
.Data(), Reset
.Size());
59 request
.AddInt16("eventExpected", HCI_EVENT_CMD_COMPLETE
);
60 request
.AddInt16("opcodeExpected", PACK_OPCODE(OGF_CONTROL_BASEBAND
, OCF_RESET
));
62 if (fMessenger
->SendMessage(&request
, &reply
) == B_OK
)
63 reply
.FindInt8("status", &btStatus
);
70 ResetLocalDeviceAddOn::GetActionOnRemoteDescription()
77 ResetLocalDeviceAddOn::TakeActionOnRemote(LocalDevice
* lDevice
, RemoteDevice
* rDevice
)
79 return B_NOT_SUPPORTED
;
84 ResetLocalDeviceAddOn::GetOverridenPropertiesDescription()
87 //return "Replace the max count of SCO packets";
93 ResetLocalDeviceAddOn::OverridenProperties(LocalDevice
* lDevice
, const char* property
)
96 //BMessage* newProperties = new BMessage();
97 //newProperties->AddInt8("max_sco", 10);
98 //return newProperties;
103 INSTANTIATE_LOCAL_DEVICE_ADDON(ResetLocalDeviceAddOn
);
104 EXPORT_LOCAL_DEVICE_ADDON
;