src/eric7/MicroPython/Devices/DeviceBase.py

branch
eric7
changeset 11236
75c26fe1d1c7
parent 11224
65b341cfab55
equal deleted inserted replaced
11235:b984f0085bed 11236:75c26fe1d1c7
80 <li>scanNetworks: scan for available WiFi networks</li> 80 <li>scanNetworks: scan for available WiFi networks</li>
81 <li>deactivateInterface: deactivate a WiFi interface</li> 81 <li>deactivateInterface: deactivate a WiFi interface</li>
82 <li>startAccessPoint: start an access point</li> 82 <li>startAccessPoint: start an access point</li>
83 <li>stopAccessPoint: stop the access point</li> 83 <li>stopAccessPoint: stop the access point</li>
84 <li>getConnectedClients: get a list of connected WiFi clients</li> 84 <li>getConnectedClients: get a list of connected WiFi clients</li>
85 <li>getSecurityModes: get a list of supported security modes</li>
86 <li>enableWebrepl
87 <li>disableWebrepl
85 </ul> 88 </ul>
86 89
87 Supported Bluetooth commands are: 90 Supported Bluetooth commands are:
88 <ul> 91 <ul>
89 <li>hasBluetooth: check, if the board has Bluetooth functionality</li> 92 <li>hasBluetooth: check, if the board has Bluetooth functionality</li>
1909 """ 1912 """
1910 Public method to start the access point interface. 1913 Public method to start the access point interface.
1911 1914
1912 @param ssid SSID of the access point (unused) 1915 @param ssid SSID of the access point (unused)
1913 @type str 1916 @type str
1914 @param security security method (defaults to None) (unused) 1917 @param security security mode (defaults to None) (unused)
1915 @type int (optional) 1918 @type str (optional)
1916 @param password password (defaults to None) (unused) 1919 @param password password (defaults to None) (unused)
1917 @type str (optional) 1920 @type str (optional)
1918 @param hostname host name of the device (defaults to None) (unused) 1921 @param hostname host name of the device (defaults to None) (unused)
1919 @type str (optional) 1922 @type str (optional)
1920 @param ifconfig IPv4 configuration for the access point if not default 1923 @param ifconfig IPv4 configuration for the access point if not default
1942 and the RSSI (if supported and available) and an error message 1945 and the RSSI (if supported and available) and an error message
1943 @rtype tuple of ([(bytes, int)], str) 1946 @rtype tuple of ([(bytes, int)], str)
1944 """ 1947 """
1945 return [], "" 1948 return [], ""
1946 1949
1950 def getSecurityModes(self):
1951 """
1952 Public method to get a list of security modes supported by the device.
1953
1954 @return list of supported security modes
1955 @rtype list of str
1956 """
1957 command = """
1958 def getSecurityModes():
1959 import network
1960 modes = [s for s in dir(network.WLAN) if s.startswith('SEC_')]
1961 return modes
1962
1963 print(getSecurityModes())
1964 del getSecurityModes
1965 """
1966 out, err = self.executeCommands(command, mode=self._submitMode)
1967 if err:
1968 return []
1969
1970 return ast.literal_eval(out.decode("utf-8"))
1971
1947 def enableWebrepl(self, password): # noqa: U-100 1972 def enableWebrepl(self, password): # noqa: U-100
1948 """ 1973 """
1949 Public method to write the given WebREPL password to the connected device and 1974 Public method to write the given WebREPL password to the connected device and
1950 modify the start script to start the WebREPL server. 1975 modify the start script to start the WebREPL server.
1951 1976
1956 """ 1981 """
1957 return False, "" 1982 return False, ""
1958 1983
1959 def disableWebrepl(self): 1984 def disableWebrepl(self):
1960 """ 1985 """
1961 Public method to write the given WebREPL password to the connected device and 1986 Public method to modify the start script to not start the WebREPL server.
1962 modify the start script to start the WebREPL server.
1963 1987
1964 @return tuple containing a flag indicating success and an error message 1988 @return tuple containing a flag indicating success and an error message
1965 @rtype tuple of (bool, str) 1989 @rtype tuple of (bool, str)
1966 """ 1990 """
1967 return False, "" 1991 return False, ""

eric ide

mercurial