dom/bluetooth/ipc/BluetoothServiceChildProcess.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
     2 /* vim: set ts=2 et sw=2 tw=80: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     5  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef mozilla_dom_bluetooth_ipc_bluetoothservicechildprocess_h__
     8 #define mozilla_dom_bluetooth_ipc_bluetoothservicechildprocess_h__
    10 #include "BluetoothService.h"
    12 namespace mozilla {
    13 namespace ipc {
    14 class UnixSocketConsumer;
    15 }
    16 namespace dom {
    17 namespace bluetooth {
    19 class BluetoothChild;
    21 } // namespace bluetooth
    22 } // namespace dom
    23 } // namespace mozilla
    26 BEGIN_BLUETOOTH_NAMESPACE
    28 class BluetoothServiceChildProcess : public BluetoothService
    29 {
    30   friend class mozilla::dom::bluetooth::BluetoothChild;
    32 public:
    33   static BluetoothServiceChildProcess*
    34   Create();
    36   virtual void
    37   RegisterBluetoothSignalHandler(const nsAString& aNodeName,
    38                                  BluetoothSignalObserver* aMsgHandler)
    39                                  MOZ_OVERRIDE;
    41   virtual void
    42   UnregisterBluetoothSignalHandler(const nsAString& aNodeName,
    43                                    BluetoothSignalObserver* aMsgHandler)
    44                                    MOZ_OVERRIDE;
    46   virtual nsresult
    47   GetDefaultAdapterPathInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
    49   virtual nsresult
    50   GetPairedDevicePropertiesInternal(const nsTArray<nsString>& aDeviceAddresses,
    51                                     BluetoothReplyRunnable* aRunnable)
    52                                     MOZ_OVERRIDE;
    54   virtual nsresult
    55   GetConnectedDevicePropertiesInternal(uint16_t aServiceUuid,
    56                                        BluetoothReplyRunnable* aRunnable)
    57                                        MOZ_OVERRIDE;
    58   virtual nsresult
    59   StopDiscoveryInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
    61   virtual nsresult
    62   StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
    64   virtual nsresult
    65   SetProperty(BluetoothObjectType aType,
    66               const BluetoothNamedValue& aValue,
    67               BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
    69   virtual nsresult
    70   CreatePairedDeviceInternal(const nsAString& aAddress,
    71                              int aTimeout,
    72                              BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
    74   virtual nsresult
    75   RemoveDeviceInternal(const nsAString& aObjectPath,
    76                        BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
    78   virtual nsresult
    79   GetServiceChannel(const nsAString& aDeviceAddress,
    80                     const nsAString& aServiceUuid,
    81                     BluetoothProfileManagerBase* aManager) MOZ_OVERRIDE;
    83   virtual bool
    84   UpdateSdpRecords(const nsAString& aDeviceAddress,
    85                    BluetoothProfileManagerBase* aManager) MOZ_OVERRIDE;
    87   virtual bool
    88   SetPinCodeInternal(const nsAString& aDeviceAddress,
    89                      const nsAString& aPinCode,
    90                      BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
    92   virtual bool
    93   SetPasskeyInternal(const nsAString& aDeviceAddress,
    94                      uint32_t aPasskey,
    95                      BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
    97   virtual bool
    98   SetPairingConfirmationInternal(const nsAString& aDeviceAddress,
    99                                  bool aConfirm,
   100                                  BluetoothReplyRunnable* aRunnable)
   101                                  MOZ_OVERRIDE;
   103   virtual void
   104   Connect(const nsAString& aDeviceAddress,
   105           uint32_t aCod,
   106           uint16_t aServiceUuid,
   107           BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
   109   virtual void
   110   Disconnect(const nsAString& aDeviceAddress,
   111              uint16_t aServiceUuid,
   112              BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
   114   virtual bool
   115   IsConnected(uint16_t aServiceUuid) MOZ_OVERRIDE;
   117   virtual void
   118   SendFile(const nsAString& aDeviceAddress,
   119            BlobParent* aBlobParent,
   120            BlobChild* aBlobChild,
   121            BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
   123   virtual void
   124   SendFile(const nsAString& aDeviceAddress,
   125            nsIDOMBlob* aBlob,
   126            BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
   128   virtual void
   129   StopSendingFile(const nsAString& aDeviceAddress,
   130                   BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
   132   virtual void
   133   ConfirmReceivingFile(const nsAString& aDeviceAddress,
   134                        bool aConfirm,
   135                        BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
   137   virtual void
   138   ConnectSco(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
   140   virtual void
   141   DisconnectSco(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
   143   virtual void
   144   IsScoConnected(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
   146 #ifdef MOZ_B2G_RIL
   147   virtual void
   148   AnswerWaitingCall(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
   150   virtual void
   151   IgnoreWaitingCall(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
   153   virtual void
   154   ToggleCalls(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
   155 #endif
   157   virtual void
   158   SendMetaData(const nsAString& aTitle,
   159                const nsAString& aArtist,
   160                const nsAString& aAlbum,
   161                int64_t aMediaNumber,
   162                int64_t aTotalMediaCount,
   163                int64_t aDuration,
   164                BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
   166   virtual void
   167   SendPlayStatus(int64_t aDuration,
   168                  int64_t aPosition,
   169                  const nsAString& aPlayStatus,
   170                  BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
   172   virtual void
   173   UpdatePlayStatus(uint32_t aDuration,
   174                    uint32_t aPosition,
   175                    ControlPlayStatus aPlayStatus) MOZ_OVERRIDE;
   177   virtual nsresult
   178   SendSinkMessage(const nsAString& aDeviceAddresses,
   179                   const nsAString& aMessage) MOZ_OVERRIDE;
   181   virtual nsresult
   182   SendInputMessage(const nsAString& aDeviceAddresses,
   183                    const nsAString& aMessage) MOZ_OVERRIDE;
   185 protected:
   186   BluetoothServiceChildProcess();
   187   virtual ~BluetoothServiceChildProcess();
   189   void
   190   NoteDeadActor();
   192   void
   193   NoteShutdownInitiated();
   195   virtual nsresult
   196   HandleStartup() MOZ_OVERRIDE;
   198   virtual nsresult
   199   HandleShutdown() MOZ_OVERRIDE;
   201 private:
   202   // This method should never be called.
   203   virtual nsresult
   204   StartInternal() MOZ_OVERRIDE;
   206   // This method should never be called.
   207   virtual nsresult
   208   StopInternal() MOZ_OVERRIDE;
   210   bool
   211   IsSignalRegistered(const nsAString& aNodeName) {
   212     return !!mBluetoothSignalObserverTable.Get(aNodeName);
   213   }
   214 };
   216 END_BLUETOOTH_NAMESPACE
   218 #endif // mozilla_dom_bluetooth_ipc_bluetoothservicechildprocess_h__

mercurial