void _device_eject_result_cb(int result, void *user_data)
{
- msgb("\rEject Device Complete [%s]", comp_error_to_string(result) );
+ msgb("\rEject Device Complete [%s]", comp_error_to_string(result));
}
static int run_device_eject(MManager *mm, struct menu_data *menu)
return RET_FAILURE;
}
- ret = companion_device_eject(group, device, _device_eject_result_cb, NULL );
+ ret = companion_device_eject(group, device, _device_eject_result_cb, NULL);
if (COMP_ERROR_NONE != ret) {
msgr("Failed to Delete Group: [%s(0x%X)]", comp_error_to_string(ret), ret);
return RET_FAILURE;
void _device_invite_result_cb(int result, void *user_data)
{
- msgb("\rInvite Device Finished [%s]", comp_error_to_string(result) );
+ msgb("\rInvite Device Finished [%s]", comp_error_to_string(result));
}
static int run_device_invite(MManager *mm, struct menu_data *menu)
deviceid = NULL;
}
if (ip) {
- free(ip );
+ free(ip);
ip = NULL;
}
if (devicetype) {
iter = found_device_list;
while (iter != NULL) {
- companion_device_h temp = (companion_device_h ) iter->data;
+ companion_device_h temp = (companion_device_h)iter->data;
char *temp_device_id;
companion_device_information_get_device_id(temp, &temp_device_id);
void _send_data_finish_cb(int result, char *resp_data, void *user_data)
{
msgb("\rFind Send Data Finished = %d", result);
- if (resp_data != NULL && strlen(resp_data) > 0) {
+ if (resp_data != NULL && strlen(resp_data) > 0)
msgp("Response from %s", resp_data);
- }
}
static int __send_data(int idx)
msgp("Sent to [ID] %s [IP] %s", deviceid, address);
if (deviceid) {
free(deviceid);
- deviceid= NULL;
+ deviceid = NULL;
}
if (address) {
free(address);
- address= NULL;
+ address = NULL;
}
ret = companion_send_data(device, message, strlen(message), _send_data_finish_cb, NULL);
- if (COMP_ERROR_NONE != ret) {
+ if (COMP_ERROR_NONE != ret)
msgr("Failed to Send Data: [ID] %s [IP] %s", deviceid, address);
- }
return ret;
}
int idx = 0;
int count = g_list_length(found_device_list);
- if (0 >= count ) {
+ if (0 >= count) {
msgr("No Device");
return RET_SUCCESS;
}
count = g_list_length(found_device_list);
- if (0 >= count ) {
+ if (0 >= count) {
msgr("No Device");
return RET_SUCCESS;
}
void _group_finish_cb(int result, void *user_data)
{
TC_PRT("find operation finished");
-
}
int companion_group_find_test(void)
found_group_list = NULL;
if (!test_get_user_int("==> Input timeout value (sec)"
- " - (Enter for skip) :", &input_int))
- {
+ " - (Enter for skip) :", &input_int)) {
input_int = 5;
TC_PRT("default timeout value [%d]", input_int);
}
found_device_list = NULL;
if (!test_get_user_int("==> Input timeout value (sec)"
- " - (Enter for skip) :", &input_int))
- {
+ " - (Enter for skip) :", &input_int)) {
input_int = 5;
TC_PRT("default timeout value [%d]", input_int);
}
found_device_list = NULL;
- ret = companion_device_get_found_devices(&devices ,&count);
+ ret = companion_device_get_found_devices(&devices, &count);
if (ret == 0)
TC_PRT("device find successful");
}
#endif
-#endif /* __TIZEN_NETWORK_COMMON_COMPANION_H__ */
\ No newline at end of file
+#endif /* __TIZEN_NETWORK_COMMON_COMPANION_H__ */
#define PRT(format, args...) printf("%s:%d() "format, __FUNCTION__, __LINE__, ##args)
#define TC_PRT(format, args...) PRT(format"\n", ##args)
-#endif /* __TIZEN_NETWORK_COMMON_COMPANION_DEBUG_H__ */
\ No newline at end of file
+#endif /* __TIZEN_NETWORK_COMMON_COMPANION_DEBUG_H__ */
int ref_count = 0;
bool __is_initialized = false;
-typedef struct _companion_group_t
-{
+typedef struct _companion_group_t {
char *uri_path;
char *device_id;
char *group_name;
companion_group_type_e type;
} companion_group_t;
-typedef struct _companion_device_t
-{
+typedef struct _companion_device_t {
char *device_id;
char *ip;
char *device_type;
} companion_device_t;
typedef struct _group_found_cb_t {
- companion_group_found_cb found_cb;
- void *user_data;
+ companion_group_found_cb found_cb;
+ void *user_data;
} group_found_cb_t;
group_found_cb_t group_found_cb;
typedef struct _device_found_cb_t {
- companion_device_found_cb found_cb;
- void *user_data;
+ companion_device_found_cb found_cb;
+ void *user_data;
} device_found_cb_t;
device_found_cb_t device_found_cb;
typedef struct _group_find_finish_cb_t {
- companion_group_find_finish_cb finish_cb;
- void *user_data;
+ companion_group_find_finish_cb finish_cb;
+ void *user_data;
} group_find_finish_cb_t;
group_find_finish_cb_t group_find_finish_cb;
typedef struct _device_find_finish_cb_t {
- companion_device_find_finish_cb finish_cb;
- void *user_data;
+ companion_device_find_finish_cb finish_cb;
+ void *user_data;
} device_find_finish_cb_t;
device_find_finish_cb_t device_find_finish_cb;
typedef struct _mowned_device_found_cb_t {
- companion_device_found_cb found_cb;
- void *user_data;
+ companion_device_found_cb found_cb;
+ void *user_data;
} mowned_device_found_cb_t;
mowned_device_found_cb_t mowned_device_found_cb;
typedef struct _mowned_device_find_finish_cb_t {
- companion_device_find_finish_cb finish_cb;
- void *user_data;
+ companion_device_find_finish_cb finish_cb;
+ void *user_data;
} mowned_device_find_finish_cb_t;
mowned_device_find_finish_cb_t mowned_device_find_finish_cb;
typedef struct _device_invite_result_cb_t {
- companion_device_invite_result_cb result_cb;
- void *user_data;
+ companion_device_invite_result_cb result_cb;
+ void *user_data;
} device_invite_result_cb_t;
device_invite_result_cb_t device_invite_result_cb;
typedef struct _device_eject_result_cb_t {
- companion_device_eject_result_cb result_cb;
- void *user_data;
+ companion_device_eject_result_cb result_cb;
+ void *user_data;
} device_eject_result_cb_t;
device_eject_result_cb_t device_eject_result_cb;
typedef struct _send_data_finish_cb_t {
- companion_send_data_finish_cb finish_cb;
- void *user_data;
+ companion_send_data_finish_cb finish_cb;
+ void *user_data;
} send_data_finish_cb_t;
send_data_finish_cb_t send_data_finish_cb;
typedef struct _request_result_cb_t {
- companion_request_result_cb result_cb;
- void *user_data;
+ companion_request_result_cb result_cb;
+ void *user_data;
} request_result_cb_t;
request_result_cb_t request_result_cb;
return device;
}
-static void __group_found_cb(Group *object,
- GVariant *va, gpointer user_data)
+static void __group_found_cb(Group *object, GVariant *va, gpointer user_data)
{
GVariantIter *iter = NULL;
const gchar *key;
- GVariant *key_value= NULL;
+ GVariant *key_value = NULL;
companion_group_t *group = NULL;
char *uri_path = NULL;
char *device_id = NULL;
g_variant_get(va, "a{sv}", &iter);
while (g_variant_iter_loop(iter, "{sv}", &key, &key_value)) {
- if (g_strcmp0(key, "URI") == 0) {
+ if (g_strcmp0(key, "URI") == 0)
uri_path = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "DeviceID") == 0) {
+ else if (g_strcmp0(key, "DeviceID") == 0)
device_id = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "GroupName") == 0) {
+ else if (g_strcmp0(key, "GroupName") == 0)
group_name = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "HostAddress") == 0) {
+ else if (g_strcmp0(key, "HostAddress") == 0)
host_addr = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "GroupDeviceType") == 0) {
+ else if (g_strcmp0(key, "GroupDeviceType") == 0)
resource_type = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "GroupType") == 0) {
+ else if (g_strcmp0(key, "GroupType") == 0)
type = g_variant_get_int32(key_value);
- }
}
g_variant_iter_free(iter);
group_found_cb.found_cb(type, group, group_found_cb.user_data);
}
-static void _group_find_finish_cb(Group *object,
- gint ret, gpointer user_data)
+static void _group_find_finish_cb(Group *object, gint ret, gpointer user_data)
{
if (group_find_finish_cb.finish_cb)
group_find_finish_cb.finish_cb(ret, group_find_finish_cb.user_data);
}
-static void __device_found_cb(Group *object,
- gint count, GVariant *va, gpointer user_data)
+static void __device_found_cb(Group *object, gint count, GVariant *va,
+ gpointer user_data)
{
GVariantIter *iter = NULL;
GVariantIter *iter_row = NULL;
int port = -1;
while (g_variant_iter_loop(iter_row, "{sv}", &key, &key_value)) {
- if (g_strcmp0(key, "DeviceID") == 0) {
+ if (g_strcmp0(key, "DeviceID") == 0)
device_id = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "Address") == 0) {
+ else if (g_strcmp0(key, "Address") == 0)
ip = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "SecVer") == 0) {
+ else if (g_strcmp0(key, "SecVer") == 0)
device_type = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "Port") == 0) {
+ else if (g_strcmp0(key, "Port") == 0)
port = g_variant_get_uint16(key_value);
- }
-
}
g_variant_iter_free(iter_row);
g_variant_iter_free(iter);
}
-static void _device_find_finish_cb(Group *object,
- gint ret, gpointer user_data)
+static void _device_find_finish_cb(Group *object, gint ret, gpointer user_data)
{
if (device_find_finish_cb.finish_cb)
device_find_finish_cb.finish_cb(ret, device_find_finish_cb.user_data);
}
-static void __mowned_device_found_cb(Group *object,
- gint count, GVariant *va, gpointer user_data)
+static void __mowned_device_found_cb(Group *object, gint count, GVariant *va,
+ gpointer user_data)
{
GVariantIter *iter = NULL;
GVariantIter *iter_row = NULL;
int port = -1;
while (g_variant_iter_loop(iter_row, "{sv}", &key, &key_value)) {
- if (g_strcmp0(key, "DeviceID") == 0) {
+ if (g_strcmp0(key, "DeviceID") == 0)
device_id = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "Address") == 0) {
+ else if (g_strcmp0(key, "Address") == 0)
ip = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "SecVer") == 0) {
+ else if (g_strcmp0(key, "SecVer") == 0)
device_type = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "Port") == 0) {
+ else if (g_strcmp0(key, "Port") == 0)
port = g_variant_get_uint16(key_value);
- }
}
g_variant_iter_free(iter_row);
g_variant_iter_free(iter);
}
-static void _mowned_device_find_finish_cb(Group *object,
- gint ret, gpointer user_data)
+static void _mowned_device_find_finish_cb(Group *object, gint ret,
+ gpointer user_data)
{
if (mowned_device_find_finish_cb.finish_cb)
mowned_device_find_finish_cb.finish_cb(ret, mowned_device_find_finish_cb.user_data);
}
-static void __device_invite_result_cb(Group *object,
- gint ret, gpointer user_data)
+static void __device_invite_result_cb(Group *object, gint ret, gpointer user_data)
{
- if(device_invite_result_cb.result_cb)
+ if (device_invite_result_cb.result_cb)
device_invite_result_cb.result_cb(ret, device_invite_result_cb.user_data);
}
-static void __device_eject_result_cb(Group *object,
- gint ret, gpointer user_data)
+static void __device_eject_result_cb(Group *object, gint ret, gpointer user_data)
{
if (device_eject_result_cb.result_cb)
device_eject_result_cb.result_cb(ret, device_eject_result_cb.user_data);
}
-static void __send_data_finish_cb(Group *object,
- gchar *resp_data, gint ret, gpointer user_data)
+static void __send_data_finish_cb(Group *object, gchar *resp_data, gint ret,
+ gpointer user_data)
{
if (send_data_finish_cb.finish_cb)
send_data_finish_cb.finish_cb(ret, resp_data, send_data_finish_cb.user_data);
}
-static void __request_result_cb(Group *object,
- gchar *cmd, gchar *arg, gint ret, gpointer user_data)
+static void __request_result_cb(Group *object, gchar *cmd, gchar *arg, gint ret,
+ gpointer user_data)
{
if (request_result_cb.result_cb)
request_result_cb.result_cb(cmd, arg, ret, request_result_cb.user_data);
GError *error = NULL;
group_proxy = group_proxy_new_for_bus_sync(
- G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- COMP_DBUS_SERVICE,
- COMP_DBUS_GROUP_PATH,
- NULL,
- &error);
+ G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ COMP_DBUS_SERVICE,
+ COMP_DBUS_GROUP_PATH,
+ NULL,
+ &error);
g_signal_connect(group_proxy,
"group-found", G_CALLBACK(__group_found_cb), NULL);
companion_group_type_e type = COMPANION_GROUP_TYPE_ERROR;
while (g_variant_iter_loop(iter_row, "{sv}", &key, &key_value)) {
- if (g_strcmp0(key, "URI") == 0) {
+ if (g_strcmp0(key, "URI") == 0)
uri_path = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "DeviceID") == 0) {
+ else if (g_strcmp0(key, "DeviceID") == 0)
device_id = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "GroupName") == 0) {
+ else if (g_strcmp0(key, "GroupName") == 0)
group_name = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "HostAddress") == 0) {
+ else if (g_strcmp0(key, "HostAddress") == 0)
host_addr = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "GroupDeviceType") == 0) {
+ else if (g_strcmp0(key, "GroupDeviceType") == 0)
resource_type = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "GroupType") == 0) {
+ else if (g_strcmp0(key, "GroupType") == 0)
type = g_variant_get_int32(key_value);
- }
}
g_variant_iter_free(iter_row);
mowned_device_found_cb.found_cb = found_cb;
mowned_device_found_cb.user_data = user_data;
- mowned_device_find_finish_cb.finish_cb= finish_cb;
+ mowned_device_find_finish_cb.finish_cb = finish_cb;
mowned_device_find_finish_cb.user_data = user_data;
/* get groups from daemon using gdbus */
companion_device_t *device = NULL;
while (g_variant_iter_loop(iter_row, "{sv}", &key, &key_value)) {
- if (g_strcmp0(key, "DeviceID") == 0) {
+ if (g_strcmp0(key, "DeviceID") == 0)
deviceid = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "Address") == 0) {
+ else if (g_strcmp0(key, "Address") == 0)
addr = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "SecVer") == 0) {
+ else if (g_strcmp0(key, "SecVer") == 0)
ver = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "Port") == 0) {
+ else if (g_strcmp0(key, "Port") == 0)
port = g_variant_get_uint16(key_value);
- }
}
g_variant_iter_free(iter_row);
companion_device_t *device = NULL;
while (g_variant_iter_loop(iter_row, "{sv}", &key, &key_value)) {
- if (g_strcmp0(key, "DeviceID") == 0) {
+ if (g_strcmp0(key, "DeviceID") == 0)
deviceid = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "Address") == 0) {
+ else if (g_strcmp0(key, "Address") == 0)
addr = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "SecVer") == 0) {
+ else if (g_strcmp0(key, "SecVer") == 0)
ver = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "Port") == 0) {
+ else if (g_strcmp0(key, "Port") == 0)
port = g_variant_get_uint16(key_value);
- }
}
g_variant_iter_free(iter_row);
g_variant_get(va, "a{sv}", &iter);
while (g_variant_iter_loop(iter, "{sv}", &key, &key_value)) {
- if (g_strcmp0(key, "DeviceID") == 0) {
+ if (g_strcmp0(key, "DeviceID") == 0)
deviceid = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "Address") == 0) {
+ else if (g_strcmp0(key, "Address") == 0)
addr = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "SecVer") == 0) {
+ else if (g_strcmp0(key, "SecVer") == 0)
ver = (char *)g_variant_get_string(key_value, NULL);
- } else if (g_strcmp0(key, "Port") == 0) {
+ else if (g_strcmp0(key, "Port") == 0)
port = g_variant_get_uint16(key_value);
- }
}
if (deviceid == NULL || addr == NULL || ver == NULL)
return -1;
}
- if (src->uri_path) {
+ if (src->uri_path)
dst->uri_path = g_strdup(src->uri_path);
- }
- if (src->device_id) {
+ if (src->device_id)
dst->device_id = g_strdup(src->device_id);
- }
- if (src->group_name) {
+ if (src->group_name)
dst->group_name = g_strdup(src->group_name);
- }
- if (src->host_addr) {
+ if (src->host_addr)
dst->host_addr = g_strdup(src->host_addr);
- }
- if (src->resource_type) {
+ if (src->resource_type)
dst->resource_type = g_strdup(src->resource_type);
- }
dst->type = src->type;
return 0;
return -1;
}
- if (src->device_id) {
+ if (src->device_id)
dst->device_id = g_strdup(src->device_id);
- }
- if (src->ip) {
+ if (src->ip)
dst->ip = g_strdup(src->ip);
- }
- if (src->device_type) {
+ if (src->device_type)
dst->device_type = g_strdup(src->device_type);
- }
return 0;
}
#ifdef __cplusplus
}
#endif
-#endif /* __COMP_CONTEXT_H__ */
\ No newline at end of file
+#endif /* __COMP_CONTEXT_H__ */
COMP_REQ_SEND_DATA_ALL, /**< Send data in subnet */
} comp_request_type_e;
-#endif /* __COMP_ENUM_H__ */
\ No newline at end of file
+#endif /* __COMP_ENUM_H__ */
int comp_gdbus_init();
-#endif /* __COMP_GDBUS_H__ */
\ No newline at end of file
+#endif /* __COMP_GDBUS_H__ */
gpointer user_data);
gboolean group_device_find(Group *group, GDBusMethodInvocation *invocation,
- gint timeout ,gpointer user_data);
+ gint timeout, gpointer user_data);
gboolean group_device_invite(Group *group, GDBusMethodInvocation *invocation,
gchar *uuid_dev1, gchar *uuid_dev2, gchar *pin, gchar *uri_1, gchar *rt_1,
gboolean group_request_create_group(Group *group, GDBusMethodInvocation *invocation,
gchar *uuid, gchar *group_name, gpointer user_data);
-gboolean group_request_invite(Group *group, GDBusMethodInvocation *invocation, gchar *uuid,
- gchar *group_name, gchar *target_uuid, gchar *PIN, gpointer user_data);
+gboolean group_request_invite(Group *group, GDBusMethodInvocation *invocation,
+ gchar *uuid, gchar *group_name, gchar *target_uuid, gchar *PIN, gpointer user_data);
-gboolean group_request_eject(Group *group, GDBusMethodInvocation *invocation, gchar *uuid,
- gchar *group_name, gchar *target_uuid, gpointer user_data);
+gboolean group_request_eject(Group *group, GDBusMethodInvocation *invocation,
+ gchar *uuid, gchar *group_name, gchar *target_uuid, gpointer user_data);
gboolean group_request_delete_group(Group *group, GDBusMethodInvocation *invocation,
- gchar *uuid, gchar *group_name, gpointer user_data);
+ gchar *uuid, gchar *group_name, gpointer user_data);
void notify_group_found(GVariant *group_data);
void notify_group_find_finish(int ret);
#ifdef __cplusplus
}
#endif
-#endif /* __COMP_GDBUS_GROUP_H__ */
\ No newline at end of file
+#endif /* __COMP_GDBUS_GROUP_H__ */
#ifdef __cplusplus
}
#endif
-#endif /* __COMP_GROUP_H__ */
\ No newline at end of file
+#endif /* __COMP_GROUP_H__ */
#include <comp_resource.h>
#include <comp_gdbus.h>
-#endif /* __COMP_MANAGER_H__ */
\ No newline at end of file
+#endif /* __COMP_MANAGER_H__ */
#ifdef __cplusplus
}
#endif
-#endif /* __COMP_RESOURCE_H__ */
\ No newline at end of file
+#endif /* __COMP_RESOURCE_H__ */
static void on_bus_acquired(GDBusConnection *connection, const gchar *path,
gpointer user_data)
{
- if (__group_init(connection) == false) {
+ if (__group_init(connection) == false)
LOG_DEBUG("Can not signal connect");
- }
if (__enabler_init(connection) == false)
LOG_ERR("Can't signal connect");
LOG_BEGIN();
ret = comp_iot_add_resource(COMP_RESOURCE_TYPE_GROUP, name);
- if (ret != COMP_ERROR_NONE) {
+ if (ret != COMP_ERROR_NONE)
LOG_ERR("Add resource is failed : %s", comp_log_get_error_string(ret));
- }
comp_context_t *comp_ctx = comp_context_get_context();
comp_check_null_ret_error("comp_ctx", comp_ctx, COMP_ERROR_INVALID_PARAMETER);
comp_command_t *cmd = g_new0(comp_command_t, 1);
comp_check_null_ret_error("cmd", cmd, COMP_ERROR_INVALID_PARAMETER);
ret = comp_iot_discovery_resource(COMP_RESOURCE_TYPE_GROUP, timeout, cmd);
- if (ret != COMP_ERROR_NONE) {
+ if (ret != COMP_ERROR_NONE)
LOG_ERR("Failed to discover resource : %s", comp_log_get_error_string(ret));
- }
LOG_END();
g_variant_builder_init(&builder, G_VARIANT_TYPE("aa{sv}"));
iter = found_group_list;
- while(iter != NULL) {
+ while (iter != NULL) {
comp_group_t *group = (comp_group_t *)iter->data;
g_variant_builder_open(&builder, G_VARIANT_TYPE_VARDICT);
LOG_BEGIN();
iter = mot_enb_dev_list;
- while(iter != NULL) {
+ while (iter != NULL) {
comp_mot_device_t *temp = (comp_mot_device_t *)iter->data;
if (g_strcmp0(temp->device_id, device->device_id) == 0) {
g_variant_builder_init(&builder, G_VARIANT_TYPE("aa{sv}"));
iter = mot_enb_dev_list;
- while(iter != NULL) {
+ while (iter != NULL) {
comp_mot_device_t *device = (comp_mot_device_t *)iter->data;
g_variant_builder_open(&builder, G_VARIANT_TYPE_VARDICT);
LOG_DEBUG("group name : %s, uuid : %s", group_name, uuid);
if (_is_pairwise_uuid(uuid) < 0) {
- /*
- * 1. Perform MOT
- * 2. Discover Mowned devices
- * 3. Pairwise
- */
- ret = agent_mot(uuid, pin);
+ ret = agent_mot(uuid, pin);
if (ret == COMP_ERROR_NONE) {
group_invite_info = g_try_malloc0(sizeof(comp_group_invite_info_t));
group_invite_info->uuid_dev1 = g_strdup(comp_ctx->device_uuid);
LOG_BEGIN();
iter = mowned_dev_list;
- while(iter != NULL) {
+ while (iter != NULL) {
comp_mot_device_t *temp = (comp_mot_device_t *)iter->data;
if (g_strcmp0(temp->device_id, device->device_id) == 0) {
g_variant_builder_init(&builder, G_VARIANT_TYPE("aa{sv}"));
iter = mowned_dev_list;
- while(iter != NULL) {
+ while (iter != NULL) {
comp_mot_device_t *device = (comp_mot_device_t *)iter->data;
g_variant_builder_open(&builder, G_VARIANT_TYPE_VARDICT);
#include <comp_log.h>
-const char *comp_log_get_error_string(int result) {
+const char *comp_log_get_error_string(int result)
+{
switch (result) {
case COMP_ERROR_NONE:
return "COMP_ERROR_NONE";
LOG_DEBUG("Name owner notify [%s]", name_owner);
if (NULL == name_owner)
- _close_gdbus_call( );
+ _close_gdbus_call();
g_free(name_owner);
}
comp_check_null_ret_error("comp_ctx", comp_ctx, FALSE);
ret = agent_mot(comp_ctx->device_uuid, "12341234");
- if (ret != COMP_ERROR_NONE) {
+ if (ret != COMP_ERROR_NONE)
LOG_ERR("agent_mot(%s) Failed", comp_ctx->device_uuid);
- }
return FALSE;
}
-static void _free_device_info(comp_mot_device_t *device) {
-
+static void _free_device_info(comp_mot_device_t *device)
+{
if (!device)
return;
(comp_group_get_invite_info() != NULL))
comp_group_notify_group_invite(result);
- if (comp_ctx && (TRUE == comp_ctx->mot_me) ) {
+ if (comp_ctx && (TRUE == comp_ctx->mot_me))
g_timeout_add(10, __perform_agent_pairwise, NULL);
- }
#endif
} else if (0 == g_strcmp0(signal_name, "remove_mo_done")) {
g_variant_get(parameters, "(i)", &result);
LOG_DEBUG("Result : %d", result);
comp_group_notify_group_invite(result);
- }else if (0 == g_strcmp0(signal_name, "unpair_done")) {
+ } else if (0 == g_strcmp0(signal_name, "unpair_done")) {
g_variant_get(parameters, "(i)", &result);
LOG_DEBUG("Result : %d", result);
agent.dbus_sub_ids = NULL;
}
-int agent_dbus_start( )
+int agent_dbus_start()
{
int ret = COMP_ERROR_NONE;
-/*\r
- * Network Configuration Module\r
- *\r
- * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
*/\r
\r
#ifndef __D2D_LOG_H__\r
-/*\r
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
*/\r
\r
#ifndef __MA_LOG_H__\r
-/*\r
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
*/\r
#include <glib.h>\r
\r
-/*\r
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
*/\r
\r
#ifndef __MA_SERVICE_INTERFACE_H__\r
-/*\r
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
*/\r
-\r
#include <glib.h>\r
\r
#include "ma.h"\r
-/*\r
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
*/\r
\r
#ifndef __MA_SERVICE_H__\r
* data structure
*/
typedef struct _proc {
- char name[2];
- int data;
- pthread_t thread;
- pthread_mutex_t lock;
- pthread_cond_t cond;
- long int waits;
+ char name[2]; /**< Thread name */
+ int data; /**< User data */
+ pthread_t thread; /**< POSIX Thread */
+ pthread_mutex_t lock; /**< POSIX Mutex */
+ pthread_cond_t cond; /**< POSIX condition */
+ long int waits; /**< How long we have to wait */
} PROC;
-void _exec_and_wait(void* args) {
+void _exec_and_wait(void* args)
+{
OCStackResult ret = OC_STACK_OK;
static struct timespec time_to_wait = {0, 0};
PROC *proc = (PROC*) args;
MA_LOGE("before increase proc[%s] data to [%d]", proc->name, proc->data);
- while(g_client->g_doneCB && proc->data < TIMES) {
+ while (g_client->g_doneCB && proc->data < TIMES) {
MA_LOGE("increase proc[%s] data to [%d]", proc->name, proc->data);
pthread_mutex_lock(&proc->lock);
pthread_cond_timedwait(&proc->cond, &proc->lock, &time_to_wait);
ret = OCProcess();
if (OC_STACK_OK != ret) {
- MA_LOGE( "OCStack process error = %d", ret);
- proc->data = TIMES;
+ MA_LOGE("OCStack process error = %d", ret);
+ proc->data = TIMES;
}
pthread_mutex_unlock(&proc->lock);
}
}
-int _init_proc(PROC *proc, void *(*routine) (void *)) {
+int _init_proc(PROC *proc, void *(*routine) (void *))
+{
pthread_attr_t attr;
MA_LOGI("try to init proc [%s]", proc->name);
ma_check_null_ret_error("g_client", g_client, OC_STACK_INVALID_PARAM);
#ifdef THREAD_COND_WAIT_USED
- int result_a = 0;
+ int result_a = 0;
PROC proc_a;
strcpy(proc_a.name, "A\0");
proc_a.data = 0;
proc_a.waits = msec;
- if (MA_ERROR_NONE !=_init_proc(&proc_a, _exec_and_wait))
+ if (MA_ERROR_NONE != _init_proc(&proc_a, _exec_and_wait))
MA_LOGE("Fail to init proc [%s]", proc_a.name);
pthread_join(proc_a.thread, (void*) &result_a);
#else
- for (int i=0; !g_client->g_doneCB && msec > i; i+=100) {
+ for (int i = 0; !g_client->g_doneCB && msec > i; i += 100) {
/*
* Basically, nanosleep is more thread-safe function,
* But, in our case, nanosleep cause crash frequently
*/
ret = nanosleep(&tim, &tim2);
- if ( 0 > ret) {
+ if (0 > ret)
MA_LOGE("nanosleep failed=%d", errno);
- }
g_mutex_lock(&g_client->iotivity_mutex);
ret = OCProcess();
g_mutex_unlock(&g_client->iotivity_mutex);
if (OC_STACK_OK != ret) {
- MA_LOGE( "OCStack process error = %d", ret);
+ MA_LOGE("OCStack process error = %d", ret);
break;
}
}
{
ma_check_null_ret("g_client", g_client);
- if (!pin || OXM_RANDOM_PIN_MAX_SIZE>=len) {
- MA_LOGE( "inputPinCB invalid parameters");
+ if (!pin || OXM_RANDOM_PIN_MAX_SIZE >= len) {
+ MA_LOGE("inputPinCB invalid parameters");
return;
}
ma_req_cb_s *con = (ma_req_cb_s *)data;
ma_check_null_ret("con", con);
- ma_service *service= (ma_service *)con->userdata;
+ ma_service *service = (ma_service *)con->userdata;
ma_check_null_ret("service", service);
ma_check_null_ret("g_client", g_client);
&g_client->g_motdev_list);
g_mutex_unlock(&g_client->iotivity_mutex);
if (OC_STACK_OK != ret) {
- MA_LOGE( "OCDiscoverMultipleOwnerEnalbedDevices API error");
+ MA_LOGE("OCDiscoverMultipleOwnerEnalbedDevices API error");
goto DISC_MOT_ENB_DEVS_END;
}
__notify_found_devs(con);
ma_check_null_ret_error("g_client", g_client, MA_ERROR_NO_DATA);
con = g_malloc0(sizeof(ma_req_cb_s));
if (NULL == con) {
- MA_LOGE( "g_malloc0() Fail=%d", errno);
+ MA_LOGE("g_malloc0() Fail=%d", errno);
/* Unset d2ds status 'pending' */
g_atomic_int_set(&g_client->pending, 0);
return MA_ERROR_OUT_OF_MEMORY;
&g_client->g_mowned_list);
g_mutex_unlock(&g_client->iotivity_mutex);
if (OC_STACK_OK != ret) {
- MA_LOGE( "OCDiscoverMultipleOwnerEnabledDevices API error");
+ MA_LOGE("OCDiscoverMultipleOwnerEnabledDevices API error");
goto DISC_OWNED_DEVS_END;
}
__notify_found_devs(con);
ma_check_null_ret_error("g_client", g_client, MA_ERROR_NO_DATA);
con = g_malloc0(sizeof(ma_req_cb_s));
if (NULL == con) {
- MA_LOGE( "g_malloc0() Fail=%d", errno);
+ MA_LOGE("g_malloc0() Fail=%d", errno);
/* Unset d2ds status 'pending' */
g_atomic_int_set(&g_client->pending, 0);
return MA_ERROR_OUT_OF_MEMORY;
if (!has_error) {
MA_LOGD("Multiple Ownership Transfer SUCCEEDED");
} else {
- MA_LOGD( "Multiple Ownership Transfer FAILED ");
+ MA_LOGD("Multiple Ownership Transfer FAILED ");
ma_print_result_list((const OCProvisionResult_t*) arr, num);
}
client->g_doneCB = true;
#ifdef MULTIPLE_OWN_AT_ONCE
OCProvisionDev_t* dev = NULL;
LL_FOREACH(g_client->g_motdev_list, dev) {
- if(OIC_PRECONFIG_PIN == dev->doxm->oxmSel) {
+ if (OIC_PRECONFIG_PIN == dev->doxm->oxmSel) {
/* Pre-Configured PIN initialization */
const char* testPreconfigPin = con->pin;/* Ex) "12341234" */
ret = OCAddPreconfigPin(dev, testPreconfigPin, strlen(testPreconfigPin));
- if(OC_STACK_OK != ret) {
+ if (OC_STACK_OK != ret) {
MA_LOGE("Failed to save the pre-configured PIN");
MA_LOGE("You can't use the pre-configured PIN OxM for MOT");
goto MOT_ENDED;
}
}
ret = OCDoMultipleOwnershipTransfer(g_client, g_client->g_motdev_list, _mot_cb);
- if (OC_STACK_OK != ret ) {
- MA_LOGE( "OCDoMultipleOwnershipTransfer: ret = %d (%s)",
+ if (OC_STACK_OK != ret) {
+ MA_LOGE("OCDoMultipleOwnershipTransfer: ret = %d (%s)",
ret, ma_ocf_error_to_string(ret));
goto MOT_ENDED;
}
#else
- if(OIC_PRECONFIG_PIN == src_dev->doxm->oxmSel) {
+ if (OIC_PRECONFIG_PIN == src_dev->doxm->oxmSel) {
/* Pre-Configured PIN initialization */
const char* testPreconfigPin = con->pin;/* Ex) "12341234" */
ret = OCAddPreconfigPin(src_dev, testPreconfigPin, strlen(testPreconfigPin));
- if(OC_STACK_OK != ret) {
+ if (OC_STACK_OK != ret) {
MA_LOGE("Failed to save the pre-configured PIN");
goto MOT_ENDED;
}
}
ret = OCDoMultipleOwnershipTransfer(g_client, src_dev, _mot_cb);
- if (OC_STACK_OK != ret ) {
- MA_LOGE( "OCDoMultipleOwnershipTransfer: ret = %d (%s)",
+ if (OC_STACK_OK != ret) {
+ MA_LOGE("OCDoMultipleOwnershipTransfer: ret = %d (%s)",
ret, ma_ocf_error_to_string(ret));
goto MOT_ENDED;
}
#endif
ret = _wait_cb_ret(CALLBACK_TIMEOUT_5S);
- if(ret) {
- MA_LOGE( "OCDoMultipleOwnershipTransfer callback error = %d (%s)",
+ if (ret) {
+ MA_LOGE("OCDoMultipleOwnershipTransfer callback error = %d (%s)",
ret, ma_ocf_error_to_string(ret));
goto MOT_ENDED;
}
ma_check_null_ret_error("g_client", g_client, MA_ERROR_NO_DATA);
con = g_malloc0(sizeof(ma_req_cb_s));
if (NULL == con) {
- MA_LOGE( "g_malloc0() Fail=%d", errno);
+ MA_LOGE("g_malloc0() Fail=%d", errno);
/* Unset d2ds status 'pending' */
g_atomic_int_set(&g_client->pending, 0);
return MA_ERROR_OUT_OF_MEMORY;
#endif
acl = (OicSecAcl_t*) OICCalloc(1, sizeof(OicSecAcl_t));
if (!acl) {
- MA_LOGE( "acl : OICCalloc failed = %d", errno);
+ MA_LOGE("acl : OICCalloc failed = %d", errno);
return NULL;
}
ace = (OicSecAce_t*) OICCalloc(1, sizeof(OicSecAce_t));
if (!ace) {
- MA_LOGE( "ace : OICCalloc failed = %d", errno);
+ MA_LOGE("ace : OICCalloc failed = %d", errno);
return NULL;
}
LL_APPEND(acl->aces, ace);
/* fill the href */
rsrc = (OicSecRsrc_t*)OICCalloc(1, sizeof(OicSecRsrc_t));
if (!rsrc) {
- MA_LOGE( "rsrc: OICCalloc failed = %d", errno);
+ MA_LOGE("rsrc: OICCalloc failed = %d", errno);
goto CREATE_ACL_ERROR;
}
len = strlen(rsrc_uri)+1; // '1' for null termination
rsrc->href = (char*) OICCalloc(len, sizeof(char));
if (!rsrc->href) {
- MA_LOGE( "rsrc->href: OICCalloc failed = %d", errno);
+ MA_LOGE("rsrc->href: OICCalloc failed = %d", errno);
goto CREATE_ACL_ERROR;
}
memcpy(rsrc->href, rsrc_uri, len);
rsrc->typeLen = 1;
rsrc->types = (char**)OICCalloc(1, sizeof(char*));
if (!rsrc->types) {
- MA_LOGE( "rsrc->types: OICCalloc failed = %d", errno);
+ MA_LOGE("rsrc->types: OICCalloc failed = %d", errno);
goto CREATE_ACL_ERROR;
}
rsrc->types[0] = g_strdup(rsrc_type);
if (!rsrc->types[0]) {
- MA_LOGE( "rsrc->types[0]: g_strdup failed = %d", errno);
+ MA_LOGE("rsrc->types[0]: g_strdup failed = %d", errno);
goto CREATE_ACL_ERROR;
}
rsrc->interfaceLen = 1;
rsrc->interfaces = (char**)OICCalloc(1, sizeof(char*));
if (!rsrc->interfaces) {
- MA_LOGE( "rsrc->interfaces: OICCalloc failed = %d", errno);
+ MA_LOGE("rsrc->interfaces: OICCalloc failed = %d", errno);
goto CREATE_ACL_ERROR;
}
rsrc->interfaces[0] = g_strdup(rsrc_interface);
if (!rsrc->interfaces[0]) {
- MA_LOGE( "rsrc->interfaces[0] : g_strdup failed = %d", errno);
+ MA_LOGE("rsrc->interfaces[0] : g_strdup failed = %d", errno);
goto CREATE_ACL_ERROR;
}
ace->eownerID = (OicUuid_t*)OICCalloc(1, sizeof(OicUuid_t));
if (NULL == ace->eownerID) {
- MA_LOGE( "ace->eownerID : OICCalloc failed = %d", errno);
+ MA_LOGE("ace->eownerID : OICCalloc failed = %d", errno);
goto CREATE_ACL_ERROR;
}
memcpy(ace->eownerID->id, subject->id, sizeof(subject->id));
if (!has_error) {
MA_LOGD("Provision ACL SUCCEEDED");
} else {
- MA_LOGD( "Provision ACL FAILED ");
+ MA_LOGD("Provision ACL FAILED ");
ma_print_result_list((const OCProvisionResult_t*) arr, nOfRes);
}
client->g_doneCB = true;
&subject_dev->doxm->deviceID, con->rsrc_uri, con->rsrc_type,
con->rsrc_interface, con->permission);
if (NULL == acl) {
- MA_LOGE( "Failed to create ACL for %s", con->rsrc_uri);
+ MA_LOGE("Failed to create ACL for %s", con->rsrc_uri);
goto PV_ACL_END;
}
/* Do ACL provisioning */
- ret= OCProvisionACL((void*) g_client, target_dev, acl, _acl_provisioning_cb);
+ ret = OCProvisionACL((void*) g_client, target_dev, acl, _acl_provisioning_cb);
if (OC_STACK_OK != ret) {
- MA_LOGD( "OCProvisionACL API error: %d (%s)", ret, ma_ocf_error_to_string(ret));
+ MA_LOGD("OCProvisionACL API error: %d (%s)", ret, ma_ocf_error_to_string(ret));
goto PV_ACL_END;
}
ret = _wait_cb_ret(CALLBACK_TIMEOUT_5S);
if (ret) {
- MA_LOGE( "OCProvisionCredentials Faild = %d", errno);
+ MA_LOGE("OCProvisionCredentials Faild = %d", errno);
goto PV_ACL_END;
}
/* display the ACL-provisioned result */
ma_check_null_ret_error("g_client", g_client, MA_ERROR_NO_DATA);
con = g_malloc0(sizeof(ma_req_cb_s));
if (NULL == con) {
- MA_LOGE( "g_malloc0() Fail=%d", errno);
+ MA_LOGE("g_malloc0() Fail=%d", errno);
/* Unset d2ds status 'pending' */
g_atomic_int_set(&g_client->pending, 0);
return MA_ERROR_OUT_OF_MEMORY;
if (!has_error) {
MA_LOGD("Provision ACL SUCCEEDED");
} else {
- MA_LOGD( "Provision ACL FAILED ");
+ MA_LOGD("Provision ACL FAILED ");
ma_print_result_list((const OCProvisionResult_t*) arr, nOfRes);
}
client->g_doneCB = true;
goto PV_CRED_END;
}
- if (!con->uuid_dev1 ) {
+ if (!con->uuid_dev1) {
MA_LOGE("dev1 is NULL");
goto PV_CRED_END;
}
SYMMETRIC_PAIR_WISE_KEY, OWNER_PSK_LENGTH_256,
dev1, dev2, _cred_provisioning_cb);
if (OC_STACK_OK != ret) {
- MA_LOGD( "OCProvisionPairwiseDevices API error: %d (%s)",
+ MA_LOGD("OCProvisionPairwiseDevices API error: %d (%s)",
ret, ma_ocf_error_to_string(ret));
goto PV_CRED_END;
}
ret = _wait_cb_ret(CALLBACK_TIMEOUT_5S);
if (ret) {
- MA_LOGE( "OCProvisionCredentials Faild = %d", errno);
+ MA_LOGE("OCProvisionCredentials Faild = %d", errno);
goto PV_CRED_END;
}
ma_check_null_ret_error("g_client", g_client, MA_ERROR_NO_DATA);
con = g_malloc0(sizeof(ma_req_cb_s));
if (!con) {
- MA_LOGE( "g_malloc0() Fail=%d", errno);
+ MA_LOGE("g_malloc0() Fail=%d", errno);
/* Unset d2ds status 'pending' */
g_atomic_int_set(&g_client->pending, 0);
return MA_ERROR_OUT_OF_MEMORY;
con->userdata = service;
con->cid = MA_DO_CRED_PROVISIONING;
- if (!uuid_dev1 ||!uuid_dev2) {
- MA_LOGE( "Invaild Prameters");
+ if (!uuid_dev1 || !uuid_dev2) {
+ MA_LOGE("Invaild Prameters");
_request_cleanup(con);
return MA_ERROR_INVALID_PARAMETER;
}
if (!has_error) {
MA_LOGD("Provision pairwise SUCCEEDED");
} else {
- MA_LOGD( "Provision pairwise FAILED ");
+ MA_LOGD("Provision pairwise FAILED ");
ma_print_result_list((const OCProvisionResult_t*) arr, nOfRes);
}
client->g_doneCB = true;
con->rsrc_type_1,
con->rsrc_interface_1, con->permission_1);
if (NULL == acl_1) {
- MA_LOGE( "Failed to create ACL for %s", con->rsrc_uri);
+ MA_LOGE("Failed to create ACL for %s", con->rsrc_uri);
goto PVPAIRWIE_ERROR;
}
con->rsrc_type_2,
con->rsrc_interface_2, con->permission_2);
if (NULL == acl_2) {
- MA_LOGE( "Failed to create ACL for %s", con->rsrc_uri);
+ MA_LOGE("Failed to create ACL for %s", con->rsrc_uri);
goto PVPAIRWIE_ERROR;
}
OWNER_PSK_LENGTH_256, target_dev_1, acl_1,
target_dev_2, acl_2, _resources_pairwise_cb);
if (OC_STACK_OK != ret) {
- MA_LOGD( "OCProvisionPairwiseDevices API error: %d (%s)", ret,
+ MA_LOGD("OCProvisionPairwiseDevices API error: %d (%s)", ret,
ma_ocf_error_to_string(ret));
goto PVPAIRWIE_ERROR;
}
ret = _wait_cb_ret(CALLBACK_TIMEOUT_5S);
if (ret) {
- MA_LOGE( "OCProvisionPairwise Faild = %d", errno);
+ MA_LOGE("OCProvisionPairwise Faild = %d", errno);
goto PVPAIRWIE_ERROR;
}
/* display the pairwise-provisioned result */
static int _resources_pairwise(ma_service *service, gchar *target_1,
gchar *subject_1, gchar *rsrc_uri_1, gchar *rsrc_type_1, gchar *rsrc_interface_1,
- int permission_1, gchar *target_2, gchar *subject_2,gchar *rsrc_uri_2,
+ int permission_1, gchar *target_2, gchar *subject_2, gchar *rsrc_uri_2,
gchar *rsrc_type_2, gchar *rsrc_interface_2, int permission_2)
{
ma_req_cb_s *con = NULL;
ma_check_null_ret_error("g_client", g_client, MA_ERROR_NO_DATA);
con = g_malloc0(sizeof(ma_req_cb_s));
if (NULL == con) {
- MA_LOGE( "g_malloc0() Fail=%d", errno);
+ MA_LOGE("g_malloc0() Fail=%d", errno);
/* Unset d2ds status 'pending' */
g_atomic_int_set(&g_client->pending, 0);
return MA_ERROR_OUT_OF_MEMORY;
if (!has_error) {
MA_LOGD("unlink SUCCEEDED");
} else {
- MA_LOGD( "unlink FAILED ");
+ MA_LOGD("unlink FAILED ");
ma_print_result_list((const OCProvisionResult_t*) arr, nOfRes);
}
client->g_doneCB = true;
goto PVUNLINKPAIRWISE_ERROR;
}
- if (!con->uuid_dev1 ) {
+ if (!con->uuid_dev1) {
MA_LOGE("dev1 is NULL");
goto PVUNLINKPAIRWISE_ERROR;
}
MA_LOGI("Unlink Selected Pairwise Devices..");
ret = OCUnlinkDevices((void*) g_client, dev1, dev2, _unlink_resources_cb);
if (OC_STACK_OK != ret) {
- MA_LOGD( "OCUnlinkDevices API error: %d (%s)", ret, ma_ocf_error_to_string(ret));
+ MA_LOGD("OCUnlinkDevices API error: %d (%s)", ret, ma_ocf_error_to_string(ret));
goto PVUNLINKPAIRWISE_ERROR;
}
ret = _wait_cb_ret(CALLBACK_TIMEOUT_5S);
if (ret) {
- MA_LOGE( "OCUnlinkDevices Faild = %d", errno);
+ MA_LOGE("OCUnlinkDevices Faild = %d", errno);
goto PVUNLINKPAIRWISE_ERROR;
}
ma_check_null_ret_error("g_client", g_client, MA_ERROR_NO_DATA);
con = g_malloc0(sizeof(ma_req_cb_s));
if (!con) {
- MA_LOGE( "g_malloc0() Fail=%d", errno);
+ MA_LOGE("g_malloc0() Fail=%d", errno);
/* Unset d2ds status 'pending' */
g_atomic_int_set(&g_client->pending, 0);
return MA_ERROR_OUT_OF_MEMORY;
con->cid = MA_UNLINK_RESOURCES;
if (!uuid_dev1 || !uuid_dev2) {
- MA_LOGE( "Invaild Prameters");
+ MA_LOGE("Invaild Prameters");
_request_cleanup(con);
return MA_ERROR_INVALID_PARAMETER;
}
if (!has_error) {
MA_LOGD("Remove Multiple Ownership SUCCEEDED");
} else {
- MA_LOGD( "Remove Multiple Ownership FAILED ");
+ MA_LOGD("Remove Multiple Ownership FAILED ");
ma_print_result_list((const OCProvisionResult_t*) arr, num);
}
client->g_doneCB = true;
goto REMOVE_SUBOWNER_ENDED;
}
ret = OCRemoveSubOwner(g_client, src_dev, &uuid_mowner, _remove_subowner_cb);
- if (OC_STACK_OK != ret ) {
- MA_LOGE( "OCRemoveSubOwner: ret = %d (%s)",
+ if (OC_STACK_OK != ret) {
+ MA_LOGE("OCRemoveSubOwner: ret = %d (%s)",
ret, ma_ocf_error_to_string(ret));
goto REMOVE_SUBOWNER_ENDED;
}
ret = _wait_cb_ret(CALLBACK_TIMEOUT_5S);
- if(ret) {
- MA_LOGE( "OCRemoveSubOwner callback error = %d (%s)",
+ if (ret) {
+ MA_LOGE("OCRemoveSubOwner callback error = %d (%s)",
ret, ma_ocf_error_to_string(ret));
goto REMOVE_SUBOWNER_ENDED;
}
ma_check_null_ret_error("g_client", g_client, MA_ERROR_NO_DATA);
con = g_malloc0(sizeof(ma_req_cb_s));
if (NULL == con) {
- MA_LOGE( "g_malloc0() Fail=%d", errno);
+ MA_LOGE("g_malloc0() Fail=%d", errno);
/* Unset d2ds status 'pending' */
g_atomic_int_set(&g_client->pending, 0);
return MA_ERROR_OUT_OF_MEMORY;
if (!has_error) {
MA_LOGD("Remove CRED for mowned device SUCCEEDED");
} else {
- MA_LOGD( "Remove CRED for mowned device FAILED ");
+ MA_LOGD("Remove CRED for mowned device FAILED ");
ma_print_result_list((const OCProvisionResult_t*) arr, num);
}
client->g_doneCB = true;
}
if (!con->target_to_revoke) {
MA_LOGE("Some parameters are wrong");
- MA_LOGE("%s", con->target_to_revoke );
+ MA_LOGE("%s", con->target_to_revoke);
goto REMOVE_DEVICE_END;
}
MA_LOGI(" Removing CRED for remote device at local SVR DB");
ret = OCRemoveDeviceWithUuid((void*) g_client, CALLBACK_TIMEOUT_5S, uuid,
- _remove_subowner_cb );
+ _remove_subowner_cb);
if (OC_STACK_OK != ret) {
- MA_LOGD( "OCRemoveDeviceWithUuid API error: %d (%s)",
+ MA_LOGD("OCRemoveDeviceWithUuid API error: %d (%s)",
ret, ma_ocf_error_to_string(ret));
goto REMOVE_DEVICE_END;
}
ret = _wait_cb_ret(CALLBACK_TIMEOUT_5S);
if (ret) {
- MA_LOGE( "OCRemoveDeviceWithUuid Faild = %d", errno);
+ MA_LOGE("OCRemoveDeviceWithUuid Faild = %d", errno);
goto REMOVE_DEVICE_END;
}
/* Disaply result result */
ma_check_null_ret_error("g_client", g_client, MA_ERROR_NO_DATA);
con = g_malloc0(sizeof(ma_req_cb_s));
if (NULL == con) {
- MA_LOGE( "g_malloc0() Fail=%d", errno);
+ MA_LOGE("g_malloc0() Fail=%d", errno);
/* Unset d2ds status 'pending' */
g_atomic_int_set(&g_client->pending, 0);
return MA_ERROR_OUT_OF_MEMORY;
g_client->g_doneCB = false;
- if(OIC_PRECONFIG_PIN == src_dev->doxm->oxmSel) {
+ if (OIC_PRECONFIG_PIN == src_dev->doxm->oxmSel) {
/* Pre-Configured PIN initialization */
const char* testPreconfigPin = con->pin;/* Ex) "12341234" */
g_mutex_lock(&g_client->iotivity_mutex);
ret = OCAddPreconfigPin(src_dev, testPreconfigPin, strlen(testPreconfigPin));
g_mutex_unlock(&g_client->iotivity_mutex);
- if(OC_STACK_OK != ret) {
+ if (OC_STACK_OK != ret) {
MA_LOGE("Failed to save the pre-configured PIN");
MA_LOGE("You can't use the pre-configured PIN OxM for MOT");
goto PV_PAIR_END;
g_mutex_lock(&g_client->iotivity_mutex);
ret = OCDoMultipleOwnershipTransfer(g_client, src_dev, _mot_cb);
g_mutex_unlock(&g_client->iotivity_mutex);
- if (OC_STACK_OK != ret ) {
- MA_LOGE( "OCDoMultipleOwnershipTransfer: ret = %d (%s)",
+ if (OC_STACK_OK != ret) {
+ MA_LOGE("OCDoMultipleOwnershipTransfer: ret = %d (%s)",
ret, ma_ocf_error_to_string(ret));
goto PV_PAIR_END;
}
ret = _wait_cb_ret(CALLBACK_TIMEOUT_5S);
- if (OC_STACK_OK != ret ) {
- MA_LOGE( "OCDoMultipleOwnershipTransfer callback error = %d (%s)",
+ if (OC_STACK_OK != ret) {
+ MA_LOGE("OCDoMultipleOwnershipTransfer callback error = %d (%s)",
ret, ma_ocf_error_to_string(ret));
goto PV_PAIR_END;
}
con->rsrc_type_1,
con->rsrc_interface_1, con->permission_1);
if (NULL == acl_1) {
- MA_LOGE( "Failed to create ACL for %s", con->rsrc_uri);
+ MA_LOGE("Failed to create ACL for %s", con->rsrc_uri);
goto PV_PAIR_END;
}
con->rsrc_type_2,
con->rsrc_interface_2, con->permission_2);
if (NULL == acl_2) {
- MA_LOGE( "Failed to create ACL for %s", con->rsrc_uri);
+ MA_LOGE("Failed to create ACL for %s", con->rsrc_uri);
goto PV_PAIR_END;
}
target_dev_2, acl_2, _resources_pairwise_cb);
g_mutex_unlock(&g_client->iotivity_mutex);
if (OC_STACK_OK != ret) {
- MA_LOGD( "OCProvisionPairwiseDevices API error: %d (%s)", ret,
+ MA_LOGD("OCProvisionPairwiseDevices API error: %d (%s)", ret,
ma_ocf_error_to_string(ret));
goto PV_PAIR_END;
}
ret = _wait_cb_ret(CALLBACK_TIMEOUT_5S);
if (ret) {
- MA_LOGE( "OCProvisionPairwise Faild = %d", errno);
+ MA_LOGE("OCProvisionPairwise Faild = %d", errno);
goto PV_PAIR_END;
}
/* display the pairwise-provisioned result */
static int _make_devices_pair(ma_service *service, gchar *pin, gchar *target_1,
gchar *subject_1, gchar *rsrc_uri_1, gchar *rsrc_type_1, gchar *rsrc_interface_1,
- int permission_1, gchar *target_2, gchar *subject_2,gchar *rsrc_uri_2,
+ int permission_1, gchar *target_2, gchar *subject_2, gchar *rsrc_uri_2,
gchar *rsrc_type_2, gchar *rsrc_interface_2, int permission_2)
{
ma_req_cb_s *con = NULL;
ma_check_null_ret_error("g_client", g_client, MA_ERROR_NO_DATA);
con = g_malloc0(sizeof(ma_req_cb_s));
if (NULL == con) {
- MA_LOGE( "g_malloc0() Fail=%d", errno);
+ MA_LOGE("g_malloc0() Fail=%d", errno);
/* Unset d2ds status 'pending' */
g_atomic_int_set(&g_client->pending, 0);
return MA_ERROR_OUT_OF_MEMORY;
goto PV_UNPAIR_END;
}
- if (NULL == con->uuid_dev1 ) {
+ if (NULL == con->uuid_dev1) {
MA_LOGE("dev1 is NULL");
goto PV_UNPAIR_END;
}
MA_LOGI("Unlink Selected Pairwise Devices..");
g_mutex_lock(&g_client->iotivity_mutex);
- ret = OCUnlinkDevices((void*) g_client, owner_dev, owned_dev, _unlink_resources_cb );
+ ret = OCUnlinkDevices((void*) g_client, owner_dev, owned_dev, _unlink_resources_cb);
g_mutex_unlock(&g_client->iotivity_mutex);
if (OC_STACK_OK != ret) {
- MA_LOGD( "OCUnlinkDevices API error = %d (%s)",
+ MA_LOGD("OCUnlinkDevices API error = %d (%s)",
ret, ma_ocf_error_to_string(ret));
} else {
ret = _wait_cb_ret(CALLBACK_TIMEOUT_5S);
if (OC_STACK_OK != ret) {
- MA_LOGD( "OCUnlinkDevices Timeout = %d (%s)",
+ MA_LOGD("OCUnlinkDevices Timeout = %d (%s)",
ret, ma_ocf_error_to_string(ret));
goto PV_UNPAIR_END;
}
g_mutex_lock(&g_client->iotivity_mutex);
ret = OCRemoveSubOwner(g_client, owned_dev, &uuid_mowner, _remove_subowner_cb);
g_mutex_unlock(&g_client->iotivity_mutex);
- if (OC_STACK_OK != ret ) {
- MA_LOGE( "OCRemoveSubOwner: ret = %d (%s)",
+ if (OC_STACK_OK != ret) {
+ MA_LOGE("OCRemoveSubOwner: ret = %d (%s)",
ret, ma_ocf_error_to_string(ret));
goto PV_UNPAIR_END;
}
ret = _wait_cb_ret(CALLBACK_TIMEOUT_5S);
if (OC_STACK_OK != ret) {
- MA_LOGE( "OCRemoveSubOwner Timeout = %d (%s)",
+ MA_LOGE("OCRemoveSubOwner Timeout = %d (%s)",
ret, ma_ocf_error_to_string(ret));
goto PV_UNPAIR_END;
}
g_mutex_lock(&g_client->iotivity_mutex);
ret = OCRemoveDeviceWithUuid((void*) g_client, CALLBACK_TIMEOUT_5S, owned_uuid,
- _remove_remove_device_cb );
+ _remove_remove_device_cb);
g_mutex_unlock(&g_client->iotivity_mutex);
if (OC_STACK_OK != ret) {
- MA_LOGD( "OCRemoveDeviceWithUuid API error = %d (%s)",
+ MA_LOGD("OCRemoveDeviceWithUuid API error = %d (%s)",
ret, ma_ocf_error_to_string(ret));
goto PV_UNPAIR_END;
}
ret = _wait_cb_ret(CALLBACK_TIMEOUT_5S);
if (OC_STACK_OK != ret) {
- MA_LOGD( "OCRemoveDeviceWithUuid Timeout = %d (%s)",
+ MA_LOGD("OCRemoveDeviceWithUuid Timeout = %d (%s)",
ret, ma_ocf_error_to_string(ret));
goto PV_UNPAIR_END;
}
ma_check_null_ret_error("g_client", g_client, MA_ERROR_NO_DATA);
con = g_malloc0(sizeof(ma_req_cb_s));
if (!con) {
- MA_LOGE( "g_malloc0() Fail=%d", errno);
+ MA_LOGE("g_malloc0() Fail=%d", errno);
/* Unset d2ds status 'pending' */
g_atomic_int_set(&g_client->pending, 0);
return MA_ERROR_OUT_OF_MEMORY;
con->userdata = service;
con->cid = MA_MAKE_UNPAIR;
- if (!uuid_dev1 ||!uuid_dev2) {
- MA_LOGE( "Invaild Prameters");
+ if (!uuid_dev1 || !uuid_dev2) {
+ MA_LOGE("Invaild Prameters");
_request_cleanup(con);
return MA_ERROR_INVALID_PARAMETER;
}
ma_check_null_ret_error("g_client", g_client, MA_ERROR_NO_DATA);
con = g_malloc0(sizeof(ma_req_cb_s));
if (!con) {
- MA_LOGE( "g_malloc0() Fail=%d", errno);
+ MA_LOGE("g_malloc0() Fail=%d", errno);
/* Unset d2ds status 'pending' */
g_atomic_int_set(&g_client->pending, 0);
return MA_ERROR_OUT_OF_MEMORY;
if (0 == g_atomic_int_get(&client->pending)) {
con = g_async_queue_pop(client->queue);
if (NULL == con) continue;
- switch(con->cid) {
+ switch (con->cid) {
case MA_FIND_MOT_ENABLED_DEVICES:
_disc_mot_env_devs_func(con);
break;
g_client = g_malloc0(sizeof(ma_subowner_s));
if (!g_client) {
- MA_LOGE( "memory allocation error = %d", errno);
+ MA_LOGE("memory allocation error = %d", errno);
return MA_ERROR_OUT_OF_MEMORY;
}
g_mutex_init(&g_client->iotivity_mutex);
g_mutex_lock(&g_client->iotivity_mutex);
ret = OCRegisterPersistentStorageHandler(&ps);
g_mutex_unlock(&g_client->iotivity_mutex);
- if (OC_STACK_OK != ret ) {
- MA_LOGE( "OCRegisterPersistentStorageHandler error = %d", ret);
+ if (OC_STACK_OK != ret) {
+ MA_LOGE("OCRegisterPersistentStorageHandler error = %d", ret);
return ret;
}
g_mutex_lock(&g_client->iotivity_mutex);
ret = OCInit(NULL, 0, OC_CLIENT_SERVER);
g_mutex_unlock(&g_client->iotivity_mutex);
- if (OC_STACK_OK != ret ) {
- MA_LOGE( "OCInit() error = [%d][%s]", ret, ma_ocf_error_to_string(ret));
+ if (OC_STACK_OK != ret) {
+ MA_LOGE("OCInit() error = [%d][%s]", ret, ma_ocf_error_to_string(ret));
return ret;
}
g_mutex_lock(&g_client->iotivity_mutex);
ret = OCConfigSelfOwnership();
g_mutex_unlock(&g_client->iotivity_mutex);
- if (OC_STACK_OK != ret ) {
- MA_LOGE( "OCConfigSelfOwnership() error = [%d][%s]",
+ if (OC_STACK_OK != ret) {
+ MA_LOGE("OCConfigSelfOwnership() error = [%d][%s]",
ret, ma_ocf_error_to_string(ret));
}
g_mutex_lock(&g_client->iotivity_mutex);
ret = OCInitPM(data_dir);
g_mutex_unlock(&g_client->iotivity_mutex);
- if (OC_STACK_OK != ret ) {
- MA_LOGE( "OCInitPM() error = [%d][%s]", ret, ma_ocf_error_to_string(ret));
+ if (OC_STACK_OK != ret) {
+ MA_LOGE("OCInitPM() error = [%d][%s]", ret, ma_ocf_error_to_string(ret));
return ret;
}
int ma_request_get_ownerid(ma_service *service, gchar **uuid_str)
{
- int ret =MA_ERROR_NONE;
+ int ret = MA_ERROR_NONE;
OicUuid_t uuid;
ma_check_null_ret_error("g_client", g_client, MA_ERROR_NO_DATA);
int ma_request_mot(ma_service *service, gchar* uuid_str, gchar *pin)
{
- int ret =MA_ERROR_NONE;
+ int ret = MA_ERROR_NONE;
ma_check_null_ret_error("g_client", g_client, MA_ERROR_NO_DATA);
ma_check_null_ret_error("service", service, FALSE);
int ma_request_prov_acl(ma_service *service, gchar *target, gchar *subject,
gchar *rsrc_uri, gchar *rsrc_type, gchar *rsrc_interface, int permission)
{
- int ret =MA_ERROR_NONE;
+ int ret = MA_ERROR_NONE;
ma_check_null_ret_error("g_client", g_client, MA_ERROR_NO_DATA);
ma_check_null_ret_error("service", service, FALSE);
int ma_request_prov_cred(ma_service *service, gchar *uuid_dev1, gchar *uuid_dev2)
{
- int ret =MA_ERROR_NONE;
+ int ret = MA_ERROR_NONE;
ma_check_null_ret_error("g_client", g_client, MA_ERROR_NO_DATA);
ma_check_null_ret_error("service", service, FALSE);
int ma_request_rsrc_pairwise(ma_service *service, gchar *target_1,
gchar *subject_1, gchar *rsrc_uri_1, gchar *rsrc_type_1,
gchar *rsrc_interface_1, int permission_1,
- gchar *target_2, gchar *subject_2,gchar *rsrc_uri_2,
+ gchar *target_2, gchar *subject_2, gchar *rsrc_uri_2,
gchar *rsrc_type_2, gchar *rsrc_interface_2,
int permission_2)
{
int ma_request_remove_subowner(ma_service *service, gchar* uuid_str)
{
- int ret =MA_ERROR_NONE;
+ int ret = MA_ERROR_NONE;
ma_check_null_ret_error("g_client", g_client, MA_ERROR_NO_DATA);
ma_check_null_ret_error("service", service, FALSE);
int ma_request_remove_device(ma_service *service, gchar* uuid_str)
{
- int ret =MA_ERROR_NONE;
+ int ret = MA_ERROR_NONE;
ma_check_null_ret_error("g_client", g_client, MA_ERROR_NO_DATA);
ma_check_null_ret_error("service", service, FALSE);
int ma_request_pair(ma_service *service, gchar *pin, gchar *target_1,
gchar *subject_1, gchar *rsrc_uri_1, gchar *rsrc_type_1,
gchar *rsrc_interface_1, int permission_1,
- gchar *target_2, gchar *subject_2,gchar *rsrc_uri_2,
+ gchar *target_2, gchar *subject_2, gchar *rsrc_uri_2,
gchar *rsrc_type_2, gchar *rsrc_interface_2,
int permission_2)
{
g_mutex_lock(&g_client->iotivity_mutex);
ret = OCStop();
g_mutex_unlock(&g_client->iotivity_mutex);
- if (OC_STACK_OK != ret) {
- MA_LOGE( "OCStack stop error");
- }
+ if (OC_STACK_OK != ret)
+ MA_LOGE("OCStack stop error");
/* Stop provisioning */
g_mutex_lock(&g_client->iotivity_mutex);
int ma_request_rsrc_pairwise(ma_service *service, gchar *target_1, gchar *subject_1,
gchar *rsrc_uri_1, gchar *rsrc_type_1,
gchar *rsrc_interface_1, int permission_1,
- gchar *target_2, gchar *subject_2,gchar *rsrc_uri_2,
+ gchar *target_2, gchar *subject_2, gchar *rsrc_uri_2,
gchar *rsrc_type_2, gchar *rsrc_interface_2,
int permission_2);
int ma_request_unlink_rsrc(ma_service *service, gchar *uuid_dev1, gchar *uuid_dev2);
int ma_request_pair(ma_service *service, gchar *pin, gchar *target_1,
gchar *subject_1, gchar *rsrc_uri_1, gchar *rsrc_type_1,
gchar *rsrc_interface_1, int permission_1,
- gchar *target_2, gchar *subject_2,gchar *rsrc_uri_2,
+ gchar *target_2, gchar *subject_2, gchar *rsrc_uri_2,
gchar *rsrc_type_2, gchar *rsrc_interface_2,
int permission_2);
int ma_request_unpair(ma_service *service, gchar *uuid_owner, gchar *uuid_owned);
OCProvisionDev_t* ma_get_dev_by_id(const OCProvisionDev_t* dev_lst,
const int dev_num)
{
- if (!dev_lst || 0>=dev_num) {
+ if (!dev_lst || 0 >= dev_num) {
MA_LOGI("Device List is Empty..\n");
return NULL;
}
OCProvisionDev_t* lst = (OCProvisionDev_t*) dev_lst;
- for (int i=0; lst; ) {
- if (dev_num == ++i) {
+ for (int i = 0; lst; ) {
+ if (dev_num == ++i)
return lst;
- }
lst = lst->next;
}
-
- return NULL;
+ return NULL;
}
#endif
OCProvisionDev_t* ma_get_dev_by_uuid(const OCProvisionDev_t* dev_lst,
const OicUuid_t* uuid)
{
- if (!dev_lst ) {
+ if (!dev_lst) {
MA_LOGI("dev_lst is empty");
return NULL;
}
- if (!uuid ) {
+ if (!uuid) {
MA_LOGI("uuid is NULL");
return NULL;
}
lst = lst->next;
}
- return NULL;
+ return NULL;
}
int ma_print_dev_list(const OCProvisionDev_t* dev_lst)
int ma_print_result_list(const OCProvisionResult_t* rslt_lst, const int rslt_cnt)
{
- if (!rslt_lst || 0>=rslt_cnt) {
+ if (!rslt_lst || 0 >= rslt_cnt) {
MA_LOGI(" Device List is Empty..\n\n");
return 0;
}
int lst_cnt = 0;
- for ( ; rslt_cnt>lst_cnt; ++lst_cnt) {
+ for (; rslt_cnt > lst_cnt; ++lst_cnt) {
MA_LOGD("%s : [%d][%s]",
ma_get_readable_uuid((const OicUuid_t*) &rslt_lst[lst_cnt].deviceId),
rslt_lst[lst_cnt].res, ma_ocf_error_to_string(rslt_lst[lst_cnt].res));
ret = SetDeviceIdSeed((const guchar *)mac_addr, WIFI_MAC_ADDR_LENGTH);
g_free(mac_addr);
}
- if (OC_STACK_OK != ret ) {
- MA_LOGE( "SetDeviceIdSeed() error = [%d][%s]", ret, ma_ocf_error_to_string(ret));
- }
+ if (OC_STACK_OK != ret)
+ MA_LOGE("SetDeviceIdSeed() error = [%d][%s]", ret, ma_ocf_error_to_string(ret));
+
wifi_manager_deinitialize(wifi_handle);
return ret;
}
{
MA_LOGD("");
- if (!src)
- {
+ if (!src) {
MA_LOGD("Invalid parameter");
return NULL;
}
memcpy(&newDev->endpoint, &src->endpoint, sizeof(OCDevAddr));
- if (src->pstat)
- {
- newDev->pstat= g_try_malloc0(sizeof(OicSecPstat_t));
+ if (src->pstat) {
+ newDev->pstat = g_try_malloc0(sizeof(OicSecPstat_t));
memcpy(newDev->pstat, src->pstat, sizeof(OicSecPstat_t));
// We have to assign NULL for not necessary information to prevent memory corruption.
memcpy(newDev->pstat->sm, src->pstat->sm, sizeof(OicSecDpom_t));
}
- if (src->doxm)
- {
+ if (src->doxm) {
newDev->doxm = g_try_malloc0(sizeof(OicSecDoxm_t));
memcpy(newDev->doxm, src->doxm, sizeof(OicSecDoxm_t));
}
if (0 == strlen(src->secVer))
- {
g_strlcpy(newDev->secVer, "0.0.0", OIC_SEC_MAX_VER_LEN);
- }
else
- {
g_strlcpy(newDev->secVer, src->secVer, OIC_SEC_MAX_VER_LEN);
- }
newDev->securePort = src->securePort;
newDev->devStatus = src->devStatus;
return newDev;
}
-#endif
\ No newline at end of file
+#endif
-/*\r
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
*/\r
-\r
#ifndef __MA_AGENT_H__\r
#define __MA_AGENT_H__\r
\r
} ma_service;\r
\r
#endif /* __MA_AGENT_H__ */\r
+\r