TheThingsArchive / ttn

The Things Network Stack V2
https://www.thethingsnetwork.org
MIT License
462 stars 276 forks source link

Payload Functions: Pass port as second argument #247

Closed FokkeZB closed 7 years ago

FokkeZB commented 8 years ago

Users will address different types of messages to different ports. In the payload functions I need to know to what port the message was addressed. Currently, I don't have this information.

I'd suggest we add the port as second argument to all 4 functions:

function Decoder(bytes, port) {
  // Decode an uplink message from
  // a Buffer of bytes to an object.

  decodedObj = {};

  if (port === 1) {
    decodedObj.isLightOn = bytes[0];
  }

  return decodedObj;
}

Once this is in place here, https://github.com/TheThingsIndustries/dashboard/issues/74 requests for the placeholders to demonstrate usage of the port.

htdvisser commented 8 years ago

@johanstokking promised on Slack to also add frame counters to the payload functions (https://thethingsnetwork.slack.com/archives/backend/p1474722721000621). I don't see the added value of adding these counters, especially because they are only relevant for LoRaWAN devices. Could you please elaborate, @johanstokking?

johanstokking commented 8 years ago

Yeah we don't need the frame counters indeed, but port is essential.

FokkeZB commented 8 years ago

Can we get this port thing rolling? I need it for the Electra demo and Node QS

romeovs commented 7 years ago

Closed by #329

FokkeZB commented 7 years ago

@romeovs could you create an issue or PR in the docs repo when you make a change that affects users?

https://github.com/TheThingsNetwork/docs/issues/66

FokkeZB commented 7 years ago

Shouldn't these be updated as well?