mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backing out 9a88f0d57e7d (Bug 790739) due to bustage
--HG-- extra : rebase_source : 1f6e7eda80f1b66b854c5c112f1b0816381f27e2
This commit is contained in:
parent
b61f668958
commit
fbe3ed43ff
@ -407,25 +407,6 @@ BluetoothHfpManager::Connect(const nsAString& aDeviceObjectPath,
|
||||
return NS_FAILED(rv) ? false : true;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothHfpManager::Listen()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
if (!bs) {
|
||||
NS_WARNING("BluetoothService not available!");
|
||||
return false;
|
||||
}
|
||||
|
||||
nsresult rv = bs->ListenSocketViaService(BluetoothReservedChannels::HANDSFREE_AG,
|
||||
BluetoothSocketType::RFCOMM,
|
||||
true,
|
||||
false,
|
||||
this);
|
||||
return NS_FAILED(rv) ? false : true;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothHfpManager::Disconnect()
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
bool SendLine(const char* aMessage);
|
||||
void CallStateChanged(int aCallIndex, int aCallState,
|
||||
const char* aNumber, bool aIsActive);
|
||||
bool Listen();
|
||||
|
||||
private:
|
||||
BluetoothHfpManager();
|
||||
|
||||
|
@ -279,13 +279,6 @@ public:
|
||||
virtual void
|
||||
DisconnectObjectPush(BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual nsresult
|
||||
ListenSocketViaService(int aChannel,
|
||||
BluetoothSocketType aType,
|
||||
bool aAuth,
|
||||
bool aEncrypt,
|
||||
mozilla::ipc::UnixSocketConsumer* aConsumer) = 0;
|
||||
|
||||
bool
|
||||
IsEnabled() const
|
||||
{
|
||||
|
@ -30,21 +30,6 @@ namespace BluetoothServiceUuidStr {
|
||||
static const char* ObjectPush = "00001105-0000-1000-8000-00805F9B34FB";
|
||||
}
|
||||
|
||||
// TODO/qdot: Move these back into gonk and make the service handler deal with
|
||||
// it there.
|
||||
//
|
||||
// Gotten from reading the "u8" values in B2G/external/bluez/src/adapter.c
|
||||
// These were hardcoded into android
|
||||
enum BluetoothReservedChannels {
|
||||
DIALUP_NETWORK = 1,
|
||||
HANDSFREE_AG = 10,
|
||||
HEADSET_AG = 11,
|
||||
OPUSH = 12,
|
||||
SIM_ACCESS = 15,
|
||||
PBAP_PSE = 19,
|
||||
FTP = 20,
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,19 +226,6 @@ BluetoothServiceChildProcess::GetSocketViaService(
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
BluetoothServiceChildProcess::ListenSocketViaService(
|
||||
int aChannel,
|
||||
BluetoothSocketType aType,
|
||||
bool aAuth,
|
||||
bool aEncrypt,
|
||||
mozilla::ipc::UnixSocketConsumer* aConsumer)
|
||||
{
|
||||
MOZ_NOT_REACHED("This should never be called!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceChildProcess::SetPinCodeInternal(
|
||||
const nsAString& aDeviceAddress,
|
||||
|
@ -101,13 +101,6 @@ public:
|
||||
mozilla::ipc::UnixSocketConsumer* aConsumer,
|
||||
BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult
|
||||
ListenSocketViaService(int aChannel,
|
||||
BluetoothSocketType aType,
|
||||
bool aAuth,
|
||||
bool aEncrypt,
|
||||
mozilla::ipc::UnixSocketConsumer* aConsumer) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool
|
||||
SetPinCodeInternal(const nsAString& aDeviceAddress,
|
||||
const nsAString& aPinCode,
|
||||
|
@ -261,7 +261,6 @@ public:
|
||||
NS_WARNING("prepare adapter failed");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -727,29 +726,6 @@ ExtractHandles(DBusMessage *aReply, nsTArray<uint32_t>& aOutHandles)
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
BluetoothDBusService::AddServiceRecords(const nsAString& aAdapterPath,
|
||||
const char* serviceName,
|
||||
unsigned long long uuidMsb,
|
||||
unsigned long long uuidLsb,
|
||||
int channel)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
DBusMessage *reply;
|
||||
reply = dbus_func_args(gThreadConnection->GetConnection(),
|
||||
NS_ConvertUTF16toUTF8(aAdapterPath).get(),
|
||||
DBUS_ADAPTER_IFACE, "AddRfcommServiceRecord",
|
||||
DBUS_TYPE_STRING, &serviceName,
|
||||
DBUS_TYPE_UINT64, &uuidMsb,
|
||||
DBUS_TYPE_UINT64, &uuidLsb,
|
||||
DBUS_TYPE_UINT16, &channel,
|
||||
DBUS_TYPE_INVALID);
|
||||
|
||||
return reply ? dbus_returns_uint32(reply) : -1;
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
BluetoothDBusService::AddReservedServicesInternal(const nsAString& aAdapterPath,
|
||||
@ -2301,9 +2277,7 @@ public:
|
||||
|
||||
nsString address = GetAddressFromObjectPath(mObjectPath);
|
||||
nsString replyError;
|
||||
BluetoothUnixSocketConnector* c =
|
||||
new BluetoothUnixSocketConnector(BluetoothSocketType::SCO, -1,
|
||||
mAuth, mEncrypt);
|
||||
BluetoothUnixSocketConnector c(BluetoothSocketType::SCO, -1, mAuth, mEncrypt);
|
||||
|
||||
BluetoothScoManager* sco = BluetoothScoManager::Get();
|
||||
if (!mConsumer->ConnectSocket(c, NS_ConvertUTF16toUTF8(address).get())) {
|
||||
@ -2328,16 +2302,16 @@ private:
|
||||
bool mEncrypt;
|
||||
};
|
||||
|
||||
class ConnectBluetoothSocketRunnable : public nsRunnable
|
||||
class CreateBluetoothSocketRunnable : public nsRunnable
|
||||
{
|
||||
public:
|
||||
ConnectBluetoothSocketRunnable(BluetoothReplyRunnable* aRunnable,
|
||||
UnixSocketConsumer* aConsumer,
|
||||
const nsAString& aObjectPath,
|
||||
const nsAString& aServiceUUID,
|
||||
BluetoothSocketType aType,
|
||||
bool aAuth,
|
||||
bool aEncrypt)
|
||||
CreateBluetoothSocketRunnable(BluetoothReplyRunnable* aRunnable,
|
||||
UnixSocketConsumer* aConsumer,
|
||||
const nsAString& aObjectPath,
|
||||
const nsAString& aServiceUUID,
|
||||
BluetoothSocketType aType,
|
||||
bool aAuth,
|
||||
bool aEncrypt)
|
||||
: mRunnable(dont_AddRef(aRunnable)),
|
||||
mConsumer(aConsumer),
|
||||
mObjectPath(aObjectPath),
|
||||
@ -2351,14 +2325,14 @@ public:
|
||||
nsresult
|
||||
Run()
|
||||
{
|
||||
NS_WARNING("Running create socket!\n");
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
nsString address = GetAddressFromObjectPath(mObjectPath);
|
||||
int channel = GetDeviceServiceChannel(mObjectPath, mServiceUUID, 0x0004);
|
||||
BluetoothValue v;
|
||||
nsString replyError;
|
||||
BluetoothUnixSocketConnector* c =
|
||||
new BluetoothUnixSocketConnector(mType, channel, mAuth, mEncrypt);
|
||||
BluetoothUnixSocketConnector c(mType, channel, mAuth, mEncrypt);
|
||||
if (!mConsumer->ConnectSocket(c, NS_ConvertUTF16toUTF8(address).get())) {
|
||||
replyError.AssignLiteral("SocketConnectionError");
|
||||
DispatchBluetoothReply(mRunnable, v, replyError);
|
||||
@ -2421,7 +2395,7 @@ BluetoothDBusService::GetSocketViaService(const nsAString& aObjectPath,
|
||||
}
|
||||
nsRefPtr<BluetoothReplyRunnable> runnable = aRunnable;
|
||||
|
||||
nsRefPtr<nsRunnable> func(new ConnectBluetoothSocketRunnable(runnable,
|
||||
nsRefPtr<nsRunnable> func(new CreateBluetoothSocketRunnable(runnable,
|
||||
aConsumer,
|
||||
aObjectPath,
|
||||
aService, aType,
|
||||
@ -2435,63 +2409,3 @@ BluetoothDBusService::GetSocketViaService(const nsAString& aObjectPath,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
class ListenBluetoothSocketRunnable : public nsRunnable
|
||||
{
|
||||
public:
|
||||
ListenBluetoothSocketRunnable(UnixSocketConsumer* aConsumer,
|
||||
int aChannel,
|
||||
BluetoothSocketType aType,
|
||||
bool aAuth,
|
||||
bool aEncrypt)
|
||||
: mConsumer(aConsumer)
|
||||
, mChannel(aChannel)
|
||||
, mType(aType)
|
||||
, mAuth(aAuth)
|
||||
, mEncrypt(aEncrypt)
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
Run()
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
BluetoothUnixSocketConnector* c =
|
||||
new BluetoothUnixSocketConnector(mType, mChannel, mAuth, mEncrypt);
|
||||
if (!mConsumer->ListenSocket(c)) {
|
||||
NS_WARNING("Can't listen on socket!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<UnixSocketConsumer> mConsumer;
|
||||
int mChannel;
|
||||
BluetoothSocketType mType;
|
||||
bool mAuth;
|
||||
bool mEncrypt;
|
||||
};
|
||||
|
||||
nsresult
|
||||
BluetoothDBusService::ListenSocketViaService(int aChannel,
|
||||
BluetoothSocketType aType,
|
||||
bool aAuth,
|
||||
bool aEncrypt,
|
||||
mozilla::ipc::UnixSocketConsumer* aConsumer)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Must be called from main thread!");
|
||||
if (!mConnection || !gThreadConnection) {
|
||||
NS_ERROR("Bluetooth service not started yet!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsRefPtr<nsRunnable> func(new ListenBluetoothSocketRunnable(aConsumer,
|
||||
aChannel, aType,
|
||||
aAuth,
|
||||
aEncrypt));
|
||||
if (NS_FAILED(mBluetoothCommandThread->Dispatch(func, NS_DISPATCH_NORMAL))) {
|
||||
NS_WARNING("Cannot dispatch firmware loading task!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -58,20 +58,6 @@ public:
|
||||
const nsAString& aDeviceAddress,
|
||||
nsAString& aDevicePath);
|
||||
|
||||
static bool
|
||||
AddServiceRecords(const nsAString& aAdapterPath,
|
||||
const char* serviceName,
|
||||
unsigned long long uuidMsb,
|
||||
unsigned long long uuidLsb,
|
||||
int channel);
|
||||
|
||||
static bool
|
||||
RemoveServiceRecords(const nsAString& aAdapterPath,
|
||||
const char* serviceName,
|
||||
unsigned long long uuidMsb,
|
||||
unsigned long long uuidLsb,
|
||||
int channel);
|
||||
|
||||
static bool
|
||||
AddReservedServicesInternal(const nsAString& aAdapterPath,
|
||||
const nsTArray<uint32_t>& aServices,
|
||||
@ -96,13 +82,6 @@ public:
|
||||
mozilla::ipc::UnixSocketConsumer* aConsumer,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual nsresult
|
||||
ListenSocketViaService(int aChannel,
|
||||
BluetoothSocketType aType,
|
||||
bool aAuth,
|
||||
bool aEncrypt,
|
||||
mozilla::ipc::UnixSocketConsumer* aConsumer);
|
||||
|
||||
virtual nsresult
|
||||
CreatePairedDeviceInternal(const nsAString& aAdapterPath,
|
||||
const nsAString& aDeviceAddress,
|
||||
|
@ -264,7 +264,7 @@ DBusMessage * dbus_func_args_error(DBusConnection *conn,
|
||||
int dbus_returns_int32(DBusMessage *reply)
|
||||
{
|
||||
DBusError err;
|
||||
int32_t ret = -1;
|
||||
int ret = -1;
|
||||
|
||||
dbus_error_init(&err);
|
||||
if (!dbus_message_get_args(reply, &err,
|
||||
@ -277,21 +277,5 @@ int dbus_returns_int32(DBusMessage *reply)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int dbus_returns_uint32(DBusMessage *reply)
|
||||
{
|
||||
DBusError err;
|
||||
uint32_t ret = -1;
|
||||
|
||||
dbus_error_init(&err);
|
||||
if (!dbus_message_get_args(reply, &err,
|
||||
DBUS_TYPE_UINT32, &ret,
|
||||
DBUS_TYPE_INVALID)) {
|
||||
LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, reply);
|
||||
}
|
||||
|
||||
dbus_message_unref(reply);
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -108,8 +108,6 @@ DBusMessage* dbus_func_args_timeout_valist(DBusConnection* conn,
|
||||
|
||||
int dbus_returns_int32(DBusMessage *reply);
|
||||
|
||||
int dbus_returns_uint32(DBusMessage *reply);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user