eon_cordova_bluetooth object (Android only)

This object enables communication between a mobile device (currently only Android-based device) and the bluetooth devices.

Functions

of_disable

Description

Turns off bluetooth on the device. When successful, the oe_success event will be triggered; when failed, the oe_error event will be triggered.

Syntax

of_disable ( )

Return value

None

of_enable

Description

Turns on bluetooth on the device. When successful, the oe_success event will be triggered; when failed, the oe_error event will be triggered.

Syntax

of_enable ( )

Return value

None

of_init

Description

Connects with the Cordova bluetooth 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_isenabled

Description

Detects if bluetooth is turned on or not on the device.

Syntax

of_isenabled ( )

Return value

Boolean

True - Bluetooth is turned on.

False - Bluetooth is turned off.

of_pair

Description

Pairs your device with a bluetooth device. When successful, the oe_success event will be triggered; when failed, the oe_error event will be triggered.

Syntax

of_pair ( string as_address )

Parameter

as_address - The address of the bluetooth device you want to pair with your device.

Return value

None

of_startdiscovery

Description

Scans for the available bluetooth devices. When successful, the oe_success event will be triggered and the found device(s) will be passed to the event; when failed, the oe_error event will be triggered.

Syntax

of_startdiscovery ( )

Return value

None

of_unpair

Description

Unpairs a bluetooth device with your device. When successful, the oe_success event will be triggered; when failed, the oe_error event will be triggered.

Syntax

of_unpair ( string as_address )

Parameter

as_address - The address of the bluetooth device you want to unpair with your device.

Return value

None

Events

oe_finish

Description

Occurs when scanning for bluetooth devices is successful. It can be used to scan for bluetooth devices in a loop.

Syntax

oe_finish ( string as_message )

Parameter

as_message - A JSON-format string which contains values returned by the function such as the address and name of the found bluetooth device.

Return value

None

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 values returned by the function such as the address and name of the found bluetooth device.

Return value

None

Properties

boolean ib_enabled

Indicates whether bluetooth is turned on.

boolean ib_exist

Indicates whether the device exists in the search list.

boolean ib_search

Indicates whether search is successful.

eon_str_cordova_bluetooth ieon_str_bluetooth[]

The structure for storing the address and name of the found bluetooth device.

long il_type

Functionality extension for developers: 1 - isenabled 2 - search.

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.