Tizen Developers

Menu
Sites
Language
Gear 2 BLE connectivity

Hello,

I am planning to develop an application for Gear 2 which will connect to an device over BLE. We already have an android and iPhone application for same. It can control the device over BLE. We want to do same using Gear 2. 

Is it possible to connect to device? If yes which approach should i go with either Native or Web application?

Please help.

Thanks in advance.

Responses

17 Replies
Raquibul Hasan

Dear Shraddha Shravagi,
Thanks for your question.
There is no SDK APIs for BLE function, Tizen 3.0 might have it (please check when it is released).

AFAIK - If someone wants to write a BLE based app for Gear devices they need to implement it as a framework application (needs to be part of binary). They also need to implement the central role on Gear side. iPhone will advertise BLE packets which your app (on GV side) needs to scan for. Once discovery is done, one needs to connect. Again BLE stack is not stable in Gear 2 devices so you might face difficulties.

If you are using Gear S2 (latest Gear device) please stay tunes for updates BLE support might come in future.

Hope this answers your question.

Thanks,
Raquibul

Raquibul Hasan

*If you are using Gear S2 (latest Gear device) please stay tuned for updates; BLE support might come in future.

Shravagi Shraddha

Hi,

Thanks a lot for your response. I have few more questions in same context.

Our current scenario has an device which has Nordic stack and which acts as an GATT server. We normally connect to it via mobile application which acts as an client and requests and gets the information. So will the Gear S2 device be able to run as an Client and connect to the device in future?

We are currently using Tizen 2.3.1 and we can scan and connect to our device using Native application. But we are not able to create a client for same bt_gatt_client_create. 

I also want to clarify regarding the approach for development of application: Should it be web application or native or any other?

I hope it will be possible via Samsung Galaxy S5 since you refered to iPhone. 

Tizen 3.0 mobile sdk has been released but is there any known timeline for Wearable sdk?

It would be great if I could get some timeline or some rough dates so that we can wait upon?

 

Regards,

Shraddha

 

Raquibul Hasan

Hello,

Where is the GATT server running? I thought you want to use BLE because you are using iPhone on the other end. If the other end allows Bluetooth then you should be able to connect using straight Bluetooth.

Re your question on native/web - I advise you to use native application because you can use the APIs directly (web uses Web runtime in the middle) and in that way you should get much more control (for example turning ON bluetooth automatically is possible through native APIs but may be not through web APIs).

We mentioned you are not able to create bt_gatt_client_create. If you provide the code and the error message we can follow up further.

Regarding timeline - I am not sure. We still need to wait for announcements.

Regards,

Raquibul

 

 

Shravagi Shraddha

Thanks for immediate reply and for spending time over it.

The GATT server is running on our custom Hardware manufactured by our company.

Let me explain you my current scenario.

We have an mobile application (Android 4.0+ BLE) which act as a GATT client establishes connection with an custom hardware via BLE. This hardware uses Nordic BLE stack which acts as a GATT server; It has few custom profiles with characteristics exposed for read write. Now the application connects with this device and reads the current characteristics and allows the user to modify their values.

Now we want to replace the mobile application with Gear app. The requirement states that the Gear will have an application running which will connect to our device and read characteristics and enable user to change them and write to device over BLE.

 

Following is my native code.:

//Initialize BT

ret = bt_initialize();
if(ret!= BT_ERROR_NONE){
     dlog_print(DLOG_ERROR, LOG_TAG, "BT init succss.");
}

//Register callbacks   

 ret = bt_gatt_set_connection_state_changed_cb(
                __bt_gatt_connection_state_changed_cb, NULL);
        ret = bt_socket_set_connection_state_changed_cb(
                socket_connection_state_changed, NULL);

//Scan for bt devices

        ret = bt_adapter_le_start_scan(__bt_adapter_le_scan_result_cb, NULL);
        if (ret != BT_ERROR_NONE)
        {
           dlog_print(DLOG_ERROR, LOG_TAG, "[bt_adapter_le_start_scan] Failed.");
        }    

//code for callback for le scan result

void __bt_adapter_le_scan_result_cb(int result,
        bt_adapter_le_device_scan_result_info_s *info, void *user_data) {
     if (info == NULL) {
        dlog_print(DLOG_INFO, LOG_TAG, "No discovery_info!");
        return;
    } else {
        dlog_print(DLOG_ERROR, LOG_TAG, "some info found");
    }

    ret = bt_gatt_connect("xx:xx:xx:xx:xx:xx", false);
    if (ret != BT_ERROR_NONE)
    {
       dlog_print(DLOG_ERROR, LOG_TAG, "Failed to connect LE device.");
    }else{
        dlog_print(DLOG_ERROR, LOG_TAG, "Connected to device successfully."); //================================== this is seen in logs
         ret = bt_gatt_client_create("xx:xx:xx:xx:xx:xx", &client);
         if (ret == BT_ERROR_NONE)
            dlog_print(DLOG_INFO, LOG_TAG, "Success in creating client");    //NEVER REACH HERE
            else{
                dlog_print(DLOG_INFO, LOG_TAG, "failure %d"+BT_ERROR_NONE);  //NEVER REACH HERE
                }
    }
}

 

RESPONSE :

LOGCAT

"BT init succss.

some info found

Connected to device successfully.

 Interpretation: I dont get any error neither it goes to gatt connection state changed listener:

Please help me if I am going wrong anywhere. 

 

 

Thanks & Regards,

Shraddha

Raquibul Hasan

Ok. Since BT scan finds some result I am assuming BT is turned ON before you try to connect. (It is a good practice to check if BT is ON, if not enable it using the APIs). A tutorial to managing BT connection can be found here: https://developer.tizen.org/development/tutorials/native-application/network/bluetooth#gatt

Please go through the tutorial and see if you are missing anything.

You can also send us system log using the following command: sdb dlog

(Pipe the output to a file and send us the output).

 

Sazzad Hissain Khan

Dear Shraddha,

Fist of all your LOG labels in both logs are different. One is for ERROR another is for INFO.

 dlog_print(DLOG_ERROR, LOG_TAG, "Connected to device successfully."); // this is seen in log
 if (ret == BT_ERROR_NONE)
      dlog_print(DLOG_INFO, LOG_TAG, "Success in creating client");    //NEVER REACH HERE

It seems you log filter is filtering only ERRORs hence you are not able to see the other info logs in logcat. Please check and confirm that your log filter is set to output all logs.

 

If you still get the same problem please follow the instructions below.

If you read the documentation for prerequisite for gatt connect (https://developer.tizen.org/development/tutorials/native-application/network/bluetooth#pre_gatt) you will see that they also have asked to register callbacks.

Register a callback for connection state changes:

 int ret = 0;
// Register for GATT connection callback
void
__bt_gatt_connection_state_changed_cb(int result, bool connected,
                                      const char *remote_address, void *user_data)
{
   if (connected)
      dlog_print(DLOG_INFO, LOG_TAG, "LE connected");
   else
      dlog_print(DLOG_INFO, LOG_TAG, "LE disconnected");
}


ret = bt_gatt_set_connection_state_changed_cb(__bt_gatt_connection_state_changed_cb, NULL);

I wonder if not registering state changed callback is the cause of such unexpected flow. Please register it and then try again.

 

I also suggest you for logging just after bt_gatt_client_create requst before IF and confirm that it reaches that point or not. like,

ret = bt_gatt_client_create("xx:xx:xx:xx:xx:xx", &client);
dlog_print(DLOG_ERROR, LOG_TAG, "Create operation requested");

And take a log. Please post your full log so that we can find where is the problem.

 

Thanks,

Hissain

 

Shravagi Shraddha

Hello, Thanks for your responses. As per your directions I have edited my code.

So the observations are:

1. I am getting Failure for registering gatt call back

2. Failure in reading characteristic

Questions:

1. Where do I register for the callback? As of now I have done in "main()". Previously I had done it in app_create() but the call back didnt get register.

2. What are the privilages required? For Tizen 2.3.1 app. As of now I have included bluetooth

 

Following is the source code:

#include "basicnativeapplication.h"
#include "bluetooth.h"
typedef struct appdata {
    Evas_Object *win;
	Evas_Object *conform;
	Evas_Object *label;
} appdata_s;

static void win_delete_request_cb(void *data, Evas_Object *obj,
		void *event_info) {
	ui_app_exit();
}

static void win_back_cb(void *data, Evas_Object *obj, void *event_info) {
	appdata_s *ad = data;
	/* Let window go to hide state. */
	elm_win_lower(ad->win);
}
bt_gatt_client_h client = NULL;
static void create_base_gui(appdata_s *ad) {
	/* Window */
	ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
	elm_win_autodel_set(ad->win, EINA_TRUE);

	if (elm_win_wm_rotation_supported_get(ad->win)) {
		int rots[4] = { 0, 90, 180, 270 };
		elm_win_wm_rotation_available_rotations_set(ad->win,
				(const int *) (&rots), 4);
	}

	evas_object_smart_callback_add(ad->win, "delete,request",
			win_delete_request_cb, NULL);
	eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, win_back_cb,
			ad);

	/* Conformant */
	ad->conform = elm_conformant_add(ad->win);
	elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
	elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE);
	evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND,
	EVAS_HINT_EXPAND);
	elm_win_resize_object_add(ad->win, ad->conform);
	evas_object_show(ad->conform);

	/* Label */
	ad->label = elm_label_add(ad->conform);
	elm_object_text_set(ad->label, "<align=center>Hello EFLf</align>");
	evas_object_size_hint_weight_set(ad->label, EVAS_HINT_EXPAND,
	EVAS_HINT_EXPAND);
	elm_object_content_set(ad->conform, ad->label);

	/* Show window after base gui is set up */
	evas_object_show(ad->win);
}
int ret, i;
int ret = 0;
bool __bt_gatt_client_foreach_desc_cb(int total, int index,
		bt_gatt_h desc_handle, void *data) {
	char *uuid = NULL;

	bt_gatt_get_uuid(desc_handle, &uuid);

	dlog_print(DLOG_INFO, LOG_TAG, "\t\t[%d / %d] uuid : (%s)", index, total,
			uuid);

	//  g_free(uuid);

	return true;
}
bool __bt_gatt_client_foreach_chr_cb(int total, int index, bt_gatt_h chr_handle,
		void *data) {
	int ret;
	char *uuid = NULL;

	bt_gatt_get_uuid(chr_handle, &uuid);

	dlog_print(DLOG_INFO, LOG_TAG, "\t[%d / %d] uuid : (%s)", index, total,
			uuid);

	//g_free(uuid);

	ret = bt_gatt_characteristic_foreach_descriptors(chr_handle,
			__bt_gatt_client_foreach_desc_cb, NULL);
	if (ret != BT_ERROR_NONE)
		dlog_print(DLOG_INFO, LOG_TAG,
				"bt_gatt_characteristic_foreach_descriptors is failed : %d",
				ret);

	return true;
}
bool __bt_gatt_client_foreach_svc_cb(int total, int index, bt_gatt_h svc_handle,
		void *data) {
	int ret;
	char *uuid = NULL;

	bt_gatt_get_uuid(svc_handle, &uuid);
	dlog_print(DLOG_INFO, LOG_TAG, "[%d / %d] uuid : (%s)", index, total, uuid);

	// g_free(uuid);

	ret = bt_gatt_service_foreach_characteristics(svc_handle,
			__bt_gatt_client_foreach_chr_cb, NULL);
	if (ret != BT_ERROR_NONE) {
		dlog_print(DLOG_INFO, LOG_TAG,
				"bt_gatt_service_foreach_characteristics is failed : %d", ret);
	}

	return true;
}
void __bt_adapter_le_scan_result_cb(int result,
		bt_adapter_le_device_scan_result_info_s *info, void *user_data) {
	bt_adapter_le_packet_type_e pkt_type = BT_ADAPTER_LE_PACKET_ADVERTISING;

	if (info == NULL) {
		dlog_print(DLOG_INFO, LOG_TAG, "No discovery_info!");

		return;
	} else {
		dlog_print(DLOG_INFO, LOG_TAG, "some info found");

	}

	if (info->adv_data_len > 31 || info->scan_data_len > 31) {
		dlog_print(DLOG_INFO, LOG_TAG, "###################");
		//bt_adapter_le_stop_scan();
		dlog_print(DLOG_INFO, LOG_TAG, "###################");

		return;
	}

	for (i = 0; i < 2; i++) {
		char **uuids;
		char *device_name;
		int tx_power_level;
		bt_adapter_le_service_data_s *data_list;
		int appearance;
		int manufacturer_id;
		char *manufacturer_data;
		int manufacturer_data_len;
		int count;

		pkt_type += i;
		if (pkt_type
				== BT_ADAPTER_LE_PACKET_ADVERTISING&& info->adv_data == NULL)
			continue;
		if (pkt_type
				== BT_ADAPTER_LE_PACKET_SCAN_RESPONSE&& info->scan_data == NULL)
			break;

		if (bt_adapter_le_get_scan_result_service_uuids(info, pkt_type, &uuids,
				&count) == BT_ERROR_NONE) {
			int i;
			for (i = 0; i < count; i++) {
				dlog_print(DLOG_INFO, LOG_TAG, "UUID[%d] = %s", i + 1,
						uuids[i]);
				// g_free(uuids[i]);
			}
			//    g_free(uuids);
		}
		if (bt_adapter_le_get_scan_result_device_name(info, pkt_type,
				&device_name) == BT_ERROR_NONE) {
			dlog_print(DLOG_INFO, LOG_TAG, "Device name = %s", device_name);
			dlog_print(DLOG_INFO, LOG_TAG, "Addresse = %s",
					info->remote_address);
			char *addr = NULL;
			dlog_print(DLOG_INFO, LOG_TAG, "Comparing");
			if (strcmp(info->remote_address, "C9:D4:67:84:5C:E7") == 0) {
				dlog_print(DLOG_INFO, LOG_TAG, "Got our device");
				bt_adapter_le_stop_scan();
				ret = bt_gatt_connect("xx:xx:xx:xx:xx:xx", false);
				if (ret != BT_ERROR_NONE) {
					dlog_print(DLOG_INFO, LOG_TAG,
							"Failed to connect LE device.");
				} else {
					dlog_print(DLOG_INFO, LOG_TAG,
							"Connected to our LE device.");
					ret = bt_gatt_client_create("xx:xx:xx:xx:xx:xx", &client);
					if (ret == BT_ERROR_NONE) {
						dlog_print(DLOG_INFO, LOG_TAG, "Client created");
						ret = bt_gatt_client_get_remote_address(client, &addr);
						if (ret == BT_ERROR_NONE)
							dlog_print(DLOG_INFO, LOG_TAG, "Success");

						ret = bt_gatt_client_foreach_services(client,
								__bt_gatt_client_foreach_svc_cb, NULL);
						if (ret != BT_ERROR_NONE) {
							dlog_print(DLOG_INFO, LOG_TAG,
									"fail to read services");
						}
						char *svc_uuid = "0000180f-0000-1000-8000-00805f9b34fb"; // Battery service
						char *chr_uuid = "00002a19-0000-1000-8000-00805f9b34fb"; // Battery level
						char *desc_uuid = "058e3555-f52f-8f88-870d-67ce119e315c"; // Client characteristic configuration
						bt_gatt_h svc = NULL;
						bt_gatt_h chr = NULL;
						bt_gatt_h desc = NULL;

						ret = bt_gatt_client_get_service(client, svc_uuid,
								&svc);
						if (ret != BT_ERROR_NONE) {
							dlog_print(DLOG_INFO, LOG_TAG,
									"bt_gatt_client_get_service is failed : %d",
									ret);

						} else {
							dlog_print(DLOG_INFO, LOG_TAG,
									"bt_gatt_client_get_service is success ");
						}

						ret = bt_gatt_service_get_characteristic(svc, chr_uuid,
								&chr);
						if (ret != BT_ERROR_NONE) {
							dlog_print(DLOG_INFO, LOG_TAG,
									"bt_gatt_service_get_characteristic is failed : %d",
									ret);
						} else {
							dlog_print(DLOG_INFO, LOG_TAG,
									"bt_gatt_client_get_char is success :");
						}
						*svc_uuid = "058e0555-f52f-8f88-870d-67ce119e315c";
						ret = bt_gatt_service_get_characteristic(svc, chr_uuid,
								&chr);
						if (ret != BT_ERROR_NONE) {
							dlog_print(DLOG_INFO, LOG_TAG,
									"bt_gatt_service_get_characteristic is failed : %d",
									ret);

						} else {
							dlog_print(DLOG_INFO, LOG_TAG,
									"bt_gatt_client_getc is success");
						}
						ret = bt_gatt_characteristic_get_descriptor(chr,
								desc_uuid, &desc);
						if (ret != BT_ERROR_NONE) {
							dlog_print(DLOG_INFO, LOG_TAG,
									"bt_gatt_characteristic_get_descriptor is failed : %d",
									ret);

						} else {
							dlog_print(DLOG_INFO, LOG_TAG,
									"bt_gatt_characteristic_get_descriptor success");
						}

					}
				}
			}
			//  g_free(device_name);
		}
		if (bt_adapter_le_get_scan_result_tx_power_level(info, pkt_type,
				&tx_power_level) == BT_ERROR_NONE) {
			dlog_print(DLOG_INFO, LOG_TAG, "TX Power level = %d",
					tx_power_level);
		}
		if (bt_adapter_le_get_scan_result_service_solicitation_uuids(info,
				pkt_type, &uuids, &count) == BT_ERROR_NONE) {
			int i;
			for (i = 0; i < count; i++) {
				dlog_print(DLOG_INFO, LOG_TAG, "Solicitation UUID[%d] = %s",
						i + 1, uuids[i]);
				//   g_free(uuids[i]);
			}
			//   g_free(uuids);
		}
		if (bt_adapter_le_get_scan_result_service_data_list(info, pkt_type,
				&data_list, &count) == BT_ERROR_NONE) {
			int i;
			for (i = 0; i < count; i++)
				dlog_print(DLOG_INFO, LOG_TAG,
						"Service Data[%d] = [0x%2.2X%2.2X:0x%.2X...]", i + 1,
						data_list[i].service_uuid[0],
						data_list[i].service_uuid[1],
						data_list[i].service_data[0]);
			bt_adapter_le_free_service_data_list(data_list, count);
		}
		if (bt_adapter_le_get_scan_result_appearance(info, pkt_type,
				&appearance) == BT_ERROR_NONE) {
			dlog_print(DLOG_INFO, LOG_TAG, "Appearance = %d", appearance);
		}
		if (bt_adapter_le_get_scan_result_manufacturer_data(info, pkt_type,
				&manufacturer_id, &manufacturer_data, &manufacturer_data_len)
				== BT_ERROR_NONE) {
			dlog_print(DLOG_INFO, LOG_TAG,
					"Manufacturer data[ID:%.4X, 0x%.2X%.2X...(len:%d)]",
					manufacturer_id, manufacturer_data[0], manufacturer_data[1],
					manufacturer_data_len);
			//   g_free(manufacturer_data);
		}

	}
}

// Register for GATT connection callback
void __bt_gatt_connection_state_changed_cb(int result, bool connected,
		const char *remote_address, void *user_data) {
	dlog_print(DLOG_INFO, LOG_TAG, "LE state changed.....................");
	if (connected) {
		dlog_print(DLOG_INFO, LOG_TAG, "LE connected");
		ret = bt_gatt_client_foreach_services(client,
				__bt_gatt_client_foreach_svc_cb, NULL);
		if (ret != BT_ERROR_NONE) {
			dlog_print(DLOG_INFO, LOG_TAG, "fail");
		}

	} else
		dlog_print(DLOG_INFO, LOG_TAG, "LE disconnected");
}
int server_socket_fd = -1;
void socket_connection_state_changed(int result,
		bt_socket_connection_state_e connection_state,
		bt_socket_connection_s *connection, void *user_data) {
	dlog_print(DLOG_INFO, LOG_TAG, "LE connected socket");
	if (result != BT_ERROR_NONE) {
		dlog_print(DLOG_INFO, LOG_TAG,
				"[socket_connection_state_changed_cb] Failed. result =%d.",
				result);

		return;
	}

	if (connection_state == BT_SOCKET_CONNECTED) {
		dlog_print(DLOG_INFO, LOG_TAG, "Callback: Connected.");
		if (connection != NULL) {
			dlog_print(DLOG_INFO, LOG_TAG,
					"Callback: Socket of connection - %d.",
					connection->socket_fd);
			dlog_print(DLOG_INFO, LOG_TAG, "Callback: Role of connection - %d.",
					connection->local_role);
			dlog_print(DLOG_INFO, LOG_TAG,
					"Callback: Address of connection - %s.",
					connection->remote_address);
			// socket_fd is used for sending data and disconnecting a device
			server_socket_fd = connection->socket_fd;
		} else {
			dlog_print(DLOG_INFO, LOG_TAG, "Callback: No connection data");
		}
	} else {
		dlog_print(DLOG_INFO, LOG_TAG, "Callback: Disconnected.");
		if (connection != NULL) {
			dlog_print(DLOG_INFO, LOG_TAG,
					"Callback: Socket of disconnection - %d.",
					connection->socket_fd);
			dlog_print(DLOG_INFO, LOG_TAG,
					"Callback: Address of connection - %s.",
					connection->remote_address);
		} else {
			dlog_print(DLOG_INFO, LOG_TAG, "Callback: No connection data");
		}
	}
}
void __bt_gatt_client_read_complete_cb(int result, bt_gatt_h gatt_handle,
		void *data) {
	char *uuid = NULL;

	bt_gatt_get_uuid(gatt_handle, &uuid);

	dlog_print(DLOG_INFO, LOG_TAG, "Read %s for uuid : (%s)",
			result == BT_ERROR_NONE ? "Success" : "Fail", uuid);

	if (result != BT_ERROR_NONE)
		return;

	return;
}
/*Working 	ret = bt_socket_create_rfcomm(my_uuid, &server_socket_fd);*/

static bool app_create(void *data) {

	/* Hook to take necessary actions before main event loop starts
	 Initialize UI resources and application's data
	 If this function returns true, the main loop of application starts
	 If this function returns false, the application is terminated */
	appdata_s *ad = data;

	create_base_gui(ad);
	dlog_print(DLOG_INFO, LOG_TAG, "init bt");
	ret = bt_initialize();
	if (ret != BT_ERROR_NONE) {
		dlog_print(DLOG_INFO, LOG_TAG, "BT init succss.");
	}

	dlog_print(DLOG_INFO, LOG_TAG, "[bt_initialize]starting.");
	ret = bt_adapter_le_start_scan(__bt_adapter_le_scan_result_cb, NULL);
	if (ret != BT_ERROR_NONE) {
		dlog_print(DLOG_INFO, LOG_TAG, "[bt_adapter_le_start_scan] Failed.");
	}

	return true;
}

static void app_control(app_control_h app_control, void *data) {
	/* Handle the launch request. */
}

static void app_pause(void *data) {
	/* Take necessary actions when application becomes invisible. */
}

static void app_resume(void *data) {
	/* Take necessary actions when application becomes visible. */

}

static void app_terminate(void *data) {
	/* Release all resources. */
}

static void ui_app_lang_changed(app_event_info_h event_info, void *user_data) {
	/*APP_EVENT_LANGUAGE_CHANGED*/
	char *locale = NULL;
	system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE,
			&locale);
	elm_language_set(locale);
	free(locale);
	return;
}

static void ui_app_orient_changed(app_event_info_h event_info, void *user_data) {
	/*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
	return;
}

static void ui_app_region_changed(app_event_info_h event_info, void *user_data) {
	/*APP_EVENT_REGION_FORMAT_CHANGED*/
}

static void ui_app_low_battery(app_event_info_h event_info, void *user_data) {
	/*APP_EVENT_LOW_BATTERY*/
}

static void ui_app_low_memory(app_event_info_h event_info, void *user_data) {
	/*APP_EVENT_LOW_MEMORY*/
}

int main(int argc, char *argv[]) {
	appdata_s ad = { 0, };
	int ret = 0;

	ui_app_lifecycle_callback_s event_callback = { 0, };
	app_event_handler_h handlers[5] = { NULL, };

	event_callback.create = app_create;
	event_callback.terminate = app_terminate;
	event_callback.pause = app_pause;
	event_callback.resume = app_resume;
	event_callback.app_control = app_control;
	dlog_print(DLOG_INFO, LOG_TAG,
			"ggggggggggggggggggggggggggggggggggggggggggg");
	ret = bt_gatt_set_connection_state_changed_cb(
			__bt_gatt_connection_state_changed_cb, NULL);
	if (ret != BT_ERROR_NONE) {
		dlog_print(DLOG_INFO, LOG_TAG,
				"[bt_socket_set_connection_state_changed_cb] failed.");

	}
	ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY],
			APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
	ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY],
			APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
	ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED],
			APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad);
	ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED],
			APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
	ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED],
			APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad);
	ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]);

	ret = ui_app_main(argc, argv, &event_callback, &ad);
	if (ret != APP_ERROR_NONE) {
		dlog_print(DLOG_INFO, LOG_TAG, "app_main() is failed. err = %d", ret);
	}

	return ret;
}

 

Shravagi Shraddha

Sorry for that unformatted log cat.

Search "basicnativeapplication" (100 hits in 1 file)
  D:\Projects\Aplheon\Alphaeon\Trunk\Mobile Application\Phase 2\Source Code\logsforgood code.txt (100 hits)
    Line 3: 01-05 10:43:10.560 : ERROR / PKGMGR_SERVER ( 5868 : 5868 ) : pkgmgr-server.c: req_cb(686) > req_id=[org.example.basicnativeapplication_1261304550], req_type=[12], pkg_type=[rpm], pkgid=[org.example.basicnativeapplication], args=[], cookie=[], backend_flag=[0]
    Line 3: 01-05 10:43:10.560 : ERROR / PKGMGR_SERVER ( 5868 : 5868 ) : pkgmgr-server.c: req_cb(686) > req_id=[org.example.basicnativeapplication_1261304550], req_type=[12], pkg_type=[rpm], pkgid=[org.example.basicnativeapplication], args=[], cookie=[], backend_flag=[0]
    Line 4: 01-05 10:43:10.575 : ERROR / PKGMGR ( 5866 : 5866 ) : pkgmgr.c: __check_sync_process(842) > file is can not remove[/tmp/org.example.basicnativeapplication, -1]
    Line 5: 01-05 10:43:10.585 : ERROR / PKGMGR_SERVER ( 5869 : 5869 ) : pkgmgr-server.c: queue_job(1954) > KILL/CHECK APP, pkgid=[org.example.basicnativeapplication]
    Line 281: 01-05 10:43:28.329 : ERROR / PKGMGR_SERVER ( 6024 : 6024 ) : pkgmgr-server.c: req_cb(686) > req_id=[org.example.basicnativeapplication_1279132066], req_type=[1], pkg_type=[rpm], pkgid=[org.example.basicnativeapplication], args=[/usr/etc/package-manager/backend/rpm '-k' 'org.example.basicnativeapplication_1279132066' '-r' 'org.example.basicnativeapplication'], cookie=[p/qDVwwX5JzZKrPzfRI+DORjXR8=], backend_flag=[0]
    Line 281: 01-05 10:43:28.329 : ERROR / PKGMGR_SERVER ( 6024 : 6024 ) : pkgmgr-server.c: req_cb(686) > req_id=[org.example.basicnativeapplication_1279132066], req_type=[1], pkg_type=[rpm], pkgid=[org.example.basicnativeapplication], args=[/usr/etc/package-manager/backend/rpm '-k' 'org.example.basicnativeapplication_1279132066' '-r' 'org.example.basicnativeapplication'], cookie=[p/qDVwwX5JzZKrPzfRI+DORjXR8=], backend_flag=[0]
    Line 281: 01-05 10:43:28.329 : ERROR / PKGMGR_SERVER ( 6024 : 6024 ) : pkgmgr-server.c: req_cb(686) > req_id=[org.example.basicnativeapplication_1279132066], req_type=[1], pkg_type=[rpm], pkgid=[org.example.basicnativeapplication], args=[/usr/etc/package-manager/backend/rpm '-k' 'org.example.basicnativeapplication_1279132066' '-r' 'org.example.basicnativeapplication'], cookie=[p/qDVwwX5JzZKrPzfRI+DORjXR8=], backend_flag=[0]
    Line 281: 01-05 10:43:28.329 : ERROR / PKGMGR_SERVER ( 6024 : 6024 ) : pkgmgr-server.c: req_cb(686) > req_id=[org.example.basicnativeapplication_1279132066], req_type=[1], pkg_type=[rpm], pkgid=[org.example.basicnativeapplication], args=[/usr/etc/package-manager/backend/rpm '-k' 'org.example.basicnativeapplication_1279132066' '-r' 'org.example.basicnativeapplication'], cookie=[p/qDVwwX5JzZKrPzfRI+DORjXR8=], backend_flag=[0]
    Line 282: 01-05 10:43:28.329 : ERROR / PKGMGR ( 6024 : 6024 ) : pkgmgr-internal.c: _get_type_from_zip(733) > can not access to [org.example.basicnativeapplication]
    Line 283: 01-05 10:43:28.329 : ERROR / PKGMGR_SERVER ( 6024 : 6024 ) : pkgmgr-server.c: __get_type_from_msg(364) > pkgtype is null for org.example.basicnativeapplication 
    Line 285: 01-05 10:43:28.339 : ERROR / PKGMGR_SERVER ( 6025 : 6025 ) : pkgmgr-server.c: queue_job(1820) > INSTALL start, pkg path=[org.example.basicnativeapplication]
    Line 289: 01-05 10:43:28.534 : WARN / W_HOME ( 712 : 712 ) : clock_event.c: _pkgmgr_event_cb(209) > Pkg:org.example.basicnativeapplication is being updateded:0
    Line 544: 01-05 10:43:37.841 : WARN / W_HOME ( 712 : 712 ) : clock_event.c: _pkgmgr_event_cb(238) > Pkg:org.example.basicnativeapplication is updated, need to check validation
    Line 632: 01-05 10:43:48.331 : ERROR / RESOURCED ( 644 : 644 ) : block.c: block_prelaunch_state(134) > [block_prelaunch_state,134] insert data org.example.basicnativeapplication, table num : 1
    Line 639: 01-05 10:43:48.466 : INFO / basicnativeapplication ( 5660 : 5660 ) : ggggggggggggggggggggggggggggggggggggggggggg
    Line 641: 01-05 10:43:48.471 : INFO / basicnativeapplication ( 5660 : 5660 ) : [bt_socket_set_connection_state_changed_cb] failed.

01-05 10:43:48.466 : ERROR / CAPI_NETWORK_BLUETOOTH ( 5660 : 5660 ) : bluetooth-gatt.c: bt_gatt_set_connection_state_changed_cb(542) > [bt_gatt_set_connection_state_changed_cb] NOT_INITIALIZED(0xfe400101)


    Line 644: 01-05 10:43:48.546 : ERROR / RESOURCED ( 644 : 644 ) : proc-main.c: proc_add_program_list(232) > [proc_add_program_list,232] not found ppi : org.example.basicnativeapplication
    Line 646: 01-05 10:43:48.666 : INFO / basicnativeapplication ( 5660 : 5660 ) : init bt
    Line 647: 01-05 10:43:48.756 : INFO / basicnativeapplication ( 5660 : 5660 ) : [bt_initialize]starting.
    Line 671: 01-05 10:43:49.391 : INFO / basicnativeapplication ( 5660 : 5660 ) : some info found
    Line 672: 01-05 10:43:49.391 : INFO / basicnativeapplication ( 5660 : 5660 ) : Device name = #IE065854      
    Line 673: 01-05 10:43:49.391 : INFO / basicnativeapplication ( 5660 : 5660 ) : Addresse = 00:00:00:01:01:3E
    Line 674: 01-05 10:43:49.391 : INFO / basicnativeapplication ( 5660 : 5660 ) : Comparing
    Line 706: 01-05 10:43:51.056 : INFO / basicnativeapplication ( 5660 : 5660 ) : some info found
    Line 707: 01-05 10:43:51.056 : INFO / basicnativeapplication ( 5660 : 5660 ) : Device name = #IE08794
    Line 708: 01-05 10:43:51.056 : INFO / basicnativeapplication ( 5660 : 5660 ) : Addresse = 00:00:00:01:57:87
    Line 709: 01-05 10:43:51.056 : INFO / basicnativeapplication ( 5660 : 5660 ) : Comparing
    Line 712: 01-05 10:43:51.176 : INFO / basicnativeapplication ( 5660 : 5660 ) : some info found
    Line 713: 01-05 10:43:51.176 : INFO / basicnativeapplication ( 5660 : 5660 ) : Device name = #IE08794
    Line 714: 01-05 10:43:51.176 : INFO / basicnativeapplication ( 5660 : 5660 ) : Addresse = 00:00:00:01:57:87
    Line 715: 01-05 10:43:51.176 : INFO / basicnativeapplication ( 5660 : 5660 ) : Comparing
    Line 732: 01-05 10:43:51.291 : INFO / basicnativeapplication ( 5660 : 5660 ) : some info found
    Line 733: 01-05 10:43:51.291 : INFO / basicnativeapplication ( 5660 : 5660 ) : Device name = #IE065854      
    Line 734: 01-05 10:43:51.291 : INFO / basicnativeapplication ( 5660 : 5660 ) : Addresse = 00:00:00:01:01:3E
    Line 735: 01-05 10:43:51.291 : INFO / basicnativeapplication ( 5660 : 5660 ) : Comparing
    Line 736: 01-05 10:43:51.381 : INFO / basicnativeapplication ( 5660 : 5660 ) : some info found
    Line 737: 01-05 10:43:51.381 : INFO / basicnativeapplication ( 5660 : 5660 ) : Device name = #IE08794
    Line 738: 01-05 10:43:51.381 : INFO / basicnativeapplication ( 5660 : 5660 ) : Addresse = 00:00:00:01:57:87
    Line 739: 01-05 10:43:51.381 : INFO / basicnativeapplication ( 5660 : 5660 ) : Comparing
    Line 741: 01-05 10:43:56.001 : INFO / basicnativeapplication ( 5660 : 5660 ) : some info found
    Line 742: 01-05 10:43:56.001 : INFO / basicnativeapplication ( 5660 : 5660 ) : Device name = #IE065854      
    Line 743: 01-05 10:43:56.001 : INFO / basicnativeapplication ( 5660 : 5660 ) : Addresse = 00:00:00:01:01:3E
    Line 744: 01-05 10:43:56.001 : INFO / basicnativeapplication ( 5660 : 5660 ) : Comparing
    Line 755: 01-05 10:44:01.096 : INFO / basicnativeapplication ( 5660 : 5660 ) : some info found
    Line 756: 01-05 10:44:01.096 : INFO / basicnativeapplication ( 5660 : 5660 ) : Device name = #IE065854      
    Line 757: 01-05 10:44:01.096 : INFO / basicnativeapplication ( 5660 : 5660 ) : Addresse = 00:00:00:01:01:3E
    Line 758: 01-05 10:44:01.096 : INFO / basicnativeapplication ( 5660 : 5660 ) : Comparing
    Line 759: 01-05 10:44:01.231 : INFO / basicnativeapplication ( 5660 : 5660 ) : some info found
    Line 760: 01-05 10:44:01.231 : INFO / basicnativeapplication ( 5660 : 5660 ) : Device name = #IE08794
    Line 761: 01-05 10:44:01.231 : INFO / basicnativeapplication ( 5660 : 5660 ) : Addresse = 00:00:00:01:57:87
    Line 762: 01-05 10:44:01.231 : INFO / basicnativeapplication ( 5660 : 5660 ) : Comparing
    Line 803: 01-05 10:44:06.041 : INFO / basicnativeapplication ( 5660 : 5660 ) : some info found
    Line 804: 01-05 10:44:06.041 : INFO / basicnativeapplication ( 5660 : 5660 ) : Device name = #IE065854      
    Line 805: 01-05 10:44:06.041 : INFO / basicnativeapplication ( 5660 : 5660 ) : Addresse = 00:00:00:01:01:3E
    Line 806: 01-05 10:44:06.041 : INFO / basicnativeapplication ( 5660 : 5660 ) : Comparing
    Line 807: 01-05 10:44:10.743 : INFO / basicnativeapplication ( 5660 : 5660 ) : some info found
    Line 808: 01-05 10:44:10.743 : INFO / basicnativeapplication ( 5660 : 5660 ) : Device name = #IE065854      
    Line 809: 01-05 10:44:10.743 : INFO / basicnativeapplication ( 5660 : 5660 ) : Addresse = 00:00:00:01:01:3E
    Line 810: 01-05 10:44:10.743 : INFO / basicnativeapplication ( 5660 : 5660 ) : Comparing
    Line 811: 01-05 10:44:15.789 : INFO / basicnativeapplication ( 5660 : 5660 ) : some info found
    Line 812: 01-05 10:44:15.789 : INFO / basicnativeapplication ( 5660 : 5660 ) : Device name = #IE065854      
    Line 813: 01-05 10:44:15.789 : INFO / basicnativeapplication ( 5660 : 5660 ) : Addresse = 00:00:00:01:01:3E
    Line 814: 01-05 10:44:15.789 : INFO / basicnativeapplication ( 5660 : 5660 ) : Comparing
    Line 1146: 01-05 10:44:20.643 : INFO / basicnativeapplication ( 5660 : 5660 ) : some info found
    Line 1147: 01-05 10:44:20.643 : INFO / basicnativeapplication ( 5660 : 5660 ) : Device name = #IE065854      
    Line 1148: 01-05 10:44:20.643 : INFO / basicnativeapplication ( 5660 : 5660 ) : Addresse = 00:00:00:01:01:3E
    Line 1149: 01-05 10:44:20.643 : INFO / basicnativeapplication ( 5660 : 5660 ) : Comparing
    Line 1150: 01-05 10:44:25.693 : INFO / basicnativeapplication ( 5660 : 5660 ) : some info found
    Line 1151: 01-05 10:44:25.693 : INFO / basicnativeapplication ( 5660 : 5660 ) : Device name = #IE065854      
    Line 1152: 01-05 10:44:25.693 : INFO / basicnativeapplication ( 5660 : 5660 ) : Addresse = 00:00:00:01:01:3E
    Line 1153: 01-05 10:44:25.693 : INFO / basicnativeapplication ( 5660 : 5660 ) : Comparing
    Line 1254: 01-05 10:44:28.033 : WARN / APPS ( 712 : 712 ) : AppsItem.cpp: onItemClicked(381) >  item(basicnativeapplication) launched, open(0)
    Line 1323: 01-05 10:44:30.723 : INFO / basicnativeapplication ( 5660 : 5660 ) : some info found
    Line 1324: 01-05 10:44:30.723 : INFO / basicnativeapplication ( 5660 : 5660 ) : Device name = #IE065854      
    Line 1325: 01-05 10:44:30.723 : INFO / basicnativeapplication ( 5660 : 5660 ) : Addresse = 00:00:00:01:01:3E
    Line 1326: 01-05 10:44:30.723 : INFO / basicnativeapplication ( 5660 : 5660 ) : Comparing
    Line 1330: 01-05 10:44:40.863 : INFO / basicnativeapplication ( 5660 : 5660 ) : some info found
    Line 1331: 01-05 10:44:40.863 : INFO / basicnativeapplication ( 5660 : 5660 ) : Device name = #IE065854      
    Line 1332: 01-05 10:44:40.863 : INFO / basicnativeapplication ( 5660 : 5660 ) : Addresse = 00:00:00:01:01:3E
    Line 1333: 01-05 10:44:40.863 : INFO / basicnativeapplication ( 5660 : 5660 ) : Comparing
    Line 1367: 01-05 10:44:45.913 : INFO / basicnativeapplication ( 5660 : 5660 ) : some info found
    Line 1368: 01-05 10:44:45.913 : INFO / basicnativeapplication ( 5660 : 5660 ) : Device name = #IE065854      
    Line 1369: 01-05 10:44:45.913 : INFO / basicnativeapplication ( 5660 : 5660 ) : Addresse = 00:00:00:01:01:3E
    Line 1370: 01-05 10:44:45.913 : INFO / basicnativeapplication ( 5660 : 5660 ) : Comparing
    Line 1371: 01-05 10:44:51.112 : INFO / basicnativeapplication ( 5660 : 5660 ) : some info found
    Line 1372: 01-05 10:44:51.112 : INFO / basicnativeapplication ( 5660 : 5660 ) : Device name = #IE065854      
    Line 1373: 01-05 10:44:51.112 : INFO / basicnativeapplication ( 5660 : 5660 ) : Addresse = 00:00:00:01:01:3E
    Line 1374: 01-05 10:44:51.112 : INFO / basicnativeapplication ( 5660 : 5660 ) : Comparing
    Line 1472: 01-05 10:44:55.616 : INFO / basicnativeapplication ( 5660 : 5660 ) : some info found
    Line 1473: 01-05 10:44:55.616 : INFO / basicnativeapplication ( 5660 : 5660 ) : UUID[1] = 180F
    Line 1474: 01-05 10:44:55.621 : INFO / basicnativeapplication ( 5660 : 5660 ) : UUID[2] = 0555
    Line 1475: 01-05 10:44:55.621 : INFO / basicnativeapplication ( 5660 : 5660 ) : Device name = AlphaeonPatch
    Line 1476: 01-05 10:44:55.621 : INFO / basicnativeapplication ( 5660 : 5660 ) : Addresse = C9:D4:67:84:5C:E7
    Line 1477: 01-05 10:44:55.621 : INFO / basicnativeapplication ( 5660 : 5660 ) : Comparing
    Line 1478: 01-05 10:44:55.621 : INFO / basicnativeapplication ( 5660 : 5660 ) : Got our device
    Line 1479: 01-05 10:44:55.796 : INFO / basicnativeapplication ( 5660 : 5660 ) : Connected to our LE device.
    Line 1480: 01-05 10:44:55.856 : INFO / basicnativeapplication ( 5660 : 5660 ) : Client created
    Line 1481: 01-05 10:44:55.856 : INFO / basicnativeapplication ( 5660 : 5660 ) : Success
    Line 1482: 01-05 10:44:55.856 : INFO / basicnativeapplication ( 5660 : 5660 ) : bt_gatt_client_get_service is failed : -61

01-05 10:44:55.856 : ERROR / CAPI_NETWORK_BLUETOOTH ( 5660 : 5660 ) : bluetooth-gatt.c: bt_gatt_service_get_characteristic(1412) > [bt_gatt_service_get_characteristic] INVALID_PARAMETER(0xffffffea)


    Line 1484: 01-05 10:44:55.861 : INFO / basicnativeapplication ( 5660 : 5660 ) : bt_gatt_service_get_characteristic is failed : -22

 

Shravagi Shraddha

Please delete this logcat if possible.

Sazzad Hissain Khan

main() is not a good place to  set bt_gatt_set_connection_state_changed_cb( _bt_gatt_connection_state_changed_cb, NULL);
If you have already set it in app_create you don't need to set it again.

From your log it seems client is created successfully but  bt_gatt_client_get_service is failed : -61 ().  And you should also keep in mind that if service is not found bt_gatt_service_get_characteristic will also throw an INVALID_PARAMETER error which is exactly the case you found in logcat.

Line 1479: 01-05 10:44:55.796 : INFO / basicnativeapplication ( 5660 : 5660 ) : Connected to our LE device.
Line 1480: 01-05 10:44:55.856 : INFO / basicnativeapplication ( 5660 : 5660 ) : Client created
Line 1481: 01-05 10:44:55.856 : INFO / basicnativeapplication ( 5660 : 5660 ) : Success
Line 1482: 01-05 10:44:55.856 : INFO / basicnativeapplication ( 5660 : 5660 ) : bt_gatt_client_get_service is failed : -61
01-05 10:44:55.856 : ERROR / CAPI_NETWORK_BLUETOOTH ( 5660 : 5660 ) : bluetooth-gatt.c: bt_gatt_service_get_characteristic(1412) > [bt_gatt_service_get_characteristic] INVALID_PARAMETER(0xffffffea)
Line 1484: 01-05 10:44:55.861 : INFO / basicnativeapplication ( 5660 : 5660 ) : bt_gatt_service_get_characteristic is failed : -22

Now if you look at the documentation of bt_gatt_client_get_service ( from https://developer.tizen.org/dev-guide/2.4/org.tizen.native.mobile.apireference/group__CAPI__NETWORK__BLUETOOTH__GATT__MODULE.html#gabe1f90f65bb903a47bdc1d42a3ccd4d5 ), you will see that,

Return values can be:
BT_ERROR_NONE - Successful 
BT_ERROR_INVALID_PARAMETER - Invalid parameter 
BT_ERROR_NO_DATA - No data available 
BT_ERROR_NOT_SUPPORTED - Not supported 


I think BT_ERROR_NO_DATA is the probable cause of your issue which happens if there is no service advertisement by Server side. Are you sure your Server is bradcasting with same service UUID?

Privilege need to use gatt and BLE is http://tizen.org/privilege/bluetooth

Regards,

Hissain

Shravagi Shraddha

Hello Hissain,

Thanks for reply.

I am using the privilage for bluetooth.

Yes the server is broadcasting battery service which I am trying to read.

Also I dont understand why I am getting 

    Line 641: 01-05 10:43:48.471 : INFO / basicnativeapplication ( 5660 : 5660 ) : [bt_socket_set_connection_state_changed_cb] failed.

it is not registering to the callback for bt connection state change.
 
I want to know if technically it is possible for gear to communicate with an device acting in a central role. Or as a client to communicate with Gatt server for current tizen 2.3.1
 
Thanks & Regards,
Shraddha
Sazzad Hissain Khan

I have already suggested you,

main() is not a good place to  set bt_gatt_set_connection_state_changed_cb( _bt_gatt_connection_state_changed_cb, NULL);
If you have already set it in app_create you don't need to set it again. Please set it from app_create as in documentation. Let us know if it resolve the error

Line 641: 01-05 10:43:48.471 : INFO / basicnativeapplication ( 5660 : 5660 ) : [bt_socket_set_connection_state_changed_cb] failed.

And yes, technically it is possible for gear to communicate with an device acting in a central role. Follow the instruction in documentation.

if it cannot be solved here, we will talk in our internal Mosaik forum details and let you know the update.

 

Regards,

Hissain

Shravagi Shraddha

Hello Hissain,

Once again really thank you for your help.

I tried to register it in app_create but getting same error.

Any directions for 

Line 1482: 01-05 10:44:55.856 : INFO / basicnativeapplication ( 5660 : 5660 ) : bt_gatt_client_get_service is failed : -61

I am getting this error for Battery service as well.

Please help.

Regards,

Shraddha

Shravagi Shraddha

Hello Hissain,

Can we get some help over this? Can you please talk over your internal forums as you said before?

Please help.

 

Regards,

Shraddha

Shravagi Shraddha

Hi,
I downloaded an application on android which made my android phone to act as peripheral and it broadcasted few characteristics BLE Peripheral Simulator [ https://play.google.com/store/apps/details?id=io.github.webbluetoothcg.bletestperipheral&hl=en]
Now i could connect to this characteristic using another Phone which listens to BLE devices.
In same scenario I replaced the listener Android APp with Samsung Gear S2 which had the code to listen and connect to my BLE device.
Gear S2 could successfully read the characteristics but it was unable to connect with the Peripheral application.
So I am doubtful if Gear S2 can act in a central role?

Any pointers would be really helpful.

Regards,
Shraddha

vrajesh s

Hello,

I am facing same issue. i tried @Shardha's and @TizenDeveloper code. but same error got.  i have Samsung Gear s2 watch

I passed my device's ( BLE Chip) UUID and for test passed Battery level  as well.

 

Logs (MY BLE Chip):

03-20 16:19:10.285 : INFO / basicbluetoothdemo ( 16187 : 16187 ) : Remote Address: 00:0B:57:00:E1:C3

03-20 16:19:10.395 : INFO / basicbluetoothdemo ( 16187 : 16187 ) : Connected to our LE device.

03-20 16:19:10.585 : INFO / basicbluetoothdemo ( 16187 : 16187 ) : Client created

03-20 16:19:10.585 : INFO / basicbluetoothdemo ( 16187 : 16187 ) : Successfully get remote address

03-20 16:19:10.585 : INFO / basicbluetoothdemo ( 16187 : 16187 ) : services found

03-20 16:19:10.585 : INFO / basicbluetoothdemo ( 16187 : 16187 ) : bt_gatt_client_get_service is failed : -22

03-20 16:19:10.585 : INFO / basicbluetoothdemo ( 16187 : 16187 ) : bt_gatt_service_get_characteristic is failed : -22

 

Logs (Battery level):

char *svc_uuid ="0000180f-0000-1000-8000-00805f9b34fb";  //Battery service

char *chr_uuid ="00002a19-0000-1000-8000-00805f9b34fb";  //Battery level

char *desc_uuid ="00002902-0000-1000-8000-00805f9b34fb";  //Client characteristic configuration*/

03-20 16:26:44.755 : INFO / basicbluetoothdemo ( 16604 : 16604 ) : services found

03-20 16:26:44.755 : INFO / basicbluetoothdemo ( 16604 : 16604 ) : bt_gatt_client_get_service is failed : -61

03-20 16:26:44.755 : INFO / basicbluetoothdemo ( 16604 : 16604 ) : bt_gatt_service_get_characteristic is failed : -22

 

Why this -22 and -64 error comes. is there anything miss something? it would be great if any solution.

Thanks in advance.

Regards,

Vrajesh