- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Development environment:
Windows 8.1 pro
Platform: CYBT-423028-02
IDE: Wiced Studio 6.2.1
Just as an example :
Created service A
It has 2 characteristics B and C
B characteristic has Read and Write property n permission
C characteristic has Read and Notify property n permission
We have developed a demo code and created a characteristic(C) of one of the services(A) with "Notify" property.
Once the peer device writes into the client configuration of (C), I get the 0x1000 for notification.
But when we use the same characteristic to send the notification value, A peer device is not getting any notification. Please tell me which attr handle should be used to send the notification to peer device, please share the example.
wiced_bt_gatt_status_t wiced_bt_gatt_send_notification (uint16_t conn_id, uint16_t attr_handle, uint16_t val_len, uint8_t *p_val );
conn_id = connected device's id
attr_handle = (Characteristic C )CLIENT_CONFIGURATION , handle
val_len = length of the actual data to be shared with a connected device
p_val = Notification value
Please note we have followed the steps from the "demo.sensor" project, but it doesn't work in our code.
So please provide me the proper example of it.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Found the issue.. the connection ID was updated wrong.. Thanks anyways.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You need to use Characteristic value handle from the gatt_db_lookup_table_t. Could you please check below lab manual program to understand the usage of wiced_bt_gatt_send_notification.
If you can attach your relevant code snippet and Gatt DB config, we can give you more specific suggestions.
Thanks,
-Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please see the generated files below using wiced ble designer...
And we could not find any notification value handle, as we can see in demo.sensor code.
// *********************************************************************************************************************************
//********************************************************testnotifynuart_db.c***************************************************
// *********************************************************************************************************************************
#include "wiced_bt_uuid.h"
#include "wiced_bt_gatt.h"
#include "testnotifynuart_db.h"
/*************************************************************************************
** GATT server definitions
*************************************************************************************/
const uint8_t gatt_database[] = // Define GATT database
{
/* Primary Service 'Generic Attribute' */
PRIMARY_SERVICE_UUID16 (HDLS_GENERIC_ATTRIBUTE, UUID_SERVICE_GATT),
/* Primary Service 'Generic Access' */
PRIMARY_SERVICE_UUID16 (HDLS_GENERIC_ACCESS, UUID_SERVICE_GAP),
/* Characteristic 'Device Name' */
CHARACTERISTIC_UUID16 (HDLC_GENERIC_ACCESS_DEVICE_NAME, HDLC_GENERIC_ACCESS_DEVICE_NAME_VALUE,
UUID_CHARACTERISTIC_DEVICE_NAME, LEGATTDB_CHAR_PROP_READ,
LEGATTDB_PERM_READABLE),
/* Characteristic 'Appearance' */
CHARACTERISTIC_UUID16 (HDLC_GENERIC_ACCESS_APPEARANCE, HDLC_GENERIC_ACCESS_APPEARANCE_VALUE,
UUID_CHARACTERISTIC_APPEARANCE, LEGATTDB_CHAR_PROP_READ,
LEGATTDB_PERM_READABLE),
/* Primary Service 'testnotifynuartServc' */
PRIMARY_SERVICE_UUID128 (HDLS_TESTNOTIFYNUARTSERVC, __UUID_TESTNOTIFYNUARTSERVC),
/* Characteristic 'testnotifynuartChar' */
CHARACTERISTIC_UUID128 (HDLC_TESTNOTIFYNUARTSERVC_TESTNOTIFYNUARTCHAR, HDLC_TESTNOTIFYNUARTSERVC_TESTNOTIFYNUARTCHAR_VALUE,
__UUID_TESTNOTIFYNUARTSERVC_TESTNOTIFYNUARTCHAR, LEGATTDB_CHAR_PROP_NOTIFY,
LEGATTDB_PERM_NONE),
/* Descriptor 'Characteristic User Description' */
CHAR_DESCRIPTOR_UUID16 (HDLD_TESTNOTIFYNUARTSERVC_TESTNOTIFYNUARTCHAR_USER_DESCRIPTION,
UUID_DESCRIPTOR_CHARACTERISTIC_USER_DESCRIPTION, LEGATTDB_PERM_READABLE),
/* Descriptor 'Client Characteristic Configuration' */
CHAR_DESCRIPTOR_UUID16_WRITABLE (HDLD_TESTNOTIFYNUARTSERVC_TESTNOTIFYNUARTCHAR_CLIENT_CONFIGURATION,
UUID_DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION, LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_REQ | LEGATTDB_PERM_AUTH_WRITABLE),
};
// Length of the GATT database
const uint16_t gatt_database_len = sizeof(gatt_database);
// ***************************************************************************************************************************************************************
// ************************************************************ testnotifynuart_db.h ***************************************************************************
// ***************************************************************************************************************************************************************
#ifndef __GATT_DATABASE_H__
#define __GATT_DATABASE_H__
#define __UUID_TESTNOTIFYNUARTSERVC 0xfc, 0xf9, 0xb4, 0x7e, 0xf4, 0x9d, 0x4f, 0x18, 0xbd, 0x79, 0x3a, 0xf5, 0xdd, 0x12, 0xf0, 0xce
#define __UUID_TESTNOTIFYNUARTSERVC_TESTNOTIFYNUARTCHAR 0xf9, 0x41, 0x1a, 0xb0, 0x9f, 0x73, 0x4b, 0x97, 0xb5, 0x2f, 0x84, 0x48, 0x8a, 0x27, 0xc2, 0x73
// ***** Primary Service 'Generic Attribute'
#define HDLS_GENERIC_ATTRIBUTE 0x0001
// ***** Primary Service 'Generic Access'
#define HDLS_GENERIC_ACCESS 0x0014
// ----- Characteristic 'Device Name'
#define HDLC_GENERIC_ACCESS_DEVICE_NAME 0x0015
#define HDLC_GENERIC_ACCESS_DEVICE_NAME_VALUE 0x0016
// ----- Characteristic 'Appearance'
#define HDLC_GENERIC_ACCESS_APPEARANCE 0x0017
#define HDLC_GENERIC_ACCESS_APPEARANCE_VALUE 0x0018
// ***** Primary Service 'testnotifynuartServc'
#define HDLS_TESTNOTIFYNUARTSERVC 0x0028
// ----- Characteristic 'testnotifynuartChar'
#define HDLC_TESTNOTIFYNUARTSERVC_TESTNOTIFYNUARTCHAR 0x0029
#define HDLC_TESTNOTIFYNUARTSERVC_TESTNOTIFYNUARTCHAR_VALUE 0x002A
// ===== Descriptor 'User Description'
#define HDLD_TESTNOTIFYNUARTSERVC_TESTNOTIFYNUARTCHAR_USER_DESCRIPTION 0x002B
// ===== Descriptor 'Client Configuration'
#define HDLD_TESTNOTIFYNUARTSERVC_TESTNOTIFYNUARTCHAR_CLIENT_CONFIGURATION 0x002C
// External Lookup Table Entry
typedef struct
{
uint16_t handle;
uint16_t max_len;
uint16_t cur_len;
uint8_t *p_data;
} gatt_db_lookup_table;
// External definitions
extern const uint8_t gatt_database[];
extern const uint16_t gatt_database_len;
extern gatt_db_lookup_table testnotifynuart_gatt_db_ext_attr_tbl[];
extern const uint16_t testnotifynuart_gatt_db_ext_attr_tbl_size;
extern uint8_t BT_LOCAL_NAME[];
extern const uint16_t BT_LOCAL_NAME_CAPACITY;
#endif /* __GATT_DATABASE_H__ */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ns_4270701 ,
As DheerajP_41 mentioned, please provide us code to check at our side.
What is the peer device you are using ?
Did you check the return value of wiced_bt_gatt_send_notification function ?
Regards,
Anjana
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Found the issue.. the connection ID was updated wrong.. Thanks anyways.