mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-11-04 10:05:51 +00:00
607 lines
11 KiB
Plaintext
607 lines
11 KiB
Plaintext
/* -*- 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/. */
|
|
|
|
include protocol PBlob;
|
|
include protocol PBluetoothRequest;
|
|
include protocol PContent;
|
|
|
|
include BluetoothTypes;
|
|
|
|
include "mozilla/dom/bluetooth/ipc/BluetoothMessageUtils.h";
|
|
|
|
using mozilla::dom::bluetooth::BluetoothAddress
|
|
from "mozilla/dom/bluetooth/BluetoothCommon.h";
|
|
using mozilla::dom::bluetooth::BluetoothObjectType
|
|
from "mozilla/dom/bluetooth/BluetoothCommon.h";
|
|
using mozilla::dom::bluetooth::BluetoothPinCode
|
|
from "mozilla/dom/bluetooth/BluetoothCommon.h";
|
|
using mozilla::dom::bluetooth::ControlPlayStatus
|
|
from "mozilla/dom/bluetooth/BluetoothCommon.h";
|
|
|
|
namespace mozilla {
|
|
namespace dom {
|
|
namespace bluetooth {
|
|
|
|
/**
|
|
* Bluetooth request types.
|
|
*/
|
|
|
|
struct GetAdaptersRequest
|
|
{ };
|
|
|
|
struct StartBluetoothRequest
|
|
{
|
|
};
|
|
|
|
struct StopBluetoothRequest
|
|
{
|
|
};
|
|
|
|
struct SetPropertyRequest
|
|
{
|
|
BluetoothObjectType type;
|
|
BluetoothNamedValue value;
|
|
};
|
|
|
|
struct GetPropertyRequest
|
|
{
|
|
BluetoothObjectType type;
|
|
BluetoothAddress address;
|
|
};
|
|
|
|
struct StartDiscoveryRequest
|
|
{
|
|
};
|
|
|
|
struct StopDiscoveryRequest
|
|
{
|
|
};
|
|
|
|
struct StartLeScanRequest
|
|
{
|
|
BluetoothUuid[] serviceUuids;
|
|
};
|
|
|
|
struct StopLeScanRequest
|
|
{
|
|
BluetoothUuid scanUuid;
|
|
};
|
|
|
|
struct PairRequest
|
|
{
|
|
BluetoothAddress address;
|
|
uint32_t timeoutMS;
|
|
};
|
|
|
|
struct UnpairRequest
|
|
{
|
|
BluetoothAddress address;
|
|
};
|
|
|
|
struct PinReplyRequest
|
|
{
|
|
BluetoothAddress address;
|
|
bool accept;
|
|
BluetoothPinCode pinCode;
|
|
};
|
|
|
|
struct SspReplyRequest
|
|
{
|
|
BluetoothAddress address;
|
|
BluetoothSspVariant variant;
|
|
bool accept;
|
|
};
|
|
|
|
struct SetPinCodeRequest
|
|
{
|
|
BluetoothAddress address;
|
|
BluetoothPinCode pincode;
|
|
};
|
|
|
|
struct SetPasskeyRequest
|
|
{
|
|
BluetoothAddress address;
|
|
uint32_t passkey;
|
|
};
|
|
|
|
struct ConfirmPairingConfirmationRequest
|
|
{
|
|
BluetoothAddress address;
|
|
};
|
|
|
|
struct DenyPairingConfirmationRequest
|
|
{
|
|
BluetoothAddress address;
|
|
};
|
|
|
|
struct PairedDevicePropertiesRequest
|
|
{
|
|
BluetoothAddress[] addresses;
|
|
};
|
|
|
|
struct ConnectedDevicePropertiesRequest
|
|
{
|
|
uint16_t serviceUuid;
|
|
};
|
|
|
|
struct FetchUuidsRequest
|
|
{
|
|
BluetoothAddress address;
|
|
};
|
|
|
|
struct ConnectRequest
|
|
{
|
|
BluetoothAddress address;
|
|
uint32_t cod;
|
|
uint16_t serviceUuid;
|
|
};
|
|
|
|
struct DisconnectRequest
|
|
{
|
|
BluetoothAddress address;
|
|
uint16_t serviceUuid;
|
|
};
|
|
|
|
struct SendFileRequest
|
|
{
|
|
BluetoothAddress address;
|
|
PBlob blob;
|
|
};
|
|
|
|
struct StopSendingFileRequest
|
|
{
|
|
BluetoothAddress address;
|
|
};
|
|
|
|
struct ConfirmReceivingFileRequest
|
|
{
|
|
BluetoothAddress address;
|
|
};
|
|
|
|
struct DenyReceivingFileRequest
|
|
{
|
|
BluetoothAddress address;
|
|
};
|
|
|
|
struct ConnectScoRequest
|
|
{
|
|
};
|
|
|
|
struct DisconnectScoRequest
|
|
{
|
|
};
|
|
|
|
struct IsScoConnectedRequest
|
|
{
|
|
};
|
|
|
|
struct SetObexPasswordRequest
|
|
{
|
|
nsString password;
|
|
};
|
|
|
|
struct RejectObexAuthRequest
|
|
{
|
|
};
|
|
|
|
struct ReplyTovCardPullingRequest
|
|
{
|
|
PBlob blob;
|
|
};
|
|
|
|
struct ReplyToPhonebookPullingRequest
|
|
{
|
|
PBlob blob;
|
|
uint16_t phonebookSize;
|
|
};
|
|
|
|
struct ReplyTovCardListingRequest
|
|
{
|
|
PBlob blob;
|
|
uint16_t phonebookSize;
|
|
};
|
|
|
|
struct ReplyToFolderListingRequest
|
|
{
|
|
uint16_t masId;
|
|
nsString folderList;
|
|
};
|
|
|
|
struct ReplyToMessagesListingRequest
|
|
{
|
|
uint16_t masId;
|
|
PBlob blob;
|
|
bool newMessage;
|
|
nsString timeStamp;
|
|
uint16_t size;
|
|
};
|
|
|
|
struct ReplyToGetMessageRequest
|
|
{
|
|
uint16_t masId;
|
|
PBlob blob;
|
|
};
|
|
|
|
struct ReplyToSetMessageStatusRequest
|
|
{
|
|
uint16_t masId;
|
|
bool messageStatus;
|
|
};
|
|
|
|
struct ReplyToSendMessageRequest
|
|
{
|
|
uint16_t masId;
|
|
nsString handleId;
|
|
bool messageStatus;
|
|
};
|
|
|
|
struct ReplyToMessageUpdateRequest
|
|
{
|
|
uint16_t masId;
|
|
bool messageStatus;
|
|
};
|
|
|
|
struct AnswerWaitingCallRequest
|
|
{
|
|
};
|
|
|
|
struct IgnoreWaitingCallRequest
|
|
{
|
|
};
|
|
|
|
struct ToggleCallsRequest
|
|
{
|
|
};
|
|
|
|
struct SendMetaDataRequest
|
|
{
|
|
nsString title;
|
|
nsString artist;
|
|
nsString album;
|
|
int64_t mediaNumber;
|
|
int64_t totalMediaCount;
|
|
int64_t duration;
|
|
};
|
|
|
|
struct SendPlayStatusRequest
|
|
{
|
|
int64_t duration;
|
|
int64_t position;
|
|
ControlPlayStatus playStatus;
|
|
};
|
|
|
|
struct ConnectGattClientRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
BluetoothAddress deviceAddress;
|
|
};
|
|
|
|
struct DisconnectGattClientRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
BluetoothAddress deviceAddress;
|
|
};
|
|
|
|
struct DiscoverGattServicesRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
};
|
|
|
|
struct GattClientStartNotificationsRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
BluetoothGattServiceId servId;
|
|
BluetoothGattId charId;
|
|
};
|
|
|
|
struct GattClientStopNotificationsRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
BluetoothGattServiceId servId;
|
|
BluetoothGattId charId;
|
|
};
|
|
|
|
struct UnregisterGattClientRequest
|
|
{
|
|
int clientIf;
|
|
};
|
|
|
|
struct GattClientReadRemoteRssiRequest
|
|
{
|
|
int clientIf;
|
|
BluetoothAddress deviceAddress;
|
|
};
|
|
|
|
struct GattClientReadCharacteristicValueRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
BluetoothGattServiceId serviceId;
|
|
BluetoothGattId charId;
|
|
};
|
|
|
|
struct GattClientWriteCharacteristicValueRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
BluetoothGattServiceId serviceId;
|
|
BluetoothGattId charId;
|
|
BluetoothGattWriteType writeType;
|
|
uint8_t[] value;
|
|
};
|
|
|
|
struct GattClientReadDescriptorValueRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
BluetoothGattServiceId serviceId;
|
|
BluetoothGattId charId;
|
|
BluetoothGattId descId;
|
|
};
|
|
|
|
struct GattClientWriteDescriptorValueRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
BluetoothGattServiceId serviceId;
|
|
BluetoothGattId charId;
|
|
BluetoothGattId descId;
|
|
uint8_t[] value;
|
|
};
|
|
|
|
struct GattServerConnectPeripheralRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
BluetoothAddress address;
|
|
};
|
|
|
|
struct GattServerDisconnectPeripheralRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
BluetoothAddress address;
|
|
};
|
|
|
|
struct UnregisterGattServerRequest
|
|
{
|
|
int serverIf;
|
|
};
|
|
|
|
struct GattServerAddServiceRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
BluetoothGattServiceId serviceId;
|
|
uint16_t handleCount;
|
|
};
|
|
|
|
struct GattServerAddIncludedServiceRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
BluetoothAttributeHandle serviceHandle;
|
|
BluetoothAttributeHandle includedServiceHandle;
|
|
};
|
|
|
|
struct GattServerAddCharacteristicRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
BluetoothAttributeHandle serviceHandle;
|
|
BluetoothUuid characteristicUuid;
|
|
BluetoothGattAttrPerm permissions;
|
|
BluetoothGattCharProp properties;
|
|
};
|
|
|
|
struct GattServerAddDescriptorRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
BluetoothAttributeHandle serviceHandle;
|
|
BluetoothAttributeHandle characteristicHandle;
|
|
BluetoothUuid descriptorUuid;
|
|
BluetoothGattAttrPerm permissions;
|
|
};
|
|
|
|
struct GattServerRemoveServiceRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
BluetoothAttributeHandle serviceHandle;
|
|
};
|
|
|
|
struct GattServerStartServiceRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
BluetoothAttributeHandle serviceHandle;
|
|
};
|
|
|
|
struct GattServerStopServiceRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
BluetoothAttributeHandle serviceHandle;
|
|
};
|
|
|
|
struct GattServerSendResponseRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
BluetoothAddress address;
|
|
uint16_t status;
|
|
int32_t requestId;
|
|
BluetoothGattResponse response;
|
|
};
|
|
|
|
struct GattServerSendIndicationRequest
|
|
{
|
|
BluetoothUuid appUuid;
|
|
BluetoothAddress address;
|
|
BluetoothAttributeHandle characteristicHandle;
|
|
bool confirm;
|
|
uint8_t[] value;
|
|
};
|
|
|
|
union Request
|
|
{
|
|
GetAdaptersRequest;
|
|
StartBluetoothRequest;
|
|
StopBluetoothRequest;
|
|
SetPropertyRequest;
|
|
GetPropertyRequest;
|
|
StartDiscoveryRequest;
|
|
StopDiscoveryRequest;
|
|
StartLeScanRequest;
|
|
StopLeScanRequest;
|
|
PairRequest;
|
|
UnpairRequest;
|
|
PinReplyRequest;
|
|
SspReplyRequest;
|
|
SetPinCodeRequest;
|
|
SetPasskeyRequest;
|
|
ConfirmPairingConfirmationRequest;
|
|
DenyPairingConfirmationRequest;
|
|
ConnectedDevicePropertiesRequest;
|
|
PairedDevicePropertiesRequest;
|
|
FetchUuidsRequest;
|
|
ConnectRequest;
|
|
DisconnectRequest;
|
|
SendFileRequest;
|
|
StopSendingFileRequest;
|
|
ConfirmReceivingFileRequest;
|
|
DenyReceivingFileRequest;
|
|
ConnectScoRequest;
|
|
DisconnectScoRequest;
|
|
IsScoConnectedRequest;
|
|
SetObexPasswordRequest;
|
|
RejectObexAuthRequest;
|
|
ReplyTovCardPullingRequest;
|
|
ReplyToPhonebookPullingRequest;
|
|
ReplyTovCardListingRequest;
|
|
ReplyToFolderListingRequest;
|
|
ReplyToMessagesListingRequest;
|
|
ReplyToGetMessageRequest;
|
|
ReplyToSetMessageStatusRequest;
|
|
ReplyToSendMessageRequest;
|
|
ReplyToMessageUpdateRequest;
|
|
AnswerWaitingCallRequest;
|
|
IgnoreWaitingCallRequest;
|
|
ToggleCallsRequest;
|
|
SendMetaDataRequest;
|
|
SendPlayStatusRequest;
|
|
ConnectGattClientRequest;
|
|
DisconnectGattClientRequest;
|
|
DiscoverGattServicesRequest;
|
|
GattClientStartNotificationsRequest;
|
|
GattClientStopNotificationsRequest;
|
|
UnregisterGattClientRequest;
|
|
GattClientReadRemoteRssiRequest;
|
|
GattClientReadCharacteristicValueRequest;
|
|
GattClientWriteCharacteristicValueRequest;
|
|
GattClientReadDescriptorValueRequest;
|
|
GattClientWriteDescriptorValueRequest;
|
|
GattServerConnectPeripheralRequest;
|
|
GattServerDisconnectPeripheralRequest;
|
|
UnregisterGattServerRequest;
|
|
GattServerAddServiceRequest;
|
|
GattServerAddIncludedServiceRequest;
|
|
GattServerAddCharacteristicRequest;
|
|
GattServerAddDescriptorRequest;
|
|
GattServerRemoveServiceRequest;
|
|
GattServerStartServiceRequest;
|
|
GattServerStopServiceRequest;
|
|
GattServerSendResponseRequest;
|
|
GattServerSendIndicationRequest;
|
|
};
|
|
|
|
protocol PBluetooth
|
|
{
|
|
manager PContent;
|
|
manages PBluetoothRequest;
|
|
|
|
/**
|
|
* The potential exists for a racy shutdown so the following sequence of
|
|
* messages is used to shutdown safely:
|
|
*
|
|
* 1. [BeginShutdown] (Parent -> Child [Optional])
|
|
* 2. StopNotifying (Child -> Parent)
|
|
* 3. NotificationsStopped (Parent -> Child)
|
|
* 4. __delete__() (Child -> Parent)
|
|
*/
|
|
|
|
child:
|
|
/**
|
|
* Sent when a settings change has enabled or disabled the bluetooth firmware.
|
|
*/
|
|
Enabled(bool enabled);
|
|
|
|
/**
|
|
* Sent when a bluetooth signal is broadcasted to child processes.
|
|
*/
|
|
Notify(BluetoothSignal signal);
|
|
|
|
/**
|
|
* Sent when the parent process is about to be shut down. See shutdown note
|
|
* above.
|
|
*/
|
|
BeginShutdown();
|
|
|
|
/**
|
|
* Sent to inform the child process that it will no longer receive any
|
|
* messages from the parent. See shutdown note above.
|
|
*/
|
|
NotificationsStopped();
|
|
|
|
parent:
|
|
/**
|
|
* Sent when the child no longer needs to use bluetooth. See shutdown note
|
|
* above.
|
|
*/
|
|
__delete__();
|
|
|
|
/**
|
|
* Sent when the child needs to receive signals related to the given node.
|
|
*/
|
|
RegisterSignalHandler(nsString node);
|
|
|
|
/**
|
|
* Sent when the child no longer needs to receive signals related to the given
|
|
* node.
|
|
*/
|
|
UnregisterSignalHandler(nsString node);
|
|
|
|
/**
|
|
* Sent when the child no longer needs to receive any messages from the
|
|
* parent. See shutdown note above.
|
|
*/
|
|
StopNotifying();
|
|
|
|
/**
|
|
* Sent when the child makes an asynchronous request to the parent.
|
|
*/
|
|
PBluetoothRequest(Request request);
|
|
|
|
/**
|
|
* FIXME: Bug 547703.
|
|
*
|
|
* This is the state machine we want:
|
|
*
|
|
* start state NOTIFYING:
|
|
* send Enabled goto NOTIFYING;
|
|
* send Notify goto NOTIFYING;
|
|
* recv RegisterSignalHandler goto NOTIFYING;
|
|
* recv UnregisterSignalHandler goto NOTIFYING;
|
|
* send BeginShutdown goto PARENT_DONE;
|
|
* recv StopNotifying goto CHILD_DONE;
|
|
*
|
|
* state PARENT_DONE:
|
|
* recv RegisterSignalHandler goto PARENT_DONE;
|
|
* recv UnregisterSignalHandler goto PARENT_DONE;
|
|
* recv StopNotifying goto CHILD_DONE;
|
|
*
|
|
* state CHILD_DONE:
|
|
* send Enabled goto CHILD_DONE;
|
|
* send Notify goto CHILD_DONE;
|
|
* send BeginShutdown goto CHILD_DONE;
|
|
* send NotificationsStopped goto DONE;
|
|
*
|
|
* state DONE:
|
|
* recv __delete__;
|
|
*/
|
|
};
|
|
|
|
} // namespace bluetooth
|
|
} // namespace dom
|
|
} // namespace mozilla
|