gatenet.mesh package

Submodules

gatenet.mesh.esp module

gatenet.mesh.esp — ESPRadio for custom ESP-based messaging and packet handling.

Example

from gatenet.mesh.esp import ESPRadio esp = ESPRadio() esp.send_message(‘Status’, dest=’node5’) packets = esp.receive_packets()

class gatenet.mesh.esp.ESPRadio[source]

Bases: MeshRadio

ESPRadio for custom ESP-based messaging.

Example

>>> from gatenet.mesh.esp import ESPRadio
>>> esp = ESPRadio()
>>> esp.send_message('Status', dest='node5')
>>> packets = esp.receive_packets()
receive_packets()[source]

Receive and decrypt all ESP packets sent by this node.

Return type:

List[Dict]

Example

>>> esp = ESPRadio()
>>> packets = esp.receive_packets()
send_message(msg, dest, rf_signal=None, channel=None)[source]

Send a message to a destination node using ESP protocol, optionally with RF info.

Return type:

bool

Example

>>> esp.send_message('Status', dest='node5', rf_signal={"freq": 2400000000}, channel=6)

gatenet.mesh.lora module

gatenet.mesh.lora — LoRaRadio for custom LoRa-based messaging and packet handling.

Example

from gatenet.mesh.lora import LoRaRadio lora = LoRaRadio() lora.send_message(‘Ping’, dest=’node3’) packets = lora.receive_packets()

class gatenet.mesh.lora.LoRaRadio[source]

Bases: MeshRadio

LoRaRadio for custom LoRa-based messaging.

Example

>>> from gatenet.mesh.lora import LoRaRadio
>>> lora = LoRaRadio()
>>> lora.send_message('Ping', dest='node3')
>>> packets = lora.receive_packets()
receive_packets()[source]

Receive and decrypt all LoRa packets sent by this node.

Return type:

List[Dict]

Example

>>> lora = LoRaRadio()
>>> packets = lora.receive_packets()
send_message(msg, dest, rf_signal=None, frequency=None)[source]

Send a message to a destination node using LoRa protocol, optionally with RF info.

Return type:

bool

Example

>>> lora.send_message('Ping', dest='node3', rf_signal={"freq": 915000000}, frequency=915.0)

gatenet.mesh.radio module

class gatenet.mesh.radio.MeshRadio[source]

Bases: object

get_topology()[source]

Get the current mesh topology (nodes, links, locations, signals, wifi).

Return type:

Dict

Example

>>> radio = MeshRadio()
>>> topology = radio.get_topology()
log_gps(lat, lon)[source]

Log GPS location for the mesh node.

Example

>>> radio = MeshRadio()
>>> radio.log_gps(37.7749, -122.4194)
log_rf_signal(signal_info)[source]

Log RF signal info (strength, freq, type, etc) and propagate as mesh event.

Parameters:

signal_info (float or dict) – RF info (can be just strength or full dict)

Example

>>> radio = MeshRadio()
>>> radio.log_rf_signal({"freq": 868000000, "power": 24, "type": "lora"})
on_signal(handler)[source]

Register a signal handler (no-op for MeshRadio, for diagnostics integration compatibility).

receive_packets()[source]

Receive and decrypt all packets sent by this node.

Return type:

List[Dict]

Example

>>> radio = MeshRadio()
>>> packets = radio.receive_packets()
scan_wifi(interface='wlan0', mock=False)[source]

Scan for Wi-Fi SSIDs/devices and correlate with mesh activity. On Raspberry Pi, uses ‘iwlist’ for real scan. If mock=True, returns sample data.

Example

>>> radio = MeshRadio()
>>> radio.scan_wifi(mock=True)
send_message(msg, dest, rf_signal=None)[source]

Send encrypted message to mesh node, optionally attaching RF signal info.

Parameters:
  • msg (str) – Message to send

  • dest (str) – Destination node

  • rf_signal (optional) – RF info from radio module

Return type:

bool

Example

>>> radio.send_message("alert", "node2", rf_signal={"freq": 868000000})
sync_logs(file_path='mesh_radio_logs.json')[source]

Sync mesh radio logs (packets, topology, GPS, RF, Wi-Fi) to a file (base node or Mini PC).

Parameters:

file_path (str) – Path to save logs (default: mesh_radio_logs.json)

Returns:

True if successful, False otherwise

Return type:

bool

Example

>>> radio = MeshRadio()
>>> radio.sync_logs()
>>> radio.sync_logs("/mnt/base_node/mesh_radio_logs.json")

Module contents

gatenet.mesh — LoRa/Mesh radio interface for encrypted messaging and topology mapping.

Features: - Parse incoming mesh packets - Send encrypted messages - Track and map mesh topology

Example usage:

from gatenet.mesh import MeshRadio mesh = MeshRadio() mesh.send_message(‘Hello’, dest=’node2’) packets = mesh.receive_packets()

class gatenet.mesh.ESPRadio[source]

Bases: MeshRadio

ESPRadio for custom ESP-based messaging.

Example

>>> from gatenet.mesh.esp import ESPRadio
>>> esp = ESPRadio()
>>> esp.send_message('Status', dest='node5')
>>> packets = esp.receive_packets()
receive_packets()[source]

Receive and decrypt all ESP packets sent by this node.

Return type:

List[Dict]

Example

>>> esp = ESPRadio()
>>> packets = esp.receive_packets()
send_message(msg, dest, rf_signal=None, channel=None)[source]

Send a message to a destination node using ESP protocol, optionally with RF info.

Return type:

bool

Example

>>> esp.send_message('Status', dest='node5', rf_signal={"freq": 2400000000}, channel=6)
class gatenet.mesh.LoRaRadio[source]

Bases: MeshRadio

LoRaRadio for custom LoRa-based messaging.

Example

>>> from gatenet.mesh.lora import LoRaRadio
>>> lora = LoRaRadio()
>>> lora.send_message('Ping', dest='node3')
>>> packets = lora.receive_packets()
receive_packets()[source]

Receive and decrypt all LoRa packets sent by this node.

Return type:

List[Dict]

Example

>>> lora = LoRaRadio()
>>> packets = lora.receive_packets()
send_message(msg, dest, rf_signal=None, frequency=None)[source]

Send a message to a destination node using LoRa protocol, optionally with RF info.

Return type:

bool

Example

>>> lora.send_message('Ping', dest='node3', rf_signal={"freq": 915000000}, frequency=915.0)
class gatenet.mesh.MeshRadio[source]

Bases: object

get_topology()[source]

Get the current mesh topology (nodes, links, locations, signals, wifi).

Return type:

Dict

Example

>>> radio = MeshRadio()
>>> topology = radio.get_topology()
log_gps(lat, lon)[source]

Log GPS location for the mesh node.

Example

>>> radio = MeshRadio()
>>> radio.log_gps(37.7749, -122.4194)
log_rf_signal(signal_info)[source]

Log RF signal info (strength, freq, type, etc) and propagate as mesh event.

Parameters:

signal_info (float or dict) – RF info (can be just strength or full dict)

Example

>>> radio = MeshRadio()
>>> radio.log_rf_signal({"freq": 868000000, "power": 24, "type": "lora"})
on_signal(handler)[source]

Register a signal handler (no-op for MeshRadio, for diagnostics integration compatibility).

receive_packets()[source]

Receive and decrypt all packets sent by this node.

Return type:

List[Dict]

Example

>>> radio = MeshRadio()
>>> packets = radio.receive_packets()
scan_wifi(interface='wlan0', mock=False)[source]

Scan for Wi-Fi SSIDs/devices and correlate with mesh activity. On Raspberry Pi, uses ‘iwlist’ for real scan. If mock=True, returns sample data.

Example

>>> radio = MeshRadio()
>>> radio.scan_wifi(mock=True)
send_message(msg, dest, rf_signal=None)[source]

Send encrypted message to mesh node, optionally attaching RF signal info.

Parameters:
  • msg (str) – Message to send

  • dest (str) – Destination node

  • rf_signal (optional) – RF info from radio module

Return type:

bool

Example

>>> radio.send_message("alert", "node2", rf_signal={"freq": 868000000})
sync_logs(file_path='mesh_radio_logs.json')[source]

Sync mesh radio logs (packets, topology, GPS, RF, Wi-Fi) to a file (base node or Mini PC).

Parameters:

file_path (str) – Path to save logs (default: mesh_radio_logs.json)

Returns:

True if successful, False otherwise

Return type:

bool

Example

>>> radio = MeshRadio()
>>> radio.sync_logs()
>>> radio.sync_logs("/mnt/base_node/mesh_radio_logs.json")