CCAux  2.20.0.0
CCAux API reference
Battery.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright (C) 2023 CrossControl AB
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; with
8  * version 2.1 of the License.
9  */
10 /*
11  * File description:
12  * External battery status and settings (Only available on specific models)
13  *
14  * Use the function GetBattery() to get a handle to pass on to the other functions.
15  * Use the method Battery_release(BATTERYHANDLE) to return the handle.
16  *
17  * Example Usage:
18  * @include battery_example.cpp
19  *
20  ************************************************/
21 
22 #ifndef CC_BATTERY_H_
23 #define CC_BATTERY_H_
24 
25 #include "CCAuxErrors.h"
26 #include "CCPlatform.h"
27 
28 #ifdef __cplusplus
29 namespace CrossControl
30 {
31 #endif
32 
33 /*
34  * Diagnostic timer data
35  */
36 typedef struct
37 {
48 
52 typedef enum
53 {
61 
65 typedef enum
66 {
70 
74 typedef enum
75 {
81  ErrorStatus_Init = 5
83 
84 typedef void *BATTERYHANDLE;
85 
105 EXTERN_C
106 CCAUXDLL_API
108 CCAUXDLL_CALLING_CONV
110 
121 EXTERN_C
122 CCAUXDLL_API
123 void CCAUXDLL_CALLING_CONV Battery_release(BATTERYHANDLE);
124 
137 EXTERN_C
138 CCAUXDLL_API
139 eErr CCAUXDLL_CALLING_CONV Battery_isBatteryPresent(BATTERYHANDLE, bool *batteryIsPresent);
140 
153 EXTERN_C
154 CCAUXDLL_API
155 eErr CCAUXDLL_CALLING_CONV Battery_getBatteryVoltageStatus(BATTERYHANDLE, uint8_t *batteryVoltagePercent);
156 
169 EXTERN_C
170 CCAUXDLL_API
172 
185 EXTERN_C
186 CCAUXDLL_API
187 eErr CCAUXDLL_CALLING_CONV Battery_getPowerSource(BATTERYHANDLE, PowerSource *status);
188 
201 EXTERN_C
202 CCAUXDLL_API
203 eErr CCAUXDLL_CALLING_CONV Battery_getBatteryTemp(BATTERYHANDLE, int16_t *temperature);
204 
218 EXTERN_C
219 CCAUXDLL_API
220 eErr CCAUXDLL_CALLING_CONV Battery_getHwErrorStatus(BATTERYHANDLE, ErrorStatus *errorCode);
221 
234 EXTERN_C
235 CCAUXDLL_API
236 eErr CCAUXDLL_CALLING_CONV Battery_getTimer(BATTERYHANDLE, BatteryTimerType *times);
237 
251 EXTERN_C
252 CCAUXDLL_API
253 eErr CCAUXDLL_CALLING_CONV Battery_getMinMaxTemp(BATTERYHANDLE, int16_t *minTemp, int16_t *maxTemp);
254 
269 EXTERN_C
270 CCAUXDLL_API
271 eErr CCAUXDLL_CALLING_CONV Battery_getBatteryHWversion(BATTERYHANDLE, char_t *buff, int32_t len);
272 
288 EXTERN_C
289 CCAUXDLL_API
290 eErr CCAUXDLL_CALLING_CONV Battery_getBatterySwVersion(BATTERYHANDLE, uint16_t *major, uint16_t *minor,
291  uint16_t *release, uint16_t *build);
292 
308 EXTERN_C
309 CCAUXDLL_API
310 eErr CCAUXDLL_CALLING_CONV Battery_getBatterySerial(BATTERYHANDLE, char_t *buff, int32_t len);
311 
313 #ifdef __cplusplus
314 } /* namespace CrossControl */
315 #endif
316 
317 #endif /* CC_BATTERY_H_ */
signed short int16_t
Definition: CCAuxTypes.h:35
unsigned short uint16_t
Definition: CCAuxTypes.h:38
char char_t
Definition: CCAuxTypes.h:17
unsigned int uint32_t
Definition: CCAuxTypes.h:39
signed int int32_t
Definition: CCAuxTypes.h:36
unsigned char uint8_t
Definition: CCAuxTypes.h:37
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_getBatteryTemp(BATTERYHANDLE, int16_t *temperature)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Battery_getBatterySerial(BATTERYHANDLE, char_t *buff, int32_t len)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Battery_getBatteryChargingStatus(BATTERYHANDLE, ChargingStatus *status)
EXTERN_C CCAUXDLL_API BATTERYHANDLE CCAUXDLL_CALLING_CONV GetBattery(void)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Battery_getPowerSource(BATTERYHANDLE, PowerSource *status)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Battery_getTimer(BATTERYHANDLE, BatteryTimerType *times)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Battery_getHwErrorStatus(BATTERYHANDLE, ErrorStatus *errorCode)
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_getBatteryVoltageStatus(BATTERYHANDLE, uint8_t *batteryVoltagePercent)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Battery_isBatteryPresent(BATTERYHANDLE, bool *batteryIsPresent)
EXTERN_C CCAUXDLL_API void CCAUXDLL_CALLING_CONV Battery_release(BATTERYHANDLE)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Battery_getBatteryHWversion(BATTERYHANDLE, char_t *buff, int32_t len)
Definition: About.h:30
PowerSource
Definition: Battery.h:66
@ PowerSource_ExternalPower
Definition: Battery.h:68
@ PowerSource_Battery
Definition: Battery.h:67
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
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
void * BATTERYHANDLE
Definition: Battery.h:84
eErr
Definition: CCAuxTypes.h:162
Definition: Battery.h:37
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