gecko-dev/dom/inputport/nsIInputPortService.idl

76 lines
2.3 KiB
Plaintext

/* 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 "nsISupports.idl"
interface nsIArray;
%{C++
#define INPUTPORT_DATA_CID \
{ 0x90b192d1, 0x357a, 0x4793, { 0xab, 0x58, 0x04, 0xee, 0x21, 0x62, 0x27, 0xda } }
#define INPUTPORT_DATA_CONTRACTID \
"@mozilla.org/inputport/inputportdata;1"
%}
/**
* XPCOM component which acts as the container for input port data.
*/
[scriptable, builtinclass, uuid(244a2b1d-aa1f-4188-a639-ddb56c554b6d)]
interface nsIInputPortData : nsISupports
{
attribute DOMString id;
attribute DOMString type;
attribute boolean connected;
};
[builtinclass, uuid(32a62e7c-f698-4846-81f7-617c87854d32)]
interface nsIInputPortListener : nsISupports
{
void notifyConnectionChanged(in DOMString portId,
in boolean isConnected);
};
[builtinclass, uuid(c2a47757-25f6-4bc8-bd27-c23af2d87381)]
interface nsIInputPortServiceCallback : nsISupports
{
const unsigned short INPUTPORT_ERROR_OK = 0;
const unsigned short INPUTPORT_ERROR_FAILURE = 1;
const unsigned short INPUTPORT_ERROR_INVALID_ARG = 2;
const unsigned short INPUTPORT_ERROR_NOT_SUPPORTED = 3;
/**
* Called when something wrong happens.
*
* @param errorCode Error code listed above from the underlying layer.
*/
void notifyError(in unsigned short errorCode);
/**
* Called when the operation succeeds.
*
* @param dataList A list of data.
* An array of |nsIInputPortData| when used for |getInputPorts()|.
*
* NOTE: |nsIArray| is adopted to prevent this interface from being split into
* multiple interfaces with different |notifySuccess|. Though the
* implementation of TV service may need |nsIMutableArray| to fill in the
* array, it doesn't seem necessary for other places to use the mutable one.
*/
void notifySuccess([optional] in nsIArray dataList);
};
%{C++
#define INPUTPORT_SERVICE_CONTRACTID \
"@mozilla.org/inputport/inputportservice;1"
%}
[uuid(6214dae0-840e-11e4-b4a9-0800200c9a66)]
interface nsIInputPortService : nsISupports
{
attribute nsIInputPortListener inputPortListener;
void getInputPorts(in nsIInputPortServiceCallback callback);
};