eon_cordova_orientation object

This object provides access to the device's compass. The compass is a sensor that detects the direction or heading that the device is pointed, typically from the top of the device.

Functions

of_clearwatch

Description

Stops watching the device's heading according to the specified watch ID.

Syntax

of_clearwatch ( string as_watchid )

Parameter

as_watchid - Watch ID returned by of_watchheading.

Return value

None

of_getcurrentheading

Description

Gets the device's current heading/direction. When successful, the oe_success event will be triggered; when failed, the oe_error event will be triggered; and the return value will be passed to the parameter of the event.

Syntax

of_getcurrentheading ( )

Return value

None.

of_init

Description

Connects with the Cordova device orientation plugin, detects if the plugin is available to call, and binds the current PowerBuilder object with the JavaScript object defined by the plugin. After that, the PowerBuilder object has all of the methods and properties that the JavaScript object has.

Syntax

of_init ( )

Return value

Integer.

1 - Success.

-1 - It is called in PowerBuilder or PowerServer Web, or there is an error.

of_watchheading

Description

Gets the device's current heading/direction at a regular interval.

Syntax

of_watchheading ( long al_frequency, decimal ad_filter )

Parameter

al_frequency - How often to retrieve the device's heading in milliseconds (default: 100)

ad_filter - The change in degrees required to retrieve the heading. It is supported in iOS only. When this parameter is set, al_frequency is ignored.

Return value

String. Watch ID is returned and can be used by of_clearwatch.

Events

oe_success

Description

Occurs when the function is successfully executed. If the JavaScript function in the Cordova plugin returns any value, that value will be passed to the as_message parameter.

Syntax

oe_success ( string as_message )

Parameter

as_message - A JSON-format string which contains the heading information.

Return value

None

Properties

eon_str_cordova_orientation ieon_str_orientation

The structure for storing the detailed heading information.

oleobject ieon_ole

PowerBuilder OLEObject object to be connected with the Cordova plugin.

powerobject ipo_bindevent

PowerBuilder object to be bound with the JavaScript object.

string is_errorevent

Stores the error event name of the PowerBuilder object.

string is_errorText

Stores the error information returned by the JavaScript function when execution failed.

string is_jserrorText

Stores the JavaScript error information when JavaScript call fails.

string is_successevent

Stores the success event name of the PowerBuilder object.

string is_successText

Stores the value returned by the JavaScript function when execution is successful.

Structures

eon_str_cordova_orientation

Description

Struct.

Stores the information of the device orientation.

Property

Type

Variable Name

Description

decimal

magneticHeading

The device's magnetic heading.

decimal

trueHeading

The device's true heading.

decimal

HeadingAccuracy

The device's heading accuracy.

decimal

timestamp

The device's timestamp.