зеркало из https://github.com/mozilla/gecko-dev.git
Bug 801507 - Listen to ObjectPush service socket, r=qdot
This commit is contained in:
Родитель
2798f40d68
Коммит
0f311715a5
|
@ -158,6 +158,27 @@ BluetoothOppManager::Disconnect()
|
|||
CloseSocket();
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothOppManager::Listen()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
CloseSocket();
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
if (!bs) {
|
||||
NS_WARNING("BluetoothService not available!");
|
||||
return false;
|
||||
}
|
||||
|
||||
nsresult rv = bs->ListenSocketViaService(BluetoothReservedChannels::OPUSH,
|
||||
BluetoothSocketType::RFCOMM,
|
||||
true,
|
||||
false,
|
||||
this);
|
||||
return NS_FAILED(rv) ? false : true;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothOppManager::SendFile(BlobParent* aActor,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
bool Connect(const nsAString& aDeviceObjectPath,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
void Disconnect();
|
||||
bool Listen();
|
||||
|
||||
bool SendFile(BlobParent* aBlob,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
|
|
@ -757,6 +757,12 @@ public:
|
|||
if (h) {
|
||||
h->Listen();
|
||||
}
|
||||
|
||||
BluetoothOppManager* opp = BluetoothOppManager::Get();
|
||||
if (opp) {
|
||||
opp->Listen();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
@ -771,6 +777,12 @@ public:
|
|||
if (h) {
|
||||
h->CloseSocket();
|
||||
}
|
||||
|
||||
BluetoothOppManager* opp = BluetoothOppManager::Get();
|
||||
if (opp) {
|
||||
opp->CloseSocket();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
@ -793,6 +805,7 @@ public:
|
|||
|
||||
uuids.AppendElement((uint32_t)(BluetoothServiceUuid::HandsfreeAG >> 32));
|
||||
uuids.AppendElement((uint32_t)(BluetoothServiceUuid::HeadsetAG >> 32));
|
||||
uuids.AppendElement((uint32_t)(BluetoothServiceUuid::ObjectPush >> 32));
|
||||
|
||||
// TODO/qdot: This needs to be held for the life of the bluetooth connection
|
||||
// so we could clean it up. For right now though, we can throw it away.
|
||||
|
|
Загрузка…
Ссылка в новой задаче