dom/bluetooth/ipc/PBluetooth.ipdl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/bluetooth/ipc/PBluetooth.ipdl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,295 @@
     1.4 +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
     1.5 +/* vim: set ts=2 et sw=2 tw=80: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.8 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +include protocol PBlob;
    1.11 +include protocol PBluetoothRequest;
    1.12 +include protocol PContent;
    1.13 +
    1.14 +include BluetoothTypes;
    1.15 +
    1.16 +include "mozilla/dom/bluetooth/ipc/BluetoothMessageUtils.h";
    1.17 +
    1.18 +using mozilla::dom::bluetooth::BluetoothObjectType from "mozilla/dom/bluetooth/BluetoothCommon.h";
    1.19 +
    1.20 +namespace mozilla {
    1.21 +namespace dom {
    1.22 +namespace bluetooth {
    1.23 +
    1.24 +/**
    1.25 + * Bluetooth request types.
    1.26 + */
    1.27 +
    1.28 +struct DefaultAdapterPathRequest
    1.29 +{ };
    1.30 +
    1.31 +struct SetPropertyRequest
    1.32 +{
    1.33 +  BluetoothObjectType type;
    1.34 +  BluetoothNamedValue value;
    1.35 +};
    1.36 +
    1.37 +struct GetPropertyRequest
    1.38 +{
    1.39 +  BluetoothObjectType type;
    1.40 +  nsString path;
    1.41 +};
    1.42 +
    1.43 +struct StartDiscoveryRequest
    1.44 +{
    1.45 +};
    1.46 +
    1.47 +struct StopDiscoveryRequest
    1.48 +{
    1.49 +};
    1.50 +
    1.51 +struct PairRequest
    1.52 +{
    1.53 +  nsString address;
    1.54 +  uint32_t timeoutMS;
    1.55 +};
    1.56 +
    1.57 +struct UnpairRequest
    1.58 +{
    1.59 +  nsString address;
    1.60 +};
    1.61 +
    1.62 +struct SetPinCodeRequest
    1.63 +{
    1.64 +  nsString path;
    1.65 +  nsString pincode;
    1.66 +};
    1.67 +
    1.68 +struct SetPasskeyRequest
    1.69 +{
    1.70 +  nsString path;
    1.71 +  uint32_t passkey;
    1.72 +};
    1.73 +
    1.74 +struct ConfirmPairingConfirmationRequest
    1.75 +{
    1.76 +  nsString path;
    1.77 +};
    1.78 +
    1.79 +struct DenyPairingConfirmationRequest
    1.80 +{
    1.81 +  nsString path;
    1.82 +};
    1.83 +
    1.84 +struct PairedDevicePropertiesRequest
    1.85 +{
    1.86 +  nsString[] addresses;
    1.87 +};
    1.88 +
    1.89 +struct ConnectedDevicePropertiesRequest
    1.90 +{
    1.91 +  uint16_t serviceUuid;
    1.92 +};
    1.93 +
    1.94 +struct ConnectRequest
    1.95 +{
    1.96 +  nsString address;
    1.97 +  uint32_t cod;
    1.98 +  uint16_t serviceUuid;
    1.99 +};
   1.100 +
   1.101 +struct DisconnectRequest
   1.102 +{
   1.103 +  nsString address;
   1.104 +  uint16_t serviceUuid;
   1.105 +};
   1.106 +
   1.107 +struct SendFileRequest
   1.108 +{
   1.109 +  nsString devicePath;
   1.110 +  PBlob blob;
   1.111 +};
   1.112 +
   1.113 +struct StopSendingFileRequest
   1.114 +{
   1.115 +  nsString devicePath;
   1.116 +};
   1.117 +
   1.118 +struct ConfirmReceivingFileRequest
   1.119 +{
   1.120 +  nsString devicePath;
   1.121 +};
   1.122 +
   1.123 +struct DenyReceivingFileRequest
   1.124 +{
   1.125 +  nsString devicePath;
   1.126 +};
   1.127 +
   1.128 +struct ConnectScoRequest
   1.129 +{
   1.130 +};
   1.131 +
   1.132 +struct DisconnectScoRequest
   1.133 +{
   1.134 +};
   1.135 +
   1.136 +struct IsScoConnectedRequest
   1.137 +{
   1.138 +};
   1.139 +
   1.140 +struct AnswerWaitingCallRequest
   1.141 +{
   1.142 +};
   1.143 +
   1.144 +struct IgnoreWaitingCallRequest
   1.145 +{
   1.146 +};
   1.147 +
   1.148 +struct ToggleCallsRequest
   1.149 +{
   1.150 +};
   1.151 +
   1.152 +struct SendMetaDataRequest
   1.153 +{
   1.154 +  nsString title;
   1.155 +  nsString artist;
   1.156 +  nsString album;
   1.157 +  int64_t mediaNumber;
   1.158 +  int64_t totalMediaCount;
   1.159 +  int64_t duration;
   1.160 +};
   1.161 +
   1.162 +struct SendPlayStatusRequest
   1.163 +{
   1.164 +  int64_t duration;
   1.165 +  int64_t position;
   1.166 +  nsString playStatus;
   1.167 +};
   1.168 +
   1.169 +union Request
   1.170 +{
   1.171 +  DefaultAdapterPathRequest;
   1.172 +  SetPropertyRequest;
   1.173 +  GetPropertyRequest;
   1.174 +  StartDiscoveryRequest;
   1.175 +  StopDiscoveryRequest;
   1.176 +  PairRequest;
   1.177 +  UnpairRequest;
   1.178 +  SetPinCodeRequest;
   1.179 +  SetPasskeyRequest;
   1.180 +  ConfirmPairingConfirmationRequest;
   1.181 +  DenyPairingConfirmationRequest;
   1.182 +  ConnectedDevicePropertiesRequest;
   1.183 +  PairedDevicePropertiesRequest;
   1.184 +  ConnectRequest;
   1.185 +  DisconnectRequest;
   1.186 +  SendFileRequest;
   1.187 +  StopSendingFileRequest;
   1.188 +  ConfirmReceivingFileRequest;
   1.189 +  DenyReceivingFileRequest;
   1.190 +  ConnectScoRequest;
   1.191 +  DisconnectScoRequest;
   1.192 +  IsScoConnectedRequest;
   1.193 +  AnswerWaitingCallRequest;
   1.194 +  IgnoreWaitingCallRequest;
   1.195 +  ToggleCallsRequest;
   1.196 +  SendMetaDataRequest;
   1.197 +  SendPlayStatusRequest;
   1.198 +};
   1.199 +
   1.200 +protocol PBluetooth
   1.201 +{
   1.202 +  manager PContent;
   1.203 +  manages PBluetoothRequest;
   1.204 +
   1.205 +  /**
   1.206 +   * The potential exists for a racy shutdown so the following sequence of
   1.207 +   * messages is used to shutdown safely:
   1.208 +   *
   1.209 +   *   1. [BeginShutdown]       (Parent -> Child [Optional])
   1.210 +   *   2. StopNotifying         (Child  -> Parent)
   1.211 +   *   3. NotificationsStopped  (Parent -> Child)
   1.212 +   *   4. __delete__()          (Child  -> Parent)
   1.213 +   */
   1.214 +
   1.215 +child:
   1.216 +  /**
   1.217 +   * Sent when a settings change has enabled or disabled the bluetooth firmware.
   1.218 +   */
   1.219 +  Enabled(bool enabled);
   1.220 +
   1.221 +  /**
   1.222 +   * Sent when a bluetooth signal is broadcasted to child processes.
   1.223 +   */
   1.224 +  Notify(BluetoothSignal signal);
   1.225 +
   1.226 +  /**
   1.227 +   * Sent when the parent process is about to be shut down. See shutdown note
   1.228 +   * above.
   1.229 +   */
   1.230 +  BeginShutdown();
   1.231 +
   1.232 +  /**
   1.233 +   * Sent to inform the child process that it will no longer receive any
   1.234 +   * messages from the parent. See shutdown note above.
   1.235 +   */
   1.236 +  NotificationsStopped();
   1.237 +
   1.238 +parent:
   1.239 +  /**
   1.240 +   * Sent when the child no longer needs to use bluetooth. See shutdown note
   1.241 +   * above.
   1.242 +   */
   1.243 +  __delete__();
   1.244 +
   1.245 +  /**
   1.246 +   * Sent when the child needs to receive signals related to the given node.
   1.247 +   */
   1.248 +  RegisterSignalHandler(nsString node);
   1.249 +
   1.250 +  /**
   1.251 +   * Sent when the child no longer needs to receive signals related to the given
   1.252 +   * node.
   1.253 +   */
   1.254 +  UnregisterSignalHandler(nsString node);
   1.255 +
   1.256 +  /**
   1.257 +   * Sent when the child no longer needs to receive any messages from the
   1.258 +   * parent. See shutdown note above.
   1.259 +   */
   1.260 +  StopNotifying();
   1.261 +
   1.262 +  /**
   1.263 +   * Sent when the child makes an asynchronous request to the parent.
   1.264 +   */
   1.265 +  PBluetoothRequest(Request request);
   1.266 +
   1.267 +  /**
   1.268 +   * FIXME: Bug 547703.
   1.269 +   *
   1.270 +   * This is the state machine we want:
   1.271 +   *
   1.272 +   * start state NOTIFYING:
   1.273 +   *   send Enabled goto NOTIFYING;
   1.274 +   *   send Notify goto NOTIFYING;
   1.275 +   *   recv RegisterSignalHandler goto NOTIFYING;
   1.276 +   *   recv UnregisterSignalHandler goto NOTIFYING;
   1.277 +   *   send BeginShutdown goto PARENT_DONE;
   1.278 +   *   recv StopNotifying goto CHILD_DONE;
   1.279 +   *
   1.280 +   * state PARENT_DONE:
   1.281 +   *   recv RegisterSignalHandler goto PARENT_DONE;
   1.282 +   *   recv UnregisterSignalHandler goto PARENT_DONE;
   1.283 +   *   recv StopNotifying goto CHILD_DONE;
   1.284 +   *
   1.285 +   * state CHILD_DONE:
   1.286 +   *   send Enabled goto CHILD_DONE;
   1.287 +   *   send Notify goto CHILD_DONE;
   1.288 +   *   send BeginShutdown goto CHILD_DONE;
   1.289 +   *   send NotificationsStopped goto DONE;
   1.290 +   *
   1.291 +   * state DONE:
   1.292 +   *   recv __delete__;
   1.293 +   */
   1.294 +};
   1.295 +
   1.296 +} // namespace bluetooth
   1.297 +} // namespace dom
   1.298 +} // namespace mozilla

mercurial