michael@0: /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: include protocol PBlob; michael@0: include protocol PBluetoothRequest; michael@0: include protocol PContent; michael@0: michael@0: include BluetoothTypes; michael@0: michael@0: include "mozilla/dom/bluetooth/ipc/BluetoothMessageUtils.h"; michael@0: michael@0: using mozilla::dom::bluetooth::BluetoothObjectType from "mozilla/dom/bluetooth/BluetoothCommon.h"; michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: namespace bluetooth { michael@0: michael@0: /** michael@0: * Bluetooth request types. michael@0: */ michael@0: michael@0: struct DefaultAdapterPathRequest michael@0: { }; michael@0: michael@0: struct SetPropertyRequest michael@0: { michael@0: BluetoothObjectType type; michael@0: BluetoothNamedValue value; michael@0: }; michael@0: michael@0: struct GetPropertyRequest michael@0: { michael@0: BluetoothObjectType type; michael@0: nsString path; michael@0: }; michael@0: michael@0: struct StartDiscoveryRequest michael@0: { michael@0: }; michael@0: michael@0: struct StopDiscoveryRequest michael@0: { michael@0: }; michael@0: michael@0: struct PairRequest michael@0: { michael@0: nsString address; michael@0: uint32_t timeoutMS; michael@0: }; michael@0: michael@0: struct UnpairRequest michael@0: { michael@0: nsString address; michael@0: }; michael@0: michael@0: struct SetPinCodeRequest michael@0: { michael@0: nsString path; michael@0: nsString pincode; michael@0: }; michael@0: michael@0: struct SetPasskeyRequest michael@0: { michael@0: nsString path; michael@0: uint32_t passkey; michael@0: }; michael@0: michael@0: struct ConfirmPairingConfirmationRequest michael@0: { michael@0: nsString path; michael@0: }; michael@0: michael@0: struct DenyPairingConfirmationRequest michael@0: { michael@0: nsString path; michael@0: }; michael@0: michael@0: struct PairedDevicePropertiesRequest michael@0: { michael@0: nsString[] addresses; michael@0: }; michael@0: michael@0: struct ConnectedDevicePropertiesRequest michael@0: { michael@0: uint16_t serviceUuid; michael@0: }; michael@0: michael@0: struct ConnectRequest michael@0: { michael@0: nsString address; michael@0: uint32_t cod; michael@0: uint16_t serviceUuid; michael@0: }; michael@0: michael@0: struct DisconnectRequest michael@0: { michael@0: nsString address; michael@0: uint16_t serviceUuid; michael@0: }; michael@0: michael@0: struct SendFileRequest michael@0: { michael@0: nsString devicePath; michael@0: PBlob blob; michael@0: }; michael@0: michael@0: struct StopSendingFileRequest michael@0: { michael@0: nsString devicePath; michael@0: }; michael@0: michael@0: struct ConfirmReceivingFileRequest michael@0: { michael@0: nsString devicePath; michael@0: }; michael@0: michael@0: struct DenyReceivingFileRequest michael@0: { michael@0: nsString devicePath; michael@0: }; michael@0: michael@0: struct ConnectScoRequest michael@0: { michael@0: }; michael@0: michael@0: struct DisconnectScoRequest michael@0: { michael@0: }; michael@0: michael@0: struct IsScoConnectedRequest michael@0: { michael@0: }; michael@0: michael@0: struct AnswerWaitingCallRequest michael@0: { michael@0: }; michael@0: michael@0: struct IgnoreWaitingCallRequest michael@0: { michael@0: }; michael@0: michael@0: struct ToggleCallsRequest michael@0: { michael@0: }; michael@0: michael@0: struct SendMetaDataRequest michael@0: { michael@0: nsString title; michael@0: nsString artist; michael@0: nsString album; michael@0: int64_t mediaNumber; michael@0: int64_t totalMediaCount; michael@0: int64_t duration; michael@0: }; michael@0: michael@0: struct SendPlayStatusRequest michael@0: { michael@0: int64_t duration; michael@0: int64_t position; michael@0: nsString playStatus; michael@0: }; michael@0: michael@0: union Request michael@0: { michael@0: DefaultAdapterPathRequest; michael@0: SetPropertyRequest; michael@0: GetPropertyRequest; michael@0: StartDiscoveryRequest; michael@0: StopDiscoveryRequest; michael@0: PairRequest; michael@0: UnpairRequest; michael@0: SetPinCodeRequest; michael@0: SetPasskeyRequest; michael@0: ConfirmPairingConfirmationRequest; michael@0: DenyPairingConfirmationRequest; michael@0: ConnectedDevicePropertiesRequest; michael@0: PairedDevicePropertiesRequest; michael@0: ConnectRequest; michael@0: DisconnectRequest; michael@0: SendFileRequest; michael@0: StopSendingFileRequest; michael@0: ConfirmReceivingFileRequest; michael@0: DenyReceivingFileRequest; michael@0: ConnectScoRequest; michael@0: DisconnectScoRequest; michael@0: IsScoConnectedRequest; michael@0: AnswerWaitingCallRequest; michael@0: IgnoreWaitingCallRequest; michael@0: ToggleCallsRequest; michael@0: SendMetaDataRequest; michael@0: SendPlayStatusRequest; michael@0: }; michael@0: michael@0: protocol PBluetooth michael@0: { michael@0: manager PContent; michael@0: manages PBluetoothRequest; michael@0: michael@0: /** michael@0: * The potential exists for a racy shutdown so the following sequence of michael@0: * messages is used to shutdown safely: michael@0: * michael@0: * 1. [BeginShutdown] (Parent -> Child [Optional]) michael@0: * 2. StopNotifying (Child -> Parent) michael@0: * 3. NotificationsStopped (Parent -> Child) michael@0: * 4. __delete__() (Child -> Parent) michael@0: */ michael@0: michael@0: child: michael@0: /** michael@0: * Sent when a settings change has enabled or disabled the bluetooth firmware. michael@0: */ michael@0: Enabled(bool enabled); michael@0: michael@0: /** michael@0: * Sent when a bluetooth signal is broadcasted to child processes. michael@0: */ michael@0: Notify(BluetoothSignal signal); michael@0: michael@0: /** michael@0: * Sent when the parent process is about to be shut down. See shutdown note michael@0: * above. michael@0: */ michael@0: BeginShutdown(); michael@0: michael@0: /** michael@0: * Sent to inform the child process that it will no longer receive any michael@0: * messages from the parent. See shutdown note above. michael@0: */ michael@0: NotificationsStopped(); michael@0: michael@0: parent: michael@0: /** michael@0: * Sent when the child no longer needs to use bluetooth. See shutdown note michael@0: * above. michael@0: */ michael@0: __delete__(); michael@0: michael@0: /** michael@0: * Sent when the child needs to receive signals related to the given node. michael@0: */ michael@0: RegisterSignalHandler(nsString node); michael@0: michael@0: /** michael@0: * Sent when the child no longer needs to receive signals related to the given michael@0: * node. michael@0: */ michael@0: UnregisterSignalHandler(nsString node); michael@0: michael@0: /** michael@0: * Sent when the child no longer needs to receive any messages from the michael@0: * parent. See shutdown note above. michael@0: */ michael@0: StopNotifying(); michael@0: michael@0: /** michael@0: * Sent when the child makes an asynchronous request to the parent. michael@0: */ michael@0: PBluetoothRequest(Request request); michael@0: michael@0: /** michael@0: * FIXME: Bug 547703. michael@0: * michael@0: * This is the state machine we want: michael@0: * michael@0: * start state NOTIFYING: michael@0: * send Enabled goto NOTIFYING; michael@0: * send Notify goto NOTIFYING; michael@0: * recv RegisterSignalHandler goto NOTIFYING; michael@0: * recv UnregisterSignalHandler goto NOTIFYING; michael@0: * send BeginShutdown goto PARENT_DONE; michael@0: * recv StopNotifying goto CHILD_DONE; michael@0: * michael@0: * state PARENT_DONE: michael@0: * recv RegisterSignalHandler goto PARENT_DONE; michael@0: * recv UnregisterSignalHandler goto PARENT_DONE; michael@0: * recv StopNotifying goto CHILD_DONE; michael@0: * michael@0: * state CHILD_DONE: michael@0: * send Enabled goto CHILD_DONE; michael@0: * send Notify goto CHILD_DONE; michael@0: * send BeginShutdown goto CHILD_DONE; michael@0: * send NotificationsStopped goto DONE; michael@0: * michael@0: * state DONE: michael@0: * recv __delete__; michael@0: */ michael@0: }; michael@0: michael@0: } // namespace bluetooth michael@0: } // namespace dom michael@0: } // namespace mozilla