src/eric7/MicroPython/Devices/DeviceBase.py

branch
eric7
changeset 10153
ffe7432f716b
parent 10144
45a9177c8e77
child 10173
9c64ac720853
equal deleted inserted replaced
10152:33e7b9d3f91c 10153:ffe7432f716b
1478 and the WiFi type (picow or pimoroni) 1478 and the WiFi type (picow or pimoroni)
1479 @rtype tuple of (bool, str) 1479 @rtype tuple of (bool, str)
1480 """ 1480 """
1481 return False, "" 1481 return False, ""
1482 1482
1483 def hasWifiCountry(self):
1484 """
1485 Public method to check, if the device (potentially) has support to set the
1486 WiFi country.
1487
1488 @return flag indicating the support of WiFi country
1489 @rtype bool
1490 """
1491 return False
1492
1483 def addDeviceWifiEntries(self, menu): 1493 def addDeviceWifiEntries(self, menu):
1484 """ 1494 """
1485 Public method to add device specific entries to the given menu. 1495 Public method to add device specific entries to the given menu.
1486 1496
1487 @param menu reference to the context menu 1497 @param menu reference to the context menu
1497 for the WiFi client, access point and overall data 1507 for the WiFi client, access point and overall data
1498 @rtype tuple of (dict, dict, dict) 1508 @rtype tuple of (dict, dict, dict)
1499 """ 1509 """
1500 return {}, {}, {} 1510 return {}, {}, {}
1501 1511
1502 def connectWifi(self, ssid, password): # noqa: U100 1512 def connectWifi(self, ssid, password, hostname): # noqa: U100
1503 """ 1513 """
1504 Public method to connect a device to a WiFi network. 1514 Public method to connect a device to a WiFi network.
1505 1515
1506 @param ssid name (SSID) of the WiFi network 1516 @param ssid name (SSID) of the WiFi network
1507 @type str 1517 @type str
1508 @param password password needed to connect 1518 @param password password needed to connect
1509 @type str 1519 @type str
1520 @param hostname host name of the device
1521 @type str
1510 @return tuple containing the connection status and an error string 1522 @return tuple containing the connection status and an error string
1511 @rtype tuple of (bool, str) 1523 @rtype tuple of (bool, str)
1512 """ 1524 """
1513 return False, self.tr("Operation not supported.") 1525 return False, self.tr("Operation not supported.")
1514 1526
1537 @return flag indicating the WiFi connection status 1549 @return flag indicating the WiFi connection status
1538 @rtype bool 1550 @rtype bool
1539 """ 1551 """
1540 return False 1552 return False
1541 1553
1542 def writeCredentials(self, ssid, password): # noqa: U100 1554 def writeCredentials(self, ssid, password, hostname, country): # noqa: U100
1543 """ 1555 """
1544 Public method to write the given credentials to the connected device and modify 1556 Public method to write the given credentials to the connected device and modify
1545 the start script to connect automatically. 1557 the start script to connect automatically.
1546 1558
1547 @param ssid SSID of the network to connect to 1559 @param ssid SSID of the network to connect to
1548 @type str 1560 @type str
1549 @param password password needed to authenticate 1561 @param password password needed to authenticate
1562 @type str
1563 @param hostname host name of the device
1564 @type str
1565 @param country WiFi country code
1550 @type str 1566 @type str
1551 @return tuple containing a flag indicating success and an error message 1567 @return tuple containing a flag indicating success and an error message
1552 @rtype tuple of (bool, str) 1568 @rtype tuple of (bool, str)
1553 """ 1569 """
1554 return False, "" 1570 return False, ""
1592 @rtype tuple of (bool, str) 1608 @rtype tuple of (bool, str)
1593 """ 1609 """
1594 return True, "" 1610 return True, ""
1595 1611
1596 def startAccessPoint( 1612 def startAccessPoint(
1597 self, ssid, security=None, password=None, ifconfig=None # noqa: U100 1613 self,
1614 ssid, # noqa: U100
1615 security=None, # noqa: U100
1616 password=None, # noqa: U100
1617 hostname=None, # noqa: U100
1618 ifconfig=None, # noqa: U100
1598 ): 1619 ):
1599 """ 1620 """
1600 Public method to start the access point interface. 1621 Public method to start the access point interface.
1601 1622
1602 @param ssid SSID of the access point 1623 @param ssid SSID of the access point
1603 @type str 1624 @type str
1604 @param security security method (defaults to None) 1625 @param security security method (defaults to None)
1605 @type int (optional) 1626 @type int (optional)
1606 @param password password (defaults to None) 1627 @param password password (defaults to None)
1628 @type str (optional)
1629 @param hostname host name of the device (defaults to None)
1607 @type str (optional) 1630 @type str (optional)
1608 @param ifconfig IPv4 configuration for the access point if not default 1631 @param ifconfig IPv4 configuration for the access point if not default
1609 (IPv4 address, netmask, gateway address, DNS server address) 1632 (IPv4 address, netmask, gateway address, DNS server address)
1610 @type tuple of (str, str, str, str) 1633 @type tuple of (str, str, str, str)
1611 @return tuple containing a flag indicating success and an error message 1634 @return tuple containing a flag indicating success and an error message
1685 the associated value 1708 the associated value
1686 @rtype list of tuples of (str, str) 1709 @rtype list of tuples of (str, str)
1687 """ 1710 """
1688 return [] 1711 return []
1689 1712
1690 def connectToLan(self, config): # noqa: U100 1713 def connectToLan(self, config, hostname): # noqa: U100
1691 """ 1714 """
1692 Public method to connect the connected device to the LAN. 1715 Public method to connect the connected device to the LAN.
1693 1716
1694 @param config configuration for the connection (either the string 'dhcp' 1717 @param config configuration for the connection (either the string 'dhcp'
1695 for a dynamic address or a tuple of four strings with the IPv4 parameters. 1718 for a dynamic address or a tuple of four strings with the IPv4 parameters.
1696 @type str or tuple of (str, str, str, str) 1719 @type str or tuple of (str, str, str, str)
1720 @param hostname host name of the device
1721 @type str
1697 @return tuple containing a flag indicating success and an error message 1722 @return tuple containing a flag indicating success and an error message
1698 @rtype tuple of (bool, str) 1723 @rtype tuple of (bool, str)
1699 """ 1724 """
1700 return False, "" 1725 return False, ""
1701 1726
1733 @return tuple containg a flag indicating success and an error message 1758 @return tuple containg a flag indicating success and an error message
1734 @rtype tuple of (bool, str) 1759 @rtype tuple of (bool, str)
1735 """ 1760 """
1736 return True, "" 1761 return True, ""
1737 1762
1738 def writeLanAutoConnect(self, config): # noqa: U100 1763 def writeLanAutoConnect(self, config, hostname): # noqa: U100
1739 """ 1764 """
1740 Public method to generate a script and associated configuration to connect the 1765 Public method to generate a script and associated configuration to connect the
1741 device to the LAN during boot time. 1766 device to the LAN during boot time.
1742 1767
1743 @param config configuration for the connection (either the string 'dhcp' 1768 @param config configuration for the connection (either the string 'dhcp'
1744 for a dynamic address or a tuple of four strings with the IPv4 parameters. 1769 for a dynamic address or a tuple of four strings with the IPv4 parameters.
1745 @type str or tuple of (str, str, str, str) 1770 @type str or tuple of (str, str, str, str)
1771 @param hostname host name of the device
1772 @type str
1746 @return tuple containing a flag indicating success and an error message 1773 @return tuple containing a flag indicating success and an error message
1747 @rtype tuple of (bool, str) 1774 @rtype tuple of (bool, str)
1748 """ 1775 """
1749 return False, "" 1776 return False, ""
1750 1777

eric ide

mercurial