Syntax
int IsChargingState(void);
Parameters
None
Return value
Returns the charging status.
Value | Description |
---|---|
OFF_CRADLE | The terminal is not installed in the cradle and is not connected to USB. |
CHARGING_USB | The terminal is connected to USB. (Charging) |
CHARGING_CRADLE | The terminal is installed in the cradle. (Charging) |
COMPLETED_USB | The terminal is connected to USB and is in a fully charged state. |
COMPLETED_CRADLE | The terminal is installed in the cradle and is fully charged. |
CHARGING_DISABLED | The terminal is installed in the cradle or connected to USB and is out of the charging temperature range. |
Remarks
Returns the current charging state of the terminal.
Requirements
Header file:
lib.hLibrary file:
libSTARTUPOPH5000.a
Sample
#include <stdio.h>
#include "lib.h"
void main(void)
{
int previous_state, current_state;
previous_state = -1; /* Not equal to 0, 1, 2, 3 */
for (;;)
{
current_state = IsChargingState();
if (current_state != previous_state)
{
previous_state = current_state;
switch(current_state)
{
case OFF_CRADLE:
printf("Not charging\n");
break;
case CHARGING_USB:
printf("Charging USB\n");
break;
case CHARGING_CRADLE:
printf("Charging CRADLE\n");
break;
case COMPLETED_USB:
printf("Completed USB\n");
break;
case COMPLETED_CRADLE:
printf("Completed CRADLE\n");
break;
case CHARGING_DISABLED:
printf("Temperature Error\n");
break;
default:
break;
}
}
Idle();
}
}
Last updated: 2020/10/07