Table of Contents

Class ChirpstackUplinkEvent

Namespace
Pamoja.Gateway
Assembly
Pamoja.Gateway.dll

An uplink as a ChirpStack network server reports it.

public sealed record ChirpstackUplinkEvent : IEquatable<ChirpstackUplinkEvent>
Inheritance
ChirpstackUplinkEvent
Implements
Inherited Members

Remarks

ChirpStack publishes every uplink it deduplicates to an MQTT topic, as the JSON form of its UplinkEvent message. Fields protobuf's JSON mapping leaves out when they hold their default read as that default: a frame counter of zero, ADR off, unconfirmed.

Constructors

ChirpstackUplinkEvent(string, string?, string, string, string, uint?, bool, byte, uint, byte?, bool, byte[], uint?, IReadOnlyList<ChirpstackReception>, int?)

An uplink as a ChirpStack network server reports it.

public ChirpstackUplinkEvent(string DeduplicationId, string? Time, string ApplicationId, string DeviceName, string DevEui, uint? DevAddr, bool Adr, byte DataRate, uint Fcnt, byte? Fport, bool Confirmed, byte[] Data, uint? FrequencyHz, IReadOnlyList<ChirpstackReception> Receptions, int? BestReception)

Parameters

DeduplicationId string

The identifier ChirpStack gave the uplink once it deduplicated the gateways' copies.

Time string

When the uplink was received, as ChirpStack wrote it, or null.

ApplicationId string

The application the device belongs to.

DeviceName string

The name the device was given in ChirpStack.

DevEui string

The device EUI, as lowercase hex.

DevAddr uint?

The device's address, or null when the event names none.

Adr bool

Whether the device had adaptive data rate on.

DataRate byte

The data rate, as the region numbers them.

Fcnt uint

The uplink frame counter.

Fport byte?

The application port, or null for a frame that carried none.

Confirmed bool

Whether the uplink was confirmed.

Data byte[]

The application payload, decoded from base64.

FrequencyHz uint?

The carrier it was heard on, in hertz, or null.

Receptions IReadOnlyList<ChirpstackReception>

Every gateway that heard it.

BestReception int?

The position in Receptions of the gateway that heard it with the highest signal-to-noise ratio, or null when none did.

Remarks

ChirpStack publishes every uplink it deduplicates to an MQTT topic, as the JSON form of its UplinkEvent message. Fields protobuf's JSON mapping leaves out when they hold their default read as that default: a frame counter of zero, ADR off, unconfirmed.

Fields

AllApplicationsTopic

The MQTT topic every application's uplink events are published on, with wildcards in place of the application and the device.

public const string AllApplicationsTopic = "application/+/device/+/event/up"

Field Value

string

Properties

Adr

Whether the device had adaptive data rate on.

public bool Adr { get; init; }

Property Value

bool

ApplicationId

The application the device belongs to.

public string ApplicationId { get; init; }

Property Value

string

BestReception

The position in Receptions of the gateway that heard it with the highest signal-to-noise ratio, or null when none did.

public int? BestReception { get; init; }

Property Value

int?

Confirmed

Whether the uplink was confirmed.

public bool Confirmed { get; init; }

Property Value

bool

Data

The application payload, decoded from base64.

public byte[] Data { get; init; }

Property Value

byte[]

DataRate

The data rate, as the region numbers them.

public byte DataRate { get; init; }

Property Value

byte

DeduplicationId

The identifier ChirpStack gave the uplink once it deduplicated the gateways' copies.

public string DeduplicationId { get; init; }

Property Value

string

DevAddr

The device's address, or null when the event names none.

public uint? DevAddr { get; init; }

Property Value

uint?

DevEui

The device EUI, as lowercase hex.

public string DevEui { get; init; }

Property Value

string

DeviceName

The name the device was given in ChirpStack.

public string DeviceName { get; init; }

Property Value

string

Fcnt

The uplink frame counter.

public uint Fcnt { get; init; }

Property Value

uint

Fport

The application port, or null for a frame that carried none.

public byte? Fport { get; init; }

Property Value

byte?

FrequencyHz

The carrier it was heard on, in hertz, or null.

public uint? FrequencyHz { get; init; }

Property Value

uint?

Receptions

Every gateway that heard it.

public IReadOnlyList<ChirpstackReception> Receptions { get; init; }

Property Value

IReadOnlyList<ChirpstackReception>

Time

When the uplink was received, as ChirpStack wrote it, or null.

public string? Time { get; init; }

Property Value

string

Methods

FromJson(string)

Reads an uplink event from the JSON ChirpStack published.

public static ChirpstackUplinkEvent FromJson(string json)

Parameters

json string

The MQTT message's payload.

Returns

ChirpstackUplinkEvent

The event.

Exceptions

PamojaException

The text is not a JSON object, the event names no device EUI, or a field does not read as what it should.

UplinkTopic(string)

Builds the MQTT topic an application's uplink events are published on.

public static string UplinkTopic(string applicationId)

Parameters

applicationId string

The application's identifier, as ChirpStack shows it.

Returns

string

The topic, application/<id>/device/+/event/up.