Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Check for downlink
for event in events:
# Format: ,[,][,],[,<data>]
event_items = event.split(',')
status = event_items.pop(0)
status = self._int(status)
if status == EventCode.RECV_DATA:
self._add_downlink(event_items)
# Check for errors
for event in events:
status = event.split(',')[0]
status = self._int(status)
if status not in (EventCode.RECV_DATA,
EventCode.TX_COMFIRMED,
EventCode.TX_UNCOMFIRMED):
raise Rak811EventError(status)
</data>
- dev_eui
- app_eui
- app_key
This call is "blocking", it will return only after the join completes.
The following exceptions can be raised:
- Rak811TimeoutError: join didn't succeed in time
- Rak811EventError: join failed
"""
self._send_command('join=otaa')
# Waiting join completion
for event in self._get_events():
status = event.split(',')[0]
status = self._int(status)
if status != EventCode.JOINED_SUCCESS:
raise Rak811EventError(status)
data = hexlify(data).decode('ascii')
self._send_command('txc=' + ','.join((
str(cnt),
str(interval * 1000),
data
)))
# Process events
events = self._get_events((cnt * (interval + 10)) - interval)
# Check for errors
for event in events:
status = event.split(',')[0]
status = self._int(status)
if status != EventCode.P2PTX_COMPLETE:
raise Rak811EventError(status)