This power specification is a set of APIs that exposes available power sources such as: batteries, wall outlet, etc. It also expose if the device is on battery power and its charge level.
usingExternalPowerSource attribute must be true if
the device is plugged
into an external power source. Otherwise, it must be false. If the correct value
cannot be obtained, or if the device does not have an internal power source,
an implementation MUST return true.powerLevel attribute MUST indicate what percent of the internal
power source
remains. The maximum value is 100, the minimum value is 0. If the value cannot be
obtained, or if the device does not have an internal power source, the attribute
value must be 0. timeRemaining attribute should indicate the estimated time
remaining (seconds) at the current rate before the system enters shutdown mode.
If usingExternalPowerSource is true and rate is greater
than or equal to 0, this value MUST be 0, meaning that there is essentially infinite
time remaining. If usingExternalPowerSource is true and rate
is less than 0 (indicating that even though the system is plugged into an
external power source, the battery is still being drained), timeRemainging
should be greater than 0. watchPowerSource() method takes one, two or three arguments.
When called, it MUST immediately return and then asynchronously start a watch
process defined as the following set of steps:
PowerSource object that reflects the delivery
context's current power source. If successful, invoke the associated
successCallback with a PowerSource object as an
argument. If the attempt fails, and the method was invoked with a non-null
errorCallback argument, this method MUST invoke the
errorCallback with a PowerError object as an
argument. watchPowerLevel() method takes one, two or three arguments.
When called, it MUST immediately return and then asynchronously start a watch
process defined as the following set of steps:
PowerLevel object. If successful, invoke the
associated successCallback with PowerLevel object
as an argument. If the attempt fails, and the method was invoked with a
non-null errorCallback argument, the implementation MUST
invoke the errorCallback with a PowerError object
as an argument.PowerLevel
object every time the implementation determines that the power level of the
hosting device has changed.watchPowerLevel() and watchPowerSource() methods
return an integer value that uniquely identifies the watch process. When the
clearWatch() method is called with this identifier, the watch process
MUST cease invoking any callbacks.
watchPowerLevel(). Use the
parameter to retrieve information about system power level.watchPowerSource(). Use the
parameter to retrieve information about system power source.sampleInterval attribute specifies in milliseconds how often
the implementation SHOULD check to see if the power level has changed. While the
specification allows the caller to sample at very small intervals, on many
implementations, this may be wasteful because the battery device may update its
level information at a frequency significantly below the sampleInterval.
On implementations that are event driven, this value MAY be ignored. The caller
should be aware that setting a value too small can adversely affect the battery life.
The default value SHOULD be 10,000, or once every 10 seconds. highThreshold is greater than zero, when system power level
rises above the specified value, the PowerLevelCallback MUST be invoked
with the crossedHighThreshold value of the PowerLevel
parameter set to true. If the PowerLevelOptions object is
not null, and the highThreshold value is 100 (default), the
PowerLevelCallback MUST not be invoked with the crossedHighThreshold
value set to true. The value must be greater or equal to 0, and no
greater than 100. lowThreshold is less than 100, when the system power level
falls below the specified value, the PowerLevelCallback MUST be invoked
with the crossedLowThreshold value of the PowerLevel
parameter set to true. If the PowerLevelOptions object is
not null, and the lowThreshold value is 0 (default), the
PowerLevelCallback MUST not be invoked with the
crossedLowThreshold value set to true. The value MUST be greater
than
or equal to 0, and no greater than 100. percentRemaining attribute should specify what percent of the
device internal power remains. For implementations where the internal power source
differentiates between the Design Maximum Capacity and the Current Maximum Capacity,
the Current Maximum Capacity SHOULD be used. The maximum value MUST be 100; the
minimum value MUST be 0, although that value MAY never be reported.
PowerLevelCallback is invoked with a PowerLevel
object whose crossedHighThreshold attribute set to true,
the power level high threshold has been crossed. This threshold value is set in
the PowerOptions parameter of a call to watchPowerLevel()
. The crossedHighThreshold value MUST be false if any one
of the following is true:
PowerLevel object is obtained by directly accessing the
Power.PowerLevel attribute;PowerLevelOption highThreshold value was
either not set or set to 100 in a prior call to watchPowerLevel();PowerLevelOption highThreshold value specified in a prior call
to watchPowerLevel(); PowerLevelOption highThreshold value specified in a prior call
to watchPowerLevel() but the highThresholdHysteresis
attribute in the PowerLevelOption was either not set or set to
a value greater than the highThreshold;PowerLevelOption highThreshold value in a prior call to
watchPowerLevel(), but the high threshold event has already
been called once, and the system power level has not yet dropped below the
value specified by the highThresholdHysteresis attribute in the
PowerLevelOption. PowerLevelCallback is invoked with a PowerLevel
object whose crossedLowThreshold attribute set to true,
the power level low threshold has been crossed. This threshold value MUST be set
in the PowerOptions parameter of a prior call to watchPowerLevel().
The crossedLowThreshold value will be false if any one
of the following is true:
PowerLevel object is obtained by directly accessing the
Power.PowerLevel attribute; PowerLevelOption lowThreshold value was either not set
or set 0 in a prior call to watchPowerLevel();PowerLevelOption lowThreshold value in a prior call to watchPowerLevel(); PowerLevelOption lowThreshold value in a prior call to watchPowerLevel()
but the lowThresholdHysteresis attribute in the
PowerLevelOption was either not set or set to a value less than the lowThreshold;PowerLevelOption lowThreshold value in a prior call to
watchPowerLevel(), but the low threshold event has already been called
once, and the system power level has not yet risen above the value specified
by the lowThresholdHysteresis attribute in the PowerLevelOption.UNKNOWN_ERROR (numeric value 0): The implementation failed to retrieve
either power source or power level information for an unknown reason.
PERMISSION_DENIED (numerice value 1): The implementation failed to
retrieve either power source or power level information because the application
context does not have permission to use the Platform API.
INFORMATION_UNAVAILABLE (numeric value 2): The implementation failed to
retrieve power information because the information was unavailable. For example,
this error would be raised if the system currently does not have an internal power
source, or if the system does provide this information.
TIMEOUT (numeric value 3): The specified maximum length of time has
elapsed before the implementation could successfully acquire power information.
INVALID_VALUE (numeric value 4): The implementation failed to retrieve
power source or power level information because one or more of the values in the
PowerLevelOptions or PowerSourceOptions parameters of the
watchPowerLevel() or watchPowerSource() calls was invalid.
For example, if the PowerLevelOptions highThreshold attribute is set
to a value greater than 100, the PowerErrorCallback MUST be invoked
with the PowerError code attribute set with a value of
INVALID_VALUE (4).
code attribute SHOULD contain one of the errors defined in this
specification. An implementation MAY define additional error codes, but MUST NOT
use the numeric values defined here.
message attribute MAY return an error message describing the
details of the error encountered. This attribute is primarily intended for
debugging and developers SHOULD NOT use it directly in their application user interface.
This section defines a set of APIs that expose CPU information such as: utilization, frequency, brand, etc.
numLogicalProcessors attribute MUST indicate how many threads
can run concurrently on the device. The minimum value is 1.
currentFrequency attribute MUST indicate the current frequency
of the CPU in Megahertz (MHz). On devices that have multiple CPUs that can run at
different frequencies, this attribute SHOULD reflect the average frequency of the
CPUs.
maximumFrequency attribute MUST indicate the maximum frequency
for the CPU(s) in Megahertz (MHz). On devices that have mutilple CPUs that
have different maximum frequencies, this attribute SHOULD reflect the maximum value.
usage attribute MUST indicate at the time of retrieval what
percentage of the total CPU resources are in use. If the device has more than one
CPU, this attribute MUST be the average usage of all CPUs on the system. The maximum
value is 100; the minimum value is 0.
architecture of the CPU.
watchCpuUsage function allows callers to monitor a delivery
context's CPU utilization and takes one, two or three parameters. When called, it
must immediately return and then asynchronously start a watch process defined by
the following set of steps:
CpuUsage object that reflects the delivery
context's current CPU utilization. If successful, invoke the associated
successCallback with the CpuUsage object as an
argument depending on the values specified in the
CpuUsageOptions parameter. If the attempt fails, and the
method was invoked with a non-null errorCallback argument, this
method MUST invoke the errorCallback with a CpuUsageError
object as an argument. CpuUsage object
every time the implementation determines that the CPU utilization of the
deliver context has changed in the manner specified by the
CpuUsageOptions parameter. watchCpuUsage() method returns an integer value that uniquely
identifies the watch process. When the clearWatch() method is called
with this identifier, the watch process MUST stop monitoring device CPU utilization
and MUST cease invoking any callbacks.
watchCpuUsage(). Use the
parameter to retrieve information about system cpu utilization.watchCpuUsage(). Use the
parameter to retrieve information about the error that occured while the implementation
attempted to obtain Cpu Utilization information.highThreshold attribute allows the caller to specify that the
implementation MUST only invoke the CpuUsageCallback when the device
CPU utilization rises above the value specified. The maximum value is 100, the
minimum value is 0. The default value is 100, meaning that the CpuUsageCallback
MUST NOT be invoked with the CpuUsage
crossedHighThreshold attribute set to true.
lowThreshold attribute allows the caller to specify that the
implementation MUST only invoke the CpuUsageCallback when the device
CPU utilization falls below the value specified. The maximum value is 100, the
minimum value is 0. The default value is 0, meaning that the CpuUsageCallback
MUST NOT be invoked with the CpuUsage crossedLowThreshold
attribute set to true.
highThresholdSampleCount attribute allows the caller to specify
how many consecutive samples must be taken above the value specified by
highThreshold before the CpuUsageCallback function is invoked
with the crossedHighThreshold attribute set to true. For
example, If
the value is 1, the CpuUsageCallback function MUST be invoked with the
crossedHighThreshold attribute set to true every time the
implementation samples the CPU utilization. If the value is 2, the
CpuUsageCallback function MUST be invoked with the
crossedHighThreshold attribute set to true only if the
implementation collects two consecutive samples that are greater than the value
specified by the highThreshold attribute. The default value is 1,
which is also the minimum value.
lowThresholdSampleCount attribute allows the caller to specify
how many consecutive samples must be taken below the value specified by
lowThreshold before the CpuUsageCallback function is invoked
with the crossedLowThreshold attribute set to true. For
example, If the value is 1, the CpuUsageCallback function MUST be
invoked with the crossedLowThreshold attribute set to true
every time the implementation samples the CPU utilization. If the value is
2, the CpuUsageCallback function must be invoked with the
crossedLowThreshold attribute set to true only if the
implementation collects two consecutive samples that are greater than the value
specified by the lowThreshold attribute. The default value is 1, which
is also the minimum value.
sampleInterval attribute is a hint to the implementation
regarding how often (in milliseconds) it SHOULD sample Cpu utilization. An
implementation SHOULD sample at the suggested rate, but MAY chose to ignore values
that are too small and which are likely to hamper system performance. If no
highThreshold or lowThreshold values are specified, the
implementation MUST invoke the CpuUsageCallback each time CPU
utilization is sampled. The default sample interval is 2000, or once every two
seconds.
timeout attribute specifies how long (in milliseconds) an
implementation SHOULD attempt to measure CPU utilization before invoking the
CpuUsageErrorCallback with the TIMEOUT error code. The
default value is 5000, or five seconds.
usage attribute MUST indicate what percentage of the total CPU
resources are in use when the CpuUsageCallback method is invoked. If
the device has more than one CPU, this attribute MUST be the average usage of all
CPUs on the system. The maximum value is 100; the minimum value is 0.
timestamp attribute MUST indicate when the Cpu usage
value was obtained.
CpuUsageCallback is invoked with a CpuUsage
object whose crossedHighThreshold attribute set to true,
the cpu usage high threshold has been crossed. This threshold value is set in
the CpuUsageOptions parameter of a call to watchCpuUsage()
. The crossedHighThreshold value MUST be false if any one
of the following is true:
CpuUsageOption highThreshold value was
either not set or set to 100 in a prior call to watchCpuUsage(); or usage is not greater than the value specified by the
CpuUsageOption highThreshold value specified in a prior call
to watchCpuUsage().CpuUsageCallback is invoked with a CpuUsage
object whose crossedLowThreshold attribute set to true,
the cpu utilization low threshold has been crossed. This threshold value MUST be set
in the CpuUsageOptions parameter of a prior call to
watchCpuUsage(). The crossedLowThreshold value MUST be
false if any one of the following is true:
CpuUsageOption lowThreshold value was either not set
or set 0 in a prior call to watchCpuUsage(); or CpuUsageOption lowThreshold value in a prior call to
watchCpuUsage(). UNKNOWN_ERROR (numeric value 0): The implementation failed to retrieve
Cpu usage information for an unknown reason.
PERMISSION_DENIED (numerice value 1): The implementation failed to
retrieve Cpu usage information because the application
context does not have permission to use the Platform API.
INFORMATION_UNAVAILABLE (numeric value 2): The implementation failed to
retrieve Cpu usage information because the information was unavailable.
TIMEOUT (numeric value 3): The specified maximum length of time has
elapsed before the implementation could successfully acquire Cpu usage information.
INVALID_VALUE (numeric value 4): The implementation failed to retrieve
CPU usage information because one or more of the values in the CpuUsageOptions
parameter of the watchCpuUsage() call was invalid. For example,
if the CpuUsageOptions highThreshold attribute is set to a value
greater than 100, the CpuErrorCallback must be invoked with the
CpuUsageError code attribute set with a value of INVALID_VALUE (4).
code attribute SHOULD contain one of the errors defined in this
specification. An implementation MAY define additional error codes, but MUST NOT
use the numeric values defined here.
message attribute MAY return an error message describing the
details of the error encountered. This attribute is primarily intended for
debugging and developers SHOULD NOT use it directly in their application user interface.
UNKNOWN_ARCH (numeric value 0): The Cpu architecture is unknown.
ARCH_I386 (numerice value 1): The CPU architecture is based on the
Intel(R) 386 instruction set.
ARCH_I586 (numerice value 2): The CPU architecture is based on the
Intel(R) 586 instruction set.
ARCH_x86-64 (numerice value 3): The CPU architecture is based on the
x86 64-bit architecture.
ARCH_ARM (numerice value 4): The CPU is an ARM processor.
code attribute SHOULD contain one of the errors defined in this
specification. An implementation MAY define additional error codes, but MUST NOT
use the numeric values defined here.
message attribute MAY return an error message describing the
details of the error encountered. This attribute is primarily intended for
debugging and developers SHOULD NOT use it directly in their application user interface.
The window.screen object already exposes width, height, availWidth, availHeight,
and colorDepth properties. This object could expose that information as well so that
there would be a single object through which all the info is available, or else this
object could expose only those objects that are not available on window.screen.
true if the screen is blank or if screen saver is active; false if otherwise.
watchOrientation() function takes one or two arguments. When called,
it must immediately return and then asynchronously start a watch process defined as
the following set of steps:
DisplayOrientation
object every time the implementation determines that the orientation of the
primary display has changed.
clearWatch() method is called with this identifier, the watch process must stop acquiring any new position fixes and must cease invoking any callbacks. When this value is used in a call to updatePosition(), the watch process SHOULD update the position information that it is using in its orientation caluculations.
watchColorDepth() function takes one or two arguments. When called,
it must immediately return and then asynchronously start a watch process defined as
the following set of steps:
clearWatch() method is called with this identifier, the watch process must stop acquiring any new position fixes and must cease invoking any callbacks. When this value is used in a call to updatePosition(), the watch process SHOULD update the position information that it is using in its orientation caluculations.
watchResolution() function takes one or two arguments. When called,
it must immediately return and then asynchronously start a watch process defined as
the following set of steps:
clearWatch() method is called with this identifier, the watch process must stop acquiring any new position fixes and must cease invoking any callbacks. When this value is used in a call to updatePosition(), the watch process SHOULD update the position information that it is using in its orientation caluculations.
watchBrightness() function takes one or two arguments. When called,
it must immediately return and then asynchronously start a watch process defined as
the following set of steps:
clearWatch() method is called with this identifier, the watch process must stop acquiring any new position fixes and must cease invoking any callbacks. When this value is used in a call to updatePosition(), the watch process SHOULD update the position information that it is using in its orientation caluculations.
successCallback and errorCallback associated with the watchId.
The Connection Interface can be used by applications to determine the network status of the device, the device's ability to connect to services over the current network, and the quality of the existing network connection(s). This API could specify a lot more information than it does. Attempts have been made to limit the specification to datum that, according to the Device API WG, have highly probable use cases.
For a more extensive sample of the kinds of connection/network related information that could be exposed, see the Moblin Platform Awareness Service. See also the BONDI 1.0 vocabulary and [[DCONTOLOGY]].
The range of information that could be provided by this API will continue to change as network technology evolves and paradigm shifts expose use cases for additional information and events.
currentNetworkBearer
MUST be valid, and MUST have a valid IP address
that allows it to communicate with other devices on the network. If the currentNetworkBearer
is null, or if it does not have a valid IP Address, this attribute MUST be false.
true if the Uniform Resource Identifier (URI)
uriDestination is reachable within the timeout and retryCount
. If no timeout or retryCount values are provided,
the system default timeout will be used, and only one attempt to reach the URI will
be made. If both timeout and retryCount are provided, this method could take up to
timeout x retryCount milliseconds to return.
uriDestination MUST be in the form of:
uriDestination = protocol + "://" + host + [":"+port] + ["/"+virtual_dir]
protocol = "tcp" | "ftp" | "http" | "https" | "icmp"
port is required for "tcp"; It is optional for the others. virtual_dir only applies to "http" and "https".
host = IPAddress | HostName
An implementation SHOULD attempt to use the device's default proxy settings for HTTP, HTTPS, and FTP.
uriDestination in milliseconds. If no timeout is
provided, the system default timeout will be used. If no retryCount value is provided,
only one attempt will be made to reach uriDestination. If both timeout and retryCount are provided, this method could take up to
timeout x retryCount milliseconds to return.
uriDestination MUST be in the form of:
uriDestination = protocol + "://" + host + [":"+port] + ["/"+virtual_dir]
protocol = "tcp" | "ftp" | "http" | "https" | "icmp"
port is required for "tcp"; It is optional for the others. virtual_dir only applies to "http" and "https".
host = IPAddress | HostName
An implementation SHOULD attempt to use the device's default proxy settings for HTTP, HTTPS, and FTP.
watchServiceChange() function takes two, three or four arguments.
uriDestination MUST be in the form of:
uriDestination = protocol + "://" + host + [":"+port] + ["/"+virtual_dir]
protocol = "tcp" | "ftp" | "http" | "https" | "icmp"
port is required for "tcp"; It is optional for the others. virtual_dir only applies to "http" and "https".
host = IPAddress | HostName
An implementation SHOULD attempt to use the device's default proxy settings for
HTTP, HTTPS, and FTP.
When called, watchServiceChange() MUST immediately return and then
asynchronously start a watch process defined as
the following set of steps:
uriDestination is reachable or not.changeCallback
with the ServiceChange available attribute set to true. changeCallback
with the ServiceChange available attribute set to false. errorCallback
argument, invoke the errorCallback with a
ServiceChangeError object as an argument. uriDestination and
invoke the changeCallback whenever the availability changes state.watchNetworkChange() function takes one, two, or three arguments.
When called, watchNetworkChange() MUST immediately return and then
asynchronously start a watch process defined as
the following set of steps:
NetworkChangeOptions
object.NetworkChangeCallback
with the appropriate flag set in the NetworkChange parameter to
indicate what change occured.errorCallback
argument, invoke the errorCallback with a
NetworkChangeError object as an argument. watchServiceChange() and watchNetworkChange()
methodw return an integer value that uniquely
identifies a watch process. When the clearWatch() method is called
with this identifier, the associated watch process MUST stop monitoring network or
service availability changes and MUST cease invoking any callbacks.
NetworkTechnology technology attribute
determines what additional attributes from sub-classes are valid. For example, if the
NetworkTechnology technology value is GPRS, because a GPRS
network is a CellularNetwork, attributes from
Network, WirelessNetwork, PLMNetwork, and
CellularNetwork will all be valid because of inheritance.
From [[DCONTOLOGY]] and
BONDI.
NOTE: [[DCONTOLOGY]] has an additional operation band attribute that is associated
with networkTechnology, but I have a difficult time envisioning a scenario
in which an application would actually want that data.
NetworkBearer object is not the
currentNetworkBearer, this value SHOULD be 0.
NetworkBearer object is not the
currentNetworkBearer, this value SHOULD be 0.
NOTE: The DCCI ontology has this, but I don't know if it is necessary.
WirelessNetwork.
true if the connection is full duplex; otherwise, false.
BONDI has this attribute
in the domain of CellularNetwork and WifiNetwork. [[DCONTOLOGY]] has it in the domain
of Network. It doesn't really make sense in the WiredNetwork domain.
NOTE: This list is going to change before the WG complete's it's task because the technology simply continues to evolve. Encapsulating the values in an object will allow the API to not change even if the range of potential values grows.
NetworkBearer bandwidth addributes to determine the link speed.
The associated Network object is a WiredNetwork object.
The associated Network object is a WirelessNetwork object.
The associated Network object is a WirelessNetwork object.
The associated Network object is a WirelessNetwork object.
The associated Network object is a WirelessNetwork object.
The associated Network object is a WirelessNetwork object.
The associated Network object is a WirelessNetwork object.
The associated Network object is a CellularNetwork object.
The associated Network object is a CellularNetwork object.
The associated Network object is a CellularNetwork object.
The associated Network object is a CellularNetwork object.
The associated Network object is a CellularNetwork object.
NOTE: I'm not sure this is accurate. Do WiMAX connections have cellId and roaming concepts?
The associated Network object is a CellularNetwork object.
The associated Network object is a CellularNetwork object.
The associated Network object is a CellularNetwork object.
technology attribute SHOULD contain one of the values defined in this
specification. An implementation MAY define additional status codes, but MUST NOT
use the numeric values defined here.
message attribute MAY return an string message describing the
network technology. This attribute is primarily intended for
debugging and developers SHOULD NOT use it directly in their application user interface.
UNKNOWN (numeric value 0): The implementation failed to retrieve
information about network changs for an unknown reason.
status attribute SHOULD contain one of the values defined in this
specification. An implementation MAY define additional status codes, but MUST NOT
use the numeric values defined here.
message attribute MAY return an error message describing the
status. This attribute is primarily intended for
debugging and developers SHOULD NOT use it directly in their application user interface.
mode attribute SHOULD contain one of the values defined in this
specification. An implementation MAY define additional status codes, but MUST NOT
use the numeric values defined here.
message attribute MAY return an string message describing the
network technology's encryptiono mode. This attribute is primarily intended for
debugging and developers SHOULD NOT use it directly in their application user interface.
watchServiceChange(). Use the
parameter to retrieve information about the visibility of a service.watchServiceChange(). Use the
parameter to retrieve information about an error that occured while the implementation
attempted to determine the visibility of a service.sampleInterval attribute specifies in milliseconds how often
the implementation SHOULD check to see if the device has accelerated. On
implementations that are event driven, this value MAY be ignored. The caller should
be aware that while lower values increase the reporting accuracy, they also
adversely affect the device's battery life.
watchNetworkChange(). Use the
parameter to retrieve information about network changes that the device detects.watchNetworkChange(). Use the
parameter to retrieve information about errors that occur while the implementation
attempts to monitor network changes.sampleInterval attribute specifies in milliseconds how often
the implementation SHOULD check to see if the the specified network resources have
changed. On
implementations that are event driven, this value MAY be ignored. The caller should
be aware that while lower values increase the reporting accuracy, they also
adversely affect the device's battery life. The default value SHOULD be 500, or
twice every second.
NetworkChangeCallback with the NetworkChange.ipAddressChanged
attribute set to true. If this value is not specified, or if it is set
to false, IP Addresses SHOULD not be monitored, and the implementation MUST NOT invoke
the NetworkChangeCallback with the NetworkChange.ipAddressChanged attribute set to
true.
NetworkChangeCallback with the NetworkChange.routeTableChanged
attribute set to true. If this value is not specified, or if it is set
to false, the system Route Table SHOULD not be monitored, and the implementation
MUST NOT invoke
the NetworkChangeCallback with the NetworkChange.routeTableChanged attribute set to
true.
NetworkChangeCallback when the device connection state changes.
If all connections are lost, the NetworkChange.disconnected attribute
will be true. If there were no connections and one was established, the
NetworkChange.connected attribute will be true.
The default value is true, meaning that if NetworkChangeOptions
parameter is not provided in the call to watchNetworkChanges(), the implementation
will only watch connection changes.
timestamp attribute MUST indicate when the change occured.
timestamp attribute MUST indicate when the change occured.
UNKNOWN_ERROR (numeric value 0): The implementation failed to retrieve
information about service availability for an unknown reason.
PERMISSION_DENIED (numerice value 1): The implementation failed to
retrieve information about service availability because the application
context does not have permission to use the Platform API.
INFORMATION_UNAVAILABLE (numeric value 2): The implementation failed to
retrieve information about service availability because the information was unavailable.
watchMovement()
call was invalid. For example, if the uriDestination is not a valid
[[URI]], the ServiceChangeErrorCallback must be invoked with the
ServiceChangeError.code attribute equal to INVALID_PARAMETER (3).
code attribute SHOULD contain one of the errors defined in this
specification. An implementation MAY define additional error codes, but MUST NOT
use the numeric values defined here.
message attribute MAY return an error message describing the
details of the error encountered. This attribute is primarily intended for
debugging and developers SHOULD NOT use it directly in their application user interface.
UNKNOWN_ERROR (numeric value 0): The implementation failed to retrieve
information about network changs for an unknown reason.
PERMISSION_DENIED (numerice value 1): The implementation failed to
retrieve network change information because the application
context does not have permission to use the Platform API.
INFORMATION_UNAVAILABLE (numeric value 2): The implementation failed to
retrieve network change information because the information was unavailable.
code attribute SHOULD contain one of the errors defined in this
specification. An implementation MAY define additional error codes, but MUST NOT
use the numeric values defined here.
message attribute MAY return an error message describing the
details of the error encountered. This attribute is primarily intended for
debugging and developers SHOULD NOT use it directly in their application user interface.
watchTemperature() function takes one, two, or three arguments.
When called, watchTemperature() MUST immediately return and then
asynchronously start a watch process defined as the following set of steps:
options parameter,
invoke the TemperatureChangeCallback
with the appropriate attribute set in the TemperatureChange parameter to
indicate what change occured.errorCallback
argument, invoke the errorCallback with a
TemperatureChangeError object as an argument. watchTemperature()
method returns an integer value that uniquely
identifies a watch process. When the clearWatch() method is called
with this identifier, the associated watch process MUST stop monitoring temperature
changes and MUST cease invoking any callbacks.
UNKNOWN_TARGET (numeric value 0): The implementation is unable to determine
what the thermal target is.
INTERNAL_COMPONENT (numerice value 1): The thermometer is deigned to
measure and report the temperature of an internal system or device component such as
the CPU.
AMBIENT_ENVIRONMENT (numeric value 2): The thermometer is deigned to
measure and report the temperature of the host device's ambient environment.
EXTERNAL_ENVIRONMENT (numeric value 3): The thermometer is deigned to
measure and report the temperature of the external environment, e.g. the outside
temperature.
EXTERNAL_COMPONENT (numeric value 4): The thermometer is deigned to
measure and report the temperature of an external component such as a car engine.
ANIMATE_BODY (numeric value 5): The thermometer is deigned to
measure and report the temperature of an external animate object such as a human body.
code attribute SHOULD contain one of the values defined in this
specification. An implementation MAY define additional thermal targets, but MUST NOT
use the numeric values defined here.
description attribute MAY return more detail about the thermometer
target.
getCurrentTemperature() or watchTemperature().
TemperatureChangeOptions parameter of a prior call to
watchTemperature() .
sampleInterval attribute specifies in milliseconds how often
the implementation SHOULD check to see if the temperature has changed.
On implementations that are event driven, this value MAY be ignored. The caller
should be aware that setting a value too small can adversely affect the battery life.
The default value SHOULD be 30,000, or once every 30 seconds.
timeout attribute denotes the maximum length of time (expressed
in milliseconds) that is allowed to pass from the call to watchTemperature()
until the corresponding successCallback is invoked. If the
implementation is unable to successfully acquire information about the temperature
before the given timeout elapses, and no other errors have occurred in
this interval, then the corresponding errorCallback MUST be invoked
with a TemperatureError object whose code attribute is set to
TIMEOUT. If the timeout attribute is negative or not
specified, the implementation MUST never timeout and MUST never invoke the
errorCallback with a TemperatureError object whose code
attribute is set to TIMEOUT. If the timeout
attribute is zero, the errorCallback MUST be invoked if power Level
information is not available immediately.
highThreshold attribute is not null, when system temperature
rises above the specified temperature (in Celsius), the TemperatureChangeCallback MUST be invoked
with the crossedHighThreshold value of the TemperatureChange
parameter set to true. If the TemperatureChangeOptions
highThreshold attribute is null or not specified,
TemperatureChangeCallback MUST NOT be invoked with the crossedHighThreshold
value set to true.
lowThreshold attribute is not null, when system temperature
falls below the specified temperature (in Celsius), the TemperatureChangeCallback MUST be invoked
with the crossedLowThreshold attribute of the TemperatureChange
parameter set to true. If the TemperatureChangeOptions
lowThreshold attribute is null or not specified,
TemperatureChangeCallback MUST NOT be invoked with the crossedHighThreshold
value set to true.
TemperatureChange object inherits the timestamp and
temperature attributes from
Temperature.
TemperatureChangeOptions highThreshold attribute in a prior call to
watchTemperature().
TemperatureChangeOptions lowThreshold attribute in a prior call to
watchTemperature().
UNKNOWN_ERROR (numeric value 0): The implementation failed to retrieve
temperature information for an unknown reason.
PERMISSION_DENIED (numerice value 1): The implementation failed to
retrieve temperature information because the application
context does not have permission to use the Platform API.
AMBIENT_ENVIRONMENT (numeric value 2): The implementation failed to
retrieve temperature information because the information was unavailable.
code attribute SHOULD contain one of the errors defined in this
specification. An implementation MAY define additional error codes, but MUST NOT
use the numeric values defined here.
message attribute MAY return an error message describing the
details of the error encountered. This attribute is primarily intended for
debugging and developers SHOULD NOT use it directly in their application user interface.
watchPhysicalKeyboardChange() function takes one or two arguments.
When called, it must immediately return and then asynchronously start a watch
process defined as the following set of steps:
errorCallback argument, invoke the errorCallback
with a InputChangeError object as an argument. PhysicalKeyboardChange
object every time the implementation determines that a physical
keyboard has attached or detached. clearWatch() method is called with this identifier, the watch process must stop acquiring any new position fixes and must cease invoking any callbacks. When this value is used in a call to updatePosition(), the watch process SHOULD update the position information that it is using in its orientation caluculations.
watchPhysicalPointerChange() function takes one or two arguments.
When called, it must immediately return and then asynchronously start a watch
process defined as the following set of steps:
errorCallback argument, invoke the errorCallback
with a InputChangeError object as an argument. PhysicalPointerChange
object every time the implementation determines that a physical
pointer has attached or detached. clearWatch() method is called with this
identifier, the watch process must stop acquiring any new position fixes and
must cease invoking any callbacks.
successCallback and errorCallback associated with
the watchId.
The use cases for this module are critical to forming a realistic picture of what kinds of information are going to be valuable for the web application that wants delivery context network information. The primary use case is: application wants to know about the network connection so that it can adjust its behavior.
Many thanks to Clayne Robison and Andy Idsinga at Intel Corporation for their contributions to this specification.