device-battery: Separate device-battery header files 27/309327/5
authorYunhee Seo <yuni.seo@samsung.com>
Mon, 8 Apr 2024 06:31:18 +0000 (15:31 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Mon, 15 Apr 2024 08:05:52 +0000 (17:05 +0900)
To apply HAL ABI Versioning, existing interface file is devided.
Below is a description of the purpose of header files.

hal-device-battery-types.h
 -> Common data types like structures or enums used between the device-battery
 HAL-API and HAL-BACKEND
hal-device-battery-interface-1.h
 -> Declaration of functions to be implemented in the device-battery HAL-BACKEND(Major version 1),
as well as definitions of data structures used between the HAL-API and HAL-BACKEND(Major version 1)
hal-device-battery-interface.h
 -> Includes the hal-device-battery-interface-[major].h files for each supported
major version.
hal-device-battery.h
 -> Declaration of the device-battery HAL-API functions

Change-Id: Ic2a07101cf70384b803e68f3088f9ea1db22a95b
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
include/hal-device-battery-interface-1.h [new file with mode: 0644]
include/hal-device-battery-interface.h
include/hal-device-battery-types.h [new file with mode: 0644]

diff --git a/include/hal-device-battery-interface-1.h b/include/hal-device-battery-interface-1.h
new file mode 100644 (file)
index 0000000..cfccc91
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __HAL_DEVICE_BATTERY_INTERFACE_1_H__
+#define __HAL_DEVICE_BATTERY_INTERFACE_1_H__
+
+#include "hal-device-battery-types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * The id of this device
+ */
+#define BATTERY_HARDWARE_DEVICE_ID     "battery"
+
+#define POWER_SOURCE_NONE     "none"
+#define POWER_SOURCE_AC       "ac"
+#define POWER_SOURCE_USB      "usb"
+#define POWER_SOURCE_WIRELESS "wireless"
+
+typedef struct _hal_backend_device_battery_funcs {
+       /* Register battery event */
+       int (*register_changed_event)(BatteryUpdated updated_cb, void *data);
+       void (*unregister_changed_event)(BatteryUpdated updated_cb);
+
+       /* Get current states */
+       int (*get_current_state)(BatteryUpdated updated_cb, void *data);
+} hal_backend_device_battery_funcs;
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __HAL_DEVICE_BATTERY_INTERFACE_1_H__ */
index 6ac77e1ac2488ca442f4afbd46908949cbf13a4c..b3a8db39e3c82a22b61b78955c2526e207197dc2 100644 (file)
 #ifndef __HAL_DEVICE_BATTERY_INTERFACE_H__
 #define __HAL_DEVICE_BATTERY_INTERFACE_H__
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include "hal-device-battery-types.h"
+#include "hal-device-battery-interface-1.h"
 
-/**
- * The id of this device
- */
-#define BATTERY_HARDWARE_DEVICE_ID     "battery"
-
-#define POWER_SOURCE_NONE     "none"
-#define POWER_SOURCE_AC       "ac"
-#define POWER_SOURCE_USB      "usb"
-#define POWER_SOURCE_WIRELESS "wireless"
-
-struct battery_info {
-       char *name;
-       char *status;
-       char *health;
-       char *power_source;
-
-       int online;
-       int present;
-       int capacity;
-
-       int current_now;
-       int current_average;
-       int voltage_now;
-       int voltage_average;
-       int temperature;
-};
-
-typedef void (*BatteryUpdated)(struct battery_info *info, void *data);
-
-typedef struct _hal_backend_device_battery_funcs {
-       /* Register battery event */
-       int (*register_changed_event)(BatteryUpdated updated_cb, void *data);
-       void (*unregister_changed_event)(BatteryUpdated updated_cb);
-
-       /* Get current states */
-       int (*get_current_state)(BatteryUpdated updated_cb, void *data);
-} hal_backend_device_battery_funcs;
-
-#ifdef __cplusplus
-}
-#endif
 #endif /* __HAL_DEVICE_BATTERY_INTERFACE_H__ */
diff --git a/include/hal-device-battery-types.h b/include/hal-device-battery-types.h
new file mode 100644 (file)
index 0000000..ff17b4b
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __HAL_DEVICE_BATTERY_TYPES_H__
+#define __HAL_DEVICE_BATTERY_TYPES_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct battery_info {
+       char *name;
+       char *status;
+       char *health;
+       char *power_source;
+
+       int online;
+       int present;
+       int capacity;
+
+       int current_now;
+       int current_average;
+       int voltage_now;
+       int voltage_average;
+       int temperature;
+};
+
+typedef void (*BatteryUpdated)(struct battery_info *info, void *data);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __HAL_DEVICE_BATTERY_TYPES_H__ */