Sample Javascript to access EB.Battery.smartBatteryStatus api


Audience

The api for "smartBatteryStatus" is differently used than the "batteryStatus" api.  The sample code only demonstrates how to access the EB.Battery.batteryStatus, but not the smartBatteryStatus.  I need to see a sample on how to use the api so that I can access the battery identification information to create the unique Battery ID (BID).  Any code snippet would be appreciated.

Submitted by Anonymous (not verified) on May 29, 2019 Permalink

Hi, the following should work:
EB.Battery.smartBatteryStatus(batteryCallback);
function batteryCallback(params){
if(params){ // Most of these methods have callbacks but null 'params' sent.
console.log(params);
}
else
console.log("No Params");
}
I do not have a device handy to double-check however.