@@ -21,9 +21,6 @@ class BoardsInterface:
2121 PYTHON = 1
2222 MICROPYTHON = 2
2323
24- WINDOWS = 1
25- LINUX = 2
26-
2724 @staticmethod
2825 def create_credentials (net_type ):
2926 return LiveObjects .Credentials (net_type )
@@ -42,9 +39,6 @@ def get_lang_str(self):
4239 def get_lang_id (self ):
4340 return self ._lang_id
4441
45- def get_os_id (self ):
46- pass
47-
4842 def get_security_level (self ):
4943 pass
5044
@@ -75,11 +69,13 @@ def __init__(self, net_type):
7569 self ._wifi_tls_capability = False
7670 self ._lte_tls_capability = False
7771 self ._credentials = super ().create_credentials (self ._net_type )
72+ self ._hostname = 'GPy'
7873
7974 def connect (self ):
8075 super ().check_network_capabilities (self ._net_type )
8176 if self ._net_type == BoardsInterface .WIFI :
82- pycom_wifi_connect (self ._credentials .get_creds ()['ssid' ], self ._credentials .get_creds ()['password' ])
77+ pycom_wifi_connect (self ._credentials .get_creds ()['ssid' ], self ._credentials .get_creds ()['password' ],
78+ self ._hostname )
8379 elif self ._net_type == BoardsInterface .LTE :
8480 lte_connect (self ._credentials .get_creds ()['pin' ])
8581
@@ -109,7 +105,6 @@ def get_security_level(self):
109105class Win32 (BoardsInterface ):
110106 def __init__ (self , net_type ):
111107 self ._lang_id = BoardsInterface .PYTHON
112- self ._os_id = BoardsInterface .WINDOWS
113108 self ._net_type = BoardsInterface .EXISTING_NETWORK if net_type == BoardsInterface .DEFAULT_CARRIER else net_type
114109 self ._carrier_capability = (BoardsInterface .EXISTING_NETWORK ,)
115110 self ._existing_network_tls_capability = True
@@ -153,7 +148,6 @@ def get_security_level(self):
153148class Linux (BoardsInterface ):
154149 def __init__ (self , net_type ):
155150 self ._lang_id = BoardsInterface .PYTHON
156- self ._os_id = BoardsInterface .LINUX
157151 self ._net_type = BoardsInterface .EXISTING_NETWORK if net_type == BoardsInterface .DEFAULT_CARRIER else net_type
158152 self ._carrier_capability = (BoardsInterface .EXISTING_NETWORK ,)
159153 self ._existing_network_tls_capability = True
@@ -178,7 +172,7 @@ class BoardsFactory:
178172
179173 def __new__ (cls , net_type ):
180174 s = sys .platform
181- sn = s [0 ].upper () + s [1 :] # capitalize first letter
175+ sn = s [0 ].upper () + s [1 :] # capitalize first letter
182176 board = eval (sn )(net_type ) # instance of board w/ net type: WiFi, LTE, etc.
183177 return board
184178
@@ -204,11 +198,11 @@ def wifi_connect(ssid, password):
204198CONN_TIMEOUT = 20
205199
206200
207- def pycom_wifi_connect (ssid , password ):
201+ def pycom_wifi_connect (ssid , password , hostname ):
208202 from network import WLAN
209203
210204 wlan = WLAN (mode = WLAN .STA )
211- wlan .hostname ('xPy_1' )
205+ wlan .hostname (hostname )
212206 start_time = time .time ()
213207 while 1 :
214208 print ("Trying to connect..." )
0 commit comments