智能照明系统APP-本地串口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
LightingSystemApp-serial/.svn/pristine/ad/ad3522d20f5426d91e41c7d3095...

64 lines
1.5 KiB

import {
invoke
} from '../../bridge'
export function onBeaconUpdate (callbackId) {
plus.ibeacon.onBeaconUpdate(data => invoke(callbackId, data))
}
export function onBeaconServiceChange (callbackId) {
plus.ibeacon.onBeaconServiceChange(data => invoke(callbackId, data))
}
export const onBeaconServiceChanged = onBeaconServiceChange
export function getBeacons (params, callbackId) {
plus.ibeacon.getBeacons({
success: (result) => {
invoke(callbackId, {
errMsg: 'getBeacons:ok',
beacons: result.beacons
})
},
fail: (error) => {
invoke(callbackId, {
errMsg: 'getBeacons:fail:' + error.message
})
}
})
}
export function startBeaconDiscovery ({
uuids,
ignoreBluetoothAvailable = false
}, callbackId) {
plus.ibeacon.startBeaconDiscovery({
uuids,
ignoreBluetoothAvailable,
success: (result) => {
invoke(callbackId, {
errMsg: 'startBeaconDiscovery:ok',
beacons: result.beacons
})
},
fail: (error) => {
invoke(callbackId, {
errMsg: 'startBeaconDiscovery:fail:' + error.message
})
}
})
}
export function stopBeaconDiscovery (params, callbackId) {
plus.ibeacon.stopBeaconDiscovery({
success: (result) => {
invoke(callbackId, Object.assign(result, {
errMsg: 'stopBeaconDiscovery:ok'
}))
},
fail: (error) => {
invoke(callbackId, {
errMsg: 'stopBeaconDiscovery:fail:' + error.message
})
}
})
}