TheThingsIndustries / generic-node-se

Generic Node Sensor Edition
https://www.genericnode.com
Other
110 stars 31 forks source link

Usage of LmHandler #236

Open niondir opened 2 years ago

niondir commented 2 years ago

I'm just curious if there is a specific reason why the LmHandler APIs are not used or if there are any plans to integrate it?

I'm using the generic-node as a template and going to use LmhpRemoteMcastSetup.c from the LmHandler directory for better Multicast support. I notices that there is a full Middleware stack implemented that mirrors some of the LoRaMac APIs like Join, Send Message, etc. e.g LoRaMacProcess is wrapped in LmHandlerProcess.

The freertos_lorawan wrapper used by the generic node ignores the LmHandler API.

Update: Once we use the LmHandler package, one must implement the FreeRTOS handler as a Middleware to allow the Mac Hooks to be set to the LmHandler functions. The LmHandler will forward the calls to middlewares and runs in the FreeRTOS task, so it should be no problem (as far as I see yet) to just use the LmHandler API for the callbacks.

xLoRaMacPrimitives.MacMcpsConfirm = prvMcpsConfirm;
xLoRaMacPrimitives.MacMcpsIndication = prvMcpsIndication;
xLoRaMacPrimitives.MacMlmeConfirm = prvMlmeConfirm;
xLoRaMacPrimitives.MacMlmeIndication = prvMlmeIndication;

Or we use OnTxData and OnRxData of the LmHandler package.