Bug 1044721 - Part 7: Update nsISmsService.idl and ensure the type-of-number and number-plan-identification constants match the corresponding enum in MozMobileMessageManager.webidl. r=btseng

This commit is contained in:
Samael Wang 2015-04-29 10:42:58 +08:00
parent f697daf654
commit 8c5a2d711b
4 changed files with 159 additions and 2 deletions

View File

@ -0,0 +1,47 @@
/* 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 "mozilla/dom/MozMobileMessageManagerBinding.h"
#include "nsISmsService.h"
namespace mozilla {
namespace dom {
namespace mobilemessage {
#define ASSERT_SMS_EQUALITY(webidlType, webidlState, xpidlState) \
static_assert(static_cast<uint32_t>(webidlType::webidlState) == nsISmsService::xpidlState, \
#webidlType "::" #webidlState " should equal to nsISmsService::" #xpidlState)
/**
* Enum TypeOfNumber
*/
#define ASSERT_SMS_TYPE_OF_NUMBER_EQUALITY(webidlState, xpidlState) \
ASSERT_SMS_EQUALITY(TypeOfNumber, webidlState, xpidlState)
ASSERT_SMS_TYPE_OF_NUMBER_EQUALITY(Unknown, TYPE_OF_NUMBER_UNKNOWN);
ASSERT_SMS_TYPE_OF_NUMBER_EQUALITY(International, TYPE_OF_NUMBER_INTERNATIONAL);
ASSERT_SMS_TYPE_OF_NUMBER_EQUALITY(National, TYPE_OF_NUMBER_NATIONAL);
ASSERT_SMS_TYPE_OF_NUMBER_EQUALITY(Network_specific, TYPE_OF_NUMBER_NETWORK_SPECIFIC);
ASSERT_SMS_TYPE_OF_NUMBER_EQUALITY(Dedicated_access_short_code, TYPE_OF_NUMBER_DEDICATED_ACCESS_SHORT_CODE);
#undef ASSERT_SMS_TYPE_OF_NUMBER_EQUALITY
/**
* Enum NumberPlanIdentification
*/
#define ASSERT_SMS_NUMBER_PLAN_IDENTIFICATION_EQUALITY(webidlState, xpidlState) \
ASSERT_SMS_EQUALITY(NumberPlanIdentification, webidlState, xpidlState)
ASSERT_SMS_NUMBER_PLAN_IDENTIFICATION_EQUALITY(Unknown, NUMBER_PLAN_IDENTIFICATION_UNKNOWN);
ASSERT_SMS_NUMBER_PLAN_IDENTIFICATION_EQUALITY(Isdn, NUMBER_PLAN_IDENTIFICATION_ISDN);
ASSERT_SMS_NUMBER_PLAN_IDENTIFICATION_EQUALITY(Data, NUMBER_PLAN_IDENTIFICATION_DATA);
ASSERT_SMS_NUMBER_PLAN_IDENTIFICATION_EQUALITY(Telex, NUMBER_PLAN_IDENTIFICATION_TELEX);
ASSERT_SMS_NUMBER_PLAN_IDENTIFICATION_EQUALITY(National, NUMBER_PLAN_IDENTIFICATION_NATIONAL);
ASSERT_SMS_NUMBER_PLAN_IDENTIFICATION_EQUALITY(Private, NUMBER_PLAN_IDENTIFICATION_PRIVATE);
#undef ASSERT_SMS_EQUALITY
} // namespace mobilemessage
} // namespace dom
} // namespace mozilla

View File

@ -10,7 +10,7 @@
"@mozilla.org/sms/gonksmsservice;1"
%}
[scriptable, uuid(4dda515e-05ec-47b1-b750-e42c74576c43)]
[scriptable, uuid(76681431-8261-4540-bab8-24ef3866e8b6)]
interface nsIGonkSmsService : nsISmsService
{
const unsigned short SMS_MESSAGE_ENCODING_7BITS_ALPHABET = 0x00;

View File

@ -12,7 +12,7 @@ interface nsIMobileMessageCallback;
#define SMS_SERVICE_CONTRACTID "@mozilla.org/sms/smsservice;1"
%}
[scriptable, uuid(ae688bca-00c9-4d08-945d-e8a5272ad5b1)]
[scriptable, uuid(c8ca5f06-ad76-44b0-a324-9e2910fd37da)]
interface nsISmsService : nsISupports
{
/**
@ -41,22 +41,131 @@ interface nsISmsService : nsISupports
const unsigned short DELIVERY_STATUS_TYPE_PENDING = 2;
const unsigned short DELIVERY_STATUS_TYPE_ERROR = 3;
/**
* Constant definitions of SM-RP type of number as defined in
* |Table 10.5.118: Called party BCD number| of 3GPP TS 24.008.
*/
const unsigned short TYPE_OF_NUMBER_UNKNOWN = 0;
const unsigned short TYPE_OF_NUMBER_INTERNATIONAL = 1;
const unsigned short TYPE_OF_NUMBER_NATIONAL = 2;
const unsigned short TYPE_OF_NUMBER_NETWORK_SPECIFIC = 3;
const unsigned short TYPE_OF_NUMBER_DEDICATED_ACCESS_SHORT_CODE = 4;
/**
* Constant definitions of SM-RP number plan identification as defined in
* |Table 10.5.118: Called party BCD number| of 3GPP TS 24.008.
*/
const unsigned short NUMBER_PLAN_IDENTIFICATION_UNKNOWN = 0;
const unsigned short NUMBER_PLAN_IDENTIFICATION_ISDN = 1;
const unsigned short NUMBER_PLAN_IDENTIFICATION_DATA = 2;
const unsigned short NUMBER_PLAN_IDENTIFICATION_TELEX = 3;
const unsigned short NUMBER_PLAN_IDENTIFICATION_NATIONAL = 4;
const unsigned short NUMBER_PLAN_IDENTIFICATION_PRIVATE = 5;
/**
* The default RIL service ID used for SMS.
*/
readonly attribute unsigned long smsDefaultServiceId;
/**
* Get the information necessary to create a multi-part SMS for a given text.
*
* @param text
* The text message content.
* @param request
* The callback object to use. It invokes
* |notifySegmentInfoForTextGot| on success, or
* |notifyGetSegmentInfoForTextFailed| on failure.
*/
void getSegmentInfoForText(in DOMString text,
in nsIMobileMessageCallback request);
/**
* Send a SMS.
*
* @param serviceId
* The ID of RIL service to use.
* @param number
* Destination number in string.
* @param message
* The text message content.
* @param silent
* |true| to send a silent message. It's used to make a SMS based
* authentication for some services such as mobile billing.
* @param request
* The callback object to use. It invokes |notifyMessageSent| on
* success, or |notifySendMessageFailed| on failure.
* @throws NS_ERROR_INVALID_ARG
* If |serviceId| exceeds the max value of available IDs.
*/
void send(in unsigned long serviceId,
in DOMString number,
in DOMString message,
in boolean silent,
in nsIMobileMessageCallback request);
/**
* Add a number to the list of silent message originators. When receiving a
* SMS sent from one of the numbers in the list, |SmsService| will notify
* observers through the topic "silent-sms-received".
*
* It's used when a SMS based authentication has been initiated and the client
* is waiting for an incoming silent message containing the authentication
* result.
*
* @param number
* Originator number in string.
* @throw NS_ERROR_UNEXPECTED
* If the given number has already been added before.
*/
void addSilentNumber(in DOMString number);
/**
* Remove a number from the silent message originator list.
*
* @param number
* Originator number in string.
* @throws NS_ERROR_INVALID_ARG
* If the number doesn't exist in the list.
*/
void removeSilentNumber(in DOMString number);
/**
* Get the short message service center address of given |serviceId|.
*
* @param serviceId
* The ID of RIL service to use.
* @param request
* The callback object to use. It invokes |notifyGetSmscAddress| on
* success, or |notifyGetSmscAddressFailed| on failure.
* @throws NS_ERROR_INVALID_ARG
* If |serviceId| exceeds the max value of available IDs.
*/
void getSmscAddress(in unsigned long serviceId,
in nsIMobileMessageCallback request);
/**
* Set the short message service center address of given |serviceId|.
*
* @param serviceId
* The ID of RIL service to use.
* @param number
* Number part of the SMSC address.
* @param typeOfNumber
* Type of number of the SMSC address.
* @param numberPlanIdentification
* Number plan identification of the SMSC address.
* @param request
* The callback object to use. It invokes |notifySetSmscAddress| on
* success, or |notifySetSmscAddressFailed| on failure.
* @throws NS_ERROR_INVALID_ARG
* If |serviceId| exceeds the max value of available IDs.
*/
void setSmscAddress(in unsigned long serviceId,
in DOMString number,
in unsigned long typeOfNumber,
in unsigned long numberPlanIdentification,
in nsIMobileMessageCallback request);
};
%{C++

View File

@ -50,6 +50,7 @@ EXPORTS.mozilla.dom += [
]
UNIFIED_SOURCES += [
'Assertions.cpp',
'Constants.cpp',
'DeletedMessageInfo.cpp',
'DOMMobileMessageError.cpp',