Skip to content

Commit de70261

Browse files
authored
Fix doc (#13)
close #10
1 parent 772ad0e commit de70261

File tree

4 files changed

+27
-10
lines changed

4 files changed

+27
-10
lines changed

.github/workflows/sphinx.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
python-version: '3.7'
1919

2020
- name: Install pip packages
21-
run: pip install sphinx==3.5.1 sphinx-rtd-theme==0.5.1
21+
run: pip install sphinx==4.2.0 sphinx-rtd-theme==0.5.1
2222

2323
- name: Insatll package requirement
2424
run: pip install -r requirements.txt

docs/wirepas_mqtt_library.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ TLVAppConfigHelper
2121
.. automodule:: wirepas_mqtt_library.wirepas_tlv_app_config_helper
2222
:special-members: __init__
2323
:members:
24-
:undoc-members:
2524

2625
Gateway return codes and special values
2726
---------------------------------------------

wirepas_mqtt_library/wirepas_network_interface.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,11 @@ def clear_gateway_status(self, gw_id):
480480
"""
481481
Clear a gateway status
482482
483-
Gateway status is sent by gateway as a retain message on the broker.
484-
It may be need to explicitly remove it in some situation:
483+
:param gw_id: Id of gateway the sink is attached
484+
:type gw_id: str
485+
486+
.. note:: Gateway status is sent by gateway as a retain message on the broker.
487+
It may be need to explicitly remove it in some situation:
485488
- An offline gateway that will never be back online (removed from network)
486489
- A sticky gateway online status that is not here anymore (bug from gateway)
487490
- A malformed gateway status (bug from gateway)
@@ -520,7 +523,7 @@ def unlock(response, param, *args):
520523
def send_message(self, gw_id, sink_id, dest, src_ep, dst_ep, payload, qos=0, csma_ca_only=False, cb=None, param=None):
521524
"""
522525
send_message(self, gw_id, sink_id, dest, src_ep, dst_ep, payload, qos=0, csma_ca_only=False, cb=None, param=None)
523-
Send a message from a sink
526+
Send a message to wirepas network from a given sink
524527
525528
:param gw_id: Id of gateway the sink is attached
526529
:type gw_id: str

wirepas_mqtt_library/wirepas_tlv_app_config_helper.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ class WirepasTLVAppConfigHelper:
1212
1313
This class contains methods allowing the modification (addition, removal)
1414
of app_config data inside a Wirepas network compliant with the TLV format.
15-
It offers an abstraction
15+
It offers an abstraction for wirepas supported feature at application level
16+
like the local provisioning.
1617
1718
"""
1819

@@ -24,9 +25,9 @@ def __init__(self, wni, network=None, gateway_sink_subset=None):
2425
:param wni: Wirepas network interface
2526
:type wni: :obj:`~wirepas_mqtt_library.wirepas_network_interface.WirepasNetworkInterface`
2627
:param network: Network address concerned by the otap
27-
:param gateway_sink: list of (gateway, sink) tupple concerned by the change
28+
:param gateway_sink_subset: list of (gateway, sink) tupple concerned by the change
2829
29-
:note: Either network or gateway_sink must be specified
30+
:note: Either network or gateway_sink_subset must be specified
3031
"""
3132
if wni is None:
3233
raise RuntimeError("No Wirepas Network Interface provided")
@@ -85,6 +86,16 @@ def remove_raw_entry(self, entry):
8586
return self
8687

8788
def setup_local_provisioning(self, enabled, psk_id=None, psk=None):
89+
"""Set a new entry to enable or disable local provisioning
90+
91+
:param enabled: True to enable local provisioning, False to disable it
92+
:type enabled: bool
93+
:param psk_id: Id of the psk on 4 bytes (only valid when enabled)
94+
:type psk_id: bytearray
95+
:param psk: psk to use for lacal provisioning on 32 bytes (only valid when enabled)
96+
:type psk: bytearray
97+
:raises ValueError: if psk and psk_id are not both set or unset or with a wrong size
98+
"""
8899
# check parameters
89100
if psk_id is not None and psk_id.__len__() != 4:
90101
raise ValueError("psk_id must be a 4 bytes bytearray")
@@ -109,7 +120,9 @@ def update_entries(self, override=False):
109120
110121
:param override: if True, if an app config is already present that doesn't
111122
follow the TLV format, full app config is overriden with TLV format with this entry
112-
:return: True if all specified sinks are updated
123+
:return: True if all specified sinks are updated, False otherwise.
124+
125+
.. warning:: If returned value is False, only a subset of sinks may be updated
113126
"""
114127

115128
if self._new_entries.__len__() == 0 and \
@@ -177,6 +190,7 @@ def update_entries(self, override=False):
177190
logging.info("Check done, doing the change")
178191
logging.debug("New configs are: %s" % new_configs)
179192

193+
res = True
180194
for gw, sink, app_config, seq, diag in new_configs:
181195
new_config = {}
182196
new_config["app_config_data"] = app_config
@@ -187,6 +201,7 @@ def update_entries(self, override=False):
187201
self.wni.set_sink_config(gw, sink, new_config)
188202
except TimeoutError:
189203
logging.error("Issue when setting new app config to [%s][%s]" % (gw, sink))
204+
res = False
190205
continue
191206

192207
logging.info("New app config set for [%s][%s]" % (gw, sink))
@@ -195,7 +210,7 @@ def update_entries(self, override=False):
195210
self._removed_entries = list()
196211
self._new_entries = dict()
197212

198-
return True
213+
return res
199214

200215
def __str__(self):
201216
str = ""

0 commit comments

Comments
 (0)