- Problem: we decided to remove the power-plugin.
- Cause: Recently, we decided to remove the power plugin and use the
power-plugin.
- Solution: Modify ua-manager to support the vendor-plugin instead of
the power plugin.
Change-Id: I3b726d46282fd6dfd437f7121a6209020ea4251d
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
Name: ua-manager
Summary: User awareness manager
-Version: 0.12.2
+Version: 0.12.3
Release: 1
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
%defattr(-, root, root)
%{_includedir}/ua-manager/plugins/ua-plugin-type.h
%{_includedir}/ua-manager/plugins/ua-plugin.h
-%{_includedir}/ua-manager/plugins/ua-power-plugin.h
+%{_includedir}/ua-manager/plugins/ua-vendor-plugin.h
%{_includedir}/ua-manager/plugins/ua-cloud-plugin.h
%{_libdir}/pkgconfig/ua-plugins.pc
src/pm/ua-light-plugin-handler.c
src/pm/ua-motion-plugin-handler.c
src/pm/ua-cloud-plugin-handler.c
- src/pm/ua-power-plugin-manager.c
- src/pm/ua-power-plugin-handler.c
+ src/pm/ua-vendor-plugin-manager.c
+ src/pm/ua-vendor-plugin-handler.c
)
IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
#define FUNC_EXIT UAM_DBG("-")
#define SENSOR_PLUGIN_DIR tzplatform_mkpath(TZ_SYS_GLOBALUSER_DATA, "network/ua/lib/sensor")
-#define POWER_PLUGIN_DIR tzplatform_mkpath(TZ_SYS_GLOBALUSER_DATA, "network/ua/lib/power")
+#define VENDOR_PLUGIN_DIR tzplatform_mkpath(TZ_SYS_GLOBALUSER_DATA, "network/ua/lib/vendor")
#define CLOUD_PLUGIN_DIR tzplatform_mkpath(TZ_SYS_GLOBALUSER_DATA, "network/ua/lib/cloud")
#define UAM_VERSION "0.1"
*
*/
-#ifndef __UAM_POWER_PLUGIN_MANAGER_H__
-#define __UAM_POWER_PLUGIN_MANAGER_H__
+#ifndef __UAM_VENDOR_PLUGIN_MANAGER_H__
+#define __UAM_VENDOR_PLUGIN_MANAGER_H__
#ifdef __cplusplus
extern "C" {
#endif
-void _uam_ppm_send_presence_detection_event(unsigned int sensor);
+void _uam_vpm_send_presence_detection_event(unsigned int sensor);
#ifdef __cplusplus
}
#endif
-#endif /* __UAM_POWER_PLUGIN_MANAGER_H__ */
+#endif /* __UAM_VENDOR_PLUGIN_MANAGER_H__ */
FUNC_ENTRY;
int status;
- /* Initialize loaded power plugins */
+ /* Initialize loaded cloud plugins */
retv_if(UAM_ERROR_NONE != __load_cloud_plugin(), UAM_ERROR_INTERNAL);
if (!cloud_plugin || !cloud_plugin->api) {
#include <string.h>
#include <ua-plugin.h>
-#include <ua-power-plugin.h>
+#include <ua-vendor-plugin.h>
#include <ua-plugin-manager.h>
#include <ua-manager-core.h>
if (UAM_ERROR_NONE != ret) {
UAM_ERR("Failed with error: %s (0x%4.4X)",
_uam_manager_error_to_str(ret), ret);
- return UAP_STATUS_FAIL;
+ return UAV_STATUS_FAIL;
}
ret = _uam_pm_set_low_power_mode(UAM_SENSOR_ALL, FALSE);
if (UAM_ERROR_NONE != ret) {
UAM_ERR("Failed with error: %s (0x%4.4X)",
_uam_manager_error_to_str(ret), ret);
- return UAP_STATUS_FAIL;
+ return UAV_STATUS_FAIL;
}
ret = _uam_pm_start_detection(UAM_DETECT_PRESENCE, sensors);
if (UAM_ERROR_NONE != ret) {
UAM_ERR("Failed with error: %s (0x%4.4X)",
_uam_manager_error_to_str(ret), ret);
- return UAP_STATUS_FAIL;
+ return UAV_STATUS_FAIL;
}
presence_check_started = TRUE;
FUNC_EXIT;
- return UAP_STATUS_SUCCESS;
+ return UAV_STATUS_SUCCESS;
}
static void stop_presence_check_callback(unsigned int sensors)
FUNC_EXIT;
}
-uap_callbacks_t power_cbs = {
+uav_callbacks_t vendor_cbs = {
.check_presence_cb = do_presence_check_callback,
.stop_presence_cb = stop_presence_check_callback,
.get_active_sensors_cb = get_active_sensors_callback,
#include <string.h>
#include <dlfcn.h>
#include <ua-plugin.h>
-#include <ua-power-plugin.h>
+#include <ua-vendor-plugin.h>
#include <ua-plugin-manager.h>
-#include <ua-power-plugin-manager.h>
+#include <ua-vendor-plugin-manager.h>
#include <tzplatform_config.h>
-extern const uap_callbacks_t power_cbs;
+extern const uav_callbacks_t vendor_cbs;
typedef struct {
void *handle;
- uap_module_t *module;
+ uav_module_t *module;
uap_api_t *api;
-} uam_power_plugin_info_t;
+} uam_vendor_plugin_info_t;
-static uam_power_plugin_info_t* pwr_plugin = NULL;
+static uam_vendor_plugin_info_t* vendor_plugin = NULL;
-static void __deinit_power_plugin(void)
+static void __deinit_vendor_plugin(void)
{
FUNC_ENTRY;
/* Deinitialize and unload power plugins */
- if (!pwr_plugin) {
+ if (!vendor_plugin) {
UAM_WARN("Power plugin is NULL");
return;
}
- if (pwr_plugin->api && pwr_plugin->api->deinit)
- pwr_plugin->api->deinit();
- if (pwr_plugin->module && pwr_plugin->module->deinit)
- pwr_plugin->module->deinit();
- if (pwr_plugin->handle)
- dlclose(pwr_plugin->handle);
+ if (vendor_plugin->api && vendor_plugin->api->deinit)
+ vendor_plugin->api->deinit();
+ if (vendor_plugin->module && vendor_plugin->module->deinit)
+ vendor_plugin->module->deinit();
+ if (vendor_plugin->handle)
+ dlclose(vendor_plugin->handle);
- g_free(pwr_plugin);
- pwr_plugin = NULL;
+ g_free(vendor_plugin);
+ vendor_plugin = NULL;
FUNC_EXIT;
}
-static gboolean __add_power_plugin(void *handle, uap_module_t *module)
+static gboolean __add_vendor_plugin(void *handle, uav_module_t *module)
{
FUNC_ENTRY;
uap_api_t *api = NULL;
- uam_power_plugin_info_t *plugin = pwr_plugin;
+ uam_vendor_plugin_info_t *plugin = vendor_plugin;
UAM_DBG("Plugin [id: %d, name: %s, version: %s]",
module->id, module->name, module->version);
- if (NULL != pwr_plugin) {
+ if (NULL != vendor_plugin) {
UAM_ERR("Plugin already added");
return FALSE;
}
return FALSE;
}
- plugin = g_try_new0(uam_power_plugin_info_t, 1);
+ plugin = g_try_new0(uam_vendor_plugin_info_t, 1);
if (NULL == plugin) {
UAM_ERR("Memory allocation failed");
return FALSE;
plugin->module = module;
plugin->api = api;
- pwr_plugin = plugin;
+ vendor_plugin = plugin;
FUNC_EXIT;
return TRUE;
}
-static int __load_power_plugin(const char *path, const char *name, const char *symbol)
+static int __load_vendor_plugin(const char *path, const char *name, const char *symbol)
{
FUNC_ENTRY;
char *filename = NULL;
void *handle = NULL;
- uap_module_t *module = NULL;
+ uav_module_t *module = NULL;
retv_if(NULL == path, UAM_ERROR_INVALID_PARAMETER);
retv_if(NULL == name, UAM_ERROR_INVALID_PARAMETER);
return UAM_ERROR_INTERNAL;
}
- module = (uap_module_t *)dlsym(handle, symbol);
+ module = (uav_module_t *)dlsym(handle, symbol);
if (module == NULL) {
UAM_ERR("Can't load power plugin module: %s", dlerror());
dlclose(handle);
return UAM_ERROR_INTERNAL;
}
- if (UAP_PLUGIN_ID_POWER != module->id) {
+ if (UAV_PLUGIN_ID_VENDOR != module->id) {
dlclose(handle);
handle = NULL;
return UAM_ERROR_INVALID_PARAMETER;
}
- retv_if(FALSE == __add_power_plugin(handle, module), UAM_ERROR_INTERNAL);
+ retv_if(FALSE == __add_vendor_plugin(handle, module), UAM_ERROR_INTERNAL);
FUNC_EXIT;
return UAM_ERROR_NONE;
}
-static int __load_power_plugins(void)
+static int __load_vendor_plugins(void)
{
FUNC_ENTRY;
const char *filename;
int ret = UAM_ERROR_INTERNAL;
- retv_if(0 == strlen(POWER_PLUGIN_DIR), UAM_ERROR_INVALID_PARAMETER);
- UAM_DBG("Loading power plugin from %s", POWER_PLUGIN_DIR);
+ retv_if(0 == strlen(VENDOR_PLUGIN_DIR), UAM_ERROR_INVALID_PARAMETER);
+ UAM_DBG("Loading vendor plugin from %s", VENDOR_PLUGIN_DIR);
- dir = g_dir_open(POWER_PLUGIN_DIR, 0, NULL);
+ dir = g_dir_open(VENDOR_PLUGIN_DIR, 0, NULL);
if (!dir) {
UAM_ERR("Unable to open directory");
return UAM_ERROR_INTERNAL;
if (g_str_has_suffix(filename, ".so") == FALSE)
continue;
/* If atleast one plugin is loaded, return value is UAM_ERROR_NONE */
- if (UAM_ERROR_NONE == __load_power_plugin(POWER_PLUGIN_DIR, filename, "uap_module"))
+ if (UAM_ERROR_NONE == __load_vendor_plugin(VENDOR_PLUGIN_DIR, filename, "uap_module"))
ret = UAM_ERROR_NONE;
}
g_dir_close(dir);
return ret;
}
-static int __init_power_plugin(void)
+static int __init_vendor_plugin(void)
{
FUNC_ENTRY;
int ret;
int status;
/* Initialize loaded power plugins */
- retv_if(UAM_ERROR_NONE != __load_power_plugins(), UAM_ERROR_INTERNAL);
+ retv_if(UAM_ERROR_NONE != __load_vendor_plugins(), UAM_ERROR_INTERNAL);
- uam_power_plugin_info_t *plugin = pwr_plugin;
+ uam_vendor_plugin_info_t *plugin = vendor_plugin;
if (!plugin || !plugin->api) {
UAM_WARN("Plugin is NULL");
return UAM_ERROR_INVALID_PARAMETER;
}
- status = plugin->api->init(&power_cbs);
+ status = plugin->api->init(&vendor_cbs);
if (UAS_STATUS_SUCCESS != status) {
/* Deinit plugin */
- __deinit_power_plugin();
+ __deinit_vendor_plugin();
return UAM_ERROR_NOT_IN_OPERATION;
}
return ret;
}
-static void __attribute__((constructor)) _uam_ppm_init(void)
+static void __attribute__((constructor)) _uam_vpm_init(void)
{
FUNC_ENTRY;
int ret;
- ret = __init_power_plugin();
+ ret = __init_vendor_plugin();
ret_if(UAM_ERROR_NONE != ret);
- UAM_INFO_C("__init_power_plugin done");
+ UAM_INFO_C("__init_vendor_plugin done");
FUNC_EXIT;
}
-static void __attribute__((destructor)) _uam_ppm_deinit(void)
+static void __attribute__((destructor)) _uam_vpm_deinit(void)
{
FUNC_ENTRY;
- __deinit_power_plugin();
+ __deinit_vendor_plugin();
FUNC_EXIT;
}
-void _uam_ppm_send_presence_detection_event(unsigned int sensor)
+void _uam_vpm_send_presence_detection_event(unsigned int sensor)
{
FUNC_ENTRY;
- ret_if(NULL == pwr_plugin);
- ret_if(NULL == pwr_plugin->api);
- ret_if(NULL == pwr_plugin->api->presence_detected_cb);
+ ret_if(NULL == vendor_plugin);
+ ret_if(NULL == vendor_plugin->api);
+ ret_if(NULL == vendor_plugin->api->presence_detected_cb);
- pwr_plugin->api->presence_detected_cb(sensor);
+ vendor_plugin->api->presence_detected_cb(sensor);
FUNC_EXIT;
}
#include "ua-manager-database.h"
#include "ua-cloud-plugin-handler.h"
-#include "ua-power-plugin-manager.h"
+#include "ua-vendor-plugin-manager.h"
#define UAM_MAX_USERS 255
#define USER_ACCOUNT_DEFAULT "default@default.com"
if (info && (UAM_SENSOR_BITMASK_BLE == sensor || UAM_SENSOR_BITMASK_WIFI == sensor))
dev_info = info;
- _uam_ppm_send_presence_detection_event(sensor);
+ _uam_vpm_send_presence_detection_event(sensor);
if (NULL == dev_info) {
__send_sensor_presence_event(sensor_info, sensor);
SET(HEADERS
ua-plugin-type.h
ua-plugin.h
- ua-power-plugin.h
+ ua-vendor-plugin.h
ua-cloud-plugin.h
)
* limitations under the License.
*
*/
-#ifndef __UAM_POWER_PLUGIN_H__
-#define __UAM_POWER_PLUGIN_H__
+#ifndef __UAM_VENDOR_PLUGIN_H__
+#define __UAM_VENDOR_PLUGIN_H__
#ifdef __cplusplus
extern "C" {
#endif
-/* UA power plugin states */
+/* UA vendor plugin states */
typedef enum {
- UAP_STATE_NOT_READY = 0x00,
- UAP_STATE_READY
-} uap_state_e;
+ UAV_STATE_NOT_READY = 0x00,
+ UAV_STATE_READY
+} uav_state_e;
/* UA power plugin return status */
typedef enum {
- UAP_STATUS_SUCCESS = 0x00,
- UAP_STATUS_FAIL = 0x01,
- UAP_STATUS_NOT_READY = 0x02,
- UAP_STATUS_NOMEM = 0x03,
- UAP_STATUS_BUSY = 0x04,
- UAP_STATUS_ALREADY_DONE = 0x05,
- UAP_STATUS_UNSUPPORTED = 0x06,
- UAP_STATUS_TIMEOUT = 0x07,
- UAP_STATUS_INVALID_PARAMS = 0x08,
-} uap_status_e;
+ UAV_STATUS_SUCCESS = 0x00,
+ UAV_STATUS_FAIL = 0x01,
+ UAV_STATUS_NOT_READY = 0x02,
+ UAV_STATUS_NOMEM = 0x03,
+ UAV_STATUS_BUSY = 0x04,
+ UAV_STATUS_ALREADY_DONE = 0x05,
+ UAV_STATUS_UNSUPPORTED = 0x06,
+ UAV_STATUS_TIMEOUT = 0x07,
+ UAV_STATUS_INVALID_PARAMS = 0x08,
+} uav_status_e;
/*
- * DIRECTION: ua-manager --> power-plugin
+ * DIRECTION: ua-manager --> vendor-plugin
* ua-manager calls this to nofity PRESENCE detected or timeout occurs
* [Param] status - Operation status Success/Fail/Timeout
* [Param] ids - Which sensor detect(s)
*/
-typedef int (*presence_cb)(uap_status_e status, uas_plugin_id_e ids);
+typedef int (*presence_cb)(uav_status_e status, uas_plugin_id_e ids);
/*
- * DIRECTION: power-plugin --> ua-manager
+ * DIRECTION: vendor-plugin --> ua-manager
* Power plugin invokes this to detect one-time PRESENCE (after TV resume).
* [Param] sensors - Which sensors will detect PRESENCE
*/
typedef int (*start_presence_check)(unsigned int sensors);
/*
- * DIRECTION: power-plugin --> ua-manager
+ * DIRECTION: vendor-plugin --> ua-manager
* Power plugin invokes this to stop one-time PRESENCE detection
*/
typedef void (*stop_presence_check)(unsigned int sensors);
/*
- * DIRECTION: power-plugin --> ua-manager
+ * DIRECTION: vendor-plugin --> ua-manager
* Get available sensor list (bitmask)
*/
typedef unsigned int (*get_active_sensors)(void);
/*
- * DIRECTION: power-plugin --> ua-manager
+ * DIRECTION: vendor-plugin --> ua-manager
* Power plugin invokes this to set low power mode in detection sensors.
* If mode == 0 - Disable LPM, else Enable LPM
*/
typedef void (*set_low_power_mode)(int mode);
/*
- * DIRECTION: power-plugin --> ua-manager
+ * DIRECTION: vendor-plugin --> ua-manager
* Power plugin invokes this to reset ua-manager database.
*/
typedef void (*reset_ua_db)(void);
get_active_sensors get_active_sensors_cb;
set_low_power_mode set_lpm_mode_cb;
reset_ua_db reset_cb;
-} uap_callbacks_t;
+} uav_callbacks_t;
typedef struct {
/* [Sync API] To initialize power plug-in */
- int (*init)(const uap_callbacks_t* callbacks);
+ int (*init)(const uav_callbacks_t* callbacks);
/* [Sync API] To deinitialize senspor plug-in */
int (*deinit)(void);
/* [Sync API] To get plug-in's current state (READY/NOT_READY) */
- int (*get_state)(uap_state_e *state);
+ int (*get_state)(uav_state_e *state);
/*
- * [Sync API] This function notify power-plugin of presence detection.
+ * [Sync API] This function notify vendor-plugin of presence detection.
* [Param] sensor - Which sensor detect event.
*/
void (*presence_detected_cb)(unsigned int sensor);
} uap_api_t;
typedef enum {
- UAP_PLUGIN_ID_NONE = 0, /**< None */
- UAP_PLUGIN_ID_POWER = 0xAAAA, /**< 0b101010.. pattern */
- UAP_PLUGIN_ID_MAX
-} uap_plugin_id_e;
+ UAV_PLUGIN_ID_NONE = 0, /**< None */
+ UAV_PLUGIN_ID_VENDOR = 0xAAAA, /**< 0b101010.. pattern */
+ UAV_PLUGIN_ID_MAX
+} uav_plugin_id_e;
typedef struct {
/** Identifier of module */
int (*init)(uap_api_t **api);
/** Modules de-init */
int (*deinit)(void);
-} uap_module_t;
+} uav_module_t;
-#define UAP_MODULE_ADD(id, name, author, version, init, deinit) \
- uap_module_t uap_module = { id, name, author, version, init, deinit };
+#define UAV_MODULE_ADD(id, name, author, version, init, deinit) \
+ uav_module_t uap_module = { id, name, author, version, init, deinit };
#ifdef __cplusplus
}
#endif
-#endif /* __UAM_POWER_PLUGIN_H__ */
+#endif /* __UAM_VENDOR_PLUGIN_H__ */