device-haptic: Fix incorrect module naming 57/309357/3
authorYunhee Seo <yuni.seo@samsung.com>
Tue, 9 Apr 2024 02:00:13 +0000 (11:00 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 15 Apr 2024 07:27:57 +0000 (07:27 +0000)
Fix incorrect module name from "board" to "device-haptic".

struct
 - hal_backend_haptic_funcs -> struct hal_backend_device_haptic_funcs

file
 - hal-haptic.h -> hal-device-haptic.h
 - hal-haptic-interface.h -> hal-device-haptic-interface.h

According to HAL API Prototype rule,
hal module funcs structure naming is same as below
 - hal_backend_[module]_funcs.
Also, hal module header files naming is same as below.
 - hal-[module].h
 - hal-[module]-interface.h

However, the hal module name was being used incorrectly.
Actual hal module name is not "haptic" but "device-haptic"

Change-Id: I976337bfdd34f05462cdaa9197d2c6314d9d3624
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
haltest/haptic.cpp
include/hal-device-haptic-interface.h [new file with mode: 0644]
include/hal-device-haptic.h [new file with mode: 0644]
include/hal-haptic-interface.h [deleted file]
include/hal-haptic.h [deleted file]
src/haptic.c

index 761ed810681365cf40eb0df1351d6dddb8a7f573..17a03076daa2db68f4fb0ebd333193fcd96119cf 100644 (file)
@@ -1,7 +1,7 @@
 #include <system_info.h>
 
 #include "haltest.h"
-#include "hal-haptic.h"
+#include "hal-device-haptic.h"
 
 class HAPTIC : public testing::Test {
        protected:
diff --git a/include/hal-device-haptic-interface.h b/include/hal-device-haptic-interface.h
new file mode 100644 (file)
index 0000000..e5c9458
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * 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_HAPTIC_INTERFACE_H__
+#define __HAL_DEVICE_HAPTIC_INTERFACE_H__
+
+#include <hal/hal-common-interface.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Enumerations of unlimited duration for the Haptic Module API.
+ */
+typedef enum {
+    HAPTIC_MODULE_DURATION_UNLIMITED = 0x7FFFFFFF,
+} haptic_module_duration;
+
+typedef struct _hal_backend_device_haptic_funcs {
+       int (*get_device_count)(int *count);
+       int (*open_device)(int *dev_handle);
+       int (*close_device)(int dev_handle);
+       bool (*is_valid)(void);
+       int (*vibrate_monotone)(int device_handle, int duration, int frequency, int overdrive, int level, int intensity, int priority);
+       int (*stop_device)(int dev_handle);
+} hal_backend_device_haptic_funcs;
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __HAL_DEVICE_HAPTIC_INTERFACE_H__ */
diff --git a/include/hal-device-haptic.h b/include/hal-device-haptic.h
new file mode 100644 (file)
index 0000000..f90ff3f
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * 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_HAPTIC_H__
+#define __HAL_DEVICE_HAPTIC_H__
+
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int hal_device_haptic_get_backend(void);
+int hal_device_haptic_put_backend(void);
+int hal_device_haptic_check_backend(void);
+
+int hal_device_haptic_get_device_count(int *count);
+int hal_device_haptic_open_device(int *handle);
+int hal_device_haptic_close_device(int handle);
+bool hal_device_haptic_is_valid(void);
+int hal_device_haptic_vibrate(int handle, int duration, int frequency, int overdrive, int level, int intensity, int priority);
+int hal_device_haptic_stop_device(int handle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  // __HAL_DEVICE_HAPTIC_H__
diff --git a/include/hal-haptic-interface.h b/include/hal-haptic-interface.h
deleted file mode 100644 (file)
index d0b8d4a..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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_HAPTIC_INTERFACE_H__
-#define __HAL_HAPTIC_INTERFACE_H__
-
-#include <hal/hal-common-interface.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief Enumerations of unlimited duration for the Haptic Module API.
- */
-typedef enum {
-    HAPTIC_MODULE_DURATION_UNLIMITED = 0x7FFFFFFF,
-} haptic_module_duration;
-
-typedef struct _hal_backend_haptic_funcs {
-       int (*get_device_count)(int *count);
-       int (*open_device)(int *dev_handle);
-       int (*close_device)(int dev_handle);
-       bool (*is_valid)(void);
-       int (*vibrate_monotone)(int device_handle, int duration, int frequency, int overdrive, int level, int intensity, int priority);
-       int (*stop_device)(int dev_handle);
-} hal_backend_haptic_funcs;
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __HAL_HAPTIC_INTERFACE_H__ */
diff --git a/include/hal-haptic.h b/include/hal-haptic.h
deleted file mode 100644 (file)
index 942fca2..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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_HAPTIC_H__
-#define __HAL_HAPTIC_H__
-
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int hal_device_haptic_get_backend(void);
-int hal_device_haptic_put_backend(void);
-int hal_device_haptic_check_backend(void);
-
-int hal_device_haptic_get_device_count(int *count);
-int hal_device_haptic_open_device(int *handle);
-int hal_device_haptic_close_device(int handle);
-bool hal_device_haptic_is_valid(void);
-int hal_device_haptic_vibrate(int handle, int duration, int frequency, int overdrive, int level, int intensity, int priority);
-int hal_device_haptic_stop_device(int handle);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  // __HAL_HAPTIC_H__
index 2d255bfd8138db650069cb2c2e59a1b04a53078f..dabb8927dfd740662477c26d94c3a8c020b33567 100644 (file)
 #include <stdio.h>
 #include <hal/hal-common.h>
 
-#include "hal-haptic.h"
-#include "hal-haptic-interface.h"
+#include "hal-device-haptic.h"
+#include "hal-device-haptic-interface.h"
 
 #include "common.h"
 
-static hal_backend_haptic_funcs *hal_haptic_funcs = NULL;
+static hal_backend_device_haptic_funcs *hal_device_haptic_funcs = NULL;
 /*
 -1 : failed to initialize
 0  : not initialized
@@ -34,17 +34,17 @@ int hal_device_haptic_get_backend(void)
 {
        int ret;
 
-       if (hal_haptic_funcs)
+       if (hal_device_haptic_funcs)
                return 0;
 
-       ret = hal_common_get_backend(HAL_MODULE_DEVICE_HAPTIC, (void **)&hal_haptic_funcs);
+       ret = hal_common_get_backend(HAL_MODULE_DEVICE_HAPTIC, (void **)&hal_device_haptic_funcs);
        if (ret < 0) {
                 _E("Failed to get haptic backend");
                hal_initialized = -1;
                return -ENODEV;
        }
 
-       if (!hal_haptic_funcs->is_valid || !(hal_haptic_funcs->is_valid())) {
+       if (!hal_device_haptic_funcs->is_valid || !(hal_device_haptic_funcs->is_valid())) {
                hal_device_haptic_put_backend();
                hal_initialized = -1;
                return -ENODEV;
@@ -56,11 +56,11 @@ int hal_device_haptic_get_backend(void)
 
 int hal_device_haptic_put_backend(void)
 {
-       if (!hal_haptic_funcs)
+       if (!hal_device_haptic_funcs)
                return -ENODEV;
 
-       hal_common_put_backend(HAL_MODULE_DEVICE_HAPTIC, (void *)hal_haptic_funcs);
-       hal_haptic_funcs = NULL;
+       hal_common_put_backend(HAL_MODULE_DEVICE_HAPTIC, (void *)hal_device_haptic_funcs);
+       hal_device_haptic_funcs = NULL;
        hal_initialized = 0;
 
        return 0;
@@ -68,7 +68,7 @@ int hal_device_haptic_put_backend(void)
 
 int hal_device_haptic_check_backend(void)
 {
-       if (!hal_haptic_funcs)
+       if (!hal_device_haptic_funcs)
                return -ENODEV;
 
        return 0;
@@ -78,81 +78,81 @@ int hal_device_haptic_get_device_count(int *count)
 {
        int ret;
 
-       if (!hal_haptic_funcs && !hal_initialized) {
+       if (!hal_device_haptic_funcs && !hal_initialized) {
                if ((ret = hal_device_haptic_get_backend()) < 0)
                        return ret;
        }
 
-       if (!hal_haptic_funcs || !hal_haptic_funcs->get_device_count)
+       if (!hal_device_haptic_funcs || !hal_device_haptic_funcs->get_device_count)
                return -ENODEV;
 
        if(!count)
                return -EINVAL;
 
-       return hal_haptic_funcs->get_device_count(count);
+       return hal_device_haptic_funcs->get_device_count(count);
 }
 
 int hal_device_haptic_open_device(int *handle)
 {
        int ret;
 
-       if (!hal_haptic_funcs && !hal_initialized) {
+       if (!hal_device_haptic_funcs && !hal_initialized) {
                if ((ret = hal_device_haptic_get_backend()) < 0)
                        return ret;
        }
 
-       if (!hal_haptic_funcs || !hal_haptic_funcs->open_device)
+       if (!hal_device_haptic_funcs || !hal_device_haptic_funcs->open_device)
                return -ENODEV;
 
        if (!handle)
                return -EINVAL;
 
-       return hal_haptic_funcs->open_device(handle);
+       return hal_device_haptic_funcs->open_device(handle);
 }
 
 int hal_device_haptic_close_device(int handle)
 {
        int ret;
 
-       if (!hal_haptic_funcs && !hal_initialized) {
+       if (!hal_device_haptic_funcs && !hal_initialized) {
                if ((ret = hal_device_haptic_get_backend()) < 0)
                        return ret;
        }
 
-       if (!hal_haptic_funcs || !hal_haptic_funcs->close_device)
+       if (!hal_device_haptic_funcs || !hal_device_haptic_funcs->close_device)
                return -ENODEV;
 
-       return hal_haptic_funcs->close_device(handle);
+       return hal_device_haptic_funcs->close_device(handle);
 }
 
 bool hal_device_haptic_is_valid(void)
 {
        int ret;
 
-       if (!hal_haptic_funcs && !hal_initialized) {
+       if (!hal_device_haptic_funcs && !hal_initialized) {
                if ((ret = hal_device_haptic_get_backend()) < 0)
                        return ret;
        }
 
-       if (!hal_haptic_funcs || !hal_haptic_funcs->is_valid)
+       if (!hal_device_haptic_funcs || !hal_device_haptic_funcs->is_valid)
                return -ENODEV;
 
-       return hal_haptic_funcs->is_valid();
+       return hal_device_haptic_funcs->is_valid();
 }
 
 int hal_device_haptic_vibrate(int handle, int duration, int frequency, int overdrive, int level, int intensity, int priority)
 {
        int ret;
 
-       if (!hal_haptic_funcs && !hal_initialized) {
+       if (!hal_device_haptic_funcs && !hal_initialized) {
                if ((ret = hal_device_haptic_get_backend()) < 0)
                        return ret;
        }
 
-       if (!hal_haptic_funcs || !hal_haptic_funcs->vibrate_monotone)
+       if (!hal_device_haptic_funcs || !hal_device_haptic_funcs->vibrate_monotone)
                return -ENODEV;
 
-       return hal_haptic_funcs->vibrate_monotone(handle, duration, frequency, overdrive,
+       return hal_device_haptic_funcs->vibrate_monotone(handle, duration, frequency, overdrive,
                                                                                        level, intensity, priority);
 }
 
@@ -160,13 +160,13 @@ int hal_device_haptic_stop_device(int handle)
 {
        int ret;
 
-       if (!hal_haptic_funcs && !hal_initialized) {
+       if (!hal_device_haptic_funcs && !hal_initialized) {
                if ((ret = hal_device_haptic_get_backend()) < 0)
                        return ret;
        }
 
-       if (!hal_haptic_funcs || !hal_haptic_funcs->stop_device)
+       if (!hal_device_haptic_funcs || !hal_device_haptic_funcs->stop_device)
                return -ENODEV;
 
-       return hal_haptic_funcs->stop_device(handle);
+       return hal_device_haptic_funcs->stop_device(handle);
 }