piermesh/docs/Transceiver/Transceiver.md

131 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<a id="transceiver-layer-0-data-transceiving"></a>
# Transceiver: Layer 0 data transceiving
### *class* Transceiver.Transceiver.Transceiver(device, filter, onodeID, cache, catch, cryptographyInfo, network)
Handling LoRa transceiving
[🔗 Source](https://git.utopic.work/PierMesh/piermesh/src/branch/main/src/Transceiver/Transceiver.py)
#### cLog
Reference to run.Node.cLog for logging
#### cryptographyInfo
Cryptography instance for encrypting transmissions
* **Type:**
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
TODO: Stop this being sent to sieve
#### send(packet, recipientNode=False)
Send individual packet
* **Parameters:**
**recipientNode** If set send to specified node
#### *async* sendAnnounce(dontRespond=False)
Send an announce packet (contains basic network mapping information) every so often so new nodes autoconnect
#### *async* sendMessage(message: Message)