@@ -84,13 +84,6 @@ typedef struct zjs_ble_handle {
84
84
ble_connection_t * connections ;
85
85
} ble_handle_t ;
86
86
87
- static struct bt_uuid * gatt_primary_service_uuid =
88
- BT_UUID_DECLARE_16 (BT_UUID_GATT_PRIMARY_VAL );
89
- static struct bt_uuid * gatt_characteristic_uuid =
90
- BT_UUID_DECLARE_16 (BT_UUID_GATT_CHRC_VAL );
91
- static struct bt_uuid * gatt_cud_uuid = BT_UUID_DECLARE_16 (BT_UUID_GATT_CUD_VAL );
92
- static struct bt_uuid * gatt_ccc_uuid = BT_UUID_DECLARE_16 (BT_UUID_GATT_CCC_VAL );
93
-
94
87
static struct k_sem ble_sem ;
95
88
96
89
static ble_handle_t * ble_handle = NULL ;
@@ -869,7 +862,8 @@ static bool zjs_ble_parse_characteristic(ble_characteristic_t *chrc)
869
862
return false;
870
863
}
871
864
872
- if (strtoul (desc_uuid , NULL , 16 ) == BT_UUID_GATT_CUD_VAL ) {
865
+ unsigned long cud_uuid = (unsigned long )BT_UUID_16 (BT_UUID_GATT_CUD )-> val ;
866
+ if (strtoul (desc_uuid , NULL , 16 ) == cud_uuid ) {
873
867
// Support CUD only, ignore all other type of descriptors
874
868
ZVAL v_value = zjs_get_property (v_desc , "value" );
875
869
if (jerry_value_is_string (v_value )) {
@@ -1038,7 +1032,7 @@ static bool zjs_ble_register_service(ble_service_t *service)
1038
1032
memset (bt_attrs , 0 , sizeof (struct bt_gatt_attr ) * num_of_entries );
1039
1033
1040
1034
// GATT Primary Service
1041
- bt_attrs [entry_index ].uuid = gatt_primary_service_uuid ;
1035
+ bt_attrs [entry_index ].uuid = BT_UUID_GATT_PRIMARY ;
1042
1036
bt_attrs [entry_index ].perm = BT_GATT_PERM_READ ;
1043
1037
bt_attrs [entry_index ].read = bt_gatt_attr_read_service ;
1044
1038
bt_attrs [entry_index ].user_data = service -> uuid ;
@@ -1058,7 +1052,7 @@ static bool zjs_ble_register_service(ble_service_t *service)
1058
1052
1059
1053
chrc_user_data -> uuid = ch -> uuid ;
1060
1054
chrc_user_data -> properties = ch -> flags ;
1061
- bt_attrs [entry_index ].uuid = gatt_characteristic_uuid ;
1055
+ bt_attrs [entry_index ].uuid = BT_UUID_GATT_CHRC ;
1062
1056
bt_attrs [entry_index ].perm = BT_GATT_PERM_READ ;
1063
1057
bt_attrs [entry_index ].read = bt_gatt_attr_read_chrc ;
1064
1058
bt_attrs [entry_index ].user_data = chrc_user_data ;
@@ -1095,7 +1089,7 @@ static bool zjs_ble_register_service(ble_service_t *service)
1095
1089
// FIXME: cud_buffer should be freed later if no longer needed, but
1096
1090
// doesn't seem to be
1097
1091
1098
- bt_attrs [entry_index ].uuid = gatt_cud_uuid ;
1092
+ bt_attrs [entry_index ].uuid = BT_UUID_GATT_CUD ;
1099
1093
bt_attrs [entry_index ].perm = BT_GATT_PERM_READ ;
1100
1094
bt_attrs [entry_index ].read = bt_gatt_attr_read_cud ;
1101
1095
bt_attrs [entry_index ].user_data = cud_buffer ;
@@ -1117,7 +1111,7 @@ static bool zjs_ble_register_service(ble_service_t *service)
1117
1111
ccc_user_data -> cfg = ble_handle -> blvl_ccc_cfg ;
1118
1112
ccc_user_data -> cfg_len = ARRAY_SIZE (ble_handle -> blvl_ccc_cfg );
1119
1113
ccc_user_data -> cfg_changed = zjs_ble_blvl_ccc_cfg_changed ;
1120
- bt_attrs [entry_index ].uuid = gatt_ccc_uuid ;
1114
+ bt_attrs [entry_index ].uuid = BT_UUID_GATT_CCC ;
1121
1115
bt_attrs [entry_index ].perm = BT_GATT_PERM_READ | BT_GATT_PERM_WRITE ;
1122
1116
bt_attrs [entry_index ].read = bt_gatt_attr_read_ccc ;
1123
1117
bt_attrs [entry_index ].write = bt_gatt_attr_write_ccc ;
0 commit comments