@@ -179,6 +179,7 @@ def __init__(self, node_name: str):
179179 self .__self_check_status_code = - 1
180180 self .__notification_thread .start ()
181181 self .__joy_polling_thread .start ()
182+ self .__bt_central .RemoveUnrecordedDevices (self .__getHistoryConnectionInfo ())
182183
183184 def __del__ (self ):
184185 self .__notification_thread .join ()
@@ -305,7 +306,7 @@ def __connect_callback(self, req, res):
305306 self .__tryToReleaseMutex (self .__poll_mutex )
306307 # res.result = self.__waitForUWBResponse(False)
307308 self .__disconnectPeripheral ()
308- self .__bt_central .RemoveUnRecordedDevices (self .__getHistoryConnectionInfo ())
309+ self .__bt_central .RemoveUnrecordedDevices (self .__getHistoryConnectionInfo ())
309310 self .__connect_timeout_timer .reset ()
310311 if self .__bt_central .ConnectToBLE (
311312 req .selected_device .mac ,
@@ -694,7 +695,7 @@ def __notificationTimerCB(self):
694695 if self .__connecting or not self .__bt_central .IsConnected ():
695696 self .__tryToReleaseMutex (self .__poll_mutex )
696697 return
697- notified = self .__bt_central .WaitForNotifications (0.5 )
698+ notified = self .__bt_central .WaitForNotifications (0.25 )
698699 self .__tryToReleaseMutex (self .__poll_mutex )
699700 if notified == 3 :
700701 self .__disconnectUnexpectedly ()
@@ -917,7 +918,7 @@ def __deleteHistory(self, mac):
917918 i = 0
918919 found = False
919920 for dev_info in history_info_list :
920- if dev_info ['mac' ] == mac :
921+ if dev_info ['mac' ] == mac or dev_info [ 'mac' ] == mac . lower () :
921922 found = True
922923 break
923924 i += 1
@@ -932,8 +933,10 @@ def __deleteHistory(self, mac):
932933 return False
933934
934935 def __deleteHistoryCB (self , req , res ):
935- res .result = self .__deleteHistory (req .map_url )
936- self .__unpair (req .map_url )
936+ res .result = False
937+ if not self .__connecting and not self .__dfu_processing :
938+ res .result = self .__deleteHistory (req .map_url )
939+ self .__unpair (req .map_url )
937940 return res
938941
939942 def __tryToReleaseMutex (self , mutex ):
@@ -1015,7 +1018,7 @@ def __joyPubPolling(self):
10151018 sleep (0.05 )
10161019
10171020 def __activateDFU (self ):
1018- if not self .__poll_mutex .acquire (blocking = True , timeout = 0.75 ):
1021+ if not self .__poll_mutex .acquire (blocking = True , timeout = 1.0 ):
10191022 self .__logger .warning ('Unable to acquire __poll_mutex' )
10201023 return False
10211024 dfu_handle = self .__bt_central .SetNotificationByUUID ( # indicate
@@ -1242,11 +1245,10 @@ def __taskStatusCB(self, msg):
12421245 self .__task_status = msg .task_status
12431246
12441247 def __unpair (self , mac : str ):
1245- if not self .__connecting and not self .__dfu_processing :
1246- if not self .__bt_central .Unpair (mac ):
1247- self .__disconnectPeripheral ()
1248- self .__logger .info ('Unpaired current device' )
1249- self .__logger .info ('Unpaired device %s' % mac )
1248+ if not self .__bt_central .Unpair (mac ):
1249+ self .__disconnectPeripheral ()
1250+ self .__logger .info ('Unpaired current device' )
1251+ self .__logger .info ('Unpaired device %s' % mac )
12501252
12511253 def __intervalTimerCB (self ):
12521254 self .__logger .info ('Intermission is off' )
0 commit comments