1/* ----------------------------------------------------------------------- *
2 *
3 *   Copyright 2009 Erwan Velu - All Rights Reserved
4 *
5 *   This program is free software; you can redistribute it and/or modify
6 *   it under the terms of the GNU General Public License as published by
7 *   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 *   Boston MA 02111-1307, USA; either version 2 of the License, or
9 *   (at your option) any later version; incorporated herein by reference.
10 *
11 * ----------------------------------------------------------------------- */
12
13#ifndef DMI_BATTERY_H
14#define DMI_BATTERY_H
15
16#include <stdbool.h>
17#include <inttypes.h>
18
19#define BATTERY_LOCATION_SIZE		65
20#define BATTERY_MANUFACTURER_SIZE	65
21#define BATTERY_MANUFACTURE_DATE_SIZE	65
22#define BATTERY_SERIAL_SIZE		65
23#define BATTERY_DEVICE_NAME_SIZE	65
24#define BATTERY_CHEMISTRY_SIZE		32
25#define BATTERY_CAPACITY_SIZE		16
26#define BATTERY_DESIGN_VOLTAGE_SIZE	16
27#define BATTERY_SBDS_SIZE		255
28#define BATTERY_MAXIMUM_ERROR_SIZE	32
29#define BATTERY_SBDS_SERIAL_SIZE	32
30#define BATTERY_SBDS_MANUFACTURE_DATE_SIZE	255
31#define BATTERY_SBDS_CHEMISTRY_SIZE	65
32#define BATTERY_OEM_INFO_SIZE		255
33
34typedef struct {
35    char location[BATTERY_LOCATION_SIZE];
36    char manufacturer[BATTERY_MANUFACTURER_SIZE];
37    char manufacture_date[BATTERY_MANUFACTURE_DATE_SIZE];
38    char serial[BATTERY_SERIAL_SIZE];
39    char name[BATTERY_DEVICE_NAME_SIZE];
40    char chemistry[BATTERY_CHEMISTRY_SIZE];
41    char design_capacity[BATTERY_CAPACITY_SIZE];
42    char design_voltage[BATTERY_DESIGN_VOLTAGE_SIZE];
43    char sbds[BATTERY_SBDS_SIZE];
44    char sbds_serial[BATTERY_SBDS_SERIAL_SIZE];
45    char maximum_error[BATTERY_MAXIMUM_ERROR_SIZE];
46    char sbds_manufacture_date[BATTERY_SBDS_MANUFACTURE_DATE_SIZE];
47    char sbds_chemistry[BATTERY_SBDS_CHEMISTRY_SIZE];
48    char oem_info[BATTERY_OEM_INFO_SIZE];
49/* The filled field have to be set to true when the dmitable implement that item */
50    bool filled;
51} s_battery;
52
53const char *dmi_battery_chemistry(uint8_t code);
54void dmi_battery_capacity(uint16_t code, uint8_t multiplier, char *capacity);
55void dmi_battery_voltage(uint16_t code, char *voltage);
56void dmi_battery_maximum_error(uint8_t code, char *error);
57#endif
58