aprsd 4.1.2__py3-none-any.whl → 4.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. aprsd/client/__init__.py +5 -13
  2. aprsd/client/client.py +156 -0
  3. aprsd/client/drivers/__init__.py +10 -0
  4. aprsd/client/drivers/aprsis.py +174 -255
  5. aprsd/client/drivers/fake.py +59 -11
  6. aprsd/client/drivers/lib/__init__.py +0 -0
  7. aprsd/client/drivers/lib/aprslib.py +296 -0
  8. aprsd/client/drivers/registry.py +86 -0
  9. aprsd/client/drivers/tcpkiss.py +423 -0
  10. aprsd/client/stats.py +2 -2
  11. aprsd/cmds/dev.py +6 -4
  12. aprsd/cmds/fetch_stats.py +2 -0
  13. aprsd/cmds/list_plugins.py +6 -133
  14. aprsd/cmds/listen.py +5 -3
  15. aprsd/cmds/send_message.py +8 -5
  16. aprsd/cmds/server.py +7 -11
  17. aprsd/conf/common.py +7 -1
  18. aprsd/exception.py +7 -0
  19. aprsd/log/log.py +1 -1
  20. aprsd/main.py +0 -7
  21. aprsd/packets/core.py +168 -169
  22. aprsd/packets/log.py +69 -59
  23. aprsd/plugin.py +3 -2
  24. aprsd/plugin_utils.py +2 -2
  25. aprsd/plugins/weather.py +2 -2
  26. aprsd/stats/collector.py +5 -4
  27. aprsd/threads/rx.py +13 -11
  28. aprsd/threads/tx.py +32 -31
  29. aprsd/utils/keepalive_collector.py +7 -5
  30. aprsd/utils/package.py +176 -0
  31. {aprsd-4.1.2.dist-info → aprsd-4.2.1.dist-info}/METADATA +48 -48
  32. {aprsd-4.1.2.dist-info → aprsd-4.2.1.dist-info}/RECORD +37 -37
  33. {aprsd-4.1.2.dist-info → aprsd-4.2.1.dist-info}/WHEEL +1 -1
  34. aprsd/client/aprsis.py +0 -183
  35. aprsd/client/base.py +0 -156
  36. aprsd/client/drivers/kiss.py +0 -144
  37. aprsd/client/factory.py +0 -91
  38. aprsd/client/fake.py +0 -49
  39. aprsd/client/kiss.py +0 -143
  40. {aprsd-4.1.2.dist-info → aprsd-4.2.1.dist-info}/entry_points.txt +0 -0
  41. {aprsd-4.1.2.dist-info → aprsd-4.2.1.dist-info/licenses}/AUTHORS +0 -0
  42. {aprsd-4.1.2.dist-info → aprsd-4.2.1.dist-info/licenses}/LICENSE +0 -0
  43. {aprsd-4.1.2.dist-info → aprsd-4.2.1.dist-info}/top_level.txt +0 -0
aprsd/cmds/listen.py CHANGED
@@ -17,7 +17,7 @@ from rich.console import Console
17
17
  # local imports here
18
18
  import aprsd
19
19
  from aprsd import cli_helper, packets, plugin, threads, utils
20
- from aprsd.client import client_factory
20
+ from aprsd.client.client import APRSDClient
21
21
  from aprsd.main import cli
22
22
  from aprsd.packets import collector as packet_collector
23
23
  from aprsd.packets import core, seen_list
@@ -221,7 +221,9 @@ def listen(
221
221
  # CONF.aprs_network.login = aprs_login
222
222
  # config["aprs"]["password"] = aprs_password
223
223
 
224
+ LOG.info(f'Python version: {sys.version}')
224
225
  LOG.info(f'APRSD Listen Started version: {aprsd.__version__}')
226
+ utils.package.log_installed_extensions_and_plugins()
225
227
 
226
228
  CONF.log_opt_values(LOG, logging.DEBUG)
227
229
  collector.Collector()
@@ -232,13 +234,13 @@ def listen(
232
234
  # Initialize the client factory and create
233
235
  # The correct client object ready for use
234
236
  # Make sure we have 1 client transport enabled
235
- if not client_factory.is_client_enabled():
237
+ if not APRSDClient().is_enabled:
236
238
  LOG.error('No Clients are enabled in config.')
237
239
  sys.exit(-1)
238
240
 
239
241
  # Creates the client object
240
242
  LOG.info('Creating client connection')
241
- aprs_client = client_factory.create()
243
+ aprs_client = APRSDClient()
242
244
  LOG.info(aprs_client)
243
245
  if not aprs_client.login_success:
244
246
  # We failed to login, will just quit!
@@ -13,8 +13,9 @@ from aprsd import (
13
13
  cli_helper,
14
14
  conf, # noqa : F401
15
15
  packets,
16
+ utils,
16
17
  )
17
- from aprsd.client import client_factory
18
+ from aprsd.client.client import APRSDClient
18
19
  from aprsd.main import cli
19
20
  from aprsd.packets import collector
20
21
  from aprsd.packets import log as packet_log
@@ -89,7 +90,9 @@ def send_message(
89
90
  else:
90
91
  aprs_password = CONF.aprs_network.password
91
92
 
92
- LOG.info(f'APRSD LISTEN Started version: {aprsd.__version__}')
93
+ LOG.info(f'Python version: {sys.version}')
94
+ LOG.info(f'APRSD SEND_MESSAGE Started version: {aprsd.__version__}')
95
+ utils.package.log_installed_extensions_and_plugins()
93
96
  if type(command) is tuple:
94
97
  command = ' '.join(command)
95
98
  if not quiet:
@@ -103,7 +106,7 @@ def send_message(
103
106
 
104
107
  def rx_packet(packet):
105
108
  global got_ack, got_response
106
- cl = client_factory.create()
109
+ cl = APRSDClient()
107
110
  packet = cl.decode_packet(packet)
108
111
  collector.PacketCollector().rx(packet)
109
112
  packet_log.log(packet, tx=False)
@@ -131,7 +134,7 @@ def send_message(
131
134
  sys.exit(0)
132
135
 
133
136
  try:
134
- client_factory.create().client # noqa: B018
137
+ APRSDClient().client # noqa: B018
135
138
  except LoginError:
136
139
  sys.exit(-1)
137
140
 
@@ -163,7 +166,7 @@ def send_message(
163
166
  # This will register a packet consumer with aprslib
164
167
  # When new packets come in the consumer will process
165
168
  # the packet
166
- aprs_client = client_factory.create().client
169
+ aprs_client = APRSDClient()
167
170
  aprs_client.consumer(rx_packet, raw=False)
168
171
  except aprslib.exceptions.ConnectionDrop:
169
172
  LOG.error('Connection dropped, reconnecting')
aprsd/cmds/server.py CHANGED
@@ -8,7 +8,7 @@ from oslo_config import cfg
8
8
  import aprsd
9
9
  from aprsd import cli_helper, plugin, threads, utils
10
10
  from aprsd import main as aprsd_main
11
- from aprsd.client import client_factory
11
+ from aprsd.client.client import APRSDClient
12
12
  from aprsd.main import cli
13
13
  from aprsd.packets import collector as packet_collector
14
14
  from aprsd.packets import seen_list
@@ -40,31 +40,27 @@ def server(ctx, flush):
40
40
 
41
41
  service_threads = service.ServiceThreads()
42
42
 
43
+ LOG.info(f'Python version: {sys.version}')
44
+ LOG.info(f'APRSD Started version: {aprsd.__version__}')
43
45
  level, msg = utils._check_version()
44
46
  if level:
45
47
  LOG.warning(msg)
46
48
  else:
47
49
  LOG.info(msg)
48
- LOG.info(f'APRSD Started version: {aprsd.__version__}')
49
-
50
- # Initialize the client factory and create
51
- # The correct client object ready for use
52
- if not client_factory.is_client_enabled():
53
- LOG.error('No Clients are enabled in config.')
54
- sys.exit(-1)
50
+ utils.package.log_installed_extensions_and_plugins()
55
51
 
56
52
  # Make sure we have 1 client transport enabled
57
- if not client_factory.is_client_enabled():
53
+ if not APRSDClient().is_enabled:
58
54
  LOG.error('No Clients are enabled in config.')
59
55
  sys.exit(-1)
60
56
 
61
- if not client_factory.is_client_configured():
57
+ if not APRSDClient().is_configured:
62
58
  LOG.error('APRS client is not properly configured in config file.')
63
59
  sys.exit(-1)
64
60
 
65
61
  # Creates the client object
66
62
  LOG.info('Creating client connection')
67
- aprs_client = client_factory.create()
63
+ aprs_client = APRSDClient()
68
64
  LOG.info(aprs_client)
69
65
  if not aprs_client.login_success:
70
66
  # We failed to login, will just quit!
aprsd/conf/common.py CHANGED
@@ -19,7 +19,7 @@ registry_group = cfg.OptGroup(
19
19
  aprsd_opts = [
20
20
  cfg.StrOpt(
21
21
  'callsign',
22
- required=True,
22
+ default='NOCALL',
23
23
  help='Callsign to use for messages sent by APRSD',
24
24
  ),
25
25
  cfg.BoolOpt(
@@ -137,6 +137,12 @@ aprsd_opts = [
137
137
  help='Set this to False, to disable sending of ack packets. This will entirely stop'
138
138
  'APRSD from sending ack packets.',
139
139
  ),
140
+ cfg.BoolOpt(
141
+ 'is_digipi',
142
+ default=False,
143
+ help='Set this to True, if APRSD is running on a Digipi.'
144
+ 'This is useful for changing the behavior of APRSD to work with Digipi.',
145
+ ),
140
146
  ]
141
147
 
142
148
  watch_list_opts = [
aprsd/exception.py CHANGED
@@ -13,3 +13,10 @@ class ConfigOptionBogusDefaultException(Exception):
13
13
  f"Config file option '{config_option}' needs to be "
14
14
  f"changed from provided default of '{default_fail}'"
15
15
  )
16
+
17
+
18
+ class APRSClientNotConfiguredException(Exception):
19
+ """APRS client is not configured."""
20
+
21
+ def __init__(self):
22
+ self.message = 'APRS client is not configured.'
aprsd/log/log.py CHANGED
@@ -85,7 +85,7 @@ def setup_logging(loglevel=None, quiet=False, custom_handler=None):
85
85
  logging.getLogger(name).propagate = name not in disable_list
86
86
 
87
87
  handlers = []
88
- if CONF.logging.enable_console_stdout:
88
+ if CONF.logging.enable_console_stdout and not quiet:
89
89
  handlers.append(
90
90
  {
91
91
  'sink': sys.stdout,
aprsd/main.py CHANGED
@@ -23,7 +23,6 @@
23
23
  import datetime
24
24
  import importlib.metadata as imp
25
25
  import logging
26
- import signal
27
26
  import sys
28
27
  import time
29
28
  from importlib.metadata import version as metadata_version
@@ -41,7 +40,6 @@ from aprsd.stats import collector
41
40
  CONF = cfg.CONF
42
41
  LOG = logging.getLogger('APRSD')
43
42
  CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
44
- flask_enabled = False
45
43
 
46
44
 
47
45
  @click.group(cls=cli_helper.AliasedGroup, context_settings=CONTEXT_SETTINGS)
@@ -73,8 +71,6 @@ def main():
73
71
 
74
72
 
75
73
  def signal_handler(sig, frame):
76
- global flask_enabled
77
-
78
74
  click.echo('signal_handler: called')
79
75
  threads.APRSDThreadList().stop_all()
80
76
  if 'subprocess' not in str(frame):
@@ -96,9 +92,6 @@ def signal_handler(sig, frame):
96
92
  # signal.signal(signal.SIGTERM, sys.exit(0))
97
93
  # sys.exit(0)
98
94
 
99
- if flask_enabled:
100
- signal.signal(signal.SIGTERM, sys.exit(0))
101
-
102
95
 
103
96
  @cli.command()
104
97
  @cli_helper.add_options(cli_helper.common_options)