2012-09-26 17:34:55 +04: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 16:24:06 +04:00
|
|
|
#include "BluetoothRilListener.h"
|
2012-09-26 17:34:55 +04:00
|
|
|
#include "mozilla/ipc/UnixSocket.h"
|
2012-09-25 14:18:38 +04:00
|
|
|
#include "nsIObserver.h"
|
2012-09-26 17:34:55 +04:00
|
|
|
|
|
|
|
BEGIN_BLUETOOTH_NAMESPACE
|
|
|
|
|
|
|
|
class BluetoothReplyRunnable;
|
2012-10-06 04:11:24 +04:00
|
|
|
class BluetoothHfpManagerObserver;
|
2012-09-26 17:34:55 +04:00
|
|
|
|
|
|
|
class BluetoothHfpManager : public mozilla::ipc::UnixSocketConsumer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
~BluetoothHfpManager();
|
|
|
|
static BluetoothHfpManager* Get();
|
2012-10-11 09:49:11 +04:00
|
|
|
virtual void ReceiveSocketData(mozilla::ipc::UnixSocketRawData* aMessage)
|
|
|
|
MOZ_OVERRIDE;
|
2012-09-26 17:34:55 +04:00
|
|
|
bool Connect(const nsAString& aDeviceObjectPath,
|
2012-10-05 14:48:05 +04:00
|
|
|
const bool aIsHandsfree,
|
2012-09-26 17:34:55 +04:00
|
|
|
BluetoothReplyRunnable* aRunnable);
|
|
|
|
void Disconnect();
|
2012-09-27 06:24:39 +04:00
|
|
|
bool SendLine(const char* aMessage);
|
2012-10-22 14:34:15 +04:00
|
|
|
bool SendCommand(const char* aCommand, const int aValue);
|
2012-09-27 09:15:22 +04:00
|
|
|
void CallStateChanged(int aCallIndex, int aCallState,
|
|
|
|
const char* aNumber, bool aIsActive);
|
2012-10-09 15:19:29 +04:00
|
|
|
void EnumerateCallState(int aCallIndex, int aCallState,
|
|
|
|
const char* aNumber, bool aIsActive);
|
2012-10-22 14:34:15 +04:00
|
|
|
void SetupCIND(int aCallIndex, int aCallState, bool aInitial);
|
2012-10-01 11:04:01 +04:00
|
|
|
bool Listen();
|
2012-10-03 09:53:39 +04:00
|
|
|
|
2012-09-26 17:34:55 +04:00
|
|
|
private:
|
2012-10-06 04:11:24 +04:00
|
|
|
friend class BluetoothHfpManagerObserver;
|
2012-09-26 17:34:55 +04:00
|
|
|
BluetoothHfpManager();
|
2012-09-25 14:18:38 +04:00
|
|
|
nsresult HandleVolumeChanged(const nsAString& aData);
|
2012-10-03 09:53:39 +04:00
|
|
|
nsresult HandleShutdown();
|
2012-10-06 04:11:24 +04:00
|
|
|
bool Init();
|
|
|
|
void Cleanup();
|
2012-10-01 11:44:48 +04:00
|
|
|
void NotifyDialer(const nsAString& aCommand);
|
2012-10-22 14:34:15 +04:00
|
|
|
void NotifySettings();
|
2012-10-11 09:49:11 +04:00
|
|
|
virtual void OnConnectSuccess() MOZ_OVERRIDE;
|
|
|
|
virtual void OnConnectError() MOZ_OVERRIDE;
|
2012-10-12 22:38:14 +04:00
|
|
|
virtual void OnDisconnect() MOZ_OVERRIDE;
|
2012-09-25 14:18:38 +04:00
|
|
|
|
2012-09-27 06:24:39 +04:00
|
|
|
int mCurrentVgs;
|
2012-09-27 09:15:33 +04:00
|
|
|
int mCurrentCallIndex;
|
|
|
|
int mCurrentCallState;
|
2012-09-27 16:24:06 +04:00
|
|
|
nsAutoPtr<BluetoothRilListener> mListener;
|
2012-09-26 17:34:55 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
END_BLUETOOTH_NAMESPACE
|
|
|
|
|
|
|
|
#endif
|