2012-09-26 06:34:55 -07:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* 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_bluetoothhfpmanager_h__
|
|
|
|
#define mozilla_dom_bluetooth_bluetoothhfpmanager_h__
|
|
|
|
|
|
|
|
#include "BluetoothCommon.h"
|
2012-09-27 05:24:06 -07:00
|
|
|
#include "BluetoothRilListener.h"
|
2012-09-26 06:34:55 -07:00
|
|
|
#include "mozilla/ipc/UnixSocket.h"
|
2012-09-25 03:18:38 -07:00
|
|
|
#include "nsIObserver.h"
|
2012-09-26 06:34:55 -07:00
|
|
|
|
|
|
|
BEGIN_BLUETOOTH_NAMESPACE
|
|
|
|
|
|
|
|
class BluetoothReplyRunnable;
|
2012-10-05 17:11:24 -07:00
|
|
|
class BluetoothHfpManagerObserver;
|
2012-09-26 06:34:55 -07:00
|
|
|
|
|
|
|
class BluetoothHfpManager : public mozilla::ipc::UnixSocketConsumer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
~BluetoothHfpManager();
|
|
|
|
static BluetoothHfpManager* Get();
|
2012-10-10 22:49:11 -07:00
|
|
|
virtual void ReceiveSocketData(mozilla::ipc::UnixSocketRawData* aMessage)
|
|
|
|
MOZ_OVERRIDE;
|
2012-09-26 06:34:55 -07:00
|
|
|
bool Connect(const nsAString& aDeviceObjectPath,
|
2012-10-05 03:48:05 -07:00
|
|
|
const bool aIsHandsfree,
|
2012-09-26 06:34:55 -07:00
|
|
|
BluetoothReplyRunnable* aRunnable);
|
|
|
|
void Disconnect();
|
2012-09-26 19:24:39 -07:00
|
|
|
bool SendLine(const char* aMessage);
|
2012-09-26 22:15:22 -07:00
|
|
|
void CallStateChanged(int aCallIndex, int aCallState,
|
|
|
|
const char* aNumber, bool aIsActive);
|
2012-10-09 04:19:29 -07:00
|
|
|
void EnumerateCallState(int aCallIndex, int aCallState,
|
|
|
|
const char* aNumber, bool aIsActive);
|
2012-10-01 00:04:01 -07:00
|
|
|
bool Listen();
|
2012-10-02 22:53:39 -07:00
|
|
|
|
2012-09-26 06:34:55 -07:00
|
|
|
private:
|
2012-10-05 17:11:24 -07:00
|
|
|
friend class BluetoothHfpManagerObserver;
|
2012-09-26 06:34:55 -07:00
|
|
|
BluetoothHfpManager();
|
2012-09-25 03:18:38 -07:00
|
|
|
nsresult HandleVolumeChanged(const nsAString& aData);
|
2012-10-02 22:53:39 -07:00
|
|
|
nsresult HandleShutdown();
|
2012-10-05 17:11:24 -07:00
|
|
|
bool Init();
|
|
|
|
void Cleanup();
|
2012-10-01 00:44:48 -07:00
|
|
|
void NotifyDialer(const nsAString& aCommand);
|
|
|
|
void NotifySettings(const bool aConnected);
|
2012-10-10 22:49:11 -07:00
|
|
|
virtual void OnConnectSuccess() MOZ_OVERRIDE;
|
|
|
|
virtual void OnConnectError() MOZ_OVERRIDE;
|
2012-10-12 11:38:14 -07:00
|
|
|
virtual void OnDisconnect() MOZ_OVERRIDE;
|
2012-09-25 03:18:38 -07:00
|
|
|
|
2012-09-26 19:24:39 -07:00
|
|
|
int mCurrentVgs;
|
2012-09-26 22:15:33 -07:00
|
|
|
int mCurrentCallIndex;
|
|
|
|
int mCurrentCallState;
|
2012-10-09 04:19:29 -07:00
|
|
|
int mCall;
|
|
|
|
int mCallSetup;
|
|
|
|
int mCallHeld;
|
2012-09-27 05:24:06 -07:00
|
|
|
nsAutoPtr<BluetoothRilListener> mListener;
|
2012-09-29 02:39:05 -07:00
|
|
|
nsString mDevicePath;
|
2012-09-26 06:34:55 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
END_BLUETOOTH_NAMESPACE
|
|
|
|
|
|
|
|
#endif
|