WebAPI/WebSMS/Multi-SIM
From MozillaWiki
Proposal: WebSms/WebMms for multi-SIM
The only difference is a new optional parameter is added for send() and sendMMS(). If API user didn't specify a value, then the default service Id is going to be used.
- nsIDOMMozMobileMessageManager
interface nsIDOMMozMobileMessageManager : nsIDOMEventTarget { nsIDOMDOMRequest getSegmentInfoForText(in DOMString text);
/** * Function to send SMS. * * @param number * Either a DOMString (only one number) or an array of numbers. * @param message * The text message to be sent. * @param sendParameters * An SmsSendParameters object. * @param return * A DOMRequest object indicating the sending result if one number * has been passed; an array of DOMRequest objects otherwise. */ [implicit_jscontext, optional_argc] jsval send(in jsval number, in DOMString message, [optional] in jsval sendParameters); /* New parameter for multi-SIM */
/** * Function to send MMS. * * @param parameters * An MmsParameters object. * @param sendParameters * An MmsSendParameters object. * @param return * A DOMRequest object indicating the sending result. */ [implicit_jscontext, optional_argc] nsIDOMDOMRequest sendMMS(in jsval parameters, [optional] in jsval sendParameters); /* New parameter for multi-SIM */
[binaryname(GetMessageMoz)] nsIDOMDOMRequest getMessage(in long id);
// The parameter can be either a message id or a nsIDOMMoz{Mms,Sms}Message. nsIDOMDOMRequest delete(in jsval param);
// Iterates through nsIDOMMoz{Mms,Sms}Message. nsIDOMDOMCursor getMessages(in nsIDOMMozSmsFilter filter, in boolean reverse);
nsIDOMDOMRequest markMessageRead(in long id, in boolean value);
// Iterates through nsIDOMMozMobileMessageThread. nsIDOMDOMCursor getThreads();
nsIDOMDOMRequest retrieveMMS(in long id);
[implicit_jscontext] attribute jsval onreceived; [implicit_jscontext] attribute jsval onretrieving; [implicit_jscontext] attribute jsval onsending; [implicit_jscontext] attribute jsval onsent; [implicit_jscontext] attribute jsval onfailed; [implicit_jscontext] attribute jsval ondeliverysuccess; [implicit_jscontext] attribute jsval ondeliveryerror; };
Regarding nsIDOMMozSmsMessage and nsIDOMMozMmsMessage, a new attribute 'iddId' is added. 'iccId' is a unique id to record which SIM the message is coming from or sent out.
- nsIDOMMozSmsMessage
interface nsIDOMMozSmsMessage : nsISupports { /** * |type| is always "sms". */ readonly attribute DOMString type;
readonly attribute long id;
readonly attribute unsigned long long threadId;
/** * Integrated Circuit Card Identifier. * * Will be null if ICC is not available. */ readonly attribute DOMString iccId; /* New attribute for multi-SIM */
/** * Should be "received", "sending", "sent" or "error". */ readonly attribute DOMString delivery;
/** * Possible delivery status values for above delivery states are: * * "received": "success" * "sending" : "pending", or "not-applicable" if the message was sent without * status report requisition. * "sent" : "pending", "success", "error", or "not-applicable" * if the message was sent without status report requisition. * "error" : "error" */ readonly attribute DOMString deliveryStatus;
readonly attribute DOMString sender; readonly attribute DOMString receiver; readonly attribute DOMString body;
/** * Should be "normal", "class-0", "class-1", "class-2" or "class-3". */ readonly attribute DOMString messageClass;
[implicit_jscontext] readonly attribute jsval timestamp; // jsval is for Date. readonly attribute boolean read; };
- nsIDOMMozMmsMessage
interface nsIDOMMozMmsMessage : nsISupports { /** * |type| is always "mms". */ readonly attribute DOMString type;
readonly attribute long id;
readonly attribute unsigned long long threadId;
/** * Integrated Circuit Card Identifier. * * Will be null if ICC is not available. */ readonly attribute DOMString iccId; /* New attribute for multi-SIM */
/** * Should be "not-downloaded", "received", "sending", "sent" or "error". */ readonly attribute DOMString delivery;
[implicit_jscontext] readonly attribute jsval deliveryStatus; // DOMString[]
readonly attribute DOMString sender;
[implicit_jscontext] readonly attribute jsval receivers; // DOMString[]
[implicit_jscontext] readonly attribute jsval timestamp; // Date object
readonly attribute boolean read; readonly attribute DOMString subject; readonly attribute DOMString smil;
[implicit_jscontext] readonly attribute jsval attachments; // MmsAttachment[]
[implicit_jscontext] readonly attribute jsval expiryDate; // Date object // Expiry date for an MMS to be // manually downloaded. };