parameters: (self)
docstring: factory reset
docstring_summary: factory reset
docstring_tokens: factory reset
function: def reset(self):
          """factory reset"""
          print('%s call reset' % self)
  
          self._deviceBeforeReset()
  
          self.__sendCommand('factoryreset', expectEcho=False)
          timeout = 10
  
          start_time = time.time()
          while time.time() < start_time + timeout:
              time.sleep(0.5)
              if not self.IsBorderRouter:
                  self._disconnect()
                  self._connect()
              try:
                  self.__executeCommand('state', timeout=0.1)
                  break
              except Exception:
                  self.__restartAgentService()
                  time.sleep(2)
                  self.__sendCommand('factoryreset', expectEcho=False)
                  time.sleep(0.5)
                  continue
          else:
              raise AssertionError("Could not connect with OT device {} after reset.".format(self))
  
          self.log('factoryreset finished within 10s timeout.')
          self._deviceAfterReset()
function_tokens: def reset ( self ) : print ( '%s call reset' % self ) self . _deviceBeforeReset ( ) self . __sendCommand ( 'factoryreset' , expectEcho = False ) timeout = 10 start_time = time . time ( ) while time . time ( ) < start_time + timeout : time . sleep ( 0.5 ) if not self . IsBorderRouter : self . _disconnect ( ) self . _connect ( ) try : self . __executeCommand ( 'state' , timeout = 0.1 ) break except Exception : self . __restartAgentService ( ) time . sleep ( 2 ) self . __sendCommand ( 'factoryreset' , expectEcho = False ) time . sleep ( 0.5 ) continue else : raise AssertionError ( "Could not connect with OT device {} after reset." . format ( self ) ) self . log ( 'factoryreset finished within 10s timeout.' ) self . _deviceAfterReset ( )