Class Gateway
The Semtech UDP packet forwarder protocol, from either side.
public static class Gateway
- Inheritance
-
Gateway
- Inherited Members
Remarks
A gateway hears packets from every node in range and hands them to a network server, which hands back the packets to transmit. This builds and reads the datagrams between them and leaves the socket, the keepalive, and the scheduling to the program that owns them.
Fields
DefaultPort
The port a packet forwarder sends to by convention.
public const int DefaultPort = 1700
Field Value
Methods
Acknowledgment(GatewayPacket)
Returns the acknowledgment a server owes a datagram.
public static GatewayPacket? Acknowledgment(GatewayPacket packet)
Parameters
packetGatewayPacketThe datagram that arrived.
Returns
- GatewayPacket
The PUSH_ACK or PULL_ACK to send back, or
nullfor a datagram that needs none. A PULL_RESP is answered with a TX_ACK, which names the gateway, so a gateway builds that one itself.
Encode(GatewayPacket)
Writes a datagram to send over a socket.
public static byte[] Encode(GatewayPacket packet)
Parameters
packetGatewayPacketThe datagram to send.
Returns
- byte[]
Its bytes.
Exceptions
- PamojaException
The datagram is missing a field its kind carries.
NameOf(GatewayTxStatus)
Names a status the way the protocol writes it.
public static string NameOf(GatewayTxStatus status)
Parameters
statusGatewayTxStatusThe status.
Returns
- string
Its word, such as
COLLISION_PACKET, orNONEwhen nothing failed.
Parse(ReadOnlySpan<byte>)
Reads a datagram that arrived.
public static GatewayPacket Parse(ReadOnlySpan<byte> datagram)
Parameters
datagramReadOnlySpan<byte>The bytes as they arrived.
Returns
- GatewayPacket
The datagram.
Exceptions
- PamojaException
It is not a datagram this protocol defines.