Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...


Uplink messages are those sent from the sensor to the network.

...

You can also refer to our Java Script payload decoder shared on the Github.

...

The device has four (4) types of Uplink messages:

  1. Parking status - port 1

  2. Heartbeat - port 2

  3. Startup - port 3

  4. User Registration - port 10

The simplest method of getting occupancy status from 1 and 2 is shown in the following Java Script code example:

Expand
titleJavaScript code example

The first example is for cases when the payload type is string (Nwave HTTP Calls for example):

Code Block
languagejs
payload = "E91F345678"

// cut out 1st byte and convert to integer
first_byte = parseInt(payload.slice(0,2), 16)

// the sensor is occupied if 1st bit is 1
occupied = Boolean(first_byte & 0x01 === 1)

console.log("Occupied: ", occupied);

The second example is for cases when the payload type is array of integers (TTN, TTI for example):

Code Block
languagejs
payload = [0xE9, 0x1F, 0x34, 0x56, 0x78]

// the sensor is occupied if 1st bit of the first byte is 1
occupied = Boolean(payload[0] & 0x01 === 1)

console.log("Occupied: ", occupied);

Info

You can also refer to our Java Script payload decoder shared on the Github.

Examples of decoded messages are available on the TTN device page.

Please refer to the sections below for detailed information on message payload structure.

4.2.1 Parking status


The parking status message uses port 1 and is confirmed by default. It may be configured as unconfirmed with or without repetitions (see downlink messages).

...