- it is needed to describe how internal API work.
Change-Id: I209468bb99590686f25c1b4c0b3a13a8542d343c
Signed-off-by: saerome kim <saerome.kim@samsung.com>
*
*/
-#ifndef __UAM_API_H__
-#define __UAM_API_H__
+#ifndef __TIZEN_UA_NETWORK_UA_API_H__
+#define __TIZEN_UA_NETWORK_UA_API_H__
#include <gmodule.h>
#include <tizen_error.h>
#ifndef TIZEN_ERROR_UA
-#define TIZEN_ERROR_UA 0x10000000 /**< To-Do: This should move to tizen_error.h */
+#define TIZEN_ERROR_UA 0x11170000 /**< To-Do: This should move to tizen_error.h */
#endif
#ifdef __cplusplus
extern "C" {
#endif
-#define UAM_SENSOR_BITMASK_BT 0x00000001
-#define UAM_SENSOR_BITMASK_BLE 0x00000002
-#define UAM_SENSOR_BITMASK_WIFI 0x00000004
-#define UAM_SENSOR_BITMASK_MOTION 0x00000008
-#define UAM_SENSOR_BITMASK_LIGHT 0x00000010
-#define UAM_SENSOR_BITMASK_AUDIO 0x00000020
-#define UAM_SENSOR_ALL 0xFFFFFFFF
-
+/**
+ * @brief Bitmask for sensors.
+ * @since_tizen 5.5
+ */
+typedef enum {
+ UAM_SENSOR_BITMASK_BT = 0x00000001, /**< Bitmask for BT */
+ UAM_SENSOR_BITMASK_BLE = 0x00000002, /**< Bitmask for BLE */
+ UAM_SENSOR_BITMASK_WIFI = 0x00000004, /**< Bitmask for Wi-Fi */
+ UAM_SENSOR_BITMASK_MOTION = 0x00000008, /**< Bitmask for motion */
+ UAM_SENSOR_BITMASK_LIGHT = 0x00000010, /**< Bitmask for light */
+ UAM_SENSOR_BITMASK_AUDIO = 0x00000020, /**< Bitmask for autio */
+ UAM_SENSOR_ALL = 0xFFFFFFFF, /**< Bitmask for all sensors */
+} uam_sensor_bitmask_e;
+
+/**
+ * @brief Max. MAC address length.
+ * @since_tizen 5.5
+ */
#define UAM_MAC_ADDRESS_STRING_LEN 18
+
+/**
+ * @brief Max. device id length.
+ * @since_tizen 5.5
+ */
#define UAM_DEVICE_ID_MAX_STRING_LEN 50
+
+/**
+ * @brief Max. IP address length.
+ * @since_tizen 5.5
+ */
#define UAM_IP_ADDRESS_MAX_STRING_LEN 50
+
+/**
+ * @brief Max. user name length.
+ * @since_tizen 5.5
+ */
#define UAM_USER_NAME_MAX_STRING_LEN 254
+
+/**
+ * @brief Max. user account length.
+ * @since_tizen 5.5
+ */
#define UAM_USER_ACCOUNT_MAX_STRING_LEN 254
+
+/**
+ * @brief Max. application id length.
+ * @since_tizen 5.5
+ */
#define UAM_APP_ID_MAX_STRING_LEN 100
+
+/**
+ * @brief Max. service id length.
+ * @since_tizen 5.5
+ */
#define UAM_SERVICE_MAX_STRING_LEN 50
+/**
+ * @brief Default service name.
+ * @since_tizen 5.5
+ */
#define UAM_SERVICE_DEFAULT "ua.service.default"
-#define FOREACH_EVENT(EVENT) \
- EVENT(UAM_EVENT_USER_ADDED) \
- EVENT(UAM_EVENT_USER_REMOVED) \
- EVENT(UAM_EVENT_DEVICE_ADDED) \
- EVENT(UAM_EVENT_DEVICE_REMOVED) \
- EVENT(UAM_EVENT_PRESENCE_DETECTED) \
- EVENT(UAM_EVENT_USER_PRESENCE_DETECTED) \
- EVENT(UAM_EVENT_ABSENCE_DETECTED) \
- EVENT(UAM_EVENT_USER_ABSENCE_DETECTED) \
- EVENT(UAM_EVENT_AMBIANT_MODE_ENABLED) \
- EVENT(UAM_EVENT_AMBIANT_MODE_DISABLED) \
- EVENT(UAM_EVENT_SENSOR_STATE_READY) \
- EVENT(UAM_EVENT_SENSOR_STATE_NOT_READY) \
- EVENT(UAM_EVENT_DETECTION_STARTED) \
- EVENT(UAM_EVENT_DETECTION_STOPPED) \
- EVENT(UAM_EVENT_DEVICE_FOUND) \
- EVENT(UAM_EVENT_SCAN_COMPLETED) \
- EVENT(UAM_EVENT_MAX)
-
+/**
+ * @brief Macro for event enum.
+ * @since_tizen 5.5
+ */
#define GENERATE_EVENT_ENUM(ENUM) ENUM,
+/**
+ * @brief Macro to print event string out.
+ * @since_tizen 5.5
+ */
#define GENERATE_EVENT_STRING(STRING) #STRING,
+/**
+ * @brief Enumerations macro of UA framework event codes.
+ * @since_tizen 5.5
+ */
typedef enum {
- FOREACH_EVENT(GENERATE_EVENT_ENUM)
+ UAM_EVENT_USER_ADDED, /**< User added */
+ UAM_EVENT_USER_REMOVED, /**< User removed */
+ UAM_EVENT_DEVICE_ADDED, /**< Device added */
+ UAM_EVENT_DEVICE_REMOVED, /**< Device removed */
+ UAM_EVENT_PRESENCE_DETECTED, /**< Presence detected */
+ UAM_EVENT_USER_PRESENCE_DETECTED, /**< User presence detected */
+ UAM_EVENT_ABSENCE_DETECTED, /**< Absence detected */
+ UAM_EVENT_USER_ABSENCE_DETECTED, /**< User absence detected */
+ UAM_EVENT_AMBIANT_MODE_ENABLED, /**< Ambient mode enabled */
+ UAM_EVENT_AMBIANT_MODE_DISABLED, /**< Ambient mode disabled */
+ UAM_EVENT_SENSOR_STATE_READY, /**< Sensor state ready */
+ UAM_EVENT_SENSOR_STATE_NOT_READY, /**< Sensor state not ready */
+ UAM_EVENT_DETECTION_STARTED, /**< Detection started */
+ UAM_EVENT_DETECTION_STOPPED, /**< Detection stopped */
+ UAM_EVENT_DEVICE_FOUND, /**< Device found */
+ UAM_EVENT_SCAN_COMPLETED, /**< Scan completed */
+ UAM_EVENT_MAX, /**< Max. event number */
} uam_event_e;
-#define FOREACH_ERROR(ERROR) \
- ERROR(UAM_ERROR_NONE, TIZEN_ERROR_NONE) \
- ERROR(UAM_ERROR_INVALID_PARAM, TIZEN_ERROR_INVALID_PARAMETER) \
- ERROR(UAM_ERROR_PERMISSION_DENIED, TIZEN_ERROR_PERMISSION_DENIED) \
- ERROR(UAM_ERROR_TIMEOUT, TIZEN_ERROR_TIMED_OUT) \
- ERROR(UAM_ERROR_NOW_IN_PROGRESS, TIZEN_ERROR_NOW_IN_PROGRESS) \
- ERROR(UAM_ERROR_NOT_SUPPORTED, TIZEN_ERROR_NOT_SUPPORTED) \
- ERROR(UAM_ERROR_NOT_INITIALIZED, TIZEN_ERROR_UA | 0x01) \
- ERROR(UAM_ERROR_NOT_IN_OPERATION, TIZEN_ERROR_UA | 0x02) \
- ERROR(UAM_ERROR_ALREADY_DONE, TIZEN_ERROR_UA | 0x03) \
- ERROR(UAM_ERROR_INTERNAL, TIZEN_ERROR_UA | 0x04) \
- ERROR(UAM_ERROR_NOT_FOUND, TIZEN_ERROR_UA | 0x10) \
- ERROR(UAM_ERROR_ALREADY_REGISTERED, TIZEN_ERROR_UA | 0x11) \
- ERROR(UAM_ERROR_DB_FAILED, TIZEN_ERROR_UA | 0x12) \
- ERROR(UAM_ERROR_NOT_REGISTERED, TIZEN_ERROR_UA | 0x13) \
-
-#define GENERATE_ERROR_ENUM(ENUM, offset) ENUM = -offset,
+/**
+ * @brief Macro to print error string out.
+ * @since_tizen 5.5
+ */
#define GENERATE_ERROR_CASE(STRING, offset) case STRING: return #STRING;
+/**
+ * @brief Enumerations macro of UA framework error codes.
+ * @since_tizen 5.5
+ */
typedef enum {
- FOREACH_ERROR(GENERATE_ERROR_ENUM)
+ UAM_ERROR_NONE = TIZEN_ERROR_NONE, /**< Succsssful */
+ UAM_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ UAM_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+ UAM_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< Time out */
+ UAM_ERROR_NOW_IN_PROGRESS = TIZEN_ERROR_NOW_IN_PROGRESS, /**< Now in progress */
+ UAM_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
+ UAM_ERROR_NOT_INITIALIZED = TIZEN_ERROR_UA | 0x01, /**< Not initiaized */
+ UAM_ERROR_NOT_IN_OPERATION = TIZEN_ERROR_UA | 0x02, /**< Not in progress */
+ UAM_ERROR_ALREADY_DONE = TIZEN_ERROR_UA | 0x03, /**< Already done */
+ UAM_ERROR_INTERNAL = TIZEN_ERROR_UA | 0x04, /**< Internal error */
+ UAM_ERROR_NOT_FOUND = TIZEN_ERROR_UA | 0x10, /**< Not found */
+ UAM_ERROR_ALREADY_REGISTERED = TIZEN_ERROR_UA | 0x11, /**< Already registered */
+ UAM_ERROR_DB_FAILED = TIZEN_ERROR_UA | 0x12, /**< DB operation failed */
+ UAM_ERROR_NOT_REGISTERED = TIZEN_ERROR_UA | 0x13, /**< Not registered */
} uam_error_e;
+/**
+ * @brief Eevent data structure.
+ * @since_tizen 5.5
+ */
typedef struct {
- int result;
- void *data;
-} uam_event_data_t;
+ int result; /**< Result code */
+ void *data; /**< Data pointer */
+} uam_event_data_s;
-typedef void (*uam_event_callback)(int event, uam_event_data_t *event_param, void *user_data);
+/**
+ * @brief Callback to be invoked when receiving events.
+ * @since_tizen 5.5
+ *
+ * @remarks The @a event_param should not be released.
+ * @remarks The @a event_param can be used only in the callback.
+ *
+ * @param[in] event Event type.
+ * @param[in] event_param The event data structure.
+ * @param[in] user_data The user data passed in _uam_init()
+ *
+ * @exception
+ * @pre
+ * @post
+ *
+ * @see _uam_init()
+ */
+typedef void (*uam_event_cb)(int event, uam_event_data_s *event_param, void *user_data);
-int _uam_init(uam_event_callback cb, void *user_data);
+/**
+ * @brief Initializes client library.
+ * @since_tizen 5.5
+ *
+ * @param[in] cb Callback handler
+ * @param[in] user_data The user data.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @rerval #UAM_ERROR_ALREADY_REGISTERED Already registered
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int _uam_init(uam_event_cb cb, void *user_data);
+/**
+ * @brief De-initializes client library.
+ * @since_tizen 5.5
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @rerval #UAM_ERROR_NOT_REGISTERED Not registered
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_deinit(void);
+/**
+ * @brief Gets available sensor list.
+ * @since_tizen 5.5
+ *
+ * @param[out] bitmask Available sensor list
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_get_available_sensors(unsigned int *bitmask);
+/**
+ * @brief Gets a specific sensor availability.
+ * @since_tizen 5.5
+ *
+ * @param[in] sensor Sensor type
+ * @param[out] status Sensor state
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_is_sensor_ready(unsigned int sensor, gboolean* status);
+/**
+ * @brief Starts presence detection.
+ * @since_tizen 5.5
+ *
+ * @param[in] bitmask Bitmask to detect
+ * @param[in] service Service name
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_start_presence_detection(unsigned int bitmask, const char *service);
+/**
+ * @brief Stops presence detection.
+ * @since_tizen 5.5
+ *
+ * @param[in] bitmask Bitmask to detect
+ * @param[in] service Service name
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_stop_presence_detection(unsigned int bitmask, const char *service);
+/**
+ * @brief Starts absence detection.
+ * @since_tizen 5.5
+ *
+ * @param[in] bitmask Bitmask to detect
+ * @param[in] service Service name
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_start_absence_detection(unsigned int bitmask, const char *service);
+/**
+ * @brief Stops absence detection.
+ * @since_tizen 5.5
+ *
+ * @param[in] bitmask Bitmask to detect
+ * @param[in] service Service name
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_stop_absence_detection(unsigned int bitmask, const char *service);
+/**
+ * @brief Starts active devices searching.
+ * @since_tizen 5.5
+ *
+ * @param[in] bitmask Bitmask to detect
+ * @param[in] detection_period Detection period
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_start_search_active_devices(unsigned int bitmask, int detection_period);
+/**
+ * @brief Stops active devices searching.
+ * @since_tizen 5.5
+ *
+ * @param[in] bitmask Bitmask to detect
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_stop_search_active_devices(unsigned int bitmask);
+/**
+ * @brief Registers application id.
+ * @since_tizen 5.5
+ *
+ * @param[in] app_id Application id
+ * @param[in] uid User id
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_register_app(const char *app_id, unsigned short uid);
+/**
+ * @brief Unregisters application id.
+ * @since_tizen 5.5
+ *
+ * @param[in] app_id Application id
+ * @param[in] uid User id
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_deregister_app(const char *app_id, unsigned short uid);
+/**
+ * @brief Enumerations for presence state.
+ * @since_tizen 5.5
+ */
typedef enum {
- UAM_PRESENCE_STATE_INVALID = 0x00,
- UAM_PRESENCE_STATE_PRESENT,
- UAM_PRESENCE_STATE_ABSENT,
+ UAM_PRESENCE_STATE_INVALID = 0x00, /**< Invaild state */
+ UAM_PRESENCE_STATE_PRESENT, /**< Presence state */
+ UAM_PRESENCE_STATE_ABSENT, /**< Absence state */
} uam_presence_state_e;
+/**
+ * @brief Enumerations for OS type.
+ * @since_tizen 5.5
+ */
typedef enum {
- UAM_OS_TYPE_UNDEFINED = 0x00,
- UAM_OS_TYPE_TIZEN,
- UAM_OS_TYPE_ANDROID,
- UAM_OS_TYPE_IOS,
- UAM_OS_TYPE_INVALID
+ UAM_OS_TYPE_UNDEFINED = 0x00, /**< Undefined */
+ UAM_OS_TYPE_TIZEN, /**< Tizen */
+ UAM_OS_TYPE_ANDROID, /**< Android */
+ UAM_OS_TYPE_IOS, /**< iOS */
+ UAM_OS_TYPE_INVALID /**< Invalid */
} uam_os_type_e;
+/**
+ * @brief Enumerations for connectivity type.
+ * @since_tizen 5.5
+ */
typedef enum {
- UAM_TECH_TYPE_NONE = 0x00,
- UAM_TECH_TYPE_BT = 0x01,
- UAM_TECH_TYPE_BLE = 0x02,
- UAM_TECH_TYPE_WIFI = 0x04,
- UAM_TECH_TYPE_P2P = 0x08,
- UAM_TECH_TYPE_MAX
+ UAM_TECH_TYPE_NONE = 0x00, /**< None */
+ UAM_TECH_TYPE_BT = 0x01, /**< BT */
+ UAM_TECH_TYPE_BLE = 0x02, /**< BLE */
+ UAM_TECH_TYPE_WIFI = 0x04, /**< Wi-Fi */
+ UAM_TECH_TYPE_P2P = 0x08, /**< Wi-Fi p2p */
+ UAM_TECH_TYPE_MAX /**< Max. connectivity type */
} uam_tech_type_e;
+/**
+ * @brief Device info structure.
+ * @since_tizen 5.5
+ */
typedef struct {
- uam_os_type_e operating_system; /* Device's OS */
- uam_tech_type_e type; /* Device's mac address type (BT/BLE/WIFI/P2p/...) */
- char mac[UAM_MAC_ADDRESS_STRING_LEN]; /* Device's MAC ADDRESS */
- char ipv4_addr[UAM_IP_ADDRESS_MAX_STRING_LEN];/* Device's IPv4 address optional */
- char device_id[UAM_DEVICE_ID_MAX_STRING_LEN]; /* Device's uniquie ID */
- long long int last_seen; /* Latest timestamp when device was discoverd */
-} uam_device_info_t;
-
-typedef struct {
- char account[UAM_USER_ACCOUNT_MAX_STRING_LEN];
- char name[UAM_USER_NAME_MAX_STRING_LEN];
-} uam_user_info_t;
-
+ uam_os_type_e operating_system; /**< Operating system */
+ uam_tech_type_e type; /**< Device's mac address type (BT/BLE/WIFI/P2p/...) */
+ char mac[UAM_MAC_ADDRESS_STRING_LEN]; /**< Device's MAC ADDRESS */
+ char ipv4_addr[UAM_IP_ADDRESS_MAX_STRING_LEN];/**< Device's IPv4 address optional */
+ char device_id[UAM_DEVICE_ID_MAX_STRING_LEN]; /**< Device's uniquie ID */
+ long long int last_seen; /**< Latest timestamp when device was discoverd */
+} uam_device_info_s;
+
+/**
+ * @brief User info structure.
+ * @since_tizen 5.5
+ */
typedef struct {
- unsigned int sensor_bitmask; /* Detecting sensor's bitmask */
- char account[UAM_USER_ACCOUNT_MAX_STRING_LEN];
- char service[UAM_SERVICE_MAX_STRING_LEN];
-} uam_detection_event_data_t;
+ char account[UAM_USER_ACCOUNT_MAX_STRING_LEN]; /**< User account */
+ char name[UAM_USER_NAME_MAX_STRING_LEN]; /**< User name */
+} uam_user_info_s;
+/**
+ * @brief Detection event structure.
+ * @since_tizen 5.5
+ */
typedef struct {
- char account[UAM_USER_ACCOUNT_MAX_STRING_LEN];
- char name[UAM_USER_NAME_MAX_STRING_LEN];
-} uam_user_event_data_t;
-
+ unsigned int sensor_bitmask; /**< Detecting sensor's bitmask */
+ char account[UAM_USER_ACCOUNT_MAX_STRING_LEN]; /**< User account */
+ char service[UAM_SERVICE_MAX_STRING_LEN]; /**< Service name */
+} uam_detection_event_data_s;
+
+/**
+ * @brief User event structure.
+ * @since_tizen 5.5
+ */
typedef struct {
- int cycle;
- int period;
- int retries;
-} uam_detection_params_t;
+ char account[UAM_USER_ACCOUNT_MAX_STRING_LEN]; /**< User account */
+ char name[UAM_USER_NAME_MAX_STRING_LEN]; /**< User name */
+} uam_user_event_data_s;
+/**
+ * @brief Application info structure.
+ * @since_tizen 5.5
+ */
typedef struct {
- char *sender;
- unsigned short uid;
- char app_id[UAM_APP_ID_MAX_STRING_LEN];
-} uam_app_info_t;
-
+ char *sender; /**< Dbus sender */
+ unsigned short uid; /**< UID */
+ char app_id[UAM_APP_ID_MAX_STRING_LEN]; /**< Application id */
+} uam_app_info_s;
+
+/**
+ * @brief Gets registered user list.
+ * @since_tizen 5.5
+ *
+ * @remarks The @a user_list should be destroyed by using #g_free() and #g_ptr_array_free().
+ *
+ * @param[out] user_list User list array
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_get_registered_users(GPtrArray **user_list);
+/**
+ * @brief Checks registerd device.
+ * @since_tizen 5.5
+ *
+ * @param[in] dev_info Device info
+ * @param[out] is_registered Registered or not
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_is_device_registered(
- uam_device_info_t *dev_info, gboolean *is_registered);
+ uam_device_info_s *dev_info, gboolean *is_registered);
-typedef void (*uam_event_callback)(int event, uam_event_data_t *event_param, void *user_data);
+/**
+ * @brief Callback to be called when receiving events.
+ * @since_tizen 5.5
+ *
+ * @remarks The @a event_param should not be released.
+ * @remarks The @a event_param can be used only in the callback.
+ *
+ * @param[in] event Event type
+ * @param[in] event_param Event data
+ * @param[in] user_data User data passed in _uam_init().
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+typedef void (*uam_event_cb)(int event, uam_event_data_s *event_param, void *user_data);
-int _uam_init(uam_event_callback cb, void *user_data);
+/**
+ * @brief Intializes a client library of ua-manager.
+ * @since_tizen 5.5
+ *
+ * @param[in] cb Event callback
+ * @param[in] user_data User data passed in _uam_init().
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int _uam_init(uam_event_cb cb, void *user_data);
+/**
+ * @brief De-intializes a client library of ua-manager.
+ * @since_tizen 5.5
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_deinit(void);
+/**
+ * @brief Retrieves available sensor list.
+ * @since_tizen 5.5
+ *
+ * @param[in] bitmask Available sensor list
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_get_available_sensors(unsigned int *bitmask);
-int _uam_get_default_user(uam_user_info_t * uam_user);
+/**
+ * @brief Gets default user info.
+ * @since_tizen 5.5
+ *
+ * @param[in] uam_user User information
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int _uam_get_default_user(uam_user_info_s *uam_user);
-int _uam_add_user(uam_user_info_t * user);
+/**
+ * @brief Adds user info.
+ * @since_tizen 5.5
+ *
+ * @param[in] user User information.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int _uam_add_user(uam_user_info_s *user);
+/**
+ * @brief Removes user info.
+ * @since_tizen 5.5
+ *
+ * @param[in] account User account.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_remove_user(char *account);
-int _uam_request_get_user_by_account(char *account, uam_user_info_t * user);
+/**
+ * @brief Brings user information that meet the user account.
+ * @since_tizen 5.5
+ *
+ * @remarks The @a user should not be released.
+ * @remarks The @a user can be used only in the function.
+ *
+ * @param[in] account User account.
+ * @param[out] user User information.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int _uam_request_get_user_by_account(char *account, uam_user_info_s *user);
-int _uam_request_get_user_by_deviceid(char *device_id, uam_user_info_t * user);
+/**
+ * @brief Brings user information that meet the device id.
+ * @since_tizen 5.5
+ *
+ * @remarks The @a user should not be released.
+ * @remarks The @a user can be used only in the function.
+ *
+ * @param[in] device_id Device id.
+ * @param[out] user User information.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int _uam_request_get_user_by_deviceid(char *device_id, uam_user_info_s *user);
-int _uam_request_get_user_by_mac(char *mac, uam_user_info_t * user);
+/**
+ * @brief Brings user information that meet the MAC address.
+ * @since_tizen 5.5
+ *
+ * @remarks The @a user should not be released.
+ * @remarks The @a user can be used only in the function.
+ *
+ * @param[in] mac Mac address.
+ * @param[out] user User information.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int _uam_request_get_user_by_mac(char *mac, uam_user_info_s *user);
-int _uam_request_add_device(char *account, uam_device_info_t *device);
+/**
+ * @brief Requests to add a device info to the user.
+ * @since_tizen 5.5
+ *
+ * @param[in] account User account.
+ * @param[in] device Device information.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int _uam_request_add_device(char *account, uam_device_info_s *device);
-int _uam_request_remove_device(char *account, uam_device_info_t *device);
+/**
+ * @brief Requests to remove a device info to the user.
+ * @since_tizen 5.5
+ *
+ * @param[in] account User account.
+ * @param[in] device Device information.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int _uam_request_remove_device(char *account, uam_device_info_s *device);
-int _uam_request_remove_device_by_deviceid(const char *device_id, uam_tech_type_e tech_type);
+/**
+ * @brief Deletes device information matching device id and sensor type.
+ * @since_tizen 5.5
+ *
+ * @param[in] device_id Device id.
+ * @param[in] tech_type Sensor type.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int _uam_request_remove_device_by_deviceid(const char *device_id,
+ uam_tech_type_e tech_type);
+/**
+ * @brief Deletes device information matching device MAC.
+ * @since_tizen 5.5
+ *
+ * @param[in] mac MAC address.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_request_remove_device_by_mac(const char *mac);
-int _uam_request_get_device_by_deviceid(const char *device_id, uam_tech_type_e tech_type, uam_device_info_t *device);
+/**
+ * @brief Retrieves device information matching device id.
+ * @since_tizen 5.5
+ *
+ * @remarks The @a device should not be released.
+ * @remarks The @a device can be used only in the function.
+ *
+ * @param[in] device_id Device id.
+ * @param[in] tech_type Sensor type.
+ * @param[out] device Device information.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int _uam_request_get_device_by_deviceid(const char *device_id,
+ uam_tech_type_e tech_type, uam_device_info_s *device);
-int _uam_request_get_device_by_mac(const char *mac, uam_device_info_t *device);
+/**
+ * @brief Retrieves device information matching MAC address.
+ * @since_tizen 5.5
+ *
+ * @remarks The @a device should not be released.
+ * @remarks The @a device can be used only in the function.
+ *
+ * @param[in] mac MAC address.
+ * @param[out] device Device information.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int _uam_request_get_device_by_mac(const char *mac, uam_device_info_s *device);
+/**
+ * @brief Gets registered devices list.
+ * @since_tizen 5.5
+ *
+ * @remarks The @a devices_list should be destroyed by using #g_free() and #g_ptr_array_free().
+ *
+ * @param[out] devices_list Device list array
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_request_get_devices(GPtrArray **devices_list);
+/**
+ * @brief Gets registered devices list per a user.
+ * @since_tizen 5.5
+ *
+ * @remarks The @a devices_list should be destroyed by using #g_free() and #g_ptr_array_free().
+ *
+ * @param[in] account User account.
+ * @param[out] devices_list Devices list
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_request_get_user_devices(char *account, GPtrArray **devices_list);
-int _uam_request_set_detection_threshold(unsigned int sensor_type, int presence_threshold, int absence_threshold);
+/**
+ * @brief Sets detection threshold.
+ * @since_tizen 5.5
+ *
+ * @param[in] sensor_type Sensor type.
+ * @param[in] presence_threshold Threshold value for presence.
+ * @param[in] absence_threshold Threshold value for absence.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int _uam_request_set_detection_threshold(unsigned int sensor_type,
+ int presence_threshold, int absence_threshold);
+/**
+ * @brief Enables low-power mode.
+ * @since_tizen 5.5
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_enable_low_power_mode(void);
+/**
+ * @brief Disables low-power mode.
+ * @since_tizen 5.5
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_disable_low_power_mode(void);
+/**
+ * @brief Gets detction window size.
+ * @since_tizen 5.5
+ *
+ * @param[out] window Window size
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_get_detection_window(unsigned int *window);
+/**
+ * @brief Sets detction window.
+ * @since_tizen 5.5
+ *
+ * @param[in] window Window size
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_set_detection_window(unsigned int window);
+/**
+ * @brief Adds a user to the service.
+ * @since_tizen 5.5
+ *
+ * @param[in] service Service idt.
+ * @param[in] account User account.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_service_add_user(const char *service, const char *account);
+/**
+ * @brief Removes a user from the service.
+ * @since_tizen 5.5
+ *
+ * @param[in] service Service idt.
+ * @param[in] account User account.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_service_remove_user(const char *service, const char *account);
-int _uam_service_add_device(const char *service, char *device_id, uam_tech_type_e tech_type);
+/**
+ * @brief Adds a device to the service.
+ * @since_tizen 5.5
+ *
+ * @param[in] service Service idt.
+ * @param[in] device_id Device id.
+ * @param[in] tech_type Sensor type.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int _uam_service_add_device(const char *service, char *device_id,
+ uam_tech_type_e tech_type);
-int _uam_service_remove_device(const char *service, char *device_id, uam_tech_type_e tech_type);
+/**
+ * @brief Removes a device from the service.
+ * @since_tizen 5.5
+ *
+ * @param[in] service Service idt.
+ * @param[in] device_id Device id.
+ * @param[in] tech_type Sensor type.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int _uam_service_remove_device(const char *service, char *device_id,
+ uam_tech_type_e tech_type);
+/**
+ * @brief Sets detction cycle per eash service.
+ * @since_tizen 5.5
+ *
+ * @param[in] service Service id
+ * @param[in] cycle The cycle number of the service.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_set_service_detection_cycle(const char *service, unsigned int cycle);
+/**
+ * @brief Gets detction cycle per eash service.
+ * @since_tizen 5.5
+ *
+ * @param[in] service Service id
+ * @param[out] cycle The cycle number of the service.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
int _uam_get_service_detection_cycle(const char *service, unsigned int *cycle);
#ifdef __cplusplus
}
#endif
-#endif /* __UAM_API_H__ */
+#endif /* __TIZEN_UA_NETWORK_UA_API_H__ */
#define UAM_SIGNAL_DEVICE_FOUND "DeviceFound"
#define UAM_SIGNAL_SCAN_COMPLETED "ScanCompleted"
+#define CASE_TO_STR(x) case x: return #x;
+
#ifdef __cplusplus
}
#endif
<allow send_destination="net.uamd"/>
<allow send_destination="net.uamd.enabler"/>
</policy>
+ <policy group="users">
+ <allow send_destination="net.uamd"/>
+ <allow send_destination="net.uamd.enabler"/>
+ </policy>
<policy context="default">
<deny own="net.uamd"/>
<deny own="net.uamd.enabler"/>
do { \
if (NULL == arg) { \
UAM_ERR("%s is NULL", #arg); \
- return UAM_ERROR_INVALID_PARAM; \
+ return UAM_ERROR_INVALID_PARAMETER; \
} \
} while (0)
extern "C" {
#endif
-int _uam_register_event_handler(uam_event_callback event_cb, void *user_data);
+int _uam_register_event_handler(uam_event_cb event_cb, void *user_data);
int _uam_unregister_event_handler(void);
#ifdef __cplusplus
int _uam_async_request(int req_func,
GArray *in_param1, GArray *in_param2,
GArray *in_param3, GArray *in_param4,
- uam_event_callback callback, void *user_data);
+ uam_event_cb callback, void *user_data);
#ifdef __cplusplus
}
static uam_callback_info_t cb_info;
-UAM_EXPORT_API int _uam_init(uam_event_callback cb, void *user_data)
+UAM_EXPORT_API int _uam_init(uam_event_cb cb, void *user_data)
{
FUNC_ENTRY;
int ret;
int i;
int count;
- count = (out_param->len)/sizeof(uam_user_info_t);
+ count = (out_param->len)/sizeof(uam_user_info_s);
if (0 == count)
UAM_INFO("No registered users");
for (i = 0; i < count; i++) {
- uam_user_info_t *user_info = NULL;
- uam_user_info_t *info;
+ uam_user_info_s *user_info = NULL;
+ uam_user_info_s *info;
- info = &g_array_index(out_param, uam_user_info_t, i);
- user_info = g_memdup(info, sizeof(uam_user_info_t));
+ info = &g_array_index(out_param, uam_user_info_s, i);
+ user_info = g_memdup(info, sizeof(uam_user_info_s));
if (user_info)
g_ptr_array_add(*user_list, (gpointer)user_info);
}
return ret;
}
-UAM_EXPORT_API int _uam_is_device_registered(uam_device_info_t *dev_info, gboolean *is_registered)
+UAM_EXPORT_API int _uam_is_device_registered(uam_device_info_s *dev_info, gboolean *is_registered)
{
FUNC_ENTRY;
int ret;
UAM_INIT_PARAMS();
UAM_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
- g_array_append_vals(in_param1, dev_info, sizeof(uam_device_info_t));
+ g_array_append_vals(in_param1, dev_info, sizeof(uam_device_info_s));
ret = _uam_sync_request(UAM_REQUEST_IS_DEVICE_ADDED,
in_param1, in_param2, in_param3, in_param4, &out_param);
if (UAM_ERROR_NONE == ret)
return ret;
}
-UAM_EXPORT_API int _uam_get_default_user(uam_user_info_t *user)
+UAM_EXPORT_API int _uam_get_default_user(uam_user_info_s *user)
{
FUNC_ENTRY;
int ret;
if (UAM_ERROR_NONE == ret) {
if (out_param->len > 0) {
- uam_user_info_t *info;
+ uam_user_info_s *info;
- info = &g_array_index(out_param, uam_user_info_t, 0);
- memcpy(user, info, sizeof(uam_user_info_t));
+ info = &g_array_index(out_param, uam_user_info_s, 0);
+ memcpy(user, info, sizeof(uam_user_info_s));
} else {
UAM_WARN("out_param length is 0");
}
return ret;
}
-UAM_EXPORT_API int _uam_add_user(uam_user_info_t *user)
+UAM_EXPORT_API int _uam_add_user(uam_user_info_s *user)
{
FUNC_ENTRY;
int ret;
}
UAM_EXPORT_API int _uam_request_get_user_by_account(char *account,
- uam_user_info_t *user)
+ uam_user_info_s *user)
{
FUNC_ENTRY;
int ret;
if (UAM_ERROR_NONE == ret) {
if (out_param->len > 0) {
- uam_user_info_t *info;
+ uam_user_info_s *info;
- info = &g_array_index(out_param, uam_user_info_t, 0);
- memcpy(user, info, sizeof(uam_user_info_t));
+ info = &g_array_index(out_param, uam_user_info_s, 0);
+ memcpy(user, info, sizeof(uam_user_info_s));
} else {
UAM_WARN("out_param length is 0");
}
}
UAM_EXPORT_API int _uam_request_get_user_by_deviceid(char *device_id,
- uam_user_info_t *user)
+ uam_user_info_s *user)
{
FUNC_ENTRY;
int ret;
if (UAM_ERROR_NONE == ret) {
if (out_param->len > 0) {
- uam_user_info_t * info;
+ uam_user_info_s * info;
- info = &g_array_index(out_param, uam_user_info_t, 0);
- memcpy(user, info, sizeof(uam_user_info_t));
+ info = &g_array_index(out_param, uam_user_info_s, 0);
+ memcpy(user, info, sizeof(uam_user_info_s));
} else {
UAM_WARN("out_param length is 0");
}
}
UAM_EXPORT_API int _uam_request_get_user_by_mac(char *mac,
- uam_user_info_t *user)
+ uam_user_info_s *user)
{
FUNC_ENTRY;
int ret;
if (UAM_ERROR_NONE == ret) {
if (out_param->len > 0) {
- uam_user_info_t * info;
+ uam_user_info_s * info;
- info = &g_array_index(out_param, uam_user_info_t, 0);
- memcpy(user, info, sizeof(uam_user_info_t));
+ info = &g_array_index(out_param, uam_user_info_s, 0);
+ memcpy(user, info, sizeof(uam_user_info_s));
} else {
UAM_WARN("out_param length is 0");
}
}
UAM_EXPORT_API int _uam_request_add_device(char *account,
- uam_device_info_t *device)
+ uam_device_info_s *device)
{
FUNC_ENTRY;
int ret;
g_strlcpy(str, account, UAM_USER_ACCOUNT_MAX_STRING_LEN);
g_array_append_vals(in_param1, str, sizeof(str));
- g_array_append_vals(in_param2, device, sizeof(uam_device_info_t));
+ g_array_append_vals(in_param2, device, sizeof(uam_device_info_s));
ret = _uam_async_request(UAM_REQUEST_ADD_DEVICE, in_param1, in_param2,
in_param3, in_param4, cb_info.callback, cb_info.user_data);
}
UAM_EXPORT_API int _uam_request_remove_device(char *account,
- uam_device_info_t *device)
+ uam_device_info_s *device)
{
FUNC_ENTRY;
int ret;
g_strlcpy(str, account, UAM_USER_ACCOUNT_MAX_STRING_LEN);
g_array_append_vals(in_param1, str, sizeof(str));
- g_array_append_vals(in_param2, device, sizeof(uam_device_info_t));
+ g_array_append_vals(in_param2, device, sizeof(uam_device_info_s));
ret = _uam_sync_request(UAM_REQUEST_DELETE_DEVICE,
in_param1, in_param2, in_param3, in_param4, &out_param);
}
UAM_EXPORT_API int _uam_request_get_device_by_deviceid(const char *device_id,
- uam_tech_type_e tech_type, uam_device_info_t *device)
+ uam_tech_type_e tech_type, uam_device_info_s *device)
{
FUNC_ENTRY;
int ret;
if (UAM_ERROR_NONE == ret) {
if (out_param->len > 0) {
- uam_device_info_t* info;
+ uam_device_info_s* info;
- info = &g_array_index(out_param, uam_device_info_t, 0);
- memcpy(device, info, sizeof(uam_device_info_t));
+ info = &g_array_index(out_param, uam_device_info_s, 0);
+ memcpy(device, info, sizeof(uam_device_info_s));
} else {
UAM_WARN("out_param length is 0");
}
}
UAM_EXPORT_API int _uam_request_get_device_by_mac(const char *mac,
- uam_device_info_t *device)
+ uam_device_info_s *device)
{
FUNC_ENTRY;
int ret;
if (UAM_ERROR_NONE == ret) {
if (out_param->len > 0) {
- uam_device_info_t* info;
+ uam_device_info_s* info;
- info = &g_array_index(out_param, uam_device_info_t, 0);
- memcpy(device, info, sizeof(uam_device_info_t));
+ info = &g_array_index(out_param, uam_device_info_s, 0);
+ memcpy(device, info, sizeof(uam_device_info_s));
} else {
UAM_WARN("out_param length is 0");
}
int i;
int count;
- count = (out_param->len)/sizeof(uam_device_info_t);
+ count = (out_param->len)/sizeof(uam_device_info_s);
if (0 == count)
UAM_INFO("No registered device");
for (i = 0; i < count; i++) {
- uam_device_info_t *device_info = NULL;
- uam_device_info_t *info;
+ uam_device_info_s *device_info = NULL;
+ uam_device_info_s *info;
- info = &g_array_index(out_param, uam_device_info_t, i);
- device_info = g_memdup(info, sizeof(uam_device_info_t));
+ info = &g_array_index(out_param, uam_device_info_s, i);
+ device_info = g_memdup(info, sizeof(uam_device_info_s));
if (device_info)
g_ptr_array_add(*devices_list, (gpointer)device_info);
}
int i;
int count;
- count = (out_param->len)/sizeof(uam_device_info_t);
+ count = (out_param->len)/sizeof(uam_device_info_s);
if (0 == count)
UAM_INFO("No registered device");
for (i = 0; i < count; i++) {
- uam_device_info_t *device_info = NULL;
- uam_device_info_t *info;
+ uam_device_info_s *device_info = NULL;
+ uam_device_info_s *info;
- info = &g_array_index(out_param, uam_device_info_t, i);
- device_info = g_memdup(info, sizeof(uam_device_info_t));
+ info = &g_array_index(out_param, uam_device_info_s, i);
+ device_info = g_memdup(info, sizeof(uam_device_info_s));
if (device_info)
g_ptr_array_add(*devices_list, (gpointer)device_info);
}
{
FUNC_ENTRY;
int ret;
- uam_app_info_t app_info;
+ uam_app_info_s app_info;
UAM_INIT_PARAMS();
UAM_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
g_strlcpy(app_info.app_id, app_id, UAM_APP_ID_MAX_STRING_LEN);
app_info.uid = uid;
- g_array_append_vals(in_param1, &app_info, sizeof(uam_app_info_t));
+ g_array_append_vals(in_param1, &app_info, sizeof(uam_app_info_s));
ret = _uam_sync_request(UAM_REQUEST_REGISTER_APP,
in_param1, in_param2, in_param3, in_param4, &out_param);
{
FUNC_ENTRY;
int ret;
- uam_app_info_t app_info;
+ uam_app_info_s app_info;
UAM_INIT_PARAMS();
UAM_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
g_strlcpy(app_info.app_id, app_id, UAM_APP_ID_MAX_STRING_LEN);
app_info.uid = uid;
- g_array_append_vals(in_param1, &app_info, sizeof(uam_app_info_t));
+ g_array_append_vals(in_param1, &app_info, sizeof(uam_app_info_s));
ret = _uam_sync_request(UAM_REQUEST_DEREGISTER_APP,
in_param1, in_param2, in_param3, in_param4, &out_param);
#include "ua-common.h"
-const char *event_string[] = {
- FOREACH_EVENT(GENERATE_EVENT_STRING)
-};
-
const char *request_string[] = {
FOREACH_REQUEST(GENERATE_REQUEST_STRING)
};
{
retv_if(UAM_EVENT_MAX <= event, NULL);
- return event_string[event];
+ switch (event) {
+ CASE_TO_STR(UAM_EVENT_USER_ADDED)
+ CASE_TO_STR(UAM_EVENT_USER_REMOVED)
+ CASE_TO_STR(UAM_EVENT_DEVICE_ADDED)
+ CASE_TO_STR(UAM_EVENT_DEVICE_REMOVED)
+ CASE_TO_STR(UAM_EVENT_PRESENCE_DETECTED)
+ CASE_TO_STR(UAM_EVENT_USER_PRESENCE_DETECTED)
+ CASE_TO_STR(UAM_EVENT_ABSENCE_DETECTED)
+ CASE_TO_STR(UAM_EVENT_USER_ABSENCE_DETECTED)
+ CASE_TO_STR(UAM_EVENT_AMBIANT_MODE_ENABLED)
+ CASE_TO_STR(UAM_EVENT_AMBIANT_MODE_DISABLED)
+ CASE_TO_STR(UAM_EVENT_SENSOR_STATE_READY)
+ CASE_TO_STR(UAM_EVENT_SENSOR_STATE_NOT_READY)
+ CASE_TO_STR(UAM_EVENT_DETECTION_STARTED)
+ CASE_TO_STR(UAM_EVENT_DETECTION_STOPPED)
+ CASE_TO_STR(UAM_EVENT_DEVICE_FOUND)
+ CASE_TO_STR(UAM_EVENT_SCAN_COMPLETED)
+ default:
+ return "UNKNOWN ERROR";
+ }
}
const char *_uam_error_to_str(int error)
{
switch (error) {
- FOREACH_ERROR(GENERATE_ERROR_CASE);
+ CASE_TO_STR(UAM_ERROR_NONE)
+ CASE_TO_STR(UAM_ERROR_INVALID_PARAMETER)
+ CASE_TO_STR(UAM_ERROR_PERMISSION_DENIED)
+ CASE_TO_STR(UAM_ERROR_TIMED_OUT)
+ CASE_TO_STR(UAM_ERROR_NOW_IN_PROGRESS)
+ CASE_TO_STR(UAM_ERROR_NOT_SUPPORTED)
+ CASE_TO_STR(UAM_ERROR_NOT_INITIALIZED)
+ CASE_TO_STR(UAM_ERROR_ALREADY_DONE)
+ CASE_TO_STR(UAM_ERROR_INTERNAL)
+ CASE_TO_STR(UAM_ERROR_NOT_FOUND)
+ CASE_TO_STR(UAM_ERROR_ALREADY_REGISTERED)
+ CASE_TO_STR(UAM_ERROR_DB_FAILED)
+ CASE_TO_STR(UAM_ERROR_NOT_REGISTERED)
default:
return "UNKNOWN ERROR";
}
void *data, void *callback, void *user_data)
{
FUNC_ENTRY;
- uam_event_data_t event_data;
+ uam_event_data_s event_data;
UAM_INFO("Event: %s [0x%4.4X], result= %s [0x%4.4X]",
_uam_event_to_str(event), event,
ret_if(NULL == callback);
- memset(&event_data, 0x00, sizeof(uam_event_data_t));
+ memset(&event_data, 0x00, sizeof(uam_event_data_s));
event_data.result = result;
event_data.data = data;
- ((uam_event_callback)callback)(event, &event_data, user_data);
+ ((uam_event_cb)callback)(event, &event_data, user_data);
FUNC_EXIT;
}
return;
if (0 == strcasecmp(signal_name, UAM_SIGNAL_USER_PRESENCE_DETECTED)) {
- uam_detection_event_data_t event_data;
+ uam_detection_event_data_s event_data;
unsigned int sensor_bitmask;
char *account = NULL;
char *service = NULL;
__uam_send_event(event, result, &event_data,
event_info->cb, event_info->user_data);
} else if (0 == strcasecmp(signal_name, UAM_SIGNAL_USER_ABSENCE_DETECTED)) {
- uam_detection_event_data_t event_data;
+ uam_detection_event_data_s event_data;
unsigned int sensor_bitmask;
char *account = NULL;
char *service = NULL;
__uam_send_event(event, result, &sensor,
event_info->cb, event_info->user_data);
} else if (0 == strcasecmp(signal_name, UAM_SIGNAL_USER_ADDED)) {
- uam_user_info_t user_info;
+ uam_user_info_s user_info;
char *account = NULL;
char *name = NULL;
- memset(&user_info, 0, sizeof(uam_user_info_t));
+ memset(&user_info, 0, sizeof(uam_user_info_s));
g_variant_get(parameters, "(i&s&s)", &result,
&account, &name);
__uam_send_event(event, result, &user_info,
event_info->cb, event_info->user_data);
} else if (0 == strcasecmp(signal_name, UAM_SIGNAL_USER_REMOVED)) {
- uam_user_info_t user_info;
+ uam_user_info_s user_info;
char *account = NULL;
char *name = NULL;
- memset(&user_info, 0, sizeof(uam_user_info_t));
+ memset(&user_info, 0, sizeof(uam_user_info_s));
g_variant_get(parameters, "(i&s&s)", &result,
&account, &name);
__uam_send_event(event, result, &user_info,
event_info->cb, event_info->user_data);
} else if (0 == strcasecmp(signal_name, UAM_SIGNAL_DEVICE_ADDED)) {
- uam_device_info_t dev_info;
+ uam_device_info_s dev_info;
int os, type;
char *mac = NULL;
char *ipv4_addr = NULL;
__uam_send_event(event, result, &dev_info,
event_info->cb, event_info->user_data);
} else if (0 == strcasecmp(signal_name, UAM_SIGNAL_DEVICE_REMOVED)) {
- uam_device_info_t dev_info;
+ uam_device_info_s dev_info;
int os, type;
char *mac = NULL;
char *ipv4_addr = NULL;
__uam_send_event(UAM_EVENT_DETECTION_STOPPED, result, NULL,
event_info->cb, event_info->user_data);
} else if (0 == strcasecmp(signal_name, UAM_SIGNAL_DEVICE_FOUND)) {
- uam_device_info_t dev_info;
+ uam_device_info_s dev_info;
int os, type;
char *mac = NULL;
char *ipv4_addr = NULL;
FUNC_EXIT;
}
-int _uam_register_event_handler(uam_event_callback event_cb, void *user_data)
+int _uam_register_event_handler(uam_event_cb event_cb, void *user_data)
{
FUNC_ENTRY;
GDBusConnection *conn;
*event = UAM_EVENT_DEVICE_ADDED;
ret_if(output == NULL);
*param_data = &g_array_index(output,
- uam_device_info_t, 0);
+ uam_device_info_s, 0);
break;
default:
UAM_ERR("Unknown request function");
FUNC_ENTRY;
int event = -1;
int result = UAM_ERROR_NONE;
- uam_event_data_t event_data;
+ uam_event_data_s event_data;
uam_req_info_t *req_info = user_data;
GError *error = NULL;
GVariant *param1;
GArray *out_param = NULL;
- memset(&event_data, 0x00, sizeof(uam_event_data_t));
+ memset(&event_data, 0x00, sizeof(uam_event_data_s));
value = g_dbus_proxy_call_finish(G_DBUS_PROXY(object), res, &error);
if (!value) {
ret_if(req_info == NULL);
- result = UAM_ERROR_TIMEOUT;
+ result = UAM_ERROR_TIMED_OUT;
} else {
g_variant_get(value, "(iv)", &result, ¶m1);
g_variant_unref(value);
__uam_get_event_info(req_info->req_func, out_param,
&event, &event_data.data);
- ((uam_event_callback)req_info->cb)(
+ ((uam_event_cb)req_info->cb)(
event, &event_data, req_info->user_data);
}
GArray *in_param2,
GArray *in_param3,
GArray *in_param4,
- uam_event_callback callback,
+ uam_event_cb callback,
void *user_data
)
{
void _uam_cloud_update_registered_devices(void);
void _uam_cloud_send_device_added(int status, const char *account,
- const uam_device_info_t *dev_info);
+ const uam_device_info_s *dev_info);
#ifdef __cplusplus
}
const char* _uam_get_sensor_str(unsigned int ids);
-int _uam_register_app_info(char *sender, uam_app_info_t app_info);
+int _uam_register_app_info(char *sender, uam_app_info_s app_info);
-int _uam_deregister_app_info(char *sender, uam_app_info_t app_info);
+int _uam_deregister_app_info(char *sender, uam_app_info_s app_info);
#ifdef __cplusplus
}
int _uam_core_remove_user(const char *account);
-int _uam_core_add_device(const char *account, const uam_device_info_t *dev_info);
+int _uam_core_add_device(const char *account, const uam_device_info_s *dev_info);
-int _uam_core_remove_device(const char *account, const uam_device_info_t *dev_info);
+int _uam_core_remove_device(const char *account, const uam_device_info_s *dev_info);
int _uam_core_remove_device_by_device_id(const char *device_id, int tech_type);
int _uam_core_remove_device_by_mac(const char *mac);
-int _uam_core_get_default_user(uam_user_info_t *user_info);
+int _uam_core_get_default_user(uam_user_info_s *user_info);
-int _uam_core_get_users(int *count, uam_user_info_t **user_list);
+int _uam_core_get_users(int *count, uam_user_info_s **user_list);
-int _uam_core_get_user_by_account(const char *account, uam_user_info_t *user);
+int _uam_core_get_user_by_account(const char *account, uam_user_info_s *user);
int _uam_core_get_devcie_by_device_id(
- const char *device_id, int tech_type, uam_device_info_t *device);
+ const char *device_id, int tech_type, uam_device_info_s *device);
-int _uam_core_get_devcie_by_mac(const char *mac, uam_device_info_t *device);
+int _uam_core_get_devcie_by_mac(const char *mac, uam_device_info_s *device);
-int _uam_core_get_user_by_device_id(const char *device_id, uam_user_info_t *user);
+int _uam_core_get_user_by_device_id(const char *device_id, uam_user_info_s *user);
-int _uam_core_get_user_by_mac(const char *mac, uam_user_info_t *user);
+int _uam_core_get_user_by_mac(const char *mac, uam_user_info_s *user);
-int _uam_core_get_devices(int *count, uam_device_info_t **device_list);
+int _uam_core_get_devices(int *count, uam_device_info_s **device_list);
int _uam_core_get_user_devices(const char *account,
- int *count, uam_device_info_t **device_list);
+ int *count, uam_device_info_s **device_list);
-int _uam_core_is_device_added(uam_device_info_t *dev, gboolean *is_added);
+int _uam_core_is_device_added(uam_device_info_s *dev, gboolean *is_added);
int _uam_core_get_available_sensors(unsigned int *sensor_bitmask);
void _uam_core_handle_sensor_ready(unsigned int sensor, gboolean is_ready);
void _uam_core_handle_device_added(int status,
- int user_id, const uam_device_info_t *dev_info);
+ int user_id, const uam_device_info_s *dev_info);
void _uam_core_handle_presence_detected(unsigned int sensor,
- int user_id, uam_device_info_t *dev_info);
+ int user_id, uam_device_info_s *dev_info);
void _uam_core_handle_absence_detected(unsigned int sensor,
- int user_id, uam_device_info_t *dev_info);
+ int user_id, uam_device_info_s *dev_info);
void _uam_core_cleanup_monitor(char *name);
int _uam_core_stop_active_device_scan(char *sender, unsigned int sensors);
-void _uam_core_handle_active_device(uam_active_scan_event_e event, unsigned int sensor, const uam_device_info_t *dev_info);
+void _uam_core_handle_active_device(uam_active_scan_event_e event, unsigned int sensor, const uam_device_info_s *dev_info);
int _uam_core_service_add_user(const char *service_name, const char *account);
/* DEVICE QUERIES */
typedef struct {
int user_id;
- uam_device_info_t dev_info;
+ uam_device_info_s dev_info;
int presence_state;
long long timestamp;
} db_device_info_t;
int _ua_device_db_delete_device_info(const char *device_id, int tech_type, const char *address);
/* insert */
-int _ua_device_db_insert_device_info(int user_id, const uam_device_info_t *dev_info,
+int _ua_device_db_insert_device_info(int user_id, const uam_device_info_s *dev_info,
int presence_state, long long timestamp);
/* update */
gboolean _uam_pm_is_sensor_ready(unsigned int sensor_bitmask);
-int _uam_pm_register_device(unsigned short user_id, const uam_device_info_t *dev);
+int _uam_pm_register_device(unsigned short user_id, const uam_device_info_s *dev);
-int _uam_pm_unregister_device(unsigned short user_id, const uam_device_info_t *dev);
+int _uam_pm_unregister_device(unsigned short user_id, const uam_device_info_s *dev);
int _uam_pm_start_detection(unsigned int detection_mode, unsigned int sensor_bitmask);
static void ble_device_detection_callback(uas_detection_type_e type, uas_device_info_t *device)
{
FUNC_ENTRY;
- uam_device_info_t *dev_info;
+ uam_device_info_s *dev_info;
ret_if(NULL == device);
static void ble_device_added_callback(int status, uas_device_info_t *device)
{
FUNC_ENTRY;
- uam_device_info_t *dev_info;
+ uam_device_info_s *dev_info;
ret_if(NULL == device);
uam_plugin_info_t *cloud_plugin;
-static void __uap_to_uam_device_info(uam_device_info_t *dest,
+static void __uap_to_uam_device_info(uam_device_info_s *dest,
const uap_device_info_t *src)
{
FUNC_ENTRY;
}
static void __uam_to_uap_device_info(uap_device_info_t *dest,
- const uam_device_info_t *src)
+ const uam_device_info_s *src)
{
FUNC_ENTRY;
static int add_device(const char *account, uap_device_info_t *dev_info)
{
FUNC_ENTRY;
- uam_device_info_t device;
- uam_user_info_t user;
+ uam_device_info_s device;
+ uam_user_info_s user;
if (NULL == account) {
if (UAM_ERROR_NONE != _uam_core_get_default_user(&user)) {
retv_if(NULL == dev_info, UAP_STATUS_INVALID_PARAMS);
- memset(&device, 0x00, sizeof(uam_device_info_t));
+ memset(&device, 0x00, sizeof(uam_device_info_s));
__uap_to_uam_device_info(&device, dev_info);
if (UAM_ERROR_NONE != _uam_core_add_device(account, &device)) {
FUNC_ENTRY;
retv_if(NULL == device_id, UAP_STATUS_INVALID_PARAMS);
- retv_if(UAP_TECH_TYPE_NONE >= type, UAM_ERROR_INVALID_PARAM);
- retv_if(UAP_TECH_TYPE_P2P < type, UAM_ERROR_INVALID_PARAM);
+ retv_if(UAP_TECH_TYPE_NONE >= type, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(UAP_TECH_TYPE_P2P < type, UAM_ERROR_INVALID_PARAMETER);
if (UAM_ERROR_NONE != _uam_core_remove_device_by_device_id(device_id, type)) {
UAM_ERR("_uam_core_remove_user() failed");
{
FUNC_ENTRY;
int indx;
- uam_device_info_t *devices = NULL;
+ uam_device_info_s *devices = NULL;
uap_device_info_t *dev_list = NULL;
int num_devices = 0;
uac_api_t *api;
}
void _uam_cloud_send_device_added(int status, const char *account,
- const uam_device_info_t *dev_info)
+ const uam_device_info_s *dev_info)
{
FUNC_ENTRY;
ret_if(NULL == cloud_plugin);
void *handle;
uas_module_t *module;
- retv_if(NULL == path, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == name, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == symbol, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == path, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == name, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == symbol, UAM_ERROR_INVALID_PARAMETER);
filename = g_build_filename(path, name, NULL);
UAM_DBG("Loading [%s]", filename);
const char *filename;
int ret = UAM_ERROR_INTERNAL;
- retv_if(0 == strlen(SENSOR_PLUGIN_DIR), UAM_ERROR_INVALID_PARAM);
+ retv_if(0 == strlen(SENSOR_PLUGIN_DIR), UAM_ERROR_INVALID_PARAMETER);
UAM_DBG("Loading plugins from %s", SENSOR_PLUGIN_DIR);
return (UAS_STATE_READY == state ? TRUE : FALSE);
}
-int _uam_pm_register_device(unsigned short user_id, const uam_device_info_t *dev)
+int _uam_pm_register_device(unsigned short user_id, const uam_device_info_s *dev)
{
FUNC_ENTRY;
int id;
uam_sensor_plugin_info_t *plugin;
uas_device_info_t *device = NULL;
- retv_if(NULL == dev, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == dev, UAM_ERROR_INVALID_PARAMETER);
id = _pm_util_uam_tech_type_to_plugin_id(dev->type);
- retv_if(UAS_PLUGIN_ID_MAX <= id, UAM_ERROR_INVALID_PARAM);
+ retv_if(UAS_PLUGIN_ID_MAX <= id, UAM_ERROR_INVALID_PARAMETER);
plugin = plugins[id];
retv_if(!plugin || !plugin->api, UAM_ERROR_NOT_SUPPORTED);
return UAM_ERROR_NONE;
}
-int _uam_pm_unregister_device(unsigned short user_id, const uam_device_info_t *dev)
+int _uam_pm_unregister_device(unsigned short user_id, const uam_device_info_s *dev)
{
FUNC_ENTRY;
int id;
uam_sensor_plugin_info_t *plugin;
uas_device_info_t *device = NULL;
- retv_if(NULL == dev, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == dev, UAM_ERROR_INVALID_PARAMETER);
id = _pm_util_uam_tech_type_to_plugin_id(dev->type);
- retv_if(UAS_PLUGIN_ID_MAX <= id, UAM_ERROR_INVALID_PARAM);
+ retv_if(UAS_PLUGIN_ID_MAX <= id, UAM_ERROR_INVALID_PARAMETER);
plugin = plugins[id];
retv_if(!plugin || !plugin->api, UAM_ERROR_NOT_SUPPORTED);
uam_sensor_plugin_info_t *plugin;
id = _pm_util_sensor_bitmask_to_plugin_id(sensor);
- retv_if(UAS_PLUGIN_ID_MAX <= id, UAM_ERROR_INVALID_PARAM);
+ retv_if(UAS_PLUGIN_ID_MAX <= id, UAM_ERROR_INVALID_PARAMETER);
plugin = plugins[id];
retv_if(!plugin || !plugin->api, UAM_ERROR_NOT_SUPPORTED);
FUNC_EXIT;
}
-uas_device_info_t *_pm_util_uam_dev_info_to_uas_dev_info(const uam_device_info_t *dev)
+uas_device_info_t *_pm_util_uam_dev_info_to_uas_dev_info(const uam_device_info_s *dev)
{
FUNC_ENTRY;
uas_device_info_t *device;
return device;
}
-uam_device_info_t *_pm_util_uas_dev_info_to_uam_dev_info(const uas_device_info_t *dev)
+uam_device_info_s *_pm_util_uas_dev_info_to_uam_dev_info(const uas_device_info_t *dev)
{
FUNC_ENTRY;
- uam_device_info_t *device;
+ uam_device_info_s *device;
int i = 0;
retv_if(NULL == dev, NULL);
- device = g_new0(uam_device_info_t, 1);
+ device = g_new0(uam_device_info_s, 1);
device->operating_system = dev->os;
g_strlcpy(device->device_id, dev->device_id, UAM_DEVICE_ID_MAX_STRING_LEN);
extern "C" {
#endif
-uas_device_info_t *_pm_util_uam_dev_info_to_uas_dev_info(const uam_device_info_t *dev);
+uas_device_info_t *_pm_util_uam_dev_info_to_uas_dev_info(const uam_device_info_s *dev);
-uam_device_info_t *_pm_util_uas_dev_info_to_uam_dev_info(const uas_device_info_t *dev);
+uam_device_info_s *_pm_util_uas_dev_info_to_uam_dev_info(const uas_device_info_t *dev);
void _pm_util_uam_db_dev_to_uas_dev(unsigned int tech_type,
uam_db_device_info_t *dev, uas_device_info_t **device);
void *handle = NULL;
uap_module_t *module = NULL;
- retv_if(NULL == path, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == name, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == symbol, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == path, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == name, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == symbol, UAM_ERROR_INVALID_PARAMETER);
filename = g_build_filename(path, name, NULL);
UAM_DBG("Loading [%s]", filename);
if (UAP_PLUGIN_ID_POWER != module->id) {
dlclose(handle);
handle = NULL;
- return UAM_ERROR_INVALID_PARAM;
+ return UAM_ERROR_INVALID_PARAMETER;
}
retv_if(FALSE == __add_power_plugin(handle, module), UAM_ERROR_INTERNAL);
const char *filename;
int ret = UAM_ERROR_INTERNAL;
- retv_if(0 == strlen(POWER_PLUGIN_DIR), UAM_ERROR_INVALID_PARAM);
+ retv_if(0 == strlen(POWER_PLUGIN_DIR), UAM_ERROR_INVALID_PARAMETER);
UAM_DBG("Loading power plugin from %s", POWER_PLUGIN_DIR);
dir = g_dir_open(POWER_PLUGIN_DIR, 0, NULL);
uam_power_plugin_info_t *plugin = pwr_plugin;
if (!plugin || !plugin->api) {
UAM_WARN("Plugin is NULL");
- return UAM_ERROR_INVALID_PARAM;
+ return UAM_ERROR_INVALID_PARAMETER;
}
status = plugin->api->init(&power_cbs);
static void wifi_device_detection_callback(uas_detection_type_e type, uas_device_info_t *device)
{
FUNC_ENTRY;
- uam_device_info_t *dev_info;
+ uam_device_info_s *dev_info;
ret_if(NULL == device);
static void wifi_device_added_callback(int status, uas_device_info_t *device)
{
FUNC_ENTRY;
- uam_device_info_t *dev_info;
+ uam_device_info_s *dev_info;
ret_if(NULL == device);
const uas_device_info_t *device)
{
FUNC_ENTRY;
- uam_device_info_t *dev_info = NULL;
+ uam_device_info_s *dev_info = NULL;
uam_active_scan_event_e event_info;
if (UAS_ACTIVE_DEVICE_FOUND == event) {
#include "ua-manager-common.h"
-const char *event_string[] = {
- FOREACH_EVENT(GENERATE_EVENT_STRING)
-};
-
const char *request_string[] = {
FOREACH_REQUEST(GENERATE_REQUEST_STRING)
};
{
retv_if(UAM_EVENT_MAX <= event, NULL);
- return event_string[event];
+ switch (event) {
+ CASE_TO_STR(UAM_EVENT_USER_ADDED)
+ CASE_TO_STR(UAM_EVENT_USER_REMOVED)
+ CASE_TO_STR(UAM_EVENT_DEVICE_ADDED)
+ CASE_TO_STR(UAM_EVENT_DEVICE_REMOVED)
+ CASE_TO_STR(UAM_EVENT_PRESENCE_DETECTED)
+ CASE_TO_STR(UAM_EVENT_USER_PRESENCE_DETECTED)
+ CASE_TO_STR(UAM_EVENT_ABSENCE_DETECTED)
+ CASE_TO_STR(UAM_EVENT_USER_ABSENCE_DETECTED)
+ CASE_TO_STR(UAM_EVENT_AMBIANT_MODE_ENABLED)
+ CASE_TO_STR(UAM_EVENT_AMBIANT_MODE_DISABLED)
+ CASE_TO_STR(UAM_EVENT_SENSOR_STATE_READY)
+ CASE_TO_STR(UAM_EVENT_SENSOR_STATE_NOT_READY)
+ CASE_TO_STR(UAM_EVENT_DETECTION_STARTED)
+ CASE_TO_STR(UAM_EVENT_DETECTION_STOPPED)
+ CASE_TO_STR(UAM_EVENT_DEVICE_FOUND)
+ CASE_TO_STR(UAM_EVENT_SCAN_COMPLETED)
+ default:
+ return "UNKNOWN ERROR";
+ }
}
const char *_uam_manager_error_to_str(int error)
{
switch (error) {
- FOREACH_ERROR(GENERATE_ERROR_CASE);
+ /* CHECK: List all enum values here */
+ CASE_TO_STR(UAM_ERROR_NONE)
+ CASE_TO_STR(UAM_ERROR_INVALID_PARAMETER)
+ CASE_TO_STR(UAM_ERROR_PERMISSION_DENIED)
+ CASE_TO_STR(UAM_ERROR_TIMED_OUT)
+ CASE_TO_STR(UAM_ERROR_NOW_IN_PROGRESS)
+ CASE_TO_STR(UAM_ERROR_NOT_SUPPORTED)
+ CASE_TO_STR(UAM_ERROR_NOT_INITIALIZED)
+ CASE_TO_STR(UAM_ERROR_NOT_IN_OPERATION)
+ CASE_TO_STR(UAM_ERROR_ALREADY_DONE)
+ CASE_TO_STR(UAM_ERROR_INTERNAL)
+ CASE_TO_STR(UAM_ERROR_NOT_FOUND)
+ CASE_TO_STR(UAM_ERROR_ALREADY_REGISTERED)
+ CASE_TO_STR(UAM_ERROR_DB_FAILED)
+ CASE_TO_STR(UAM_ERROR_NOT_REGISTERED)
default:
return "UNKNOWN ERROR";
}
json_object *jint;
json_object *jvalue;
- retv_if(NULL == cycle, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == period, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == retries, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == cycle, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == period, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == retries, UAM_ERROR_INVALID_PARAMETER);
contents = __uam_get_file_content(UAM_CONFIG_FILE);
retv_if(NULL == contents, UAM_ERROR_INTERNAL);
FUNC_EXIT;
}
-static void __send_device_event(int event, const uam_device_info_t *dev_info)
+static void __send_device_event(int event, const uam_device_info_s *dev_info)
{
FUNC_ENTRY;
GVariant *param;
{
FUNC_ENTRY;
uam_db_device_info_t *device = data;
- uam_device_info_t dev_info;
+ uam_device_info_s dev_info;
unsigned short user_id;
GSList *l;
}
static void __get_uam_db_dev_list_to_uam_dev_list(
- GSList *db_dev_list, uam_device_info_t **device_list, int *count)
+ GSList *db_dev_list, uam_device_info_s **device_list, int *count)
{
FUNC_ENTRY;
GSList *l;
}
}
- *device_list = g_new0(uam_device_info_t, *count);
+ *device_list = g_new0(uam_device_info_s, *count);
/* Copy devices */
for (l = db_dev_list; NULL != l; l = g_slist_next(l)) {
FUNC_EXIT;
}
-static int __copy_tech_info_to_device_info(uam_db_tech_info_t *tech, uam_device_info_t *device)
+static int __copy_tech_info_to_device_info(uam_db_tech_info_t *tech, uam_device_info_s *device)
{
FUNC_ENTRY;
GSList *l;
- retv_if(NULL == tech, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == tech, UAM_ERROR_INVALID_PARAMETER);
- memset(device, 0x00, sizeof(uam_device_info_t));
+ memset(device, 0x00, sizeof(uam_device_info_s));
for (l = tech->addresses; NULL != l; l = g_slist_next(l)) {
uam_db_address_info_t *addr = l->data;
}
static void __uam_core_add_dev_to_list(
- uam_db_user_info_t *user, const uam_device_info_t *dev_info,
+ uam_db_user_info_t *user, const uam_device_info_s *dev_info,
int presence_state, long long timestamp, GSList *svc_list)
{
FUNC_ENTRY;
return UAM_ERROR_NONE;
}
-int _uam_core_add_device(const char *account, const uam_device_info_t *dev_info)
+int _uam_core_add_device(const char *account, const uam_device_info_s *dev_info)
{
FUNC_ENTRY;
int ret;
uam_db_device_info_t *device;
uam_db_user_info_t *user;
- retv_if(NULL == account, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == dev_info, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == account, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == dev_info, UAM_ERROR_INVALID_PARAMETER);
l = g_slist_find_custom(users, account, __compare_user_account);
- retv_if(NULL == l, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == l, UAM_ERROR_INVALID_PARAMETER);
user = l->data;
l = g_slist_find_custom(devices, dev_info->device_id, __compare_device_id);
return UAM_ERROR_NONE;
}
-int _uam_core_is_device_added(uam_device_info_t *dev, gboolean *is_added)
+int _uam_core_is_device_added(uam_device_info_s *dev, gboolean *is_added)
{
FUNC_ENTRY;
uam_db_device_info_t *device;
GSList *l;
- retv_if(NULL == dev, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == is_added, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == dev, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == is_added, UAM_ERROR_INVALID_PARAMETER);
*is_added = FALSE;
l = g_slist_find_custom(devices, dev->device_id, __compare_device_id);
return UAM_ERROR_NONE;
}
-int _uam_core_remove_device(const char *account, const uam_device_info_t *dev_info)
+int _uam_core_remove_device(const char *account, const uam_device_info_s *dev_info)
{
FUNC_ENTRY;
int ret;
uam_db_device_info_t *device;
uam_db_user_info_t *user;
- retv_if(NULL == account, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == dev_info, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == account, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == dev_info, UAM_ERROR_INVALID_PARAMETER);
/* Retrieve user from list */
l = g_slist_find_custom(users, account, __compare_user_account);
- retv_if(NULL == l, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == l, UAM_ERROR_INVALID_PARAMETER);
user = l->data;
/* Retrieve device from list */
l = g_slist_find_custom(devices, dev_info->device_id, __compare_device_id);
- retv_if(NULL == l, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == l, UAM_ERROR_INVALID_PARAMETER);
device = l->data;
- retv_if(user != device->user, UAM_ERROR_INVALID_PARAM);
- retv_if(!(device->supported_techs & dev_info->type), UAM_ERROR_INVALID_PARAM);
+ retv_if(user != device->user, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(!(device->supported_techs & dev_info->type), UAM_ERROR_INVALID_PARAMETER);
/* Retrieve tech info from list */
l = g_slist_find_custom(device->tech_list,
&(dev_info->type), __compare_tech_type);
- retv_if(NULL == l, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == l, UAM_ERROR_INVALID_PARAMETER);
tech = l->data;
ret = _uam_pm_unregister_device(user->user_id, dev_info);
FUNC_ENTRY;
int ret;
GSList *l;
- uam_device_info_t dev_info;
+ uam_device_info_s dev_info;
uam_db_tech_info_t *tech;
uam_db_device_info_t *device;
- retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAM);
- retv_if(UAM_TECH_TYPE_NONE >= tech_type, UAM_ERROR_INVALID_PARAM);
- retv_if(UAM_TECH_TYPE_P2P < tech_type, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(UAM_TECH_TYPE_NONE >= tech_type, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(UAM_TECH_TYPE_P2P < tech_type, UAM_ERROR_INVALID_PARAMETER);
/* Retrieve device from list */
l = g_slist_find_custom(devices, device_id, __compare_device_id);
FUNC_ENTRY;
uam_db_tech_info_t *tech;
uam_db_device_info_t *device;
- uam_device_info_t dev_info;
+ uam_device_info_s dev_info;
int ret;
- retv_if(NULL == mac, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == mac, UAM_ERROR_INVALID_PARAMETER);
tech = __get_tech_info_by_mac(mac);
retv_if(NULL == tech, UAM_ERROR_NOT_FOUND);
return UAM_ERROR_NONE;
}
-int _uam_core_get_default_user(uam_user_info_t *user_info)
+int _uam_core_get_default_user(uam_user_info_s *user_info)
{
FUNC_ENTRY;
int ret;
GSList *l;
uam_db_user_info_t *user;
- retv_if(NULL == user_info, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == user_info, UAM_ERROR_INVALID_PARAMETER);
ret = _uam_core_add_user(USER_ACCOUNT_DEFAULT, USER_NAME_DEFAULT);
if ((UAM_ERROR_NONE != ret) && (UAM_ERROR_ALREADY_REGISTERED != ret)) {
retv_if(NULL == l, UAM_ERROR_INTERNAL);
user = l->data;
- memset(user_info, 0x00, sizeof(uam_user_info_t));
+ memset(user_info, 0x00, sizeof(uam_user_info_s));
g_strlcpy(user_info->account, user->account, UAM_USER_ACCOUNT_MAX_STRING_LEN);
g_strlcpy(user_info->name, user->name, UAM_USER_NAME_MAX_STRING_LEN);
return UAM_ERROR_NONE;
}
-int _uam_core_get_users(int *count, uam_user_info_t **user_list)
+int _uam_core_get_users(int *count, uam_user_info_s **user_list)
{
FUNC_ENTRY;
guint size;
GSList *l;
size = g_slist_length(users);
- *user_list = g_new0(uam_user_info_t, size);
+ *user_list = g_new0(uam_user_info_s, size);
*count = 0;
/* fetch users list from DB */
return UAM_ERROR_NONE;
}
-int _uam_core_get_user_by_account(const char *account, uam_user_info_t *user)
+int _uam_core_get_user_by_account(const char *account, uam_user_info_s *user)
{
FUNC_ENTRY;
uam_db_user_info_t *db_info;
GSList *l;
- retv_if(NULL == account, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == account, UAM_ERROR_INVALID_PARAMETER);
l = g_slist_find_custom(users, account, __compare_user_account);
retv_if(NULL == l, UAM_ERROR_NOT_FOUND);
}
int _uam_core_get_devcie_by_device_id(
- const char *device_id, int tech_type, uam_device_info_t *device)
+ const char *device_id, int tech_type, uam_device_info_s *device)
{
FUNC_ENTRY;
uam_db_device_info_t *db_info;
GSList *l;
GSList *l1;
- retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAM);
- retv_if(UAM_TECH_TYPE_NONE >= tech_type, UAM_ERROR_INVALID_PARAM);
- retv_if(UAM_TECH_TYPE_P2P < tech_type, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(UAM_TECH_TYPE_NONE >= tech_type, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(UAM_TECH_TYPE_P2P < tech_type, UAM_ERROR_INVALID_PARAMETER);
l = g_slist_find_custom(devices, device_id, __compare_device_id);
retv_if(NULL == l, UAM_ERROR_NOT_FOUND);
db_info = l->data;
retv_if(!(tech_type & db_info->supported_techs), UAM_ERROR_NOT_FOUND);
- memset(device, 0x00, sizeof(uam_device_info_t));
+ memset(device, 0x00, sizeof(uam_device_info_s));
for (l1 = db_info->tech_list; NULL != l1; l1 = g_slist_next(l1)) {
uam_db_tech_info_t *tech = l1->data;
return UAM_ERROR_NONE;
}
-int _uam_core_get_devcie_by_mac(const char *mac, uam_device_info_t *device)
+int _uam_core_get_devcie_by_mac(const char *mac, uam_device_info_s *device)
{
FUNC_ENTRY;
int ret;
uam_db_tech_info_t *tech;
- retv_if(NULL == mac, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == mac, UAM_ERROR_INVALID_PARAMETER);
tech = __get_tech_info_by_mac(mac);
retv_if(NULL == tech, UAM_ERROR_NOT_FOUND);
return UAM_ERROR_NONE;
}
-int _uam_core_get_user_by_device_id(const char *device_id, uam_user_info_t *user)
+int _uam_core_get_user_by_device_id(const char *device_id, uam_user_info_s *user)
{
FUNC_ENTRY;
uam_db_device_info_t *dev;
GSList *l;
- retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAMETER);
l = g_slist_find_custom(devices, device_id, __compare_device_id);
retv_if(NULL == l, UAM_ERROR_NOT_FOUND);
return UAM_ERROR_NONE;
}
-int _uam_core_get_user_by_mac(const char *mac, uam_user_info_t *user)
+int _uam_core_get_user_by_mac(const char *mac, uam_user_info_s *user)
{
FUNC_ENTRY;
uam_db_tech_info_t *tech;
- retv_if(NULL == mac, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == mac, UAM_ERROR_INVALID_PARAMETER);
tech = __get_tech_info_by_mac(mac);
retv_if(NULL == tech, UAM_ERROR_NOT_FOUND);
return UAM_ERROR_NONE;
}
-int _uam_core_get_devices(int *count, uam_device_info_t **device_list)
+int _uam_core_get_devices(int *count, uam_device_info_s **device_list)
{
FUNC_ENTRY;
}
int _uam_core_get_user_devices(const char *account,
- int *count, uam_device_info_t **device_list)
+ int *count, uam_device_info_s **device_list)
{
FUNC_ENTRY;
uam_db_user_info_t *user;
GSList *l;
l = g_slist_find_custom(users, account, __compare_user_account);
- retv_if(NULL == l, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == l, UAM_ERROR_INVALID_PARAMETER);
user = l->data;
__get_uam_db_dev_list_to_uam_dev_list(user->devices, device_list, count);
uam_db_user_info_t *user;
uam_db_service_info_t *service;
- retv_if(NULL == account, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == svc_name, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == account, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == svc_name, UAM_ERROR_INVALID_PARAMETER);
retv_if(0 == g_strcmp0(svc_name, UAM_SERVICE_DEFAULT), UAM_ERROR_PERMISSION_DENIED);
/* Retrieve user from list */
l = g_slist_find_custom(users, account, __compare_user_account);
- retv_if(NULL == l, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == l, UAM_ERROR_INVALID_PARAMETER);
user = l->data;
/* Retrieve service from list */
GSList *l;
uam_db_user_info_t *user;
- retv_if(NULL == account, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == svc_name, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == account, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == svc_name, UAM_ERROR_INVALID_PARAMETER);
retv_if(0 == g_strcmp0(svc_name, UAM_SERVICE_DEFAULT), UAM_ERROR_PERMISSION_DENIED);
/* Retrieve user from list */
l = g_slist_find_custom(users, account, __compare_user_account);
- retv_if(NULL == l, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == l, UAM_ERROR_INVALID_PARAMETER);
user = l->data;
/* Retrieve service from list */
l = g_slist_find_custom(services, svc_name, __compare_svc_name);
- retv_if(NULL == l, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == l, UAM_ERROR_INVALID_PARAMETER);
for (l = user->devices; NULL != l; l = g_slist_next(l)) {
uam_db_device_info_t *device = l->data;
uam_db_tech_info_t *tech_info;
uam_db_service_info_t *service;
- retv_if(NULL == svc_name, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == svc_name, UAM_ERROR_INVALID_PARAMETER);
retv_if(0 == g_strcmp0(svc_name, UAM_SERVICE_DEFAULT), UAM_ERROR_PERMISSION_DENIED);
- retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAM);
- retv_if(UAM_TECH_TYPE_NONE >= tech_type, UAM_ERROR_INVALID_PARAM);
- retv_if(UAM_TECH_TYPE_MAX <= tech_type, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(UAM_TECH_TYPE_NONE >= tech_type, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(UAM_TECH_TYPE_MAX <= tech_type, UAM_ERROR_INVALID_PARAMETER);
tech_info = __uam_core_get_dev_tech_info(device_id, tech_type);
- retv_if(NULL == tech_info, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == tech_info, UAM_ERROR_INVALID_PARAMETER);
l = g_slist_find_custom(tech_info->svc_list, svc_name, __compare_svc_name);
retv_if(NULL != l, UAM_ERROR_ALREADY_REGISTERED);
char *mac;
uam_db_tech_info_t *tech_info;
- retv_if(NULL == svc_name, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAM);
- retv_if(UAM_TECH_TYPE_NONE >= tech_type, UAM_ERROR_INVALID_PARAM);
- retv_if(UAM_TECH_TYPE_MAX <= tech_type, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == svc_name, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(UAM_TECH_TYPE_NONE >= tech_type, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(UAM_TECH_TYPE_MAX <= tech_type, UAM_ERROR_INVALID_PARAMETER);
retv_if(0 == g_strcmp0(svc_name, UAM_SERVICE_DEFAULT), UAM_ERROR_PERMISSION_DENIED);
/* Retrieve service from list */
l = g_slist_find_custom(services, svc_name, __compare_svc_name);
- retv_if(NULL == l, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == l, UAM_ERROR_INVALID_PARAMETER);
tech_info = __uam_core_get_dev_tech_info(device_id, tech_type);
- retv_if(NULL == tech_info, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == tech_info, UAM_ERROR_INVALID_PARAMETER);
l = g_slist_find_custom(tech_info->svc_list, svc_name, __compare_svc_name);
retv_if(NULL == l, UAM_ERROR_NOT_REGISTERED);
uam_db_service_info_t *service;
unsigned int elapsed_time;
- retv_if(NULL == svc_name, UAM_ERROR_INVALID_PARAM);
- retv_if(UAM_DETECTION_CYCLE_MIN > new_cycle, UAM_ERROR_INVALID_PARAM);
- retv_if(0 != (new_cycle % UAM_DETECTION_CYCLE_MIN), UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == svc_name, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(UAM_DETECTION_CYCLE_MIN > new_cycle, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(0 != (new_cycle % UAM_DETECTION_CYCLE_MIN), UAM_ERROR_INVALID_PARAMETER);
l = g_slist_find_custom(services, svc_name, __compare_svc_name);
- retv_if(NULL == l, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == l, UAM_ERROR_INVALID_PARAMETER);
service = l->data;
elapsed_time = service->cycle - service->remaining_time;
GSList *l;
uam_db_service_info_t *service;
- retv_if(NULL == svc_name, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == cycle, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == svc_name, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == cycle, UAM_ERROR_INVALID_PARAMETER);
l = g_slist_find_custom(services, svc_name, __compare_svc_name);
- retv_if(NULL == l, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == l, UAM_ERROR_INVALID_PARAMETER);
service = l->data;
*cycle = service->cycle;
gboolean is_monitor_added = TRUE;
GSList *l;
- retv_if(NULL == sender, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == svc_name, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == sender, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == svc_name, UAM_ERROR_INVALID_PARAMETER);
l = g_slist_find_custom(services, svc_name, __compare_svc_name);
- retv_if(NULL == l, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == l, UAM_ERROR_INVALID_PARAMETER);
service = l->data;
monitor = __uam_find_monitor(monitors, sender, svc_name, detection_type);
uam_monitor_info_t *monitor;
uam_db_service_info_t *service;
- retv_if(NULL == sender, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == svc_name, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == sender, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == svc_name, UAM_ERROR_INVALID_PARAMETER);
monitor = __uam_find_monitor(monitors, sender, svc_name, detection_type);
retv_if(NULL == monitor, UAM_ERROR_NOT_IN_OPERATION);
{
FUNC_ENTRY;
- retv_if(NULL == window, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == window, UAM_ERROR_INVALID_PARAMETER);
*window = detection_window;
{
FUNC_ENTRY;
- retv_if(0 >= window, UAM_ERROR_INVALID_PARAM);
- retv_if(UAM_DETECTION_WINDOW_MAX < window, UAM_ERROR_INVALID_PARAM);
- retv_if(0 != (window % UAM_DETECTION_WINDOW_STEP), UAM_ERROR_INVALID_PARAM);
+ retv_if(0 >= window, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(UAM_DETECTION_WINDOW_MAX < window, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(0 != (window % UAM_DETECTION_WINDOW_STEP), UAM_ERROR_INVALID_PARAMETER);
if (UAM_ERROR_NONE != _uam_pm_set_detection_window(window)) {
UAM_ERR("_uam_pm_set_detection_window(%d) failed", window);
}
void _uam_core_handle_device_added(int status,
- int user_id, const uam_device_info_t *dev_info)
+ int user_id, const uam_device_info_s *dev_info)
{
FUNC_ENTRY;
GSList *l;
l = _uam_manager_get_request_list();
for (; NULL != l; l = g_slist_next(l)) {
uam_request_context_t *info = l->data;
- uam_device_info_t *dev;
+ uam_device_info_s *dev;
GArray *out_param;
if (!info || (UAM_REQUEST_ADD_DEVICE != info->function))
}
out_param = g_array_new(FALSE, FALSE, sizeof(gchar));
- g_array_append_vals(out_param, dev_info, sizeof(uam_device_info_t));
+ g_array_append_vals(out_param, dev_info, sizeof(uam_device_info_s));
_uam_manager_method_return(info->context, out_param, status);
g_free(info->data);
_uam_manager_remove_req_ctxt_from_list(info);
}
void _uam_core_handle_presence_detected(unsigned int sensor,
- int user_id, uam_device_info_t *dev_info)
+ int user_id, uam_device_info_s *dev_info)
{
FUNC_ENTRY;
uam_db_user_info_t *user;
}
void _uam_core_handle_absence_detected(unsigned int sensor,
- int user_id, uam_device_info_t *dev_info)
+ int user_id, uam_device_info_s *dev_info)
{
FUNC_ENTRY;
uam_db_user_info_t *user;
int ret;
uam_scanner_info_t *scanner;
- retv_if(NULL == sender, UAM_ERROR_INVALID_PARAM);
- retv_if(0 == sensors, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == sender, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(0 == sensors, UAM_ERROR_INVALID_PARAMETER);
scanner = __uam_find_scanner(sender);
retv_if(NULL != scanner, UAM_ERROR_NOW_IN_PROGRESS);
uam_scanner_info_t *scanner;
GSList *l;
- retv_if(NULL == sender, UAM_ERROR_INVALID_PARAM);
- retv_if(0 == sensors, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == sender, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(0 == sensors, UAM_ERROR_INVALID_PARAMETER);
scanner = __uam_find_scanner(sender);
retv_if(NULL == scanner, UAM_ERROR_NOT_IN_OPERATION);
}
void _uam_core_handle_active_device(uam_active_scan_event_e event,
- unsigned int sensor, const uam_device_info_t *dev_info)
+ unsigned int sensor, const uam_device_info_s *dev_info)
{
FUNC_ENTRY;
GSList *l;
int error_code = UAM_ERROR_NONE;
sqlite3_stmt *stmt = update_ip_address;
- retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == address, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == ip_address, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == address, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == ip_address, UAM_ERROR_INVALID_PARAMETER);
DB_ACTION(sqlite3_bind_text(stmt, 1, ip_address, -1, SQLITE_TRANSIENT));
DB_ACTION(sqlite3_bind_text(stmt, 2, device_id, -1, SQLITE_TRANSIENT));
int error_code = UAM_ERROR_NONE;
sqlite3_stmt *stmt = update_presence;
- retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == address, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == address, UAM_ERROR_INVALID_PARAMETER);
DB_ACTION(sqlite3_bind_int(stmt, 1, presence_state));
DB_ACTION(sqlite3_bind_text(stmt, 2, device_id, -1, SQLITE_TRANSIENT));
int error_code = UAM_ERROR_NONE;
sqlite3_stmt *stmt = update_timestamp;
- retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == address, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == address, UAM_ERROR_INVALID_PARAMETER);
DB_ACTION(sqlite3_bind_int64(stmt, 1, timestamp));
DB_ACTION(sqlite3_bind_text(stmt, 2, device_id, -1, SQLITE_TRANSIENT));
return error_code;
}
-int _ua_device_db_insert_device_info(int user_id, const uam_device_info_t *dev_info,
+int _ua_device_db_insert_device_info(int user_id, const uam_device_info_s *dev_info,
int presence_state, long long timestamp)
{
FUNC_ENTRY;
int error_code = UAM_ERROR_NONE;
sqlite3_stmt *stmt = insert_device_info;
- retv_if(NULL == dev_info, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == dev_info, UAM_ERROR_INVALID_PARAMETER);
UAM_INFO("%s-%d-%s-%s-%lld-%d-%d-%d", dev_info->device_id,
dev_info->type, dev_info->mac, dev_info->ipv4_addr,
int error_code = UAM_ERROR_NONE;
sqlite3_stmt *stmt = select_device;
- retv_if(NULL == info, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == info, UAM_ERROR_INVALID_PARAMETER);
UAM_INFO("UserId: %s", device_id);
int error_code = UAM_ERROR_NONE;
sqlite3_stmt *stmt = select_device_number;
- retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAM);
- retv_if(NULL == address, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == address, UAM_ERROR_INVALID_PARAMETER);
UAM_INFO("UserId: %s", device_id);
#include <aul_svc.h>
#include <bundle_internal.h>
-GSList *apps; /* List of apps to launch - uam_app_info_t*/
+GSList *apps; /* List of apps to launch - uam_app_info_s*/
#define UA_EVENT "UA_EVENT"
}
}
-static void __uam_app_launcher(uam_app_info_t *app_info, int event)
+static void __uam_app_launcher(uam_app_info_s *app_info, int event)
{
FUNC_ENTRY;
int r = 0;
UAM_INFO("dest: [%s] ", dest);
if (NULL == dest) {
for (l = apps; NULL != l; l = g_slist_next(l)) {
- uam_app_info_t *app_info = l->data;
+ uam_app_info_s *app_info = l->data;
if (NULL == app_info)
continue;
}
} else {
for (l = apps; NULL != l; l = g_slist_next(l)) {
- uam_app_info_t *app_info = l->data;
+ uam_app_info_s *app_info = l->data;
if (NULL == app_info)
continue;
return UAM_ERROR_NONE;
}
-static uam_app_info_t *__uam_find_app(const char *name)
+static uam_app_info_s *__uam_find_app(const char *name)
{
// FUNC_ENTRY;
GSList *l;
retv_if(NULL == name, NULL);
for (l = apps; NULL != l; l = g_slist_next(l)) {
- uam_app_info_t *app_info = l->data;
+ uam_app_info_s *app_info = l->data;
if (!app_info || !app_info->sender)
continue;
return NULL;
}
-int _uam_register_app_info(char *sender, uam_app_info_t app_info)
+int _uam_register_app_info(char *sender, uam_app_info_s app_info)
{
FUNC_ENTRY;
int ret;
- uam_app_info_t *app;
+ uam_app_info_s *app;
app = __uam_find_app(sender);
return ret;
}
- app = g_malloc0(sizeof(uam_app_info_t));
+ app = g_malloc0(sizeof(uam_app_info_s));
app->sender = g_strdup(sender);
g_strlcpy(app->app_id, app_info.app_id, UAM_APP_ID_MAX_STRING_LEN);
app->uid = app_info.uid;
return ret;
}
-int _uam_deregister_app_info(char *sender, uam_app_info_t app_info)
+int _uam_deregister_app_info(char *sender, uam_app_info_s app_info)
{
FUNC_ENTRY;
int ret;
- uam_app_info_t *app;
+ uam_app_info_s *app;
app = __uam_find_app(sender);
break;
}
case UAM_REQUEST_GET_DEFAULT_USER: {
- uam_user_info_t user;
+ uam_user_info_s user;
result = _uam_core_get_default_user(&user);
g_array_append_vals(*out_param1,
- &user, sizeof(uam_user_info_t));
+ &user, sizeof(uam_user_info_s));
break;
}
case UAM_REQUEST_ADD_USER: {
}
case UAM_REQUEST_GET_USER_BY_ACCOUNT: {
const char *account;
- uam_user_info_t user;
+ uam_user_info_s user;
account = (char *)g_variant_get_data(in_param1);
UAM_DBG("Account: [%s]", account);
result = _uam_core_get_user_by_account(account, &user);
if (UAM_ERROR_NONE == result)
g_array_append_vals(*out_param1,
- &user, sizeof(uam_user_info_t));
+ &user, sizeof(uam_user_info_s));
break;
}
case UAM_REQUEST_GET_USER_BY_DEVICE_ID: {
const char *device_id;
- uam_user_info_t user;
+ uam_user_info_s user;
device_id = (char *)g_variant_get_data(in_param1);
UAM_DBG("device_id: [%s]", device_id);
result = _uam_core_get_user_by_device_id(device_id, &user);
if (UAM_ERROR_NONE == result)
g_array_append_vals(*out_param1,
- &user, sizeof(uam_user_info_t));
+ &user, sizeof(uam_user_info_s));
break;
}
case UAM_REQUEST_GET_USER_BY_MAC: {
const char *mac;
- uam_user_info_t user;
+ uam_user_info_s user;
mac = (char *)g_variant_get_data(in_param1);
UAM_DBG("MAC: [%s]", mac);
result = _uam_core_get_user_by_mac(mac, &user);
if (UAM_ERROR_NONE == result)
g_array_append_vals(*out_param1,
- &user, sizeof(uam_user_info_t));
+ &user, sizeof(uam_user_info_s));
break;
}
case UAM_REQUEST_GET_USERS: {
int count = 0;
- uam_user_info_t *users = NULL;
+ uam_user_info_s *users = NULL;
result = _uam_core_get_users(&count, &users);
if (UAM_ERROR_NONE == result) {
for (indx = 0; indx < count; indx++)
g_array_append_vals(*out_param1,
- &(users[indx]), sizeof(uam_user_info_t));
+ &(users[indx]), sizeof(uam_user_info_s));
g_free(users);
}
}
case UAM_REQUEST_IS_DEVICE_ADDED: {
gboolean is_added = FALSE;
- uam_device_info_t dev_info;
+ uam_device_info_s dev_info;
__uam_manager_copy_params(in_param1,
- &dev_info, sizeof(uam_device_info_t));
+ &dev_info, sizeof(uam_device_info_s));
UAM_DBG("DeviceId: [%s], Type: %d, MAC: [%s]",
dev_info.device_id, dev_info.type, dev_info.mac);
}
case UAM_REQUEST_DELETE_DEVICE: {
const char *account;
- uam_device_info_t dev_info;
+ uam_device_info_s dev_info;
account = (char *)g_variant_get_data(in_param1);
__uam_manager_copy_params(in_param2,
- &dev_info, sizeof(uam_device_info_t));
+ &dev_info, sizeof(uam_device_info_s));
UAM_DBG("Account: [%s], Type: %d, MAC: [%s]",
account, dev_info.type, dev_info.mac);
case UAM_REQUEST_GET_DEVICE_BY_DEVICE_ID: {
const char *device_id;
int tech_type;
- uam_device_info_t device;
+ uam_device_info_s device;
device_id = (char *)g_variant_get_data(in_param1);
__uam_manager_copy_params(in_param2, &tech_type, sizeof(int));
result = _uam_core_get_devcie_by_device_id(device_id, tech_type, &device);
if (UAM_ERROR_NONE == result)
g_array_append_vals(*out_param1,
- &device, sizeof(uam_device_info_t));
+ &device, sizeof(uam_device_info_s));
break;
}
case UAM_REQUEST_GET_DEVICE_BY_MAC: {
const char *mac;
- uam_device_info_t device;
+ uam_device_info_s device;
mac = (char *)g_variant_get_data(in_param1);
UAM_DBG("mac: [%s]", mac);
result = _uam_core_get_devcie_by_mac(mac, &device);
if (UAM_ERROR_NONE == result)
g_array_append_vals(*out_param1,
- &device, sizeof(uam_device_info_t));
+ &device, sizeof(uam_device_info_s));
break;
}
case UAM_REQUEST_GET_DEVICES: {
int count = 0;
- uam_device_info_t *devices = NULL;
+ uam_device_info_s *devices = NULL;
result = _uam_core_get_devices(&count, &devices);
if (UAM_ERROR_NONE == result) {
for (indx = 0; indx < count; indx++)
g_array_append_vals(*out_param1,
- &(devices[indx]), sizeof(uam_device_info_t));
+ &(devices[indx]), sizeof(uam_device_info_s));
g_free(devices);
}
case UAM_REQUEST_GET_USER_DEVICES: {
const char *account;
int count = 0;
- uam_device_info_t *devices = NULL;
+ uam_device_info_s *devices = NULL;
account = (char *)g_variant_get_data(in_param1);
UAM_DBG("Account: [%s]", account);
for (indx = 0; indx < count; indx++)
g_array_append_vals(*out_param1,
- &(devices[indx]), sizeof(uam_device_info_t));
+ &(devices[indx]), sizeof(uam_device_info_s));
g_free(devices);
}
break;
}
case UAM_REQUEST_REGISTER_APP: {
- uam_app_info_t app_info;
+ uam_app_info_s app_info;
__uam_manager_copy_params(in_param1,
- &app_info, sizeof(uam_app_info_t));
+ &app_info, sizeof(uam_app_info_s));
result = _uam_register_app_info(sender, app_info);
break;
}
case UAM_REQUEST_DEREGISTER_APP: {
- uam_app_info_t app_info;
+ uam_app_info_s app_info;
__uam_manager_copy_params(in_param1,
- &app_info, sizeof(uam_app_info_t));
+ &app_info, sizeof(uam_app_info_s));
result = _uam_deregister_app_info(sender, app_info);
break;
switch (function) {
case UAM_REQUEST_ADD_DEVICE: {
const char *account;
- uam_device_info_t dev_info;
+ uam_device_info_s dev_info;
if (__uam_manager_is_request_pending(UAM_REQUEST_ADD_DEVICE)) {
UAM_ERR("Another request is already in progress");
account = (char *)g_variant_get_data(in_param1);
__uam_manager_copy_params(in_param2,
- &dev_info, sizeof(uam_device_info_t));
+ &dev_info, sizeof(uam_device_info_s));
UAM_DBG("Account: [%s], Type: %d, MAC: [%s] IP: [%s], ID: [%s]",
account, dev_info.type, dev_info.mac,
dev_info.ipv4_addr, dev_info.device_id);
if (UAM_ERROR_NONE == result) {
__uam_manager_save_request_context(
context, result, sender, function,
- g_memdup(&dev_info, sizeof(uam_device_info_t)));
+ g_memdup(&dev_info, sizeof(uam_device_info_s)));
}
break;
}
int error_code = UAM_ERROR_NONE;
sqlite3_stmt *stmt = insert_service_info;
- retv_if(NULL == service_name, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == service_name, UAM_ERROR_INVALID_PARAMETER);
UAM_INFO("%s-%d", service_name, cycle);
int error_code = UAM_ERROR_NONE;
sqlite3_stmt *stmt = update_cycle;
- retv_if(NULL == service_name, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == service_name, UAM_ERROR_INVALID_PARAMETER);
DB_ACTION(sqlite3_bind_int64(stmt, 1, cycle));
DB_ACTION(sqlite3_bind_text(stmt, 2, service_name, -1, SQLITE_TRANSIENT));
sqlite3_stmt *stmt = select_service;
int rc;
- retv_if(!service_name, UAM_ERROR_INVALID_PARAM);
- retv_if(!info, UAM_ERROR_INVALID_PARAM);
+ retv_if(!service_name, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(!info, UAM_ERROR_INVALID_PARAMETER);
UAM_INFO("Service Name: %s", service_name);
int error_code = UAM_ERROR_NONE;
sqlite3_stmt *stmt = insert_user_info;
- retv_if(NULL == account, UAM_ERROR_INVALID_PARAM);
+ retv_if(NULL == account, UAM_ERROR_INVALID_PARAMETER);
UAM_INFO("%s-%s", name, account);
int error_code = UAM_ERROR_NONE;
sqlite3_stmt *stmt = delete_user_info;
- retv_if(0 > user_id, UAM_ERROR_INVALID_PARAM);
+ retv_if(0 > user_id, UAM_ERROR_INVALID_PARAMETER);
UAM_INFO("UserId: %d", user_id);
int error_code = UAM_ERROR_NONE;
sqlite3_stmt *stmt = select_user_data;
- retv_if(0 > user_id, UAM_ERROR_INVALID_PARAM);
- retv_if(!info, UAM_ERROR_INVALID_PARAM);
+ retv_if(0 > user_id, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(!info, UAM_ERROR_INVALID_PARAMETER);
UAM_INFO("UserId: %d", user_id);