#include #include #include #include #include #include #undef LOG_TAG #define LOG_TAG "HALAPI_BLUETOOTH" #define EXPORT __attribute__ ((visibility("default"))) static int bluetooth_vim3_start(void) { int ret; ret = system("/hal/etc/bluetooth/bt-dev-start.sh"); if (ret == 0x100) { LOGE("script internal failed"); return HAL_BACKEND_ERROR_INTERNAL; } else if (ret == 0x200) { LOGE("script timeout failed"); return HAL_BACKEND_ERROR_TIMEOUT; } LOGD("script started successfully"); return HAL_BACKEND_ERROR_NONE; } static int bluetooth_vim3_stop(void) { int ret; ret = system("/hal/etc/bluetooth/bt-dev-end.sh"); if (ret == 0x100) { LOGE("script internal failed"); return HAL_BACKEND_ERROR_INTERNAL; } else if (ret == 0x200) { LOGE("script timeout failed"); return HAL_BACKEND_ERROR_TIMEOUT; } LOGD("script started successfully"); return HAL_BACKEND_ERROR_NONE; } static int bluetooth_vim3_init(void **data) { hal_backend_bluetooth_funcs *bluetooth_funcs; bluetooth_funcs = calloc(1, sizeof(hal_backend_bluetooth_funcs)); if (!bluetooth_funcs) return -ENOMEM; bluetooth_funcs->start = bluetooth_vim3_start; bluetooth_funcs->stop = bluetooth_vim3_stop; *data = (void *)bluetooth_funcs; return 0; } static int bluetooth_vim3_exit(void *data) { if (!data) return -EINVAL; free(data); return 0; } hal_backend EXPORT hal_backend_bluetooth_data = { .name = "bluetooth-vim3", .vendor = "VIM3", .abi_version = HAL_ABI_VERSION_TIZEN_6_5, .init = bluetooth_vim3_init, .exit = bluetooth_vim3_exit, };