0 Replies Latest reply on Sep 10, 2013 11:31 AM by Tyler Mills

    How can I return smartBatteryEvent data with Javascript on an MC65?

    Tyler Mills
      <HTML>
          <HEAD>
        <TITLE>Battery Data</TITLE>
        <META HTTP-EQUIV="battery" content="sampleInterval:0;batteryEvent:url('JavaScript:lowBattery(%json)');">            
              <meta http-equiv="quitbutton" content="visibility:visible;" />
          </HEAD> 
          <SCRIPT type="text/javascript">
          function lowBattery(jsonObject)
          {
        if(jsonObject.eventSource != "Critical Battery") {
        battery.getSmartBatteryStatus('serialNumber');
        alert("Event: " + jsonObject.eventSource + " ,Battery remaining: " + jsonObject.batteryLifePercent + 
        "% ,Backup battery remaining:" + jsonObject.backupBatteryLifePercent + "% ,AC line status: " + jsonObject.acLineStatus );
        application.minimize();
        //if critical battery, turn off device!
        }else{
        device.powerOff();
        }
        } 
        battery.setSystemNotifications='Enabled';
        application.minimize();
          </SCRIPT>
        <a href="batteryMon.html">Refresh</a>
      </HTML>
      

      I have tried placing battery.getSmartBatteryStatus(); within the lowBattery function and then returning jsonObject.serialNumber or just serialNumber to no avail.