Image Transfer Demo Gatt Client Data Readin

Hi Everyone,

I am trying to create a central nrf to see the retrieved image chunk files from the image transfer service. I was looking at the Zephyr example (peripheral_hr_coded) and it does the same thing I asked for. I changed the UUIDs accordingly and I can find the advertisement and it successfully connects. But I am stuck where I subscribe to the server. There is a client object and I am a little bit confused about how to implement my client for image transfer service. Is there any way that you guys can help?

The change part will be in this code. (I believe)

Thank you,

Bsarica

err = bt_hrs_client_handles_assign(dm, &hrs_c);
	if (err) {
		printk("Could not init HRS client object (err %d)\n", err);
		return;
	}

	err = bt_hrs_client_measurement_subscribe(&hrs_c, notify_func);
	if (err && err != -EALREADY) {
		printk("Subscribe failed (err %d)\n", err);
	} else {
		printk("[SUBSCRIBED]\n");
	}

	err = bt_gatt_dm_data_release(dm);
	if (err) {
		printk("Could not release the discovery data (err %d)\n", err);
	}

Parents
  • For an additional information, I tried this kind of stuff without creating a client but I am getting the error I put below.

    static void discovery_complete(struct bt_gatt_dm *dm,
    			       void *context)
    {
    
    	const struct bt_gatt_dm_attr *gatt_service_attr =
    			bt_gatt_dm_service_get(dm);
    	const struct bt_gatt_service_val *gatt_service =
    			bt_gatt_dm_attr_service_val(gatt_service_attr);
    
    
    	if(bt_uuid_cmp(gatt_service->uuid,APP_UUID))
    		return;
    
    	const struct bt_gatt_dm_attr *gatt_chrc;
    	const struct bt_gatt_dm_attr *gatt_desc;
    
    	int err;
    	gatt_chrc = bt_gatt_dm_char_by_uuid(dm,CHAR_UUID);
    
    	if(err){
    		printk("Cannot Find\n");
    	}	
    
    	gatt_desc = bt_gatt_dm_desc_by_uuid(dm,gatt_chrc,APP_UUID);
    
    	uuid_handle = gatt_desc->handle;
    
    	gatt_desc = bt_gatt_dm_desc_by_uuid(dm, gatt_chrc, BT_UUID_GATT_CCC);
    
    	ccc_handle = gatt_desc->handle;
    
    	conn = bt_gatt_dm_conn_get(dm);
    
    	printk("Connection");
    	
    	struct bt_gatt_subscribe_params *params = local_params;
    	params->ccc_handle = ccc_handle;
    	params->value = BT_GATT_CCC_NOTIFY;
    	params->value_handle = uuid_handle;
    	params->notify = char_read_cb;
    
    	atomic_set_bit(params->flags, BT_GATT_SUBSCRIBE_FLAG_VOLATILE);
    
    	bt_gatt_subscribe(conn,params);
    }

  • Hello,

    bsarica said:
    For an additional information, I tried this kind of stuff without creating a client but I am getting the error I put below.

    How far does it get before it throws that error?

    It looks like the application is trying to change the value of something it is not allowed to change.

    What does the log say directly before it says "MPU FAULT"?

    BR,

    Edvin

Reply
  • Hello,

    bsarica said:
    For an additional information, I tried this kind of stuff without creating a client but I am getting the error I put below.

    How far does it get before it throws that error?

    It looks like the application is trying to change the value of something it is not allowed to change.

    What does the log say directly before it says "MPU FAULT"?

    BR,

    Edvin

Children
Related