gecko-dev/dom/system/gonk/nsIDataCallInterfaceService.idl
2015-08-18 09:54:36 +08:00

263 lines
8.2 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"
[scriptable, uuid(88f18811-8f19-4902-a9b8-2a6430c71c94)]
interface nsIDataCall : nsISupports
{
/**
* Data call fail cause. One of the nsIDataCallInterface.DATACALL_FAIL_*
* values.
*/
readonly attribute long failCause;
/**
* If failCause != nsIDataCallInterface.DATACALL_FAIL_NONE, this field
* indicates the suggested retry back-off timer. The unit is milliseconds.
*/
readonly attribute long suggestedRetryTime;
/**
* Context ID, uniquely identifies this call.
*/
readonly attribute long cid;
/**
* Data call network state. One of the nsIDataCallInterface.DATACALL_STATE_*
* values.
*/
readonly attribute long active;
/**
* Data call connection type. One of the
* nsIDataCallInterface.DATACALL_PDP_TYPE_* values.
*/
readonly attribute long pdpType;
/**
* The network interface name.
*/
readonly attribute DOMString ifname;
/**
* A space-delimited list of addresses with optional "/" prefix length.
*/
readonly attribute DOMString addresses;
/**
* A space-delimited list of DNS server addresses.
*/
readonly attribute DOMString dnses;
/**
* A space-delimited list of default gateway addresses.
*/
readonly attribute DOMString gateways;
/**
* A space-delimited list of Proxy Call State Control Function addresses for
* IMS client.
*/
readonly attribute DOMString pcscf;
};
[scriptable, uuid(e119c54b-9354-4ad6-a1ee-18608bde9320)]
interface nsIDataCallInterfaceListener : nsISupports
{
/**
* Notify data call interface listeners about unsolicited data call state
* changes.
*/
void notifyDataCallListChanged(in uint32_t count,
[array, size_is(count)] in nsIDataCall
dataCalls);
};
[scriptable, uuid(db0b640a-3b3a-4f48-84dc-256e176876c2)]
interface nsIDataCallCallback : nsISupports
{
/**
* Called when setupDataCall() returns succesfully.
*/
void notifySetupDataCallSuccess(in nsIDataCall dataCall);
/**
* Called when getDataCallList() returns succesfully.
*/
void notifyGetDataCallListSuccess(in uint32_t count,
[array, size_is(count)] in nsIDataCall
dataCalls);
/**
* Called when request returns succesfully.
*/
void notifySuccess();
/**
* Called when request returns error.
*/
void notifyError(in AString errorMsg);
};
[scriptable, uuid(ec219021-8623-4b9f-aba5-4db58c60684f)]
interface nsIDataCallInterface : nsISupports
{
/**
* Data fail causes, defined in TS 24.008.
*/
const long DATACALL_FAIL_NONE = 0;
const long DATACALL_FAIL_OPERATOR_BARRED = 0x08;
const long DATACALL_FAIL_INSUFFICIENT_RESOURCES = 0x1A;
const long DATACALL_FAIL_MISSING_UKNOWN_APN = 0x1B;
const long DATACALL_FAIL_UNKNOWN_PDP_ADDRESS_TYPE = 0x1C;
const long DATACALL_FAIL_USER_AUTHENTICATION = 0x1D;
const long DATACALL_FAIL_ACTIVATION_REJECT_GGSN = 0x1E;
const long DATACALL_FAIL_ACTIVATION_REJECT_UNSPECIFIED = 0x1F;
const long DATACALL_FAIL_SERVICE_OPTION_NOT_SUPPORTED = 0x20;
const long DATACALL_FAIL_SERVICE_OPTION_NOT_SUBSCRIBED = 0x21;
const long DATACALL_FAIL_SERVICE_OPTION_OUT_OF_ORDER = 0x22;
const long DATACALL_FAIL_NSAPI_IN_USE = 0x23;
const long DATACALL_FAIL_ONLY_IPV4_ALLOWED = 0x32;
const long DATACALL_FAIL_ONLY_IPV6_ALLOWED = 0x33;
const long DATACALL_FAIL_ONLY_SINGLE_BEARER_ALLOWED = 0x34;
const long DATACALL_FAIL_PROTOCOL_ERRORS = 0x6F;
/* Not mentioned in the specification */
const long DATACALL_FAIL_VOICE_REGISTRATION_FAIL = -1;
const long DATACALL_FAIL_DATA_REGISTRATION_FAIL = -2;
const long DATACALL_FAIL_SIGNAL_LOST = -3;
const long DATACALL_FAIL_PREF_RADIO_TECH_CHANGED = -4;
const long DATACALL_FAIL_RADIO_POWER_OFF = -5;
const long DATACALL_FAIL_TETHERED_CALL_ACTIVE = -6;
const long DATACALL_FAIL_ERROR_UNSPECIFIED = 0xFFFF;
/**
* Data call network state.
*/
const long DATACALL_STATE_INACTIVE = 0;
const long DATACALL_STATE_ACTIVE_DOWN = 1;
const long DATACALL_STATE_ACTIVE_UP = 2;
/**
* Data call authentication type. Must match the values in ril_consts
* RIL_DATACALL_AUTH_TO_GECKO array.
*/
const long DATACALL_AUTH_NONE = 0;
const long DATACALL_AUTH_PAP = 1;
const long DATACALL_AUTH_CHAP = 2;
const long DATACALL_AUTH_PAP_OR_CHAP = 3;
/**
* Data call protocol type. Must match the values in ril_consts
* RIL_DATACALL_PDP_TYPES array.
*/
const long DATACALL_PDP_TYPE_IPV4 = 0;
const long DATACALL_PDP_TYPE_IPV4V6 = 1;
const long DATACALL_PDP_TYPE_IPV6 = 2;
/**
* Reason for deactivating data call.
*/
const long DATACALL_DEACTIVATE_NO_REASON = 0;
const long DATACALL_DEACTIVATE_RADIO_SHUTDOWN = 1;
/**
* Setup data call.
*
* @param apn
* Apn to connect to.
* @param username
* Username for apn.
* @param password
* Password for apn.
* @param authType
* Authentication type. One of the DATACALL_AUTH_* values.
* @param pdpType
* Connection type. One of the DATACALL_PDP_TYPE_* values.
* @param nsIDataCallCallback
* Called when request is finished.
*
* If successful, the notifySetupDataCallSuccess() will be called with the
* new nsIDataCall.
*
* Otherwise, the notifyError() will be called, and the error will be either
* 'RadioNotAvailable', 'OpNotAllowedBeforeRegToNw',
* 'OpNotAllowedDuringVoiceCall', 'RequestNotSupported' or 'GenericFailure'.
*/
void setupDataCall(in AString apn, in AString username,
in AString password, in long authType,
in long pdpType,
in nsIDataCallCallback callback);
/**
* Deactivate data call.
*
* @param cid
* Context id.
* @param reason
* Disconnect Reason. One of the DATACALL_DEACTIVATE_* values.
* @param nsIDataCallCallback
* Called when request is finished.
*
* If successful, the notifySuccess() will be called.
*
* Otherwise, the notifyError() will be called, and the error will be either
* 'RadioNotAvailable' or 'GenericFailure'.
*/
void deactivateDataCall(in long cid,
in long reason,
in nsIDataCallCallback callback);
/**
* Get current data call list.
*
* @param nsIDataCallCallback
* Called when request is finished.
*
* If successful, the notifyGetDataCallListSuccess() will be called with the
* list of nsIDataCall(s).
*
* Otherwise, the notifyError() will be called, and the error will be either
* 'RadioNotAvailable' or 'GenericFailure'.
*/
void getDataCallList(in nsIDataCallCallback callback);
/**
* Set data registration state.
*
* @param attach
* whether to attach data registration or not.
* @param nsIDataCallCallback
* Called when request is finished.
*
* If successful, the notifySuccess() will be called.
*
* Otherwise, the notifyError() will be called, and the error will be either
* 'RadioNotAvailable', 'SubscriptionNotAvailable' or 'GenericFailure'.
*/
void setDataRegistration(in boolean attach,
in nsIDataCallCallback callback);
/**
* Register to receive unsolicited events from this nsIDataCallInterface.
*/
void registerListener(in nsIDataCallInterfaceListener listener);
/**
* Unregister to stop receiving unsolicited events from this
* nsIDataCallInterface.
*/
void unregisterListener(in nsIDataCallInterfaceListener listener);
};
[scriptable, uuid(64700406-7429-4743-a6ae-f82e9877fd0d)]
interface nsIDataCallInterfaceService : nsISupports
{
/**
* Get the corresponding data call interface.
*
* @param clientId
* clientId of the data call interface to get.
*/
nsIDataCallInterface getDataCallInterface(in long clientId);
};