Details
-
Type: Bug
-
Status: Resolved
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.3 Final
-
Fix Version/s: BridgeIt 1.0
-
Component/s: Containers
-
Labels:None
-
Environment:ICEmobile, ICEmobile-SX
Description
ICEmobile-SX is effectively a "helper application" and interacts with the browser via a custom URL scheme. Improvements to this scheme and an API will enhance the functionality of ICEmobile-SX/BridgeIt.
One option for ICEmobile-SX return value enhancement is to use JSON encoding rather than URL encoding. Unfortunately, JSON is characterized by an abundance of characters that must all be encoded in URLs (specifically braces, quotes, and commas).
URL encoding will be used as the base encoding for ICEmobile-SX return values. By default name=value pairs will be found in the document by id (name is not unique and would require a form to be specified) and their value will be set. If the id (with suffix "-hid" added) is not found, but is valid, a hidden field will be created to store the value. This case where the ID is "invalid" can be used by JavaScript invocations that rely on the callback alone for data transport. In this case the name passed to ICEmobile-SX invocation should be of the form "_result" since underscore is not an allowed character for HTML IDs.
[Possible future simplified ajax capability: If an element without a value is found (such as a div or text area) the value will be set to the innerHTML of the element.]
Name/value pairs of the form "!name=value" (where the name starts with "!") are reserved and are processed by the hashchange logic for flags and other data values used by the JavaScript API.
The safest data transport mechanism is to use the name=value form since this will function even if the browser completely loads the page (thereby losing any in-memory context for JavaScript callbacks).
Each native function is defined in the ice.mobi namespace, for instance:
ice.mobi.scan("myqr");
will result in the scanned value being stored in the field with name "myqr" and id "myqr-hid" adjacent to the element with id "myqr".
ice.mobi.scan("_myqr", mycallback);
will result in
mycallback(event)
where
event.command = "scan"
event.name = "_myqr"
event.value = "scanned text"
event.response = null
event.preview = null
event.status = "done"
ice.mobi.camera("_mycam", mycallback);
will result in
mycallback(event)
where
event.command = "camera"
event.name = "_mycam"
event.value = null
event.response = "handled by AuxUploadResourceHandler"
event.preview = "data:image/png;base64,iVBOR..."
event.status = "wait"
event.statusDetail = "offline"
For bulk upload types such as photo and video, ICEfaces does not return a useful value, but other approaches could use the return value from the upload to associate the upload with future HTTP requests (thereby supporting a sessionless interaction).
Values for status: "done", "wait", "fail". statusDetail contains the error message or description of the wait condition.