src/eric7/MicroPython/Devices/RP2040Devices.py

branch
eric7
changeset 10138
56614cf9d03c
parent 10089
5fe9bfafbc7c
child 10144
45a9177c8e77
equal deleted inserted replaced
10137:fe5195fba5f7 10138:56614cf9d03c
597 station["status"] = self.__statusTranslations[ 597 station["status"] = self.__statusTranslations[
598 self._deviceData["wifi_type"] 598 self._deviceData["wifi_type"]
599 ][station["status"]] 599 ][station["status"]]
600 except KeyError: 600 except KeyError:
601 station["status"] = str(station["status"]) 601 station["status"] = str(station["status"])
602 if "status" in station: 602 if "status" in ap:
603 # translate the numerical status to a string 603 # translate the numerical status to a string
604 try: 604 try:
605 ap["status"] = self.__statusTranslations[self._deviceData["wifi_type"]][ 605 ap["status"] = self.__statusTranslations[self._deviceData["wifi_type"]][
606 ap["status"] 606 ap["status"]
607 ] 607 ]
712 result["status"] 712 result["status"]
713 ] 713 ]
714 except KeyError: 714 except KeyError:
715 error = str(result["status"]) 715 error = str(result["status"])
716 716
717 self._networkConnected = result["connected"]
718
717 return result["connected"], error 719 return result["connected"], error
718 720
719 def disconnectWifi(self): 721 def disconnectWifi(self):
720 """ 722 """
721 Public method to disconnect a device from the WiFi network. 723 Public method to disconnect a device from the WiFi network.
756 return super().disconnectWifi() 758 return super().disconnectWifi()
757 759
758 out, err = self.executeCommands(command, mode=self._submitMode) 760 out, err = self.executeCommands(command, mode=self._submitMode)
759 if err: 761 if err:
760 return False, err 762 return False, err
763
764 self._networkConnected = False
761 765
762 return out.decode("utf-8").strip() == "True", "" 766 return out.decode("utf-8").strip() == "True", ""
763 767
764 def writeCredentials(self, ssid, password): 768 def writeCredentials(self, ssid, password):
765 """ 769 """
1607 command, mode=self._submitMode, timeout=15000 1611 command, mode=self._submitMode, timeout=15000
1608 ) 1612 )
1609 if err: 1613 if err:
1610 return False, err 1614 return False, err
1611 1615
1616 self._networkConnected = True
1617
1612 return out.strip() == b"True", "" 1618 return out.strip() == b"True", ""
1613 1619
1614 def disconnectFromLan(self): 1620 def disconnectFromLan(self):
1615 """ 1621 """
1616 Public method to disconnect from the LAN. 1622 Public method to disconnect from the LAN.
1638 out, err = self.executeCommands( 1644 out, err = self.executeCommands(
1639 command, mode=self._submitMode, timeout=15000 1645 command, mode=self._submitMode, timeout=15000
1640 ) 1646 )
1641 if err: 1647 if err:
1642 return False, err 1648 return False, err
1649
1650 self._networkConnected = False
1643 1651
1644 return out.strip() == b"True", "" 1652 return out.strip() == b"True", ""
1645 1653
1646 def checkInternetViaLan(self): 1654 def checkInternetViaLan(self):
1647 """ 1655 """

eric ide

mercurial