New in webOS 3.0+
For Plug-In Development Kit (PDK) apps, some new APIs and capabilities have been added.
New APIs
For webOS 3.0, three new PDL APIs (libpdl) have been added:
-
PDL_EnableCompass – Activates or deactivates compass tracking. You must activate compass tracking before any calls to
PDL_GetCompass. -
PDL_GetCompass – Gets the compass bearing for magnetic and true north.
-
PDL_SetKeyboardState – Summons or dismisses the on-screen keyboard for the HP TouchPad.
For webOS 3.0.2, six new PDL APIs have been added:
-
PDL_HandleJSCalls – Calls the handlers for any pending downstream JS calls in the queue.
-
PDL_IsPoller – Returns true if a polling handler is handling "parms" or false if they are being handled immediately.
-
PDL_LoadOGL – Dynamically opens a specific OpenGL version.
-
PDL_Log – Logs to the file /media/internal/tracking.txt under the category "pdl_log".
-
PDL_RegisterPollingJSHandler – Same as PDL_RegisterJSHandler, but instead of the JS handler being called immediately, the request is put in a queue, and an event is posted to SDL to alert you.
-
PDL_SetAutomaticSoundPausing – Enables or disables automatic sound pausing when carded.
For webOS 3.0.5, seven new PDL APIs have been added:
-
PDL_SensorExists – Returns flag indicating if sensor exists on a device.
-
PDL_EnableSensor – Enables or disables a sensor. Once enabled, your app can receive the sensor's events. Once disabled, the events stop.
-
PDL_PollSensor – Gets events from a specific, enabled sensor.
-
PDL_PollActiveSensors – Same as PDL_PollSensor, but returns the first event available for all the currently active sensors.
-
PDL_DismissFullscreen – Returns a plug-in from fullscreen mode back to being a component on a web page.
-
PDL_IsFullscreenPlugin – Returns flag indicating if app is a plug-in that is now fullscreen.
-
PDL_SetFullscreen – Causes a plug-in to go from being a component on a web page to being fullscreen.
The first 4 APIs were added to support new sensor functionality.
Compass struct
For PDL_GetCompass, a new stuct has been created:
typedef struct { int confidence; double magneticBearing; double trueBearing; } PDL_Compass;
Note:
The new sensor functionality added in webOS 3.0.x also supports a compass sensor and we recommend you use that. However, the compass APIs and data types added in webOS 3.0 will remain for backward compatibility.
Emulator
Starting with webOS 3.0, you can run x86-compiled PDK code in the Emulator in either full-screen or hybrid mode. SDL APIs are supported, but OpenGL ES is not.
To build PDK code, you need a separate x86 toolchain. On Windows, you can download the current CodeSourcery G++ Lite cross-compiler from http://www.codesourcery.com/sgpp/lite/ia32/portal/release1567. We have seen problems with these tools when hosted on 64-bit Windows.
Hybrid Applications
In Enyo 0.9, we added an enyo.Hybrid control type to wrap PDK objects in JavaScript (JS) applications.
Since a hybrid app runs in two separate processes, there is a delay between when the HTML's <object> tag becomes available and when the Plug-in's exposed methods can be called. The only safe way to work around this is to set up a "ready" method on the object from the JS side and wait until it is called via PDL_CallJS before the JS invokes Plug-in methods. On webOS 2.1 and earlier, this technique mostly worked, but, since then, WebKit and adapter changes have meant that checking for a method on an <object> before it's completely constructed can cause the <object> tag to be removed from the DOM.