|
9 | 9 | # This module contains helper methods for calling card.* Notecard API commands.
|
10 | 10 | # This module is optional and not required for use with the Notecard.
|
11 | 11 |
|
12 |
| -import notecard |
13 | 12 | from notecard.validators import validate_card_object
|
14 | 13 |
|
15 | 14 |
|
@@ -137,16 +136,51 @@ def wireless(card, mode=None, apn=None):
|
137 | 136 |
|
138 | 137 | Args:
|
139 | 138 | card (Notecard): The current Notecard object.
|
140 |
| - mode (string): The wireless module mode to set. |
| 139 | + mode (string): The wireless module mode to set. Must be one of: |
| 140 | + "-" to reset to the default mode |
| 141 | + "auto" to perform automatic band scan mode (default) |
| 142 | + "m" to restrict the modem to Cat-M1 |
| 143 | + "nb" to restrict the modem to Cat-NB1 |
| 144 | + "gprs" to restrict the modem to EGPRS |
141 | 145 | apn (string): Access Point Name (APN) when using an external SIM.
|
| 146 | + Use "-" to reset to the Notecard default APN. |
142 | 147 |
|
143 | 148 | Returns:
|
144 |
| - string: The result of the Notecard request. |
| 149 | + dict: The result of the Notecard request containing network status and |
| 150 | + signal information. |
145 | 151 | """
|
146 | 152 | req = {"req": "card.wireless"}
|
147 | 153 | if mode:
|
148 | 154 | req["mode"] = mode
|
149 | 155 | if apn:
|
150 | 156 | req["apn"] = apn
|
| 157 | + return card.Transaction(req) |
| 158 | + |
| 159 | + |
| 160 | +@validate_card_object |
| 161 | +def transport(card, method=None, allow=None): |
| 162 | + """Configure the Notecard's connectivity method. |
151 | 163 |
|
| 164 | + Args: |
| 165 | + card (Notecard): The current Notecard object. |
| 166 | + method (string): The connectivity method to enable. Must be one of: |
| 167 | + "-" to reset to device default |
| 168 | + "wifi-cell" to prioritize WiFi with cellular fallback |
| 169 | + "wifi" to enable WiFi only |
| 170 | + "cell" to enable cellular only |
| 171 | + "ntn" to enable Non-Terrestrial Network mode |
| 172 | + "wifi-ntn" to prioritize WiFi with NTN fallback |
| 173 | + "cell-ntn" to prioritize cellular with NTN fallback |
| 174 | + "wifi-cell-ntn" to prioritize WiFi, then cellular, then NTN |
| 175 | + allow (bool): When True, allows adding Notes to non-compact Notefiles |
| 176 | + while connected over a non-terrestrial network. |
| 177 | +
|
| 178 | + Returns: |
| 179 | + dict: The result of the Notecard request. |
| 180 | + """ |
| 181 | + req = {"req": "card.transport"} |
| 182 | + if method: |
| 183 | + req["method"] = method |
| 184 | + if allow is not None: |
| 185 | + req["allow"] = allow |
152 | 186 | return card.Transaction(req)
|
0 commit comments