Hi everyone,
I use SAP for my development in Web APP (Consumer(Android)_Provider(Tizen)).
How can I send HR data to Android when it changed until shut down the app?
I’ve tried to write HR sensor monitor in function onconnected
!!! Then send data once HR changed. But HR data seems to be the same after about 5 minutes without any reason.
Is that because something get wrong, CPU processing speed? Memory full? or what if I use setInterval
?
onconnect: function (socket) {
var onConnectionLost, dataOnReceive;
SASocket = socket;
function onchangedCB_HR(hrmInfo) {
tizen.humanactivitymonitor.getHumanActivityData('HRM', onsuccessCB_HR, onerrorCB_HR);
}
function onsuccessCB_HR(hrmInfo) {
var date = new Date(Date.now());
var hours = date.getHours();
var minutes = "0" + date.getMinutes();
var seconds = "0" + date.getSeconds();
var Time = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);
var HRdata;
HRdata = "<" + Time + ">" + "HR" + "#" + hrmInfo.heartRate;
sendData(HRdata);
}
function onerrorCB_HR(error) {
tizen.humanactivitymonitor.stop('HRM');
console.log('HR Error occurred: ' + error.message);
}
function sendData(data){
SASocket.sendData(SAAgent.channelIds[0], data );
}
tizen.humanactivitymonitor.start('HRM', onchangedCB_HR);
}
Thanks for your help,
Egg.