Add set preconfigured pin 75/187875/1
authorJihoon Jung <jh8801.jung@samsung.com>
Wed, 29 Aug 2018 06:35:28 +0000 (15:35 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Wed, 29 Aug 2018 06:35:46 +0000 (15:35 +0900)
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
Change-Id: I8f82a7844ccbad378cb056fd5d7e82e8401683d9

include/mdg_internal.h
src/mdg.c
src/mdg_gdbus.xml
test/mdg-manager.c

index 9eee306..21a9e8e 100755 (executable)
@@ -37,6 +37,7 @@ typedef void (*mdg_receive_file_cb)(int result, char *device_id,
 
 int mdg_set_receive_file_cb(mdg_h handle, mdg_receive_file_cb receive_cb, void *user_data);
 int mdg_unset_receive_file_cb(mdg_h handle);
+int mdg_set_preconfigured_pin(mdg_h handle, char *password);
 
 
 #ifdef __cplusplus
index a37b824..735f1a0 100755 (executable)
--- a/src/mdg.c
+++ b/src/mdg.c
@@ -452,6 +452,22 @@ EXPORT_API int mdg_unset_receive_file_cb(mdg_h handle)
        return ret;
 }
 
+EXPORT_API int mdg_set_preconfigured_pin(mdg_h handle, char *password)
+{
+       int ret = MDG_ERROR_NONE;
+       GError *error = NULL;
+
+       CHECK_FEATURE_SUPPORTED(MDG_FEATURE);
+
+       mdg_manager_s *_handle = handle;
+       mdg_check_null_ret_error("handle", handle, MDG_ERROR_INVALID_PARAMETER);
+       CHECK_HANDLE_IS_VALID(handle);
+
+       group_call_set_preconfigured_pin_sync(_handle->group_proxy, password, &ret, NULL, &error);
+
+       return ret;
+}
+
 EXPORT_API int mdg_device_get_local_device(mdg_h handle,
        mdg_device_h *device)
 {
index 0f72d56..966828b 100755 (executable)
                        <arg type="s" name="uuid" direction="in" />
                        <arg type="i" name="result" direction="out" />
                </method>
+               <method name="SetPreconfiguredPin">
+                       <arg type="s" name="preconfigured_pin" direction="in" />
+                       <arg type="i" name="result" direction="out" />
+               </method>
                <!-- Signal (D-Bus) definitions -->
                <signal name="Event">
                        <arg type="i" name="type" direction="out" />
index f724307..ae23531 100755 (executable)
@@ -1267,6 +1267,17 @@ static int run_unregist_channel(MManager *mm, struct menu_data *menu)
        return RET_SUCCESS;
 }
 
+static int run_set_preconfigured_pin(MManager *mm, struct menu_data *menu)
+{
+       int ret = 0;
+
+       ret = mdg_set_preconfigured_pin(handle, pin);
+
+       msg(" - mdg_set_preconfigured_pin() ret: [0x%X] [%s]", ret, mdg_error_to_string(ret));
+
+       return RET_SUCCESS;
+}
+
 static struct menu_data menu_group_create[] = {
        { "0", "Group Name", NULL, NULL, groupid },
        { "1", "Run", NULL, run_group_create, NULL },
@@ -1388,6 +1399,12 @@ static struct menu_data menu_unregist_channel[] = {
        { NULL, NULL, },
 };
 
+static struct menu_data menu_set_preconfigured_pin[] = {
+       { "0", "PIN", NULL, NULL, pin },
+       { "1", "Run", NULL, run_set_preconfigured_pin, NULL },
+       { NULL, NULL, },
+};
+
 struct menu_data menu_mdg_manager[] = {
        { "1", "Show Local Device", NULL, run_device_show_local_device, NULL }, // O
        { "2", "Create Group", menu_group_create, NULL, NULL }, // 0
@@ -1409,4 +1426,5 @@ struct menu_data menu_mdg_manager[] = {
        { "18", "Unregist Channel", menu_unregist_channel, NULL, NULL },
        { "19", "Send Message", menu_send_data, NULL, NULL }, // 0
        { "20", "Send File", menu_send_file, NULL, NULL }, // 0
+       { "21", "Set Preconfigured PIN", menu_set_preconfigured_pin, NULL, NULL }, // 0
 };