Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add softdevice_v5 handlers: exchange of default MTU and TX complete #2

Merged
merged 2 commits into from
Aug 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions python/pc_ble_driver_py/ble_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def __init__(self, ble_driver):
self.observers = list()
self.db_conns = dict()
self.evt_sync = dict()
self.default_mtu = 23

def open(self):
self.driver.open()
Expand Down Expand Up @@ -464,6 +465,9 @@ def on_gap_evt_auth_key_request(self, ble_driver, conn_handle, **kwargs):
def on_evt_tx_complete(self, ble_driver, conn_handle, **kwargs):
self.evt_sync[conn_handle].notify(evt = BLEEvtID.evt_tx_complete, data = kwargs)

def on_gattc_evt_write_cmd_tx_complete(self, ble_driver, conn_handle, **kwargs):
self.evt_sync[conn_handle].notify(evt = BLEEvtID.gattc_evt_write_cmd_tx_complete, data = kwargs)

def on_gattc_evt_write_rsp(self, ble_driver, conn_handle, **kwargs):
self.evt_sync[conn_handle].notify(evt = BLEEvtID.gattc_evt_write_rsp, data = kwargs)

Expand All @@ -482,12 +486,21 @@ def on_gattc_evt_char_disc_rsp(self, ble_driver, conn_handle, **kwargs):
def on_gattc_evt_desc_disc_rsp(self, ble_driver, conn_handle, **kwargs):
self.evt_sync[conn_handle].notify(evt = BLEEvtID.gattc_evt_desc_disc_rsp, data = kwargs)

def on_gatts_evt_hvn_tx_complete(self, ble_driver, conn_handle, **kwargs):
self.evt_sync[conn_handle].notify(evt = BLEEvtID.gatts_evt_hvn_tx_complete, data = kwargs)

def on_gatts_evt_hvc(self, ble_driver, status, error_handle, attr_handle, **kwargs):
self.evt_sync[conn_handle].notify(evt=BLEEvtID.gatts_evt_hvc, data=kwargs)

def on_gatts_evt_write(self, ble_driver, conn_handle, **kwargs):
self.evt_sync[conn_handle].notify(evt=BLEEvtID.gatts_evt_write, data=kwargs)

def on_gap_evt_data_length_update_request(self, ble_driver, conn_handle, data_length_params):
self.driver.ble_gap_data_length_update(conn_handle, None, None)

def on_gatts_evt_exchange_mtu_request(self, ble_driver, conn_handle, client_mtu):
self.driver.ble_gatts_exchange_mtu_reply(conn_handle, self.default_mtu)

def on_att_mtu_exchanged(self, ble_driver, conn_handle, att_mtu):
self.db_conns[conn_handle].att_mtu = att_mtu

Expand Down
2 changes: 2 additions & 0 deletions python/pc_ble_driver_py/observers.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ def on_gatts_evt_write(self, ble_driver, conn_handle, attr_handle, uuid, op, aut
def on_gatts_evt_exchange_mtu_request(self, ble_driver, conn_handle, client_mtu):
pass

def on_gattc_evt_exchange_mtu_rsp(self, ble_driver, conn_handle, **kwargs):
pass

class BLEAdapterObserver(object):
def __init__(self, *args, **kwargs):
Expand Down