992 if err: |
992 if err: |
993 return False |
993 return False |
994 |
994 |
995 return out.strip() == b"True" |
995 return out.strip() == b"True" |
996 |
996 |
997 def writeCredentials(self, ssid, password, hostname, country): # noqa: U100 |
997 def writeCredentials(self, ssid, password, hostname, _country): |
998 """ |
998 """ |
999 Public method to write the given credentials to the connected device and modify |
999 Public method to write the given credentials to the connected device and modify |
1000 the start script to connect automatically. |
1000 the start script to connect automatically. |
1001 |
1001 |
1002 @param ssid SSID of the network to connect to |
1002 @param ssid SSID of the network to connect to |
1003 @type str |
1003 @type str |
1004 @param password password needed to authenticate |
1004 @param password password needed to authenticate |
1005 @type str |
1005 @type str |
1006 @param hostname host name of the device |
1006 @param hostname host name of the device |
1007 @type str |
1007 @type str |
1008 @param country WiFi country code (unused) |
1008 @param _country WiFi country code (unused) |
1009 @type str |
1009 @type str |
1010 @return tuple containing a flag indicating success and an error message |
1010 @return tuple containing a flag indicating success and an error message |
1011 @rtype tuple of (bool, str) |
1011 @rtype tuple of (bool, str) |
1012 """ |
1012 """ |
1013 if not self.__deviceVolumeMounted(): |
1013 if not self.__deviceVolumeMounted(): |
2087 return False, str(err) |
2087 return False, str(err) |
2088 |
2088 |
2089 return True, "" |
2089 return True, "" |
2090 |
2090 |
2091 |
2091 |
2092 def createDevice( |
2092 def createDevice(microPythonWidget, deviceType, vid, pid, boardName, _serialNumber): |
2093 microPythonWidget, deviceType, vid, pid, boardName, serialNumber # noqa: U100 |
|
2094 ): |
|
2095 """ |
2093 """ |
2096 Function to instantiate a MicroPython device object. |
2094 Function to instantiate a MicroPython device object. |
2097 |
2095 |
2098 @param microPythonWidget reference to the main MicroPython widget |
2096 @param microPythonWidget reference to the main MicroPython widget |
2099 @type MicroPythonWidget |
2097 @type MicroPythonWidget |
2103 @type int |
2101 @type int |
2104 @param pid product ID |
2102 @param pid product ID |
2105 @type int |
2103 @type int |
2106 @param boardName name of the board |
2104 @param boardName name of the board |
2107 @type str |
2105 @type str |
2108 @param serialNumber serial number of the board |
2106 @param _serialNumber serial number of the board (unused) |
2109 @type str |
2107 @type str |
2110 @return reference to the instantiated device object |
2108 @return reference to the instantiated device object |
2111 @rtype CircuitPythonDevice |
2109 @rtype CircuitPythonDevice |
2112 """ |
2110 """ |
2113 return CircuitPythonDevice( |
2111 return CircuitPythonDevice( |