1245 print(ujson.dumps(res)) |
1245 print(ujson.dumps(res)) |
1246 |
1246 |
1247 ethernet_status() |
1247 ethernet_status() |
1248 del ethernet_status, w5x00_init |
1248 del ethernet_status, w5x00_init |
1249 """.format( |
1249 """.format( |
1250 WiznetUtilities.wiznetInit() |
1250 WiznetUtilities.mpyWiznetInit() |
1251 ) |
1251 ) |
1252 |
1252 |
1253 out, err = self._interface.execute(command, mode=self._submitMode) |
1253 out, err = self._interface.execute(command, mode=self._submitMode) |
1254 if err: |
1254 if err: |
1255 raise OSError(self._shortError(err)) |
1255 raise OSError(self._shortError(err)) |
1301 print(nic.isconnected()) |
1301 print(nic.isconnected()) |
1302 |
1302 |
1303 connect_lan({1}) |
1303 connect_lan({1}) |
1304 del connect_lan, w5x00_init |
1304 del connect_lan, w5x00_init |
1305 """.format( |
1305 """.format( |
1306 WiznetUtilities.wiznetInit(), repr(config) if config == "dhcp" else config |
1306 WiznetUtilities.mpyWiznetInit(), "'dhcp'" if config == "dhcp" else config |
1307 ) |
1307 ) |
1308 |
1308 |
1309 with EricOverrideCursor(): |
1309 with EricOverrideCursor(): |
1310 out, err = self._interface.execute( |
1310 out, err = self._interface.execute( |
1311 command, mode=self._submitMode, timeout=15000 |
1311 command, mode=self._submitMode, timeout=15000 |
1333 print(not nic.isconnected()) |
1333 print(not nic.isconnected()) |
1334 |
1334 |
1335 disconnect_lan() |
1335 disconnect_lan() |
1336 del disconnect_lan, w5x00_init |
1336 del disconnect_lan, w5x00_init |
1337 """.format( |
1337 """.format( |
1338 WiznetUtilities.wiznetInit(), |
1338 WiznetUtilities.mpyWiznetInit(), |
1339 ) |
1339 ) |
1340 |
1340 |
1341 with EricOverrideCursor(): |
1341 with EricOverrideCursor(): |
1342 out, err = self._interface.execute( |
1342 out, err = self._interface.execute( |
1343 command, mode=self._submitMode, timeout=15000 |
1343 command, mode=self._submitMode, timeout=15000 |
1373 print(False) |
1373 print(False) |
1374 |
1374 |
1375 check_internet() |
1375 check_internet() |
1376 del check_internet, w5x00_init |
1376 del check_internet, w5x00_init |
1377 """.format( |
1377 """.format( |
1378 WiznetUtilities.wiznetInit(), |
1378 WiznetUtilities.mpyWiznetInit(), |
1379 ) |
1379 ) |
1380 |
1380 |
1381 out, err = self._interface.execute( |
1381 out, err = self._interface.execute( |
1382 command, mode=self._submitMode, timeout=10000 |
1382 command, mode=self._submitMode, timeout=10000 |
1383 ) |
1383 ) |
1492 out, err = self._interface.execute(command, mode=self._submitMode) |
1493 out, err = self._interface.execute(command, mode=self._submitMode) |
1493 if err: |
1494 if err: |
1494 raise OSError(self._shortError(err)) |
1495 raise OSError(self._shortError(err)) |
1495 return out.strip() == b"True" |
1496 return out.strip() == b"True" |
1496 |
1497 |
1497 def setNetworkTime(self, server="0.pool.ntp.org", tzOffset=0, timeout=10): |
1498 def setNetworkTime(self, server="pool.ntp.org", tzOffset=0, timeout=10): |
1498 """ |
1499 """ |
1499 Public method to set the time to the network time retrieved from an |
1500 Public method to set the time to the network time retrieved from an |
1500 NTP server. |
1501 NTP server. |
1501 |
1502 |
1502 @param server name of the NTP server to get the network time from |
1503 @param server name of the NTP server to get the network time from |