【事件】 | void onBluetoothEnableSuccessed() |
【说明】 | 当rexseeBluetooth.enable()成功打开蓝牙时触发。 |
【参数】 | 无 |
【示例】 |
window.onBluetoothEnableSuccessed = function(){
参见rexseeBluetooth.enable()。
// TODO } |
【事件】 | void onBluetoothEnableFailed() |
【说明】 | 当rexseeBluetooth.enable()未能成功打开蓝牙时触发。 |
【参数】 | 无 |
【示例】 |
window.onBluetoothEnableFailed = function(){
参见rexseeBluetooth.enable()。
// TODO } |
【事件】 | void onBluetoothSetDiscoverableSuccessed(int discoverableSeconds) |
【说明】 | 当rexseeBluetooth.setDiscoverable(int seconds)设置成功时触发。 |
【参数】 | discoverableSeconds:可被检测的周期,通常等于setDiscoverable(int seconds)函数传递的参数,但最大为300秒。 |
【示例】 |
window.onBluetoothSetDiscoverableSuccessed = function(int discoverableSeconds){
参见rexseeBluetooth.setDiscoverable(int seconds)。
// TODO } |
【事件】 | void onBluetoothSetDiscoverableFailed() |
【说明】 | 当rexseeBluetooth.setDiscoverable(int seconds)未能设置成功时触发。 |
【参数】 | 无 |
【示例】 |
window.onBluetoothSetDiscoverableFailed = function(){
参见rexseeBluetooth.setDiscoverable(int seconds)。
// TODO } |
【事件】 | void onBluetoothDeviceConnectStateChanged() |
【说明】 | 当和远端蓝牙设备的连接状态发生变化时触发,可以用getCurrentDevice()函数获取当前正在操作的远端设备的信息,用getConnectState()获得新状态而用getPreviousConnectState()获得旧状态。 |
【参数】 | 无 |
【示例】 |
window.onBluetoothDeviceConnectStateChanged = function(){
参见rexseeBluetooth.connect()。
// TODO } |
【事件】 | void onBluetoothDeviceConnectFailed() |
【说明】 | 当试图连接远端蓝牙设备失败时触发,可以用getCurrentDevice()函数获取当前正在操作的远端设备的信息。 |
【参数】 | 无 |
【示例】 |
window.onBluetoothDeviceConnectFailed = function(){
参见rexseeBluetooth.connect()。
// TODO } |
【事件】 | void onBluetoothReceivedConnectRequest() |
【说明】 | 当接收到远端设备的连接请求时触发,可以用getCurrentDevice()函数获取远端设备的信息。 |
【参数】 | 无 |
【示例】 |
window.onBluetoothReceivedConnectRequest= function(){
参见rexseeBluetooth.startListenerForConnectRequest()。
// TODO } |
【事件】 | void onBluetoothConnectionLost() |
【说明】 | 当连接断开时(例如远端设备用disconnect()函数断开了连接),可以用getCurrentDevice()函数获取远端设备的信息。 |
【参数】 | 无 |
【示例】 |
window.onBluetoothConnectionLost= function(){
// TODO } |
【事件】 | void onBluetoothDataRead(String data) |
【说明】 | 当连接远端蓝牙设备后读取到远端设备发送的数据时触发,可以用getCurrentDevice()函数获取当前正在操作的远端设备的信息。 |
【参数】 | data:远端设备发送的数据,是escape()过的数据,应使用unescape()读取。 |
【示例】 |
window.onBluetoothDataRead = function(data){
参见rexseeBluetooth.connect()。
// TODO } |
【事件】 | void onBluetoothDataWrite(String data) |
【说明】 | 当连接远端蓝牙设备后向远端设备写入数据时触发,可以用getCurrentDevice()函数获取当前正在操作的远端设备的信息。 |
【参数】 | data:向远端设备写入的数据,是escape()过的数据,应使用unescape()读取。 |
【示例】 |
window.onBluetoothDataWrite = function(data){
参见rexseeBluetooth.write()。
// TODO } |
【事件】 | void onBluetoothDiscoveringStarted() |
【说明】 | 扫描开始时触发,无论该扫描是由本应用启动还是其它应用启动。但是,该事件默认是不会被触发的,只有在调用startListenerForBroadcast()后才会被触发,而在调用stopListenerForBroadcast()后就不会再被触发。 |
【参数】 | 无 |
【示例】 |
window.onBluetoothDiscoveringStarted = function(){
参见rexseeBluetooth.startListenerForBroadcast()。
// TODO } |
【事件】 | void onBluetoothDiscoveringFinished() |
【说明】 | 扫描结束时触发,无论该扫描是由本应用启动还是其它应用启动。但是,该事件默认是不会被触发的,只有在调用startListenerForBroadcast()后才会被触发,而在调用stopListenerForBroadcast()后就不会再被触发。 |
【参数】 | 无 |
【示例】 |
window.onBluetoothDiscoveringFinished = function(){
参见rexseeBluetooth.startListenerForBroadcast()。
// TODO } |
【事件】 | void onBluetoothLocalNameChanged() |
【说明】 | 当本机蓝牙适配器的名称发生变化时触发,无论该变化是由本应用启动还是其它应用启动。但是,该事件默认是不会被触发的,只有在调用startListenerForBroadcast()后才会被触发,而在调用stopListenerForBroadcast()后就不会再被触发。 |
【参数】 | 无 |
【示例】 |
window.onBluetoothLocalNameChanged = function(){
参见rexseeBluetooth.startListenerForBroadcast()。
// TODO } |
【事件】 | void onBluetoothScanModeChanged(String currentMode, String previouseMode) |
【说明】 | 当本机蓝牙适配器的扫描方式发生变化时触发,无论该变化是由本应用启动还是其它应用启动。但是,该事件默认是不会被触发的,只有在调用startListenerForBroadcast()后才会被触发,而在调用stopListenerForBroadcast()后就不会再被触发。 |
【参数】 | currentMode:当前的扫描方式,"connectable"、"connectable_discoverable"或"none"。 previousMode:修改前的扫描方式。 |
【示例】 |
window.onBluetoothScanModeChanged = function(String currentMode, String previouseMode){
参见rexseeBluetooth.startListenerForBroadcast()。
// TODO } |
【事件】 | void onBluetoothStateChanged(String currentState, String previouseState) |
【说明】 | 当本机蓝牙适配器的状态发生变化时触发,无论该变化是由本应用启动还是其它应用启动。但是,该事件默认是不会被触发的,只有在调用startListenerForBroadcast()后才会被触发,而在调用stopListenerForBroadcast()后就不会再被触发。 |
【参数】 | currentState:当前的状态,"on"、"off"、"turning_on"、"turning_off"或"unknown"。 previouseState:修改前的状态。 |
【示例】 |
window.onBluetoothStateChanged = function(String currentState, String previouseState){
参见rexseeBluetooth.startListenerForBroadcast()。
// TODO } |
【事件】 | void onBluetoothDeviceFound(String address) |
【说明】 | 当在扫描中找到新的蓝牙设备时触发,无论该扫描是由本应用启动还是其它应用启动。但是,该事件默认是不会被触发的,只有在调用startListenerForBroadcast()后才会被触发,而在调用stopListenerForBroadcast()后就不会再被触发。 |
【参数】 | address:远端设备的蓝牙地址。 |
【示例】 |
window.onBluetoothDeviceFound = function(String address){
参见rexseeBluetooth.startListenerForBroadcast()。
// TODO } |
【事件】 | void onBluetoothDeviceACLConnected(String address) |
【说明】 | 当本机和远端蓝牙设备建立底层链接(ACL)时触发,无论该动作是由本应用启动还是其它应用启动。但是,该事件默认是不会被触发的,只有在调用startListenerForBroadcast()后才会被触发,而在调用stopListenerForBroadcast()后就不会再被触发。 |
【参数】 | address:远端设备的蓝牙地址。 |
【示例】 |
window.onBluetoothDeviceACLConnected = function(String address){
参见rexseeBluetooth.startListenerForBroadcast()。
// TODO } |
【事件】 | void onBluetoothDeviceACLDisconnected(String address) |
【说明】 | 当本机和远端蓝牙设备的底层链接(ACL)断开时触发,无论该动作是由本应用启动还是其它应用启动。但是,该事件默认是不会被触发的,只有在调用startListenerForBroadcast()后才会被触发,而在调用stopListenerForBroadcast()后就不会再被触发。 |
【参数】 | address:远端设备的蓝牙地址。 |
【示例】 |
window.onBluetoothDeviceACLDisconnected = function(String address){
参见rexseeBluetooth.startListenerForBroadcast()。
// TODO } |
【事件】 | void onBluetoothDeviceACLDisconnectRequested(String address) |
【说明】 | 当本机和远端蓝牙设备的底层链接(ACL)被要求断开(尚未断开但即将断开)时触发,无论该动作是由本应用启动还是其它应用启动。但是,该事件默认是不会被触发的,只有在调用startListenerForBroadcast()后才会被触发,而在调用stopListenerForBroadcast()后就不会再被触发。 |
【参数】 | address:远端设备的蓝牙地址。 |
【示例】 |
window.onBluetoothDeviceACLDisconnectRequested = function(String address){
参见rexseeBluetooth.startListenerForBroadcast()。
// TODO } |
【事件】 | void onBluetoothDeviceBondStateChanged(String address, String currentBondState, String previousBondState) |
【说明】 | 当本机和远端蓝牙设备的绑定状态发生变化时触发,无论该变化是由本应用启动还是其它应用启动。但是,该事件默认是不会被触发的,只有在调用startListenerForBroadcast()后才会被触发,而在调用stopListenerForBroadcast()后就不会再被触发。 |
【参数】 | address:远端设备的蓝牙地址。 currentBondState:当前的绑定状态,"bonded"、"bonding"或"none"。 previousBondState:修改前的绑定状态。 |
【示例】 |
window.onBluetoothDeviceBondStateChanged = function(String address, String currentBondState, String previousBondState){
参见rexseeBluetooth.startListenerForBroadcast()。
// TODO } |
【事件】 | void onBluetoothDeviceClassChanged(String address) |
【说明】 | 当远端蓝牙设备的类型发生变化时触发,无论该变化是由本应用启动还是其它应用启动。但是,该事件默认是不会被触发的,只有在调用startListenerForBroadcast()后才会被触发,而在调用stopListenerForBroadcast()后就不会再被触发。 |
【参数】 | address:远端设备的蓝牙地址。 |
【示例】 |
window.onBluetoothDeviceClassChanged = function(String address){
参见rexseeBluetooth.startListenerForBroadcast()。
// TODO } |
【事件】 | void onBluetoothDeviceNameChanged(String address) |
【说明】 | 当远端蓝牙设备的名称发生变化时触发,无论该变化是由本应用启动还是其它应用启动。但是,该事件默认是不会被触发的,只有在调用startListenerForBroadcast()后才会被触发,而在调用stopListenerForBroadcast()后就不会再被触发。 |
【参数】 | address:远端设备的蓝牙地址。 |
【示例】 |
window.onBluetoothDeviceNameChanged = function(String address){
参见rexseeBluetooth.startListenerForBroadcast()。
// TODO } |