Use const reference as input parameter as suggested by julun
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26801 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
1be4b7c0c5
commit
af9ccaf254
@ -48,7 +48,7 @@ public:
|
||||
|
||||
LocalDevice* GetLocalDeviceOwner();
|
||||
|
||||
RemoteDevice(BString address);
|
||||
RemoteDevice(const BString& address);
|
||||
RemoteDevice(bdaddr_t address);
|
||||
|
||||
protected:
|
||||
|
@ -30,7 +30,7 @@ namespace Bluetooth {
|
||||
bool
|
||||
RemoteDevice::IsTrustedDevice(void)
|
||||
{
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -38,58 +38,58 @@ BString
|
||||
RemoteDevice::GetFriendlyName(bool alwaysAsk)
|
||||
{
|
||||
|
||||
if (!alwaysAsk) {
|
||||
// Check if the name is already retrieved
|
||||
// TODO: Check if It is known from a KnownDevicesList
|
||||
return BString("Not implemented");
|
||||
}
|
||||
|
||||
if (fDiscovererLocalDevice == NULL)
|
||||
return BString("#NoOwnerError#Not Valid name");
|
||||
|
||||
if (fMessenger == NULL)
|
||||
return BString("#ServerNotReady#Not Valid name");
|
||||
|
||||
void* remoteNameCommand = NULL;
|
||||
if (!alwaysAsk) {
|
||||
// Check if the name is already retrieved
|
||||
// TODO: Check if It is known from a KnownDevicesList
|
||||
return BString("Not implemented");
|
||||
}
|
||||
|
||||
if (fDiscovererLocalDevice == NULL)
|
||||
return BString("#NoOwnerError#Not Valid name");
|
||||
|
||||
if (fMessenger == NULL)
|
||||
return BString("#ServerNotReady#Not Valid name");
|
||||
|
||||
void* remoteNameCommand = NULL;
|
||||
size_t size;
|
||||
|
||||
/* Issue inquiry command */
|
||||
BMessage request(BT_MSG_HANDLE_SIMPLE_REQUEST);
|
||||
BMessage reply;
|
||||
|
||||
request.AddInt32("hci_id", fDiscovererLocalDevice->GetID());
|
||||
|
||||
// Fill the request
|
||||
|
||||
// Issue inquiry command
|
||||
BMessage request(BT_MSG_HANDLE_SIMPLE_REQUEST);
|
||||
BMessage reply;
|
||||
|
||||
request.AddInt32("hci_id", fDiscovererLocalDevice->GetID());
|
||||
|
||||
// Fill the request
|
||||
remoteNameCommand = buildRemoteNameRequest(fBdaddr, fPageRepetitionMode, fClockOffset, &size); // Fill correctily
|
||||
|
||||
|
||||
request.AddData("raw command", B_ANY_TYPE, remoteNameCommand, size);
|
||||
|
||||
request.AddInt16("eventExpected", HCI_EVENT_CMD_STATUS);
|
||||
request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_LINK_CONTROL, OCF_REMOTE_NAME_REQUEST));
|
||||
|
||||
request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_LINK_CONTROL, OCF_REMOTE_NAME_REQUEST));
|
||||
|
||||
request.AddInt16("eventExpected", HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE);
|
||||
|
||||
|
||||
if (fMessenger->SendMessage(&request, &reply) == B_OK)
|
||||
{
|
||||
BString name;
|
||||
int8 status;
|
||||
|
||||
if ((reply.FindInt8("status", &status) == B_OK) && (status == BT_OK)) {
|
||||
|
||||
if ((reply.FindString("friendlyname", &name) == B_OK ) ) {
|
||||
return name;
|
||||
} else {
|
||||
return BString("");// should not happen
|
||||
}
|
||||
|
||||
} else {
|
||||
// seems we got a netative event
|
||||
return BString("#CommandFailed#Not Valid name");
|
||||
}
|
||||
}
|
||||
|
||||
return BString("#NotCompletedRequest#Not Valid name");
|
||||
|
||||
|
||||
if (fMessenger->SendMessage(&request, &reply) == B_OK)
|
||||
{
|
||||
BString name;
|
||||
int8 status;
|
||||
|
||||
if ((reply.FindInt8("status", &status) == B_OK) && (status == BT_OK)) {
|
||||
|
||||
if ((reply.FindString("friendlyname", &name) == B_OK ) ) {
|
||||
return name;
|
||||
} else {
|
||||
return BString(""); // should not happen
|
||||
}
|
||||
|
||||
} else {
|
||||
// seems we got a negative event
|
||||
return BString("#CommandFailed#Not Valid name");
|
||||
}
|
||||
}
|
||||
|
||||
return BString("#NotCompletedRequest#Not Valid name");
|
||||
}
|
||||
|
||||
|
||||
@ -103,16 +103,16 @@ RemoteDevice::GetFriendlyName()
|
||||
bdaddr_t
|
||||
RemoteDevice::GetBluetoothAddress()
|
||||
{
|
||||
return fBdaddr;
|
||||
return fBdaddr;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
RemoteDevice::Equals(RemoteDevice* obj)
|
||||
{
|
||||
bdaddr_t ba = obj->GetBluetoothAddress();
|
||||
bdaddr_t ba = obj->GetBluetoothAddress();
|
||||
|
||||
return bdaddrUtils::Compare(&fBdaddr, &ba);
|
||||
return bdaddrUtils::Compare(&fBdaddr, &ba);
|
||||
}
|
||||
|
||||
// static RemoteDevice* GetRemoteDevice(Connection conn);
|
||||
@ -120,7 +120,7 @@ RemoteDevice::Equals(RemoteDevice* obj)
|
||||
bool
|
||||
RemoteDevice::Authenticate()
|
||||
{
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -131,7 +131,7 @@ RemoteDevice::Authenticate()
|
||||
bool
|
||||
RemoteDevice::IsAuthenticated()
|
||||
{
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -141,7 +141,7 @@ RemoteDevice::IsAuthenticated()
|
||||
bool
|
||||
RemoteDevice::IsEncrypted()
|
||||
{
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
LocalDevice*
|
||||
@ -166,7 +166,7 @@ RemoteDevice::RemoteDevice(bdaddr_t address)
|
||||
}
|
||||
|
||||
|
||||
RemoteDevice::RemoteDevice(BString address)
|
||||
RemoteDevice::RemoteDevice(const BString& address)
|
||||
{
|
||||
fBdaddr = bdaddrUtils::FromString((const char *)address.String());
|
||||
fMessenger = _RetrieveBluetoothMessenger();
|
||||
@ -183,7 +183,6 @@ RemoteDevice::~RemoteDevice()
|
||||
BString
|
||||
RemoteDevice::GetProperty(const char* property) /* Throwing */
|
||||
{
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user