tcp: Add APICall trace entry and move TRACEs into locked parts.
[haiku.git] / src / add-ons / bluetooth / ResetLocalDevice / ResetLocalDevice.cpp
blob783b44da46f6e4fd35c1a352f739e774affd9959
1 #include "ResetLocalDevice.h"
3 #include <Messenger.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()
19 const char*
20 ResetLocalDeviceAddOn::GetName()
22 return "Reset LocalDevice";
26 status_t
27 ResetLocalDeviceAddOn::InitCheck(LocalDevice* lDevice)
29 // you can perform a Reset in all Devices
30 fCheck = B_OK;
31 return fCheck;
35 const char*
36 ResetLocalDeviceAddOn::GetActionDescription()
38 return "Perform a Reset command to the LocalDevice";
42 status_t
43 ResetLocalDeviceAddOn::TakeAction(LocalDevice* lDevice)
45 int8 btStatus = BT_ERROR;
47 BMessenger* fMessenger = new BMessenger(BLUETOOTH_SIGNATURE);
49 if (fMessenger == NULL || !fMessenger->IsValid())
50 return B_ERROR;
52 BluetoothCommand<> Reset(OGF_CONTROL_BASEBAND, OCF_RESET);
54 BMessage request(BT_MSG_HANDLE_SIMPLE_REQUEST);
55 BMessage reply;
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);
65 return btStatus;
69 const char*
70 ResetLocalDeviceAddOn::GetActionOnRemoteDescription()
72 return NULL;
76 status_t
77 ResetLocalDeviceAddOn::TakeActionOnRemote(LocalDevice* lDevice, RemoteDevice* rDevice)
79 return B_NOT_SUPPORTED;
83 const char*
84 ResetLocalDeviceAddOn::GetOverridenPropertiesDescription()
86 // Example usage:
87 //return "Replace the max count of SCO packets";
88 return NULL;
92 BMessage*
93 ResetLocalDeviceAddOn::OverridenProperties(LocalDevice* lDevice, const char* property)
95 // Example usage:
96 //BMessage* newProperties = new BMessage();
97 //newProperties->AddInt8("max_sco", 10);
98 //return newProperties;
100 return NULL;
103 INSTANTIATE_LOCAL_DEVICE_ADDON(ResetLocalDeviceAddOn);
104 EXPORT_LOCAL_DEVICE_ADDON;