+ g_mainloop = g_main_loop_new(NULL, 0);
+ if(!g_mainloop)
+ {
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "g_main_loop_new failed\n");
+ return CA_STATUS_FAILED;
+ }
+
+ if (CA_STATUS_OK != ca_thread_pool_add_task(g_threadPoolHandle, GMainLoopThread, (void *) NULL))
+ {
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to create thread!");
+ return CA_STATUS_FAILED;
+ }
+
+ // Initialize Bluetooth service
+ int err = bt_initialize();
+ if (BT_ERROR_NONE != err)
+ {
+ OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Bluetooth initialization failed!, error num [%x]",
+ err);
+ return CA_STATUS_FAILED;
+ }
+