2024-08-01 22:03:59 +00:00
|
|
|
|
<a id="layer-0-data-transceiving"></a>
|
|
|
|
|
|
2024-08-01 01:09:11 +00:00
|
|
|
|
# Layer 0 data transceiving
|
|
|
|
|
|
|
|
|
|
### *class* Transceiver.Transceiver.Transceiver(device, filter, onodeID, cache, catch, cryptographyInfo, cLog)
|
|
|
|
|
|
|
|
|
|
Handling LoRa transceiving
|
|
|
|
|
|
2024-08-01 22:03:59 +00:00
|
|
|
|
[🔗 Source](https://git.utopic.work/PierMesh/piermesh/src/branch/main/src/Transceiver/Transceiver.py)
|
|
|
|
|
|
2024-08-01 01:09:11 +00:00
|
|
|
|
#### cLog
|
|
|
|
|
|
|
|
|
|
Reference to run.Node.cLog for logging
|
|
|
|
|
|
|
|
|
|
#### cryptographyInfo
|
|
|
|
|
|
|
|
|
|
Cryptography instance for encrypting transmissions
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
[Cryptography.WhaleSong.DHEFern](/PierMesh/piermesh/src/branch/main/docs/Cryptography/WhaleSong.md#Cryptography.WhaleSong.DHEFern)
|
|
|
|
|
|
|
|
|
|
#### filter
|
|
|
|
|
|
|
|
|
|
Sponge.base.Filter instance for filtering packets
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
[Sponge.base.Filter](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.base.Filter)
|
|
|
|
|
|
|
|
|
|
#### tcache
|
|
|
|
|
|
|
|
|
|
Data backend Daisy Cache
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
[Daisy.Cache.Cache](/PierMesh/piermesh/src/branch/main/docs/Daisy/Cache.md#Daisy.Cache.Cache)
|
|
|
|
|
|
|
|
|
|
#### tcatch
|
|
|
|
|
|
|
|
|
|
Daisy Catch Cache for Catch operations
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
[Daisy.Catch.Catch](/PierMesh/piermesh/src/branch/main/docs/Daisy/Catch.md#Daisy.Catch.Catch)
|
|
|
|
|
|
|
|
|
|
#### notConnected
|
|
|
|
|
|
|
|
|
|
Whether the transceiver has been connected to yet
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
bool
|
|
|
|
|
|
|
|
|
|
#### acks
|
|
|
|
|
|
|
|
|
|
Acknowledgements received per packet
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
dict
|
|
|
|
|
|
|
|
|
|
#### onodeID
|
|
|
|
|
|
|
|
|
|
PierMesh node ID
|
|
|
|
|
|
|
|
|
|
#### messages
|
|
|
|
|
|
|
|
|
|
Message completion acknowldgements
|
|
|
|
|
|
|
|
|
|
* **Type:**
|
|
|
|
|
dict
|
|
|
|
|
|
|
|
|
|
### Notes
|
|
|
|
|
|
|
|
|
|
TODO: Check if we can remove cpid
|
|
|
|
|
|
|
|
|
|
#### *async* addPackets(data, sender, senderName, recipient, recipientNode, directID=False, packetsClass=None, encrypt=False)
|
|
|
|
|
|
|
|
|
|
Convert binary data to Message and send each packet
|
|
|
|
|
:param data: Data to send
|
|
|
|
|
:type data: bytes
|
|
|
|
|
:param sender: Peer/Node ID of sender
|
|
|
|
|
:param senderName: ID matching specific user title
|
|
|
|
|
:param recipient: Peer/Node ID of recipient
|
|
|
|
|
:param recipientNode: Node ID of node to route to
|
|
|
|
|
:param directID: If set send to this Node only
|
|
|
|
|
:param packetsClass: Protocol for message
|
|
|
|
|
|
|
|
|
|
#### *async* announce()
|
|
|
|
|
|
|
|
|
|
Announce loop runner
|
|
|
|
|
|
|
|
|
|
#### awaitFullResponse(pid)
|
|
|
|
|
|
|
|
|
|
TODO
|
|
|
|
|
|
|
|
|
|
Wait for message completed response
|
|
|
|
|
|
|
|
|
|
#### *async* awaitResponse(pid)
|
|
|
|
|
|
|
|
|
|
Wait for acknowldgement response
|
|
|
|
|
|
|
|
|
|
#### *async* initNodeDH(dhefOb, recipientNode, onodeID)
|
|
|
|
|
|
|
|
|
|
Send Diffie Hellman initialization message
|
|
|
|
|
|
|
|
|
|
#### onConnection(interface, topic=<class 'pubsub.core.callables.AUTO_TOPIC'>)
|
|
|
|
|
|
|
|
|
|
When the node connects start announce loop and end the waiting loop
|
|
|
|
|
|
|
|
|
|
#### onReceive(packet, interface)
|
|
|
|
|
|
|
|
|
|
Run each received packet through Sponge.base.Filters sieve using a new event loop
|
|
|
|
|
|
|
|
|
|
#### *async* progressCheck()
|
|
|
|
|
|
|
|
|
|
Checks if acknowldgement was received per packet and if not resends
|
|
|
|
|
|
|
|
|
|
#### responseCheck(packet)
|
|
|
|
|
|
|
|
|
|
On acknowldgement response set acks based on response
|
|
|
|
|
|
|
|
|
|
#### send(packet, recipientNode=False)
|
|
|
|
|
|
|
|
|
|
Send individual packet
|
|
|
|
|
|
|
|
|
|
* **Parameters:**
|
|
|
|
|
**recipientNode** – If set send to specified node
|
|
|
|
|
|
|
|
|
|
#### *async* sendAnnounce()
|
|
|
|
|
|
|
|
|
|
Send an announce packet (contains basic network mapping information) every so often so new nodes autoconnect
|