Git Product home page Git Product logo

util-lorawan-packets's Introduction

util-lorawan-packets

A simple library just to pack (marshal) and parse (unmarshal) LoRaWAN packets in C. It's intended to be used as basis for upper-layer LoRaWAN node oder network-server stacks. Beside this it could be useful for LoRaWAN testing and verification purposes.

When using this library knowledge about the LoRaWAN specification is needed. You can request the LoRaWAN specification here: https://www.lora-alliance.org/for-developers

Features

  • Stack independent LoRaWAN packet parser & encoder
  • Easy integration into custom upper-layer LoRaWAN stack implementations
  • Only 5 functions: Init, New, Delete, Marshal, Unmarshal
  • Support LoRaWAN 1.0 protocol (EU868 only)
  • Support LoRaWAN 1.1 protocol

The Following message types (MType) are implemented:

  • JoinRequest
  • JoinAccept
  • UnconfirmedDataUp
  • UnconfirmedDataDown
  • ConfirmedDataUp
  • ConfirmedDataDown
  • TBD: RejoinRequest (LoRaWAN 1.1)

Background

We use this library internally inside our proprietary closed-source (sorry!) freeRTOS based LoRaWAN-Stack. At Lobaro we heavily try to achieve a flexible & modular code-base to get projects done fast. With embedded C-code this is often not that easy as with modern languages like goLang. This might be the reason why most LoRaWAN implementations mix the "simple" task of packet encode/decode with protocol business logic.

This library tries to decouple the packet generation from LoRaWAN stack logic. It includes - cleanly separated - only the absolute minimum of needed LoRaWAN state like keys or framecounters. We think that this LoRaWAN packet encode/decode library is valuable for anybody writing its own LoRaWAN stack. Writing an own LoRaWAN stack is not that hard and can be crucial for getting the most out of the protocol for a particular application.

Future development

  • Additions / Fixes will be constantly merged into this repository.
  • Soon the support of the LoRaWAN 1.1 specification should be integrated.
  • Add GoLang cgo wrapper

Demo/Example

TBD

Related

Contribute

We appreciate any feedback, do not hesitate to create issues or pull requests.

License

util-lorawan-packets is licensed under The MIT License. Check LICENSE for more information.

AES, CMAC have its own licenses. Please follow links below to get the details.

Acknowledgement

util-lorawan-packets's People

Contributors

kratenko avatar niondir avatar tothero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

util-lorawan-packets's Issues

base64 decoding

Hello, want to understand at what place the base64 decoder is placed.I am asking this, since lorawan packets uses base64 format to transfer the data, but on AES128 input the data is decoded from base64.
base64_issue

LoRaWAN_UnmarshalPacket

Hi,

I think that you need to check of UNCONFIRMED and CONFIRMED in LoRaWAN_UnmarshalPacket

if (packet->MHDR.type == MTYPE_CONFIRMED_DATA_UP || packet->MHDR.type == MTYPE_UNCONFIRMED_DATA_UP) {

instead of

if (packet->MHDR.type == MTYPE_UNCONFIRMED_DATA_UP || packet->MHDR.type == MTYPE_UNCONFIRMED_DATA_UP) {

Sorry, no git at hand to commit,
BR,

The size of CFlist in Joinaccept message

Hi, i found a issue about the library, the function is located in the path(/util-lorawan-packets/lw_packets.c LoRaWAN_MarshalPacket())
the code is following:
if (packet->BODY.JoinAccept.hasCFlist) {
memcpy(&(outBuffer[pos]), packet->BODY.JoinAccept.CFlist.FreqCH4, 3);
pos += 3;
memcpy(&(outBuffer[pos]), packet->BODY.JoinAccept.CFlist.FreqCH5, 3);
pos += 3;
memcpy(&(outBuffer[pos]), packet->BODY.JoinAccept.CFlist.FreqCH6, 3);
pos += 3;
memcpy(&(outBuffer[pos]), packet->BODY.JoinAccept.CFlist.FreqCH7, 3);
pos += 3;
memcpy(&(outBuffer[pos]), packet->BODY.JoinAccept.CFlist.FreqCH8, 3);
pos += 3;
}
In accordance with LoRaWAN standard protocols,the length of CFlist Field should be set with 16 bytes,but the above coding showed that the length of CFlist Field is 15 bytes,could you explain it?

Demo/Example

Hi, could you please provide a simple example code how to implement this library?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.