WebAPI/WebSMS: Difference between revisions
(create page) |
(wip api) |
||
Line 13: | Line 13: | ||
== Proposed API == | == Proposed API == | ||
This API is work in progress and mostly reflect what is implemented and is going to be really soon. Some changes are going to happen. See the comments below each interfaces. | |||
navigator.sms returns an object with the following interface: | |||
interface nsIDOMSmsManager | |||
{ | |||
nsIDOMSmsRequest send(in DOMString number, in DOMString message); | |||
void suggestSend(in DOMString number, in DOMString message); | |||
unsigned short getNumberOfMessagesForText(in DOMString text); | |||
SMSRequest delete(in long uuid); | |||
SMSRequest (request.result == SMSIterator) get( { person: "", date: "", direction: "forward" or "backward" } ); | |||
}; | |||
Comments: | |||
* ''send'' and ''suggestSend'' could take an array of numbers. | |||
* suggestSend could be removed in favor of Web Activities. | |||
* maybe ''delete'' shouldn't return a SMSRequest? | |||
interface nsIDOMSmsRequest | |||
{ | |||
readonly attribute unsigned short readyState; | |||
readonly attribute unsigned short errorCode; | |||
attribute nsIDOMEventListener onsuccess; | |||
attribute nsIDOMEventListener onerror; | |||
attribute readonly nsIDOMSmsMessage? message; | |||
}; | |||
Comments: | |||
* message attribute might be removed. | |||
interface nsIDOMSmsMessage | |||
{ | |||
readonly attribute long uuid; | |||
readonly attribute DOMString sender; | |||
readonly attribute DOMString receiver; | |||
readonly attribute DOMString body; | |||
readonly attribute Date timestamp; | |||
}; | |||
Comments: | |||
* Have an array of receiver? | |||
* Add a status attribute? (with the following value: ''sending'', ''sent'', ''delivered'' (not sure), ''received'') | |||
* Merge sender/receiver and use the status attribute? |
Revision as of 18:49, 23 August 2011
Steps
In a first time, we want an API that allows to do a SMS Messaging application with similar features that the stock one.
Some advanced functionality might be added after. For example, a "before-sms-send" event that would allow preventing sending a SMS with .preventDefault().
MMS support will be considered later.
Status
You can find some patches here: bug 674725. They are implementing some parts of the proposed API except delete, get and SmsRequest. Also, SmsMessage isn't fully implemented. Those patches are still work in progress.
Proposed API
This API is work in progress and mostly reflect what is implemented and is going to be really soon. Some changes are going to happen. See the comments below each interfaces.
navigator.sms returns an object with the following interface:
interface nsIDOMSmsManager { nsIDOMSmsRequest send(in DOMString number, in DOMString message); void suggestSend(in DOMString number, in DOMString message); unsigned short getNumberOfMessagesForText(in DOMString text); SMSRequest delete(in long uuid); SMSRequest (request.result == SMSIterator) get( { person: "", date: "", direction: "forward" or "backward" } ); };
Comments:
- send and suggestSend could take an array of numbers.
- suggestSend could be removed in favor of Web Activities.
- maybe delete shouldn't return a SMSRequest?
interface nsIDOMSmsRequest { readonly attribute unsigned short readyState; readonly attribute unsigned short errorCode; attribute nsIDOMEventListener onsuccess; attribute nsIDOMEventListener onerror; attribute readonly nsIDOMSmsMessage? message; };
Comments:
- message attribute might be removed.
interface nsIDOMSmsMessage { readonly attribute long uuid; readonly attribute DOMString sender; readonly attribute DOMString receiver; readonly attribute DOMString body; readonly attribute Date timestamp; };
Comments:
- Have an array of receiver?
- Add a status attribute? (with the following value: sending, sent, delivered (not sure), received)
- Merge sender/receiver and use the status attribute?