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:

  1. PDL_EnableCompass – Activates or deactivates compass tracking. You must activate compass tracking before any calls to PDL_GetCompass.

  2. PDL_GetCompass – Gets the compass bearing for magnetic and true north.

  3. 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:

  1. PDL_HandleJSCalls – Calls the handlers for any pending downstream JS calls in the queue.

  2. PDL_IsPoller – Returns true if a polling handler is handling "parms" or false if they are being handled immediately.

  3. PDL_LoadOGL – Dynamically opens a specific OpenGL version.

  4. PDL_Log – Logs to the file /media/internal/tracking.txt under the category "pdl_log".

  5. 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.

  6. PDL_SetAutomaticSoundPausing – Enables or disables automatic sound pausing when carded.

Compass struct

For PDL_GetCompass, a new stuct has been created:

typedef struct
{
  int confidence;
  double magneticBearing;
  double trueBearing;
} PDL_Compass; 

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.