Replies: 2 comments
-
Hello, I have some information to share with you
|
Beta Was this translation helpful? Give feedback.
0 replies
-
oh. thanks, I'll try onminute, but anyway, timer used as patch only, main function is a listener and vibration. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
hi all,
I'll tried to make a little watchdog for bt connection in background and it works at least strange.
through few minutes after installing it works fine, but after few hours, it may works or may not, as it pleases. no logic or dependencies. also it works only while display is off.
at first time, I'd thought what it's a listener issue, but injecting of timer-checker patch hand no affects.
so is I do something wrong or I do not understand how it must works?
`
import { Vibrator } from "@zos/sensor";
import { addListener, connectStatus } from '@zos/ble'
const vibrator = new Vibrator()
let isConnected = connectStatus()
const callback_btListener = (cState) => {
isConnected = cState
doVibro()
}
addListener(callback_btListener)
function doVibro(){
if (isConnected){
vibrator.stop()
vibrator.setMode(31)
vibrator.start()
} else {
vibrator.stop()
vibrator.setMode(23)
vibrator.start()
}
}
setInterval(() => {
if (isConnected != connectStatus()){
isConnected = connectStatus()
doVibro()
}
}, 1000)
AppService({
onEvent(e) {
},
onInit(e) {
},
onDestroy() {
},
});
`
Beta Was this translation helpful? Give feedback.
All reactions