Skip to content

Instantly share code, notes, and snippets.

@martinloretzzz
Created March 20, 2020 15:14
Show Gist options
  • Save martinloretzzz/a281b0ce1fbb7ce523f12c02a179e4f7 to your computer and use it in GitHub Desktop.
Save martinloretzzz/a281b0ce1fbb7ce523f12c02a179e4f7 to your computer and use it in GitHub Desktop.
Typescript Definition from The Things Network Http Integration
// https://www.thethingsnetwork.org/docs/applications/http/
export interface TTNHttpMessage {
app_id: string;
dev_id: string;
hardware_serial: string;
port: number;
counter: number;
is_retry: boolean;
confirmed: boolean;
payload_raw: string;
payload_fields?: object;
metadata: Metadata;
}
type ISODate = string;
interface Metadata {
time: ISODate;
frequency: number;
modulation: "LORA" | "FSK";
data_rate?: string; // if LORA
bit_rate?: number; // if FSK
coding_rate: string;
gateways: Gateway[];
latitude?: number;
longitude?: number;
altitude?: number;
}
interface Gateway {
gtw_id: string;
timestamp: number;
time?: ISODate;
channel: number;
rssi: number;
snr: number;
rf_chain: number;
latitude?: number;
longitude?: number;
altitude?: number;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment