Skip to content

Commit 703a55b

Browse files
committed
Implementation of default network carrier: EXISTING_NETWORK for RPi, WIFI for other boards. For GPy is possible to select LTE instead DEFAULT_CARRIER.
1 parent 7305686 commit 703a55b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

1_send_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import time
88
import LiveObjects
99

10-
board = LiveObjects.BoardsFactory(net_type=LiveObjects.BoardsInterface.WIFI)
10+
board = LiveObjects.BoardsFactory(net_type=LiveObjects.BoardsInterface.DEFAULT_CARRIER)
1111

1212
apikey = board.get_apikey()
1313
client_id = board.get_client_id()

LiveObjects/hal.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
class BoardsInterface:
1414

15+
DEFAULT_CARRIER = 1
1516
EXISTING_NETWORK = 2
1617
WIFI = 3
1718
LTE = 4
@@ -51,11 +52,11 @@ class LoPy(BoardsInterface):
5152
class GPy(BoardsInterface):
5253
def __init__(self, net_type):
5354
self._lang = 'microPython'
54-
self._net_type = net_type
55+
self._net_type = BoardsInterface.WIFI if net_type == BoardsInterface.DEFAULT_CARRIER else net_type
5556
self._wifi_tls_capability = True
5657
self._lte_tls_capability = False
5758
self._mqtt_lib = super().mqtt_lib_import_str(self._lang)
58-
self._credentials = super().create_credentials(net_type)
59+
self._credentials = super().create_credentials(self._net_type)
5960

6061
def network_connect(self):
6162
if self._net_type == BoardsInterface.WIFI:
@@ -73,7 +74,7 @@ def get_security_level(self):
7374
class Esp8266(BoardsInterface):
7475
def __init__(self, net_type):
7576
self._lang = 'microPython'
76-
self._net_type = net_type
77+
self._net_type = BoardsInterface.WIFI if net_type == BoardsInterface.DEFAULT_CARRIER else None
7778
self._wifi_tls_capability = False
7879
self._wifi_lte_capability = False
7980
self._mqtt_lib = super().mqtt_lib_import_str(self._lang)
@@ -95,7 +96,7 @@ class Win32(BoardsInterface):
9596
class Esp32(BoardsInterface):
9697
def __init__(self, net_type):
9798
self._lang = 'microPython'
98-
self._net_type = net_type
99+
self._net_type = BoardsInterface.WIFI if net_type == BoardsInterface.DEFAULT_CARRIER else None
99100
self._wifi_tls_capability = True
100101
self._wifi_lte_capability = False
101102
self._mqtt_lib = super().mqtt_lib_import_str(self._lang)
@@ -113,7 +114,7 @@ def get_security_level(self):
113114
class Linux(BoardsInterface):
114115
def __init__(self, net_type):
115116
self._lang = 'Python'
116-
self._net_type = net_type
117+
self._net_type = BoardsInterface.EXISTING_NETWORK if net_type == BoardsInterface.DEFAULT_CARRIER else None
117118
self._wifi_tls_capability = True
118119
self._wifi_lte_capability = False
119120
self._mqtt_lib = super().mqtt_lib_import_str(self._lang)

0 commit comments

Comments
 (0)