ReticulumTelemetryHub 0.1.0__py3-none-any.whl → 0.1.2__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.

Potentially problematic release.


This version of ReticulumTelemetryHub might be problematic. Click here for more details.

Files changed (25) hide show
  1. reticulum_telemetry_hub/lxmf_telemetry/model/fields/field_telemetry_stream.py +7 -0
  2. {lxmf_telemetry → reticulum_telemetry_hub/lxmf_telemetry}/model/persistance/sensors/location.py +1 -1
  3. {lxmf_telemetry → reticulum_telemetry_hub/lxmf_telemetry}/model/persistance/sensors/magnetic_field.py +1 -1
  4. {lxmf_telemetry → reticulum_telemetry_hub/lxmf_telemetry}/model/persistance/sensors/time.py +2 -2
  5. {lxmf_telemetry → reticulum_telemetry_hub/lxmf_telemetry}/telemetry_controller.py +4 -4
  6. reticulum_telemetry_hub/reticulum_server/__init__.py +0 -0
  7. reticulum_telemetry_hub/reticulum_server/__main__.py +311 -0
  8. reticulumtelemetryhub-0.1.2.dist-info/LICENSE +437 -0
  9. reticulumtelemetryhub-0.1.2.dist-info/METADATA +139 -0
  10. reticulumtelemetryhub-0.1.2.dist-info/RECORD +21 -0
  11. lxmf_telemetry/model/fields/field_telemetry_stream.py +0 -7
  12. reticulum_server/main.py +0 -182
  13. reticulumtelemetryhub-0.1.0.dist-info/METADATA +0 -15
  14. reticulumtelemetryhub-0.1.0.dist-info/RECORD +0 -19
  15. {lxmf_telemetry → reticulum_telemetry_hub}/__init__.py +0 -0
  16. {lxmf_telemetry/model/persistance/sensors → reticulum_telemetry_hub/lxmf_telemetry}/__init__.py +0 -0
  17. {lxmf_telemetry → reticulum_telemetry_hub/lxmf_telemetry}/model/persistance/__init__.py +0 -0
  18. {lxmf_telemetry → reticulum_telemetry_hub/lxmf_telemetry}/model/persistance/appearance.py +0 -0
  19. {lxmf_telemetry → reticulum_telemetry_hub/lxmf_telemetry}/model/persistance/peer.py +0 -0
  20. {reticulum_server → reticulum_telemetry_hub/lxmf_telemetry/model/persistance/sensors}/__init__.py +0 -0
  21. {lxmf_telemetry → reticulum_telemetry_hub/lxmf_telemetry}/model/persistance/sensors/sensor.py +0 -0
  22. {lxmf_telemetry → reticulum_telemetry_hub/lxmf_telemetry}/model/persistance/sensors/sensor_enum.py +0 -0
  23. {lxmf_telemetry → reticulum_telemetry_hub/lxmf_telemetry}/model/persistance/sensors/sensor_mapping.py +0 -0
  24. {lxmf_telemetry → reticulum_telemetry_hub/lxmf_telemetry}/model/persistance/telemeter.py +0 -0
  25. {reticulumtelemetryhub-0.1.0.dist-info → reticulumtelemetryhub-0.1.2.dist-info}/WHEEL +0 -0
@@ -0,0 +1,7 @@
1
+ from reticulum_telemetry_hub.lxmf_telemetry.model.persistance.telemeter import Telemeter
2
+
3
+
4
+ class FieldTelmetryStream():
5
+
6
+ telemeters: list[Telemeter]
7
+
@@ -1,5 +1,5 @@
1
1
  from sqlalchemy import Column
2
- from lxmf_telemetry.model.persistance.sensors.sensor import Sensor
2
+ from reticulum_telemetry_hub.lxmf_telemetry.model.persistance.sensors.sensor import Sensor
3
3
  from .sensor_enum import SID_LOCATION
4
4
  import struct
5
5
  import RNS
@@ -1,5 +1,5 @@
1
1
  from sqlalchemy import Column
2
- from lxmf_telemetry.model.persistance.sensors.sensor import Sensor
2
+ from reticulum_telemetry_hub.lxmf_telemetry.model.persistance.sensors.sensor import Sensor
3
3
  from .sensor_enum import SID_MAGNETIC_FIELD
4
4
  import struct
5
5
  import RNS
@@ -4,8 +4,8 @@ from typing import Optional
4
4
  from sqlalchemy import ForeignKey, DateTime
5
5
  from sqlalchemy.orm import Mapped, mapped_column
6
6
 
7
- from lxmf_telemetry.model.persistance.sensors.sensor_enum import SID_TIME
8
- from lxmf_telemetry.model.persistance.sensors.sensor import Sensor
7
+ from reticulum_telemetry_hub.lxmf_telemetry.model.persistance.sensors.sensor_enum import SID_TIME
8
+ from reticulum_telemetry_hub.lxmf_telemetry.model.persistance.sensors.sensor import Sensor
9
9
 
10
10
  class Time(Sensor):
11
11
  __tablename__ = 'Time'
@@ -3,11 +3,11 @@ from datetime import datetime
3
3
  import LXMF
4
4
  import RNS
5
5
  from msgpack import packb, unpackb
6
- from lxmf_telemetry.model.persistance import Base
7
- from lxmf_telemetry.model.persistance.sensors.sensor import Sensor
8
- from lxmf_telemetry.model.persistance.telemeter import Telemeter
6
+ from reticulum_telemetry_hub.lxmf_telemetry.model.persistance import Base
7
+ from reticulum_telemetry_hub.lxmf_telemetry.model.persistance.sensors.sensor import Sensor
8
+ from reticulum_telemetry_hub.lxmf_telemetry.model.persistance.telemeter import Telemeter
9
9
 
10
- from lxmf_telemetry.model.persistance.sensors.sensor_mapping import sid_mapping
10
+ from reticulum_telemetry_hub.lxmf_telemetry.model.persistance.sensors.sensor_mapping import sid_mapping
11
11
  from sqlalchemy import create_engine
12
12
  from sqlalchemy.orm import sessionmaker, Session, joinedload
13
13
 
File without changes
@@ -0,0 +1,311 @@
1
+ """
2
+ Reticulum Telemetry Hub (RTH) - Main Execution Script
3
+
4
+ This code initializes and manages the Reticulum Telemetry Hub (RTH) as part of the RNS ecosystem.
5
+ The hub is designed to provide TCP node functionalities, to handle telemetry data collection, message routing, and peer communication within a Reticulum network.
6
+
7
+ Key Components:
8
+ - **TelemetryController**: Manages telemetry data and command handling.
9
+ - **AnnounceHandler**: Listens for and processes announcements from other nodes in the Reticulum network.
10
+ - **LXMF Router**: Manages message delivery, routing, and storage within the LXMF protocol.
11
+
12
+ Functionalities:
13
+ - **One to Many Messages**: Broadcasts messages to all connected clients (experimental).
14
+ - **Telemetry Collector**: Stores telemetry data from connected clients (currently supporting Sideband).
15
+ - **Replication Node**: Saves messages for later delivery if the recipient is offline.
16
+ - **Reticulum Transport**: Routes traffic, passes network announcements, and handles path requests.
17
+
18
+ Usage:
19
+ - The script loads or generates an identity for the hub, configures the LXMF router, and starts the main loop.
20
+ - It supports manual commands to announce the hub identity or request telemetry from a specific connection.
21
+
22
+ Configuration:
23
+ - Modify `STORAGE_PATH` and `IDENTITY_PATH` to change where data is stored.
24
+ - The `APP_NAME` constant defines the application name used in LXMF.
25
+
26
+ Running the Script:
27
+ - Execute this script directly to start the hub and enter the interactive command loop.
28
+ - Commands include `exit` to terminate, `announce` to re-announce the hub identity, and `telemetry` to request telemetry from a connected peer.
29
+
30
+ Author: FreeTAKTeam
31
+ Date: Aug 2024
32
+ """
33
+
34
+ import os
35
+ import time
36
+ import LXMF
37
+ import RNS
38
+ import argparse
39
+ from pathlib import Path
40
+ from reticulum_telemetry_hub.lxmf_telemetry.telemetry_controller import (
41
+ TelemetryController,
42
+ )
43
+
44
+ # Constants
45
+ STORAGE_PATH = "RTH_Store" # Path to store temporary files
46
+ IDENTITY_PATH = os.path.join(STORAGE_PATH, "identity") # Path to store identity file
47
+ APP_NAME = LXMF.APP_NAME + ".delivery" # Application name for LXMF
48
+ PLUGIN_COMMAND = (
49
+ 0 # Command to join the network, equivalent to ping on the sideband client
50
+ )
51
+
52
+
53
+ class AnnounceHandler:
54
+ """Handles announcements from other nodes in the Reticulum network."""
55
+
56
+ def __init__(self, identities):
57
+ self.aspect_filter = APP_NAME # Filter for LXMF announcements
58
+ self.identities = identities # Dictionary to store identities
59
+
60
+ def received_announce(self, destination_hash, announced_identity, app_data):
61
+ # Log the received announcement details
62
+ RNS.log("\t+--- LXMF Announcement -----------------------------------------")
63
+ RNS.log(f"\t| Source hash : {RNS.prettyhexrep(destination_hash)}")
64
+ RNS.log(f"\t| Announced identity : {announced_identity}")
65
+ RNS.log(f"\t| App data : {app_data}")
66
+ RNS.log("\t+---------------------------------------------------------------")
67
+ self.identities[destination_hash] = app_data.decode("utf-8")
68
+
69
+
70
+ class ReticulumTelemetryHub:
71
+ """Reticulum Telemetry Hub (RTH)"""
72
+
73
+ lxm_router: LXMF.LXMRouter
74
+ connections: dict[bytes, RNS.Destination]
75
+ identities: dict[str, str]
76
+ my_lxmf_dest: RNS.Destination
77
+ ret: RNS.Reticulum
78
+ storage_path: Path
79
+ identity_path: Path
80
+ tel_controller: TelemetryController
81
+
82
+ def __init__(self, display_name: str, storage_path: Path, identity_path: Path):
83
+ self.ret = RNS.Reticulum() # Initialize Reticulum
84
+ self.tel_controller = TelemetryController() # Initialize telemetry controller
85
+ self.connections = {} # List to store connections
86
+
87
+ identity = self.load_or_generate_identity(
88
+ identity_path
89
+ ) # Load or generate identity
90
+
91
+ self.lxm_router = LXMF.LXMRouter(
92
+ storagepath=storage_path
93
+ ) # Initialize LXMF router
94
+
95
+ self.my_lxmf_dest = self.lxm_router.register_delivery_identity(
96
+ identity, display_name=display_name
97
+ ) # Register delivery identity
98
+
99
+ self.identities = {} # Dictionary to store identities
100
+
101
+ self.lxm_router.set_message_storage_limit(megabytes=5)
102
+
103
+ # Register delivery callback
104
+ self.lxm_router.register_delivery_callback(
105
+ lambda msg: self.delivery_callback(msg)
106
+ )
107
+
108
+ # Register announce handler
109
+ RNS.Transport.register_announce_handler(
110
+ AnnounceHandler(self.identities)
111
+ )
112
+
113
+ def command_handler(self, commands: list, message: LXMF.LXMessage):
114
+ """Handles commands received from the client and sends responses back.
115
+
116
+ Args:
117
+ commands (list): List of commands received from the client
118
+ message (LXMF.LXMessage): LXMF message object
119
+ """
120
+ for command in commands:
121
+ print(f"Command: {command}")
122
+ if PLUGIN_COMMAND in command and command[PLUGIN_COMMAND] == "join":
123
+ dest = RNS.Destination(
124
+ message.source.identity,
125
+ RNS.Destination.OUT,
126
+ RNS.Destination.SINGLE,
127
+ "lxmf",
128
+ "delivery",
129
+ )
130
+ self.connections[dest.identity.hash] = dest
131
+ RNS.log(f"Connection added: {message.source}")
132
+ confirmation = LXMF.LXMessage(
133
+ dest,
134
+ self.my_lxmf_dest,
135
+ "Connection established",
136
+ desired_method=LXMF.LXMessage.DIRECT,
137
+ )
138
+ self.lxm_router.handle_outbound(confirmation)
139
+ continue # Skip the rest of the loop
140
+ elif PLUGIN_COMMAND in command and command[PLUGIN_COMMAND] == "leave":
141
+ dest = RNS.Destination(
142
+ message.source.identity,
143
+ RNS.Destination.OUT,
144
+ RNS.Destination.SINGLE,
145
+ "lxmf",
146
+ "delivery",
147
+ )
148
+ self.connections.pop(dest.identity.hash, None)
149
+ RNS.log(f"Connection removed: {message.source}")
150
+ confirmation = LXMF.LXMessage(
151
+ dest,
152
+ self.my_lxmf_dest,
153
+ "Connection removed",
154
+ desired_method=LXMF.LXMessage.DIRECT,
155
+ )
156
+ self.lxm_router.handle_outbound(confirmation)
157
+ continue
158
+ msg = self.tel_controller.handle_command(
159
+ command, message, self.my_lxmf_dest
160
+ )
161
+ if msg:
162
+ self.lxm_router.handle_outbound(msg)
163
+
164
+ def delivery_callback(self, message: LXMF.LXMessage):
165
+ """Callback function to handle incoming messages.
166
+
167
+ Args:
168
+ message (LXMF.LXMessage): LXMF message object
169
+ """
170
+ try:
171
+ # Format the timestamp of the message
172
+ time_string = time.strftime(
173
+ "%Y-%m-%d %H:%M:%S", time.localtime(message.timestamp)
174
+ )
175
+ signature_string = "Signature is invalid, reason undetermined"
176
+
177
+ # Determine the signature validation status
178
+ if message.signature_validated:
179
+ signature_string = "Validated"
180
+ elif message.unverified_reason == LXMF.LXMessage.SIGNATURE_INVALID:
181
+ signature_string = "Invalid signature"
182
+ return
183
+ elif message.unverified_reason == LXMF.LXMessage.SOURCE_UNKNOWN:
184
+ signature_string = "Cannot verify, source is unknown"
185
+ return
186
+
187
+ # Log the delivery details
188
+ self.log_delivery_details(message, time_string, signature_string)
189
+
190
+ # Handle the commands
191
+ if message.signature_validated and LXMF.FIELD_COMMANDS in message.fields:
192
+ self.command_handler(message.fields[LXMF.FIELD_COMMANDS], message)
193
+
194
+ # Handle telemetry data
195
+ if self.tel_controller.handle_message(message):
196
+ RNS.log("Telemetry data saved")
197
+
198
+ # Skip if the message content is empty
199
+ if message.content is None or message.content == b"":
200
+ return
201
+
202
+ # Broadcast the message to all connected clients
203
+ msg = (
204
+ self.identities[message.get_source().hash]
205
+ + " > "
206
+ + message.content_as_string()
207
+ )
208
+ self.send_message(msg)
209
+ except Exception as e:
210
+ RNS.log(f"Error: {e}")
211
+
212
+ def send_message(self, message: str):
213
+ """Sends a message to all connected clients.
214
+
215
+ Args:
216
+ message (str): Message to send
217
+ """
218
+ for connection in self.connections:
219
+ response = LXMF.LXMessage(
220
+ connection,
221
+ self.my_lxmf_dest,
222
+ message,
223
+ desired_method=LXMF.LXMessage.DIRECT,
224
+ )
225
+ self.lxm_router.handle_outbound(response)
226
+
227
+ def log_delivery_details(self, message, time_string, signature_string):
228
+ RNS.log("\t+--- LXMF Delivery ---------------------------------------------")
229
+ RNS.log(f"\t| Source hash : {RNS.prettyhexrep(message.source_hash)}")
230
+ RNS.log(f"\t| Source instance : {message.get_source()}")
231
+ RNS.log(
232
+ f"\t| Destination hash : {RNS.prettyhexrep(message.destination_hash)}"
233
+ )
234
+ # RNS.log(f"\t| Destination identity : {message.source_identity}")
235
+ RNS.log(f"\t| Destination instance : {message.get_destination()}")
236
+ RNS.log(f"\t| Transport Encryption : {message.transport_encryption}")
237
+ RNS.log(f"\t| Timestamp : {time_string}")
238
+ RNS.log(f"\t| Title : {message.title_as_string()}")
239
+ RNS.log(f"\t| Content : {message.content_as_string()}")
240
+ RNS.log(f"\t| Fields : {message.fields}")
241
+ RNS.log(f"\t| Message signature : {signature_string}")
242
+ RNS.log("\t+---------------------------------------------------------------")
243
+
244
+ def load_or_generate_identity(self, identity_path):
245
+ # Load existing identity or generate a new one
246
+ if os.path.exists(identity_path):
247
+ try:
248
+ RNS.log("Loading existing identity")
249
+ return RNS.Identity.from_file(identity_path)
250
+ except:
251
+ RNS.log("Failed to load existing identity, generating new")
252
+ else:
253
+ RNS.log("Generating new identity")
254
+
255
+ identity = RNS.Identity() # Create a new identity
256
+ Path(identity_path).parent.mkdir(parents=True, exist_ok=True)
257
+ identity.to_file(identity_path) # Save the new identity to file
258
+ return identity
259
+
260
+ def interactive_loop(self):
261
+ # Periodically announce the LXMF identity
262
+ while True:
263
+ choice = input("Enter your choice (exit/announce/telemetry): ")
264
+
265
+ if choice == "exit":
266
+ break
267
+ elif choice == "announce":
268
+ self.my_lxmf_dest.announce()
269
+ elif choice == "telemetry":
270
+ connection_hash = input("Enter the connection hash: ")
271
+ found = False
272
+ for connection in self.connections:
273
+ if connection.hexhash == connection_hash:
274
+ message = LXMF.LXMessage(
275
+ connection,
276
+ self.my_lxmf_dest,
277
+ "Requesting telemetry",
278
+ desired_method=LXMF.LXMessage.DIRECT,
279
+ fields={
280
+ LXMF.FIELD_COMMANDS: [
281
+ {TelemetryController.TELEMETRY_REQUEST: 1000000000}
282
+ ]
283
+ },
284
+ )
285
+ self.lxm_router.handle_outbound(message)
286
+ found = True
287
+ break
288
+ if not found:
289
+ print("Connection not found")
290
+
291
+
292
+ if __name__ == "__main__":
293
+ ap = argparse.ArgumentParser()
294
+ ap.add_argument(
295
+ "-s", "--storage_dir", help="Storage directory path", default=STORAGE_PATH
296
+ )
297
+ ap.add_argument("--headless", action="store_true", help="Run in headless mode")
298
+ ap.add_argument("--display_name", help="Display name for the server", default="RTH")
299
+
300
+ args = ap.parse_args()
301
+
302
+ if args.storage_dir:
303
+ storage_path = args.storage_dir
304
+ identity_path = os.path.join(STORAGE_PATH, "identity")
305
+
306
+ reticulum_server = ReticulumTelemetryHub(
307
+ args.display_name, storage_path, identity_path
308
+ )
309
+
310
+ if not args.headless:
311
+ reticulum_server.interactive_loop()
@@ -0,0 +1,437 @@
1
+ Attribution-NonCommercial-ShareAlike 4.0 International
2
+
3
+ =======================================================================
4
+
5
+ Creative Commons Corporation ("Creative Commons") is not a law firm and
6
+ does not provide legal services or legal advice. Distribution of
7
+ Creative Commons public licenses does not create a lawyer-client or
8
+ other relationship. Creative Commons makes its licenses and related
9
+ information available on an "as-is" basis. Creative Commons gives no
10
+ warranties regarding its licenses, any material licensed under their
11
+ terms and conditions, or any related information. Creative Commons
12
+ disclaims all liability for damages resulting from their use to the
13
+ fullest extent possible.
14
+
15
+ Using Creative Commons Public Licenses
16
+
17
+ Creative Commons public licenses provide a standard set of terms and
18
+ conditions that creators and other rights holders may use to share
19
+ original works of authorship and other material subject to copyright
20
+ and certain other rights specified in the public license below. The
21
+ following considerations are for informational purposes only, are not
22
+ exhaustive, and do not form part of our licenses.
23
+
24
+ Considerations for licensors: Our public licenses are
25
+ intended for use by those authorized to give the public
26
+ permission to use material in ways otherwise restricted by
27
+ copyright and certain other rights. Our licenses are
28
+ irrevocable. Licensors should read and understand the terms
29
+ and conditions of the license they choose before applying it.
30
+ Licensors should also secure all rights necessary before
31
+ applying our licenses so that the public can reuse the
32
+ material as expected. Licensors should clearly mark any
33
+ material not subject to the license. This includes other CC-
34
+ licensed material, or material used under an exception or
35
+ limitation to copyright. More considerations for licensors:
36
+ wiki.creativecommons.org/Considerations_for_licensors
37
+
38
+ Considerations for the public: By using one of our public
39
+ licenses, a licensor grants the public permission to use the
40
+ licensed material under specified terms and conditions. If
41
+ the licensor's permission is not necessary for any reason--for
42
+ example, because of any applicable exception or limitation to
43
+ copyright--then that use is not regulated by the license. Our
44
+ licenses grant only permissions under copyright and certain
45
+ other rights that a licensor has authority to grant. Use of
46
+ the licensed material may still be restricted for other
47
+ reasons, including because others have copyright or other
48
+ rights in the material. A licensor may make special requests,
49
+ such as asking that all changes be marked or described.
50
+ Although not required by our licenses, you are encouraged to
51
+ respect those requests where reasonable. More considerations
52
+ for the public:
53
+ wiki.creativecommons.org/Considerations_for_licensees
54
+
55
+ =======================================================================
56
+
57
+ Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
58
+ Public License
59
+
60
+ By exercising the Licensed Rights (defined below), You accept and agree
61
+ to be bound by the terms and conditions of this Creative Commons
62
+ Attribution-NonCommercial-ShareAlike 4.0 International Public License
63
+ ("Public License"). To the extent this Public License may be
64
+ interpreted as a contract, You are granted the Licensed Rights in
65
+ consideration of Your acceptance of these terms and conditions, and the
66
+ Licensor grants You such rights in consideration of benefits the
67
+ Licensor receives from making the Licensed Material available under
68
+ these terms and conditions.
69
+
70
+
71
+ Section 1 -- Definitions.
72
+
73
+ a. Adapted Material means material subject to Copyright and Similar
74
+ Rights that is derived from or based upon the Licensed Material
75
+ and in which the Licensed Material is translated, altered,
76
+ arranged, transformed, or otherwise modified in a manner requiring
77
+ permission under the Copyright and Similar Rights held by the
78
+ Licensor. For purposes of this Public License, where the Licensed
79
+ Material is a musical work, performance, or sound recording,
80
+ Adapted Material is always produced where the Licensed Material is
81
+ synched in timed relation with a moving image.
82
+
83
+ b. Adapter's License means the license You apply to Your Copyright
84
+ and Similar Rights in Your contributions to Adapted Material in
85
+ accordance with the terms and conditions of this Public License.
86
+
87
+ c. BY-NC-SA Compatible License means a license listed at
88
+ creativecommons.org/compatiblelicenses, approved by Creative
89
+ Commons as essentially the equivalent of this Public License.
90
+
91
+ d. Copyright and Similar Rights means copyright and/or similar rights
92
+ closely related to copyright including, without limitation,
93
+ performance, broadcast, sound recording, and Sui Generis Database
94
+ Rights, without regard to how the rights are labeled or
95
+ categorized. For purposes of this Public License, the rights
96
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
97
+ Rights.
98
+
99
+ e. Effective Technological Measures means those measures that, in the
100
+ absence of proper authority, may not be circumvented under laws
101
+ fulfilling obligations under Article 11 of the WIPO Copyright
102
+ Treaty adopted on December 20, 1996, and/or similar international
103
+ agreements.
104
+
105
+ f. Exceptions and Limitations means fair use, fair dealing, and/or
106
+ any other exception or limitation to Copyright and Similar Rights
107
+ that applies to Your use of the Licensed Material.
108
+
109
+ g. License Elements means the license attributes listed in the name
110
+ of a Creative Commons Public License. The License Elements of this
111
+ Public License are Attribution, NonCommercial, and ShareAlike.
112
+
113
+ h. Licensed Material means the artistic or literary work, database,
114
+ or other material to which the Licensor applied this Public
115
+ License.
116
+
117
+ i. Licensed Rights means the rights granted to You subject to the
118
+ terms and conditions of this Public License, which are limited to
119
+ all Copyright and Similar Rights that apply to Your use of the
120
+ Licensed Material and that the Licensor has authority to license.
121
+
122
+ j. Licensor means the individual(s) or entity(ies) granting rights
123
+ under this Public License.
124
+
125
+ k. NonCommercial means not primarily intended for or directed towards
126
+ commercial advantage or monetary compensation. For purposes of
127
+ this Public License, the exchange of the Licensed Material for
128
+ other material subject to Copyright and Similar Rights by digital
129
+ file-sharing or similar means is NonCommercial provided there is
130
+ no payment of monetary compensation in connection with the
131
+ exchange.
132
+
133
+ l. Share means to provide material to the public by any means or
134
+ process that requires permission under the Licensed Rights, such
135
+ as reproduction, public display, public performance, distribution,
136
+ dissemination, communication, or importation, and to make material
137
+ available to the public including in ways that members of the
138
+ public may access the material from a place and at a time
139
+ individually chosen by them.
140
+
141
+ m. Sui Generis Database Rights means rights other than copyright
142
+ resulting from Directive 96/9/EC of the European Parliament and of
143
+ the Council of 11 March 1996 on the legal protection of databases,
144
+ as amended and/or succeeded, as well as other essentially
145
+ equivalent rights anywhere in the world.
146
+
147
+ n. You means the individual or entity exercising the Licensed Rights
148
+ under this Public License. Your has a corresponding meaning.
149
+
150
+
151
+ Section 2 -- Scope.
152
+
153
+ a. License grant.
154
+
155
+ 1. Subject to the terms and conditions of this Public License,
156
+ the Licensor hereby grants You a worldwide, royalty-free,
157
+ non-sublicensable, non-exclusive, irrevocable license to
158
+ exercise the Licensed Rights in the Licensed Material to:
159
+
160
+ a. reproduce and Share the Licensed Material, in whole or
161
+ in part, for NonCommercial purposes only; and
162
+
163
+ b. produce, reproduce, and Share Adapted Material for
164
+ NonCommercial purposes only.
165
+
166
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
167
+ Exceptions and Limitations apply to Your use, this Public
168
+ License does not apply, and You do not need to comply with
169
+ its terms and conditions.
170
+
171
+ 3. Term. The term of this Public License is specified in Section
172
+ 6(a).
173
+
174
+ 4. Media and formats; technical modifications allowed. The
175
+ Licensor authorizes You to exercise the Licensed Rights in
176
+ all media and formats whether now known or hereafter created,
177
+ and to make technical modifications necessary to do so. The
178
+ Licensor waives and/or agrees not to assert any right or
179
+ authority to forbid You from making technical modifications
180
+ necessary to exercise the Licensed Rights, including
181
+ technical modifications necessary to circumvent Effective
182
+ Technological Measures. For purposes of this Public License,
183
+ simply making modifications authorized by this Section 2(a)
184
+ (4) never produces Adapted Material.
185
+
186
+ 5. Downstream recipients.
187
+
188
+ a. Offer from the Licensor -- Licensed Material. Every
189
+ recipient of the Licensed Material automatically
190
+ receives an offer from the Licensor to exercise the
191
+ Licensed Rights under the terms and conditions of this
192
+ Public License.
193
+
194
+ b. Additional offer from the Licensor -- Adapted Material.
195
+ Every recipient of Adapted Material from You
196
+ automatically receives an offer from the Licensor to
197
+ exercise the Licensed Rights in the Adapted Material
198
+ under the conditions of the Adapter's License You apply.
199
+
200
+ c. No downstream restrictions. You may not offer or impose
201
+ any additional or different terms or conditions on, or
202
+ apply any Effective Technological Measures to, the
203
+ Licensed Material if doing so restricts exercise of the
204
+ Licensed Rights by any recipient of the Licensed
205
+ Material.
206
+
207
+ 6. No endorsement. Nothing in this Public License constitutes or
208
+ may be construed as permission to assert or imply that You
209
+ are, or that Your use of the Licensed Material is, connected
210
+ with, or sponsored, endorsed, or granted official status by,
211
+ the Licensor or others designated to receive attribution as
212
+ provided in Section 3(a)(1)(A)(i).
213
+
214
+ b. Other rights.
215
+
216
+ 1. Moral rights, such as the right of integrity, are not
217
+ licensed under this Public License, nor are publicity,
218
+ privacy, and/or other similar personality rights; however, to
219
+ the extent possible, the Licensor waives and/or agrees not to
220
+ assert any such rights held by the Licensor to the limited
221
+ extent necessary to allow You to exercise the Licensed
222
+ Rights, but not otherwise.
223
+
224
+ 2. Patent and trademark rights are not licensed under this
225
+ Public License.
226
+
227
+ 3. To the extent possible, the Licensor waives any right to
228
+ collect royalties from You for the exercise of the Licensed
229
+ Rights, whether directly or through a collecting society
230
+ under any voluntary or waivable statutory or compulsory
231
+ licensing scheme. In all other cases the Licensor expressly
232
+ reserves any right to collect such royalties, including when
233
+ the Licensed Material is used other than for NonCommercial
234
+ purposes.
235
+
236
+
237
+ Section 3 -- License Conditions.
238
+
239
+ Your exercise of the Licensed Rights is expressly made subject to the
240
+ following conditions.
241
+
242
+ a. Attribution.
243
+
244
+ 1. If You Share the Licensed Material (including in modified
245
+ form), You must:
246
+
247
+ a. retain the following if it is supplied by the Licensor
248
+ with the Licensed Material:
249
+
250
+ i. identification of the creator(s) of the Licensed
251
+ Material and any others designated to receive
252
+ attribution, in any reasonable manner requested by
253
+ the Licensor (including by pseudonym if
254
+ designated);
255
+
256
+ ii. a copyright notice;
257
+
258
+ iii. a notice that refers to this Public License;
259
+
260
+ iv. a notice that refers to the disclaimer of
261
+ warranties;
262
+
263
+ v. a URI or hyperlink to the Licensed Material to the
264
+ extent reasonably practicable;
265
+
266
+ b. indicate if You modified the Licensed Material and
267
+ retain an indication of any previous modifications; and
268
+
269
+ c. indicate the Licensed Material is licensed under this
270
+ Public License, and include the text of, or the URI or
271
+ hyperlink to, this Public License.
272
+
273
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
274
+ reasonable manner based on the medium, means, and context in
275
+ which You Share the Licensed Material. For example, it may be
276
+ reasonable to satisfy the conditions by providing a URI or
277
+ hyperlink to a resource that includes the required
278
+ information.
279
+ 3. If requested by the Licensor, You must remove any of the
280
+ information required by Section 3(a)(1)(A) to the extent
281
+ reasonably practicable.
282
+
283
+ b. ShareAlike.
284
+
285
+ In addition to the conditions in Section 3(a), if You Share
286
+ Adapted Material You produce, the following conditions also apply.
287
+
288
+ 1. The Adapter's License You apply must be a Creative Commons
289
+ license with the same License Elements, this version or
290
+ later, or a BY-NC-SA Compatible License.
291
+
292
+ 2. You must include the text of, or the URI or hyperlink to, the
293
+ Adapter's License You apply. You may satisfy this condition
294
+ in any reasonable manner based on the medium, means, and
295
+ context in which You Share Adapted Material.
296
+
297
+ 3. You may not offer or impose any additional or different terms
298
+ or conditions on, or apply any Effective Technological
299
+ Measures to, Adapted Material that restrict exercise of the
300
+ rights granted under the Adapter's License You apply.
301
+
302
+
303
+ Section 4 -- Sui Generis Database Rights.
304
+
305
+ Where the Licensed Rights include Sui Generis Database Rights that
306
+ apply to Your use of the Licensed Material:
307
+
308
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
309
+ to extract, reuse, reproduce, and Share all or a substantial
310
+ portion of the contents of the database for NonCommercial purposes
311
+ only;
312
+
313
+ b. if You include all or a substantial portion of the database
314
+ contents in a database in which You have Sui Generis Database
315
+ Rights, then the database in which You have Sui Generis Database
316
+ Rights (but not its individual contents) is Adapted Material,
317
+ including for purposes of Section 3(b); and
318
+
319
+ c. You must comply with the conditions in Section 3(a) if You Share
320
+ all or a substantial portion of the contents of the database.
321
+
322
+ For the avoidance of doubt, this Section 4 supplements and does not
323
+ replace Your obligations under this Public License where the Licensed
324
+ Rights include other Copyright and Similar Rights.
325
+
326
+
327
+ Section 5 -- Disclaimer of Warranties and Limitation of Liability.
328
+
329
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
330
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
331
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
332
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
333
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
334
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
335
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
336
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
337
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
338
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
339
+
340
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
341
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
342
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
343
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
344
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
345
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
346
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
347
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
348
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
349
+
350
+ c. The disclaimer of warranties and limitation of liability provided
351
+ above shall be interpreted in a manner that, to the extent
352
+ possible, most closely approximates an absolute disclaimer and
353
+ waiver of all liability.
354
+
355
+
356
+ Section 6 -- Term and Termination.
357
+
358
+ a. This Public License applies for the term of the Copyright and
359
+ Similar Rights licensed here. However, if You fail to comply with
360
+ this Public License, then Your rights under this Public License
361
+ terminate automatically.
362
+
363
+ b. Where Your right to use the Licensed Material has terminated under
364
+ Section 6(a), it reinstates:
365
+
366
+ 1. automatically as of the date the violation is cured, provided
367
+ it is cured within 30 days of Your discovery of the
368
+ violation; or
369
+
370
+ 2. upon express reinstatement by the Licensor.
371
+
372
+ For the avoidance of doubt, this Section 6(b) does not affect any
373
+ right the Licensor may have to seek remedies for Your violations
374
+ of this Public License.
375
+
376
+ c. For the avoidance of doubt, the Licensor may also offer the
377
+ Licensed Material under separate terms or conditions or stop
378
+ distributing the Licensed Material at any time; however, doing so
379
+ will not terminate this Public License.
380
+
381
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
382
+ License.
383
+
384
+
385
+ Section 7 -- Other Terms and Conditions.
386
+
387
+ a. The Licensor shall not be bound by any additional or different
388
+ terms or conditions communicated by You unless expressly agreed.
389
+
390
+ b. Any arrangements, understandings, or agreements regarding the
391
+ Licensed Material not stated herein are separate from and
392
+ independent of the terms and conditions of this Public License.
393
+
394
+
395
+ Section 8 -- Interpretation.
396
+
397
+ a. For the avoidance of doubt, this Public License does not, and
398
+ shall not be interpreted to, reduce, limit, restrict, or impose
399
+ conditions on any use of the Licensed Material that could lawfully
400
+ be made without permission under this Public License.
401
+
402
+ b. To the extent possible, if any provision of this Public License is
403
+ deemed unenforceable, it shall be automatically reformed to the
404
+ minimum extent necessary to make it enforceable. If the provision
405
+ cannot be reformed, it shall be severed from this Public License
406
+ without affecting the enforceability of the remaining terms and
407
+ conditions.
408
+
409
+ c. No term or condition of this Public License will be waived and no
410
+ failure to comply consented to unless expressly agreed to by the
411
+ Licensor.
412
+
413
+ d. Nothing in this Public License constitutes or may be interpreted
414
+ as a limitation upon, or waiver of, any privileges and immunities
415
+ that apply to the Licensor or You, including from the legal
416
+ processes of any jurisdiction or authority.
417
+
418
+ =======================================================================
419
+
420
+ Creative Commons is not a party to its public
421
+ licenses. Notwithstanding, Creative Commons may elect to apply one of
422
+ its public licenses to material it publishes and in those instances
423
+ will be considered the “Licensor.” The text of the Creative Commons
424
+ public licenses is dedicated to the public domain under the CC0 Public
425
+ Domain Dedication. Except for the limited purpose of indicating that
426
+ material is shared under a Creative Commons public license or as
427
+ otherwise permitted by the Creative Commons policies published at
428
+ creativecommons.org/policies, Creative Commons does not authorize the
429
+ use of the trademark "Creative Commons" or any other trademark or logo
430
+ of Creative Commons without its prior written consent including,
431
+ without limitation, in connection with any unauthorized modifications
432
+ to any of its public licenses or any other arrangements,
433
+ understandings, or agreements concerning use of licensed material. For
434
+ the avoidance of doubt, this paragraph does not form part of the
435
+ public licenses.
436
+
437
+ Creative Commons may be contacted at creativecommons.org.
@@ -0,0 +1,139 @@
1
+ Metadata-Version: 2.1
2
+ Name: ReticulumTelemetryHub
3
+ Version: 0.1.2
4
+ Summary:
5
+ Author: naman108
6
+ Requires-Python: >=3.10,<4.0
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: Python :: 3.10
9
+ Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Requires-Dist: lxmf (>=0.4.4,<0.5.0)
12
+ Requires-Dist: msgpack (>=1.0.8,<2.0.0)
13
+ Requires-Dist: pytest (>=8.3.2,<9.0.0)
14
+ Requires-Dist: sqlalchemy (>=2.0.32,<3.0.0)
15
+ Description-Content-Type: text/markdown
16
+
17
+ # Reticulum-Telemetry-Hub (RTH)
18
+ ![image](https://github.com/user-attachments/assets/ba29799c-7194-4052-aedf-1b5e1c8648d5)
19
+
20
+
21
+ Reticulum-Telemetry-Hub (RTH) is an independent component within the [Reticulum](https://reticulum.network/) / [lXMF](https://github.com/markqvist/LXMF) ecosystem, designed to manage a complete TCP node across a Reticulum-based network.
22
+ The RTH enable communication and data sharing between clients like [Sideband](https://github.com/FreeTAKTeam/Sideband](https://github.com/markqvist/Sideband)) or Meshchat, enhancing situational awareness and operational efficiency in distributed networks.
23
+
24
+ ## Core Functionalities
25
+
26
+ The Reticulum-Telemetry-Hub can perform the following key functions:
27
+
28
+ - **One to Many Messages**: RTH supports broadcasting messages to all connected clients.
29
+ - By sending a message to the hub, it will be distributed to all clients connected to the network. *(Initial implementation - Experimental)*
30
+ - **Telemetry Collector**: RTH acts as a telemetry data repository, collecting data from all connected clients.
31
+ Currently, this functionality is focused on Sideband clients that have enabled their Reticulum identity. By rewriting the code we hope to see a wider implementation of Telemetry in other applications.
32
+ - **Replication Node**: RTH uses the LXMF router to ensure message delivery even when the target client is offline. If a message's destination is not available at the time of sending, RTH will save the message and deliver it once the client comes online.
33
+ - **Reticulum Transport**: RTH uses Reticulum as a transport node, routing traffic to other peers, passing network announcements, and fulfilling path requests.
34
+
35
+ ## Installation
36
+ To install Reticulum-Telemetry-Hub, clone the repository and proceed with the following steps:
37
+
38
+ ```bash
39
+ git clone https://github.com/FreeTAKTeam/Reticulum-Telemetry-Hub.git
40
+ cd Reticulum-Telemetry-Hub
41
+ ```
42
+
43
+ ## Configuration
44
+ until we implement the wizard you will need to configure different config files.
45
+ ## RNS Config file
46
+ located under ```/[USERNAME]/.reticulum```
47
+ ```
48
+ [reticulum]
49
+ enable_transport = True
50
+ share_instance = Yes
51
+ [interfaces]
52
+
53
+ [[TCP Server Interface]]
54
+ type = TCPServerInterface
55
+ interface_enabled = True
56
+
57
+ # This configuration will listen on all IP
58
+ # interfaces on port 4242
59
+
60
+ listen_ip = 0.0.0.0
61
+ listen_port = 4242
62
+ ```
63
+ ## Router Config File
64
+ located under ```/[USERNAME]/.lxmd```
65
+ ```
66
+ [propagation]
67
+ enable_node = yes
68
+ # Automatic announce interval in minutes, suggested.
69
+ announce_interval = 10
70
+ propagation_transfer_max_accepted_size = 1024
71
+
72
+ [lxmf]
73
+ display_name = RTH_router
74
+
75
+ ```
76
+
77
+ ## Service
78
+ In order to start the router automatically on startup, we will need to install a /etc/systemd/system/lxmd.service file:
79
+
80
+ ```
81
+ [Unit]
82
+ Description=Reticulum LXMF Daemon (lxmd)
83
+ After=network-online.target
84
+ Wants=network-online.target
85
+
86
+ [Service]
87
+ ExecStart=/usr/local/bin/lxmd
88
+ Restart=on-failure
89
+ User=root # Change this if you run lxmd as a non-root user
90
+ WorkingDirectory=/usr/local/bin # Adjust to where lxmd is located
91
+ ExecReload=/bin/kill -HUP $MAINPID
92
+
93
+ [Install]
94
+ WantedBy=multi-user.target
95
+ ```
96
+
97
+ ## Usage
98
+ Enable and start the service: Once the service file is created, run the following commands to enable and start the service:
99
+
100
+ ```bash
101
+ Copy code
102
+ sudo systemctl daemon-reload
103
+ sudo systemctl enable lxmd.service
104
+ sudo systemctl start lxmd.service
105
+ ```
106
+
107
+ Ensure your Reticulum network is operational and configure for the full functionality of RTH.
108
+ Once installed and configured, you can start the Reticulum-Telemetry-Hub by running:
109
+
110
+ ```bash
111
+ python3 main.py
112
+ ```
113
+
114
+
115
+
116
+ ### Project Roadmap
117
+ - **Transition to Command-Based Server Joining**: Shift the "joining the server" functionality from an announce-based method to a command-based approach for improved control and scalability.
118
+ - **Object-Based Configuration Management**: Refactor the system to enable access to all configuration files via objects, enhancing modularity and ease of management.
119
+ - **Configuration Wizard Development**: Introduce a user-friendly wizard to simplify the configuration process.
120
+ - **Integration with TAK_LXMF Bridge**: Incorporate RTH into the TAK_LXMF bridge to strengthen the link between TAK devices and Reticulum networks.
121
+ - **Foundation for FTS "Flock of Parrot"**: Use RTH as the base for implementing the FreeTAKServer "Flock of Parrot" concept, aiming for scalable, interconnected FTS instances.
122
+
123
+ ## Contributing
124
+ We welcome and encourage contributions from the community! To contribute, please fork the repository and submit a pull request. Make sure that your contributions adhere to the project's coding standards and include appropriate tests.
125
+
126
+ ## License
127
+ This project is licensed under the Creative Commons License Attribution-NonCommercial-ShareAlike 4.0 International. For more details, refer to the `LICENSE` file in the repository.
128
+
129
+ ## Support
130
+ For any issues or support, feel free to open an issue on this GitHub repository or join the FreeTAKServer community on [Discord](The FTS Discord Server).
131
+
132
+ # Support Reticulum
133
+ You can help support the continued development of open, free and private communications systems by donating via one of the following channels to the original Reticulm author:
134
+
135
+ * Monero: 84FpY1QbxHcgdseePYNmhTHcrgMX4nFfBYtz2GKYToqHVVhJp8Eaw1Z1EedRnKD19b3B8NiLCGVxzKV17UMmmeEsCrPyA5w
136
+ * Ethereum: 0xFDabC71AC4c0C78C95aDDDe3B4FA19d6273c5E73
137
+ * Bitcoin: 35G9uWVzrpJJibzUwpNUQGQNFzLirhrYAH
138
+ * Ko-Fi: https://ko-fi.com/markqvist
139
+
@@ -0,0 +1,21 @@
1
+ reticulum_telemetry_hub/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ reticulum_telemetry_hub/lxmf_telemetry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ reticulum_telemetry_hub/lxmf_telemetry/model/fields/field_telemetry_stream.py,sha256=N8Cpg_lLFwmKRJ6iZmICX7whBr0wILE5CPiuy3hK3PU,163
4
+ reticulum_telemetry_hub/lxmf_telemetry/model/persistance/__init__.py,sha256=hD85jXD4cCPILUALrU0NB3Cy-bpaxPjkeeUsMYWjkLA,84
5
+ reticulum_telemetry_hub/lxmf_telemetry/model/persistance/appearance.py,sha256=D_IeRMW3OjdEzJB295h0lIHsRrG6JyeQmoC_Y2k085s,631
6
+ reticulum_telemetry_hub/lxmf_telemetry/model/persistance/peer.py,sha256=tvTePw_krqGzcZWAc8QI8WwP4BXQ5mgrVsj3gB0TLWs,488
7
+ reticulum_telemetry_hub/lxmf_telemetry/model/persistance/sensors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ reticulum_telemetry_hub/lxmf_telemetry/model/persistance/sensors/location.py,sha256=SPBfS97VLoufcrhxAk11VghqAx8-byysrNL2kvD7hFg,2710
9
+ reticulum_telemetry_hub/lxmf_telemetry/model/persistance/sensors/magnetic_field.py,sha256=o_5wdRQNPZCGjmbaJ4B5F7nk7I0UaAxxid187D0zA9U,1087
10
+ reticulum_telemetry_hub/lxmf_telemetry/model/persistance/sensors/sensor.py,sha256=6wajbHL1ns5khwuje7-DSQmUYGsCMclkccsy8LCAe-o,1502
11
+ reticulum_telemetry_hub/lxmf_telemetry/model/persistance/sensors/sensor_enum.py,sha256=JUjfjg4RKHGhyNjKURPOr1Ij9gge8tD1IBgWXSiRJX0,718
12
+ reticulum_telemetry_hub/lxmf_telemetry/model/persistance/sensors/sensor_mapping.py,sha256=3FREi7bhgXxSpVH6iZcWznKxvRwEQVCXuyBFwwSeuRk,237
13
+ reticulum_telemetry_hub/lxmf_telemetry/model/persistance/sensors/time.py,sha256=CikfC5sPIzbxI0BvDdW0T-0lhTABpVQpDYrVPOGueuE,1006
14
+ reticulum_telemetry_hub/lxmf_telemetry/model/persistance/telemeter.py,sha256=skhoPaifmQsypv11Aon4b8zQg84qohuVmYGJtSmqaU0,973
15
+ reticulum_telemetry_hub/lxmf_telemetry/telemetry_controller.py,sha256=2mxZ1Po2ebd4vzarvmMpBaQlGIRcpcdfHKxeRFEuclc,5057
16
+ reticulum_telemetry_hub/reticulum_server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
+ reticulum_telemetry_hub/reticulum_server/__main__.py,sha256=SYiaFosfdzXbhYkX6CUbSrfK9wPkrTisI7nLRX8WJ7I,13074
18
+ reticulumtelemetryhub-0.1.2.dist-info/LICENSE,sha256=BH0iWXQaPrsw2MikPUunm1simgaazR0r6knyKyl9jpg,21286
19
+ reticulumtelemetryhub-0.1.2.dist-info/METADATA,sha256=k1VeQVxdYUrmTNpmLsy3zmOdV34La9eydxGPfVZlKxk,5974
20
+ reticulumtelemetryhub-0.1.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
21
+ reticulumtelemetryhub-0.1.2.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- from lxmf_telemetry.model.persistance.telemeter import Telemeter
2
-
3
-
4
- class FieldTelmetryStream():
5
-
6
- telemeters: list[Telemeter]
7
-
reticulum_server/main.py DELETED
@@ -1,182 +0,0 @@
1
- import os
2
- import time
3
- import LXMF
4
- import RNS
5
- from lxmf_telemetry.telemetry_controller import TelemetryController
6
-
7
- # Constants
8
- STORAGE_PATH = "./tmp1" # Path to store temporary files
9
- IDENTITY_PATH = os.path.join(STORAGE_PATH, "identity") # Path to store identity file
10
- APP_NAME = LXMF.APP_NAME + ".delivery" # Application name for LXMF
11
-
12
- tel_controller = TelemetryController()
13
-
14
- class AnnounceHandler:
15
- def __init__(self, connections, my_lxmf_dest, lxm_router):
16
- self.aspect_filter = APP_NAME # Filter for LXMF announcements
17
- self.connections = connections # List to store connections
18
- self.my_lxmf_dest = my_lxmf_dest # LXMF destination
19
- self.lxm_router = lxm_router # LXMF router
20
-
21
- def received_announce(self, destination_hash, announced_identity, app_data):
22
- # Log the received announcement details
23
- RNS.log("\t+--- LXMF Announcement -----------------------------------------")
24
- RNS.log(f"\t| Source hash : {RNS.prettyhexrep(destination_hash)}")
25
- RNS.log(f"\t| Announced identity : {announced_identity}")
26
- RNS.log(f"\t| App data : {app_data}")
27
- RNS.log("\t+---------------------------------------------------------------")
28
-
29
- # Create a new destination from the announced identity
30
- dest = RNS.Destination(
31
- announced_identity,
32
- RNS.Destination.OUT,
33
- RNS.Destination.SINGLE,
34
- "lxmf",
35
- "delivery",
36
- )
37
- self.connections.append(dest) # Add the new destination to connections
38
-
39
- # Create and send a message to the new destination
40
- message = LXMF.LXMessage(
41
- dest, self.my_lxmf_dest, "Hi there", desired_method=LXMF.LXMessage.DIRECT
42
- )
43
- self.lxm_router.handle_outbound(message) # Handle outbound message
44
-
45
- def command_handler(commands: list, message: LXMF.LXMessage, lxm_router, my_lxmf_dest):
46
- for command in commands:
47
- print(f"Command: {command}")
48
- msg = tel_controller.handle_command(command, message, my_lxmf_dest)
49
- if msg:
50
- lxm_router.handle_outbound(msg)
51
-
52
- def delivery_callback(message: LXMF.LXMessage, connections, my_lxmf_dest, lxm_router):
53
- # Format the timestamp of the message
54
- try:
55
- time_string = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(message.timestamp))
56
- signature_string = "Signature is invalid, reason undetermined"
57
-
58
- # Determine the signature validation status
59
- if message.signature_validated:
60
- signature_string = "Validated"
61
- elif message.unverified_reason == LXMF.LXMessage.SIGNATURE_INVALID:
62
- signature_string = "Invalid signature"
63
- elif message.unverified_reason == LXMF.LXMessage.SOURCE_UNKNOWN:
64
- signature_string = "Cannot verify, source is unknown"
65
-
66
- if message.signature_validated and LXMF.FIELD_COMMANDS in message.fields:
67
- command_handler(message.fields[LXMF.FIELD_COMMANDS], message, lxm_router, my_lxmf_dest)
68
- return
69
-
70
- if tel_controller.handle_message(message):
71
- RNS.log("Telemetry data saved")
72
- return
73
-
74
- # Log the delivery details
75
- RNS.log("\t+--- LXMF Delivery ---------------------------------------------")
76
- RNS.log(f"\t| Source hash : {RNS.prettyhexrep(message.source_hash)}")
77
- RNS.log(f"\t| Source instance : {message.get_source()}")
78
- RNS.log(
79
- f"\t| Destination hash : {RNS.prettyhexrep(message.destination_hash)}"
80
- )
81
- #RNS.log(f"\t| Destination identity : {message.source_identity}")
82
- RNS.log(f"\t| Destination instance : {message.get_destination()}")
83
- RNS.log(f"\t| Transport Encryption : {message.transport_encryption}")
84
- RNS.log(f"\t| Timestamp : {time_string}")
85
- RNS.log(f"\t| Title : {message.title_as_string()}")
86
- RNS.log(f"\t| Content : {message.content_as_string()}")
87
- RNS.log(f"\t| Fields : {message.fields}")
88
- RNS.log(f"\t| Message signature : {signature_string}")
89
- RNS.log("\t+---------------------------------------------------------------")
90
- for connection in connections:
91
- if connection.hash != message.source_hash:
92
- response = LXMF.LXMessage(
93
- connection,
94
- my_lxmf_dest,
95
- message.content_as_string(),
96
- desired_method=LXMF.LXMessage.DIRECT,
97
- )
98
- lxm_router.handle_outbound(response) # Handle outbound response
99
- except Exception as e:
100
- RNS.log(f"Error: {e}")
101
-
102
- def load_or_generate_identity(identity_path):
103
- # Load existing identity or generate a new one
104
- if os.path.exists(identity_path):
105
- try:
106
- RNS.log("Loading existing identity")
107
- return RNS.Identity.from_file(identity_path)
108
- except:
109
- RNS.log("Failed to load existing identity, generating new")
110
- else:
111
- RNS.log("Generating new identity")
112
-
113
- identity = RNS.Identity() # Create a new identity
114
- identity.to_file(identity_path) # Save the new identity to file
115
- return identity
116
-
117
-
118
-
119
- def main():
120
- global my_lxmf_dest
121
- connections = [] # List to store connections
122
- r = RNS.Reticulum() # Initialize Reticulum
123
- lxm_router = LXMF.LXMRouter(storagepath=STORAGE_PATH) # Initialize LXMF router
124
- # lxm_router.enable_propagation()
125
- identity = load_or_generate_identity(IDENTITY_PATH) # Load or generate identity
126
- my_lxmf_dest = lxm_router.register_delivery_identity(
127
- identity, "test_server"
128
- ) # Register delivery identity
129
- lxm_router.set_message_storage_limit(megabytes=5)
130
- lxm_router.enable_propagation()
131
-
132
- # Register delivery callback
133
- lxm_router.register_delivery_callback(
134
- lambda msg: delivery_callback(msg, connections, my_lxmf_dest, lxm_router)
135
- )
136
- # Register announce handler
137
- RNS.Transport.register_announce_handler(
138
- AnnounceHandler(connections, my_lxmf_dest, lxm_router)
139
- )
140
-
141
- # Announce LXMF identity
142
- my_lxmf_dest.announce()
143
- lxm_router.announce_propagation_node()
144
- RNS.log("LXMF identity announced")
145
- RNS.log("\t+--- LXMF Identity ---------------------------------------------")
146
- RNS.log(f"\t| Hash : {RNS.prettyhexrep(my_lxmf_dest.hash)}")
147
- RNS.log(
148
- f"\t| Public key : {RNS.prettyhexrep(my_lxmf_dest.identity.pub.public_bytes())}"
149
- )
150
- RNS.log("\t+---------------------------------------------------------------")
151
-
152
- # Periodically announce the LXMF identity
153
- while True:
154
- choice = input("Enter your choice (exit/announce/telemetry): ")
155
-
156
- if choice == "exit":
157
- break
158
- elif choice == "announce":
159
- my_lxmf_dest.announce()
160
- elif choice == "announce_prop":
161
- lxm_router.announce_propagation_node()
162
- elif choice == "telemetry":
163
- connection_hash = input("Enter the connection hash: ")
164
- found = False
165
- for connection in connections:
166
- if connection.hexhash == connection_hash:
167
- message = LXMF.LXMessage(
168
- connection,
169
- my_lxmf_dest,
170
- "Requesting telemetry",
171
- desired_method=LXMF.LXMessage.DIRECT,
172
- fields={LXMF.FIELD_COMMANDS: [{TelemetryController.TELEMETRY_REQUEST: 1000000000}]}
173
- )
174
- lxm_router.handle_outbound(message)
175
- found = True
176
- break
177
- if not found:
178
- print("Connection not found")
179
-
180
-
181
- if __name__ == "__main__":
182
- main()
@@ -1,15 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: ReticulumTelemetryHub
3
- Version: 0.1.0
4
- Summary:
5
- Author: naman108
6
- Requires-Python: >=3.12,<4.0
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: Programming Language :: Python :: 3.12
9
- Requires-Dist: lxmf (>=0.4.4,<0.5.0)
10
- Requires-Dist: msgpack (>=1.0.8,<2.0.0)
11
- Requires-Dist: pytest (>=8.3.2,<9.0.0)
12
- Requires-Dist: sqlalchemy (>=2.0.32,<3.0.0)
13
- Description-Content-Type: text/markdown
14
-
15
-
@@ -1,19 +0,0 @@
1
- lxmf_telemetry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- lxmf_telemetry/model/fields/field_telemetry_stream.py,sha256=d1cZ4MICGnJLh6n0kG0Rfh27h1rTiSlUNilgFHO9Q8o,139
3
- lxmf_telemetry/model/persistance/__init__.py,sha256=hD85jXD4cCPILUALrU0NB3Cy-bpaxPjkeeUsMYWjkLA,84
4
- lxmf_telemetry/model/persistance/appearance.py,sha256=D_IeRMW3OjdEzJB295h0lIHsRrG6JyeQmoC_Y2k085s,631
5
- lxmf_telemetry/model/persistance/peer.py,sha256=tvTePw_krqGzcZWAc8QI8WwP4BXQ5mgrVsj3gB0TLWs,488
6
- lxmf_telemetry/model/persistance/sensors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- lxmf_telemetry/model/persistance/sensors/location.py,sha256=rMqsfCksHvp-Ol3YkfKHzkDBP4Wv-uki44oCHSHiKzM,2686
8
- lxmf_telemetry/model/persistance/sensors/magnetic_field.py,sha256=n5FBwUgYMTremcUUTp06ZiRE_ZiHtcjP9EUgk6rcd0U,1063
9
- lxmf_telemetry/model/persistance/sensors/sensor.py,sha256=6wajbHL1ns5khwuje7-DSQmUYGsCMclkccsy8LCAe-o,1502
10
- lxmf_telemetry/model/persistance/sensors/sensor_enum.py,sha256=JUjfjg4RKHGhyNjKURPOr1Ij9gge8tD1IBgWXSiRJX0,718
11
- lxmf_telemetry/model/persistance/sensors/sensor_mapping.py,sha256=3FREi7bhgXxSpVH6iZcWznKxvRwEQVCXuyBFwwSeuRk,237
12
- lxmf_telemetry/model/persistance/sensors/time.py,sha256=oor-uHLq05N-5TPvXzBIfTgXH0tAkQ7T61dXGCcyn1o,958
13
- lxmf_telemetry/model/persistance/telemeter.py,sha256=skhoPaifmQsypv11Aon4b8zQg84qohuVmYGJtSmqaU0,973
14
- lxmf_telemetry/telemetry_controller.py,sha256=wMmrNY-CRfbwfQvA4xWT1vPz1VnLER6cRrPictkkPC4,4961
15
- reticulum_server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- reticulum_server/main.py,sha256=BPLcln7ZQgaUREJvFgBZnkfLRtYZnEUx1M96fMq7PYY,7940
17
- reticulumtelemetryhub-0.1.0.dist-info/METADATA,sha256=Qe-h5spqSFpHa-AgNrGGzJ5_cfIf0olBpDu5tn_lTl4,422
18
- reticulumtelemetryhub-0.1.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
19
- reticulumtelemetryhub-0.1.0.dist-info/RECORD,,
File without changes