Skip to content

Commit aa53197

Browse files
Fixed minor bugs
1 parent 3b64a39 commit aa53197

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# robotframework-aprslib
22
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
33

4-
```robotframework-aprslib``` is a [Robot Framework](https://www.robotframework.org) keyword collection for the [aprslib](https://github.com/rossengeorgiev/aprs-python) Python library. It allows licensed ham radio operators to establish a connection to the APRS-IS servers and send/receive/decode APRS requests.
4+
```robotframework-aprslib``` is a [Robot Framework](https://www.robotframework.org) keyword collection for the [aprslib](https://github.com/rossengeorgiev/aprs-python) Python library. It allows __licensed ham radio operators__ to establish a connection to the APRS-IS servers and send/receive/decode APRS requests.
55

66
## Default settings for a new APRS-IS connection
77

@@ -66,8 +66,8 @@ My first test case
6666
|``Receive APRS Packet``|Receives an APRS packet to APRS-IS in case an open connection to the APRS-IS network has been established. The default setting uses the parameter values ``immortal`` = ``True`` and ``raw``= ``False``, meaning that aprslib will try to re-establish the connection in case it is lost and will also auto-decode APRS packets when received|``immortal`` and ``raw`` (both boolean params)|
6767
|``Get <field name> Value from APRS Packet``|various wrappers; e.g. ``Get Message Text Value From APRS Packet`` will return the decoded message string if it is present in the message|``aprs_packet``. If you specify a field that does not exit in the packet, this keyword will cause an error. Both raw and decoded messages are supported.|
6868
|``Get Value From APRS Packet``|called by the aporementioned ``Get <field name> Value fron APRS Packet`` functions |``aprs_packet`` and ``field_name``. If you specify a field that does not exit in the packet, this keyword will cause an error. Both raw and decoded messages are supported.|
69-
|``APRS Packet Should Contain <field name>``|Similar to ``Get <field name> Value From APRS Packet`` but only returns ``True``/``False`` in case the field does / does not exit|``aprs_packet`` and ``field_name``. Raw and decoded messages are supported.|
70-
|``APRS Packet Should Contain``|called by the aforementioned ``APRS Packet Should Contain <field name>`` functions |``aprs_packet`` and ``field_name``|
69+
|``Check If APRS Packet Contains <field name>``|Similar to ``Get <field name> Value From APRS Packet`` but returns ``True``/``False`` in case the field does / does not exit|``aprs_packet`` and ``field_name``. Both raw and decoded messages are supported.|
70+
|``Check If APRS Packet Contains``|called by the aforementioned ``Check If APRS Packet Contains <field name>`` functions |``aprs_packet`` and ``field_name``|
7171
|``Get APRS MsgNo``, ``Set APRS MsgNo``, ``Increment APRS MsgNo`` and ``Get APRS MsgNo as Alphanumeric``| Gets and sets the MsgNo that you can use for building up your own messages (aka library-maintained counter value). The ``alphanumeric`` keyword provides the message number in a format which [supports the more recent replyack scheme](http://www.aprs.org/aprs11/replyacks.txt). An ``increment`` to the value of ``675`` (``ZZ``) will automatically reset the value to ``0`` (``AA``). ``Get APRS MsgNo`` does NOT automatically increment the message number.|``Set APRS MsgNo`` allows you to set a numeric value between 0 and 675 (equals ``AA`` to ``ZZ``). All other keywords have no parameters.|
7272

7373
## Known issues

src/AprsLibrary.py

+12-20
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
)
3232
logger = logging.getLogger(__name__)
3333

34-
__version__ = "0.3.2"
34+
__version__ = "0.3.3"
3535
__author__ = "Joerg Schultze-Lutter"
3636

3737

@@ -463,11 +463,7 @@ def get_msgno(self, aprs_packet):
463463
# find out if a field exists or not.
464464
@keyword("Get Value From APRS Packet")
465465
def get_value_from_aprs_packet(self, aprs_packet, field_name):
466-
t_dict = type(dict())
467-
t_str = type(str())
468-
t_byte = type(bytes())
469-
470-
valid_message_types = [t_dict, t_str, t_byte]
466+
valid_message_types = [type(dict), type(str), type(byte)]
471467
if type(aprs_packet) not in valid_message_types:
472468
raise TypeError("This does not look like a valid APRS message type")
473469

@@ -496,49 +492,49 @@ def get_value_from_aprs_packet(self, aprs_packet, field_name):
496492
# All keywords can process raw (byte-format or str-format) as well as
497493
# processed APRS messages (which exist as dict objects)
498494

499-
@keyword("APRS Packet Should Contain Format")
495+
@keyword("Check If APRS Packet Contains Format")
500496
def check_packet_format(self, aprs_packet):
501497
return self.check_if_field_exists_in_packet(
502498
aprs_packet=aprs_packet, field_name="format"
503499
)
504500

505-
@keyword("APRS Message Should Contain Raw Message")
501+
@keyword("Check If APRS Packet Contains Raw Message")
506502
def check_packet_raw(self, aprs_packet):
507503
return self.check_if_field_exists_in_packet(
508504
aprs_packet=aprs_packet, field_name="raw"
509505
)
510506

511-
@keyword("APRS Message Should Contain From")
507+
@keyword("Check If APRS Packet Contains From")
512508
def check_packet_from(self, aprs_packet):
513509
return self.check_if_field_exists_in_packet(
514510
aprs_packet=aprs_packet, field_name="from"
515511
)
516512

517-
@keyword("APRS Message Should Contain To")
513+
@keyword("Check If APRS Packet Contains To")
518514
def check_packet_to(self, aprs_packet):
519515
return self.check_if_field_exists_in_packet(
520516
aprs_packet=aprs_packet, field_name="to"
521517
)
522518

523-
@keyword("APRS Message Should Contain Message Text")
519+
@keyword("Check If APRS Packet Contains Message Text")
524520
def check_packet_text(self, aprs_packet):
525521
return self.check_if_field_exists_in_packet(
526522
aprs_packet=aprs_packet, field_name="message_text"
527523
)
528524

529-
@keyword("APRS Message Should Contain Response")
525+
@keyword("Check If APRS Packet Contains Response")
530526
def check_packet_response(self, aprs_packet):
531527
return self.check_if_field_exists_in_packet(
532528
aprs_packet=aprs_packet, field_name="response"
533529
)
534530

535-
@keyword("APRS Message Should Contain Adresse")
531+
@keyword("Check If APRS Packet Contains Adresse")
536532
def check_packet_addresse(self, aprs_packet):
537533
return self.check_if_field_exists_in_packet(
538534
aprs_packet=aprs_packet, field_name="addresse"
539535
)
540536

541-
@keyword("APRS Message Should Contain Message Number")
537+
@keyword("Check If APRS Packet Contains Message Number")
542538
def check_packet_msgno(self, aprs_packet):
543539
return self.check_if_field_exists_in_packet(
544540
aprs_packet=aprs_packet, field_name="msgNo"
@@ -547,13 +543,9 @@ def check_packet_msgno(self, aprs_packet):
547543
# This is the core function which will check if a field exists
548544
# in our packet(s). The packet can either be in
549545
# raw format (str or bytes) OR decoded.
550-
@keyword("APRS Message should contain")
546+
@keyword("Check If APRS Packet Contains")
551547
def check_if_field_exists_in_packet(self, aprs_packet, field_name):
552-
t_dict = type(dict())
553-
t_str = type(str())
554-
t_byte = type(bytes())
555-
556-
valid_message_types = [t_dict, t_str, t_byte]
548+
valid_message_types = [type(dict), type(str), type(byte)]
557549
if type(aprs_packet) not in valid_message_types:
558550
raise TypeError("This does not look like a valid APRS message type")
559551

0 commit comments

Comments
 (0)