Skip to content

Commit

Permalink
wid/nimble/gatt: Delete custom wid for nimble GATT tests
Browse files Browse the repository at this point in the history
Delete custom wids for GATT tests.
Deleted wids worked in improper fashion.
Generic wids enable proper functionality by
looking for proper characteristic with correct
security restrictions.
  • Loading branch information
szymon-czapracki authored and sjanc committed Nov 28, 2024
1 parent f6b7006 commit 94f15c0
Showing 1 changed file with 0 additions and 74 deletions.
74 changes: 0 additions & 74 deletions autopts/ptsprojects/mynewt/gatt_wid.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,77 +61,3 @@ def hdl_wid_98(_: WIDParams):
def hdl_wid_118(_: WIDParams):
return '{0:04x}'.format(65000)


def hdl_wid_121(_: WIDParams):
# Lookup characteristic UUID that returns Insufficient Encryption Key Size
# TODO This needs reworking
chrcs = btp.gatts_get_attrs(type_uuid='2803')

for chrc in chrcs:
handle, perm, _ = chrc

chrc_val = btp.gatts_get_attr_val(btp.pts_addr_type_get(),
btp.pts_addr_get(), handle)
if not chrc_val:
continue

(_, val_len, val) = chrc_val

hdr = '<BH'
hdr_len = struct.calcsize(hdr)
uuid_len = val_len - hdr_len

_, handle, _ = struct.unpack("<BH%ds" % uuid_len, val)
chrc_value_attr = btp.gatts_get_attrs(start_handle=handle,
end_handle=handle)
if not chrc_value_attr:
continue

handle, perm, _ = chrc_value_attr[0]
chrc_value_data = btp.gatts_get_attr_val(btp.pts_addr_type_get(),
btp.pts_addr_get(), handle)
if not chrc_value_data:
continue

if perm & Perm.write_enc and perm & Perm.read_enc:
return '{0:04x}'.format(handle)

return '0000'


def hdl_wid_122(_: WIDParams):
# Lookup characteristic UUID that returns Insufficient Encryption Key Size
# TODO This needs reworking
chrcs = btp.gatts_get_attrs(type_uuid='2803')
for chrc in chrcs:
handle, perm, _ = chrc

chrc_data = btp.gatts_get_attr_val(btp.pts_addr_type_get(),
btp.pts_addr_get(), handle)
if not chrc_data:
continue

_, val_len, val = chrc_data

hdr = '<BH'
hdr_len = struct.calcsize(hdr)
uuid_len = val_len - hdr_len

_, handle, chrc_uuid = struct.unpack("<BH%ds" % uuid_len, val)
chrc_value_attr = btp.gatts_get_attrs(start_handle=handle,
end_handle=handle)
if not chrc_value_attr:
continue

handle, perm, _ = chrc_value_attr[0]
chrc_value_data = btp.gatts_get_attr_val(btp.pts_addr_type_get(),
btp.pts_addr_get(), handle)
if not chrc_value_data:
continue

_, val_len, val = chrc_value_data

if perm & Perm.read and perm & Perm.read_enc:
return btp.btp2uuid(uuid_len, chrc_uuid)

return '0000'

0 comments on commit 94f15c0

Please sign in to comment.