|
EXTERN_C CCAUXDLL_API BATTERYHANDLE CCAUXDLL_CALLING_CONV | GetBattery (void) |
|
EXTERN_C CCAUXDLL_API void CCAUXDLL_CALLING_CONV | Battery_release (BATTERYHANDLE) |
|
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV | Battery_isBatteryPresent (BATTERYHANDLE, bool *batteryIsPresent) |
|
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV | Battery_getBatteryVoltageStatus (BATTERYHANDLE, uint8_t *batteryVoltagePercent) |
|
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV | Battery_getBatteryChargingStatus (BATTERYHANDLE, ChargingStatus *status) |
|
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV | Battery_getPowerSource (BATTERYHANDLE, PowerSource *status) |
|
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV | Battery_getBatteryTemp (BATTERYHANDLE, int16_t *temperature) |
|
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV | Battery_getHwErrorStatus (BATTERYHANDLE, ErrorStatus *errorCode) |
|
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV | Battery_getTimer (BATTERYHANDLE, BatteryTimerType *times) |
|
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV | Battery_getMinMaxTemp (BATTERYHANDLE, int16_t *minTemp, int16_t *maxTemp) |
|
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV | Battery_getBatteryHWversion (BATTERYHANDLE, char_t *buff, int32_t len) |
|
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV | Battery_getBatterySwVersion (BATTERYHANDLE, uint16_t *major, uint16_t *minor, uint16_t *release, uint16_t *build) |
|
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV | Battery_getBatterySerial (BATTERYHANDLE, char_t *buff, int32_t len) |
|
Functions in the Battery class
◆ Battery_getBatteryChargingStatus()
Get battery charging status.
Supported Platform(s): XM
- Parameters
-
status | the current charging mode of the battery. |
- Returns
- error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.
Example Usage:
{
cout <<
"getBatteryChargingStatus: " <<
GetErrorStringA(error) <<
" - battery is not present!" << std::endl;
}
{
cout <<
"getBatteryChargingStatus: " <<
GetErrorStringA(error) << std::endl;
}
else
{
switch(cs)
{
cout << "getBatteryChargingStatus: Battery is not being charged" << std::endl;
break;
cout << "getBatteryChargingStatus: Battery is being charged" << std::endl;
break;
cout << "getBatteryChargingStatus: Battery is fully charged" << std::endl;
break;
cout << "getBatteryChargingStatus: Temperature is too low to charge the battery" << std::endl;
break;
cout << "getBatteryChargingStatus: Temperature is too high to charge the battery" << std::endl;
break;
cout << "getBatteryChargingStatus: ChargingStatus_Unknown" << std::endl;
break;
default:
cout << "getBatteryChargingStatus: invalid return value" << std::endl;
break;
}
}
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Battery_getBatteryChargingStatus(BATTERYHANDLE, ChargingStatus *status)
ChargingStatus
Definition: Battery.h:53
@ ChargingStatus_TempHigh
Definition: Battery.h:58
@ ChargingStatus_NoCharge
Definition: Battery.h:54
@ ChargingStatus_Unknown
Definition: Battery.h:59
@ ChargingStatus_TempLow
Definition: Battery.h:57
@ ChargingStatus_Charging
Definition: Battery.h:55
@ ChargingStatus_FullyCharged
Definition: Battery.h:56
EXTERN_C CCAUXDLL_API char_t const *CCAUXDLL_CALLING_CONV GetErrorStringA(eErr errCode)
@ ERR_SUCCESS
Definition: CCAuxTypes.h:163
@ ERR_NOT_SUPPORTED
Definition: CCAuxTypes.h:165
◆ Battery_getBatteryHWversion()
Get battery hardware version (PCB revision).
Supported Platform(s): XM
- Parameters
-
buff | Text output buffer. |
len | Maximum length of the output buffer. If the actual length of the data is greater, an error will be returned. |
- Returns
- error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.
Example Usage:
char buf[255];
{
cout <<
"getBatteryHWversion: " <<
GetErrorStringA(error) <<
" - battery is not present!" << std::endl;
}
{
}
else
{
cout << "getBatteryHWversion: " << buf << std::endl;
}
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Battery_getBatteryHWversion(BATTERYHANDLE, char_t *buff, int32_t len)
◆ Battery_getBatterySerial()
Get battery serial number.
Supported Platform(s): XM
- Parameters
-
buff | Text output buffer. |
len | Maximum length of the output buffer. If the actual length of the data is greater, an error will be returned. The serial number is 10 characters plus terminating zero, in total 11 bytes in size. |
- Returns
- error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.
Example Usage:
{
cout <<
"getBatterySerial: " <<
GetErrorStringA(error) <<
" - battery is not present!" << std::endl;
}
{
}
else
{
cout << "getBatterySerial: " << buf << std::endl;
}
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Battery_getBatterySerial(BATTERYHANDLE, char_t *buff, int32_t len)
◆ Battery_getBatterySwVersion()
Get the battery software version
Supported Platform(s): XM
- Parameters
-
major | Major version number |
minor | Minor version number |
release | Release version number |
build | Build version number |
- Returns
- error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.
Example Usage:
unsigned short major;
unsigned short minor;
unsigned short release;
unsigned short build;
{
cout <<
"getBatterySwVersion: " <<
GetErrorStringA(error) <<
" - battery is not present!" << std::endl;
}
{
}
else
{
cout << "getBatterySwVersion: v" << major << "." << minor << "." << release << "." << build << std::endl;
}
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Battery_getBatterySwVersion(BATTERYHANDLE, uint16_t *major, uint16_t *minor, uint16_t *release, uint16_t *build)
◆ Battery_getBatteryTemp()
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Battery_getBatteryTemp |
( |
BATTERYHANDLE |
, |
|
|
int16_t * |
temperature |
|
) |
| |
Get battery temperature.
Supported Platform(s): XM
- Parameters
-
temperature | PCB Temperature in degrees Celsius. |
- Returns
- error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.
Example Usage:
short temp;
{
cout <<
"getBatteryTemp: " <<
GetErrorStringA(error) <<
" - battery is not present!" << std::endl;
}
{
}
else
{
cout << "getBatteryTemp: " << temp << " deg C" << std::endl;
}
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Battery_getBatteryTemp(BATTERYHANDLE, int16_t *temperature)
◆ Battery_getBatteryVoltageStatus()
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Battery_getBatteryVoltageStatus |
( |
BATTERYHANDLE |
, |
|
|
uint8_t * |
batteryVoltagePercent |
|
) |
| |
Get battery voltage status.
Supported Platform(s): XM
- Parameters
-
batteryVoltagePercent | the current voltage level of the battery, in percent [0..100]. |
- Returns
- error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.
Example Usage:
unsigned char s;
{
cout <<
"getBatteryVoltageStatus: " <<
GetErrorStringA(error) <<
" - battery is not present!" << std::endl;
}
{
cout <<
"getBatteryVoltageStatus: " <<
GetErrorStringA(error) << std::endl;
}
else
{
cout << "getBatteryVoltageStatus: " << (int)s << " %" << std::endl;
}
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Battery_getBatteryVoltageStatus(BATTERYHANDLE, uint8_t *batteryVoltagePercent)
◆ Battery_getHwErrorStatus()
Get hardware error code. If hardware errors are found or other problems are discovered by the battery pack, they are reported here.
Supported Platform(s): XM
- Parameters
-
errorCode | Error code. Zero means no error. |
- Returns
- error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.
Example Usage:
{
cout <<
"getHwErrorStatus: " <<
GetErrorStringA(error) <<
" - battery is not present!" << std::endl;
}
{
}
else
{
switch(es)
{
cout << "getHwErrorStatus: " << "Battery reports no HW errors" << std::endl;
break;
cout << "getHwErrorStatus: " << "Battery error! The thermistor temp sensor is not working" << std::endl;
break;
cout << "getHwErrorStatus: " << "Battery error! The secondary temp sensor is not working" << std::endl;
break;
cout << "getHwErrorStatus: " << "Battery error! Charging failed" << std::endl;
break;
cout << "getHwErrorStatus: " << "Battery error! Overcurrent detected" << std::endl;
break;
cout << "getHwErrorStatus: " << "Battery error! Battery not initiated" << std::endl;
break;
default:
cout << "getHwErrorStatus: " << "invalid return value" << std::endl;
break;
}
}
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Battery_getHwErrorStatus(BATTERYHANDLE, ErrorStatus *errorCode)
ErrorStatus
Definition: Battery.h:75
@ ErrorStatus_ThermistorTempSensor
Definition: Battery.h:77
@ ErrorStatus_Overcurrent
Definition: Battery.h:80
@ ErrorStatus_Init
Definition: Battery.h:81
@ ErrorStatus_NoError
Definition: Battery.h:76
@ ErrorStatus_SecondaryTempSensor
Definition: Battery.h:78
@ ErrorStatus_ChargeFail
Definition: Battery.h:79
◆ Battery_getMinMaxTemp()
Get temperature interval of the battery.
Supported Platform(s): XM
- Parameters
-
minTemp | Minimum measured temperature. |
maxTemp | Maximum measured temperature. |
- Returns
- error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.
Example Usage:
short max;
{
cout <<
"getMinMaxTemp: " <<
GetErrorStringA(error) <<
" - battery is not present!" << std::endl;
}
{
}
else
{
cout << "getMinMaxTemp: MinTemp:" << temp << ", MaxTemp: " << max << std::endl;
}
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Battery_getMinMaxTemp(BATTERYHANDLE, int16_t *minTemp, int16_t *maxTemp)
◆ Battery_getPowerSource()
Get the currently used power source.
Supported Platform(s): XM
- Parameters
-
status | the current power source, external power or battery. |
- Returns
- error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.
Example Usage:
{
cout <<
"getPowerSource: " <<
GetErrorStringA(error) <<
" - battery is not present!" << std::endl;
}
{
}
else
{
cout << "getPowerSource: Power source: Battery" << std::endl;
else
cout << "getPowerSource: Power source: External Power" << std::endl;
}
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Battery_getPowerSource(BATTERYHANDLE, PowerSource *status)
PowerSource
Definition: Battery.h:66
@ PowerSource_Battery
Definition: Battery.h:67
◆ Battery_getTimer()
Get battery diagnostic timer.
Supported Platform(s): XM
- Parameters
-
times | Get a struct with the current diagnostic times. |
- Returns
- error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.
Example Usage:
memset(×, 0, sizeof(times));
{
cout <<
"getTimer: " <<
GetErrorStringA(error) <<
" - battery is not present!" << std::endl;
}
{
}
else
{
cout << "getTimer: " << std::endl;
cout <<
"Total run time on main power=" << times.
TotRunTimeMain*60 <<
" min(s)" << std::endl
<<
"Total run time on battery power=" << times.
TotRunTimeBattery*60 <<
" min(s)" << std::endl
<<
"Total run time below -20C=" << times.
RunTime_m20 <<
" min(s)" << std::endl
<<
"Total run time -20-0C=" << times.
RunTime_m20_0 <<
" min(s)" << std::endl
<<
"Total run time 0-40C=" << times.
RunTime_0_40 <<
" min(s)" << std::endl
<<
"Total run time 40-60C=" << times.
RunTime_40_60 <<
" min(s)" << std::endl
<<
"Total run time 60-70C=" << times.
RunTime_60_70 <<
" min(s)" << std::endl
<<
"Total run time 70-80C=" << times.
RunTime_70_80 <<
" min(s)" << std::endl
<<
"Total run time above 80C=" << times.
RunTime_Above80 <<
" min(s)" << std::endl;
}
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Battery_getTimer(BATTERYHANDLE, BatteryTimerType *times)
uint32_t RunTime_40_60
Definition: Battery.h:43
uint32_t TotRunTimeMain
Definition: Battery.h:38
uint32_t RunTime_Above80
Definition: Battery.h:46
uint32_t RunTime_0_40
Definition: Battery.h:42
uint32_t TotRunTimeBattery
Definition: Battery.h:39
uint32_t RunTime_60_70
Definition: Battery.h:44
uint32_t RunTime_70_80
Definition: Battery.h:45
uint32_t RunTime_m20
Definition: Battery.h:40
uint32_t RunTime_m20_0
Definition: Battery.h:41
◆ Battery_isBatteryPresent()
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Battery_isBatteryPresent |
( |
BATTERYHANDLE |
, |
|
|
bool * |
batteryIsPresent |
|
) |
| |
Is an external battery connected?
Supported Platform(s): XM
- Parameters
-
batteryIsPresent | true if a battery is connected, otherwise false. |
- Returns
- -
Example Usage:
{
}
else
{
if (bpresent)
{
cout << "Battery is present. Testing functionality... " << std::endl;
}
else
{
cout << "Battery is NOT present." << std::endl;
}
}
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Battery_isBatteryPresent(BATTERYHANDLE, bool *batteryIsPresent)
◆ Battery_release()
EXTERN_C CCAUXDLL_API void CCAUXDLL_CALLING_CONV CrossControl::Battery_release |
( |
BATTERYHANDLE |
| ) |
|
Delete the Battery object
Supported Platform(s): XM.
- Returns
- -
Example Usage:
assert(pBattery);
readBatteryInfo(pBattery);
EXTERN_C CCAUXDLL_API BATTERYHANDLE CCAUXDLL_CALLING_CONV GetBattery(void)
EXTERN_C CCAUXDLL_API void CCAUXDLL_CALLING_CONV Battery_release(BATTERYHANDLE)
void * BATTERYHANDLE
Definition: Battery.h:84
◆ GetBattery()
EXTERN_C CCAUXDLL_API BATTERYHANDLE CCAUXDLL_CALLING_CONV CrossControl::GetBattery |
( |
void |
| ) |
|
Factory function that creates instances of the Battery object.
Supported Platform(s): XM
- Returns
- BATTERYHANDLE to an allocated battery object. The returned handle needs to be deallocated using the Battery_release(BATTERYHANDLE) method when it's no longer needed. Returns NULL if it fails to allocate memory.
Example Usage:
assert(pBattery);
readBatteryInfo(pBattery);