canmove, Confirmed users
725
edits
No edit summary |
|||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Proposal for an improved and simplied Telephony API (José M. Cantera, Telefónica I+D) | == Proposal for an improved and simplied Telephony API (José M. Cantera, Telefónica I+D) == | ||
[[Sensor API]] | [[Sensor API]] | ||
Line 33: | Line 33: | ||
interface IncomingCallEvent : Event { | interface IncomingCallEvent : Event { | ||
readonly attribute TelephonySession session; | readonly attribute TelephonySession session; | ||
} | |||
== philikon's thoughts == | |||
* IMHO <code>navigator.telephony.dial("numbergoeshere");</code> is nicer than <code>new TelephonyCall("numbergoeshere");</code>, because a constructor with side-effects like that just feels icky. | |||
* We have a bunch of telephony-related functionality that's not reflected yet: | |||
** controlling and reading radio power | |||
** reading radio metadata (operator, signal strength, etc.) | |||
** ... | |||
* I would also suggest another readyState, <code>"dialing"</code> that comes before <code>"calling"</code> for outgoing calls. | |||
* Nits: we should probably define the possible values for readyState on the interface (nit: for XHR they're ints, not strings... I like being consistent, but I also prefers strings... hmmm...). Also, event listener objects should probably be declared as <code>EventListener</code>. | |||
My proposal on this (as a delta to the main proposal): | |||
interface Telephony { | |||
// ... all the stuff from the main proposal | |||
void power(bool on); | |||
TelephonyCall dial(String number); | |||
const String RADIOSTATE_UNAVAILABLE = "unavailable"; | |||
const String RADIOSTATE_OFF = "off"; | |||
const String RADIOSTATE_READY = "ready"; | |||
const String CARDSTATE_NOT_READY = "unavailable"; | |||
const String CARDSTATE_ABSENT = "absent"; | |||
const String CARDSTATE_PIN_REQUIRED = "pin_required"; | |||
const String CARDSTATE_PUK_REQUIRED = "puk_required"; | |||
const String CARDSTATE_NETWORK_LOCKED = "network_locked"; | |||
const String CARDSTATE_NOT_READY = "not_ready"; | |||
const String CARDSTATE_READY = "ready"; | |||
readonly String radioState; | |||
readonly String cardState; | |||
EventListener onradiostatechange | |||
EventListener oniccstatechange | |||
EventListener onsignalstrengthchange | |||
EventListener onoperatorchange | |||
} | |||
interface TelephonyCall { | |||
// ... all the stuff from the main proposal | |||
const String READYSTATE_DIALING = "dialing"; | |||
const String READYSTATE_CALLING = "calling"; | |||
const String READYSTATE_INCOMING = "incoming"; | |||
const String READYSTATE_CONNECTED = "connected"; | |||
const String READYSTATE_CLOSED = "closed"; | |||
const String READYSTATE_BUSY = "busy"; | |||
} | } |