2012-07-17 20:41:54 -07:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
2012-08-16 19:53:45 -07:00
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
2012-07-17 20:41:54 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_bluetooth_bluetoothdbuseventservice_h__
|
|
|
|
#define mozilla_dom_bluetooth_bluetoothdbuseventservice_h__
|
|
|
|
|
|
|
|
#include "BluetoothCommon.h"
|
|
|
|
#include "mozilla/ipc/RawDBusConnection.h"
|
|
|
|
#include "BluetoothService.h"
|
|
|
|
|
|
|
|
class DBusMessage;
|
|
|
|
|
|
|
|
BEGIN_BLUETOOTH_NAMESPACE
|
|
|
|
|
|
|
|
/**
|
2012-07-31 21:49:59 -07:00
|
|
|
* BluetoothDBusService is the implementation of BluetoothService for DBus on
|
|
|
|
* linux/android/B2G. Function comments are in BluetoothService.h
|
2012-07-17 20:41:54 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
class BluetoothDBusService : public BluetoothService
|
|
|
|
, private mozilla::ipc::RawDBusConnection
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual nsresult StartInternal();
|
|
|
|
virtual nsresult StopInternal();
|
|
|
|
virtual nsresult GetDefaultAdapterPathInternal(BluetoothReplyRunnable* aRunnable);
|
2012-08-16 19:53:45 -07:00
|
|
|
virtual nsresult GetPairedDevicePropertiesInternal(const nsTArray<nsString>& aDeviceAddresses,
|
|
|
|
BluetoothReplyRunnable* aRunnable);
|
2012-07-17 20:41:54 -07:00
|
|
|
virtual nsresult StartDiscoveryInternal(const nsAString& aAdapterPath,
|
|
|
|
BluetoothReplyRunnable* aRunnable);
|
|
|
|
virtual nsresult StopDiscoveryInternal(const nsAString& aAdapterPath,
|
|
|
|
BluetoothReplyRunnable* aRunnable);
|
2012-07-31 21:49:59 -07:00
|
|
|
virtual nsresult
|
|
|
|
GetProperties(BluetoothObjectType aType,
|
|
|
|
const nsAString& aPath,
|
|
|
|
BluetoothReplyRunnable* aRunnable);
|
|
|
|
virtual nsresult
|
|
|
|
SetProperty(BluetoothObjectType aType,
|
|
|
|
const nsAString& aPath,
|
|
|
|
const BluetoothNamedValue& aValue,
|
|
|
|
BluetoothReplyRunnable* aRunnable);
|
|
|
|
virtual bool
|
|
|
|
GetDevicePath(const nsAString& aAdapterPath,
|
|
|
|
const nsAString& aDeviceAddress,
|
|
|
|
nsAString& aDevicePath);
|
2012-08-07 21:19:07 -07:00
|
|
|
virtual int
|
|
|
|
GetDeviceServiceChannelInternal(const nsAString& aObjectPath,
|
|
|
|
const nsAString& aPattern,
|
|
|
|
int aAttributeId);
|
2012-07-17 20:41:54 -07:00
|
|
|
|
2012-08-09 20:17:06 -07:00
|
|
|
virtual nsTArray<PRUint32>
|
|
|
|
AddReservedServicesInternal(const nsAString& aAdapterPath,
|
|
|
|
const nsTArray<PRUint32>& aServices);
|
|
|
|
|
2012-08-09 20:17:06 -07:00
|
|
|
virtual bool
|
|
|
|
RemoveReservedServicesInternal(const nsAString& aAdapterPath,
|
|
|
|
const nsTArray<PRUint32>& aServiceHandles);
|
|
|
|
|
2012-08-17 03:35:59 -07:00
|
|
|
virtual nsresult
|
|
|
|
CreatePairedDeviceInternal(const nsAString& aAdapterPath,
|
|
|
|
const nsAString& aDeviceAddress,
|
|
|
|
int aTimeout,
|
|
|
|
BluetoothReplyRunnable* aRunnable);
|
|
|
|
|
|
|
|
virtual nsresult
|
|
|
|
RemoveDeviceInternal(const nsAString& aAdapterPath,
|
|
|
|
const nsAString& aDeviceObjectPath,
|
|
|
|
BluetoothReplyRunnable* aRunnable);
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
SetPinCodeInternal(const nsAString& aDeviceAddress, const nsAString& aPinCode);
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
SetPasskeyInternal(const nsAString& aDeviceAddress, PRUint32 aPasskey);
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
SetPairingConfirmationInternal(const nsAString& aDeviceAddress, bool aConfirm);
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
SetAuthorizationInternal(const nsAString& aDeviceAddress, bool aAllow);
|
|
|
|
|
2012-07-17 20:41:54 -07:00
|
|
|
private:
|
2012-07-31 21:49:59 -07:00
|
|
|
nsresult SendGetPropertyMessage(const nsAString& aPath,
|
|
|
|
const char* aInterface,
|
|
|
|
void (*aCB)(DBusMessage *, void *),
|
|
|
|
BluetoothReplyRunnable* aRunnable);
|
2012-07-17 20:41:54 -07:00
|
|
|
nsresult SendDiscoveryMessage(const nsAString& aAdapterPath,
|
|
|
|
const char* aMessageName,
|
|
|
|
BluetoothReplyRunnable* aRunnable);
|
2012-07-31 21:49:59 -07:00
|
|
|
nsresult SendSetPropertyMessage(const nsString& aPath, const char* aInterface,
|
|
|
|
const BluetoothNamedValue& aValue,
|
|
|
|
BluetoothReplyRunnable* aRunnable);
|
2012-07-17 20:41:54 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
END_BLUETOOTH_NAMESPACE
|
|
|
|
|
|
|
|
#endif
|