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>
#include <system_info.h>
#include "haltest.h"
-#include "hal-haptic.h"
+#include "hal-device-haptic.h"
class HAPTIC : public testing::Test {
protected:
--- /dev/null
+/*
+ * 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__ */
--- /dev/null
+/*
+ * 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__
+++ /dev/null
-/*
- * 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__ */
+++ /dev/null
-/*
- * 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__
#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
{
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;
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;
int hal_device_haptic_check_backend(void)
{
- if (!hal_haptic_funcs)
+ if (!hal_device_haptic_funcs)
return -ENODEV;
return 0;
{
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);
}
{
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);
}