NubeIO / module-core-loraraw

0 stars 0 forks source link

[Feature][FGA] LoRaRAW Unique Transmission #31

Open Shiny380 opened 2 months ago

Shiny380 commented 2 months ago

This feature enables LoRaRAW Unique address transmission. i.e. From the gateway to a specific sensor such as a Droplet/MicroEdge Requires: https://github.com/NubeIO/driver-lora/issues/8

  1. Allow user to add writable points
    • Schema will require user to specify for encoding:
      • integer for the point ID
      • Enum for the data type, Default should be Float32=40 (float32)
  2. Setup a handler for the Write Point endpoint
    • I will get Tan to implement the data encoder once this is setup, so ignore the function implementation for now
  3. Encrypt the data same as Driver-LoRa
    • Address should be the device address (AAC0BBCC) but you will need to convert this to decimal (int[4]) before doing any encryption
    • For now (improved on later here), add a config to the module for the encryption key
      • call it default_key
      • read in Hex format
      • make sure to set it as secret so it is not displayed in plain text, like here
  4. Convert to Hex and write to the serial port (Driver-LoRa will transmit as is)

Data encoding Document

https://docs.google.com/document/d/1DsEAdiUQcmw5YJ9Fi7VrVbzbtGrhEaLDQXoOrtvfW0w/edit#heading=h.lm2l9j87mmll

maharjanaman commented 1 month ago

Hi @Shiny380, I went through loraraw and driver-lora codebases and had a question related to making points writable,

And regarding,

Setup a handler for the Write Point endpoint

We already have the endpoint and method implemented for point write https://github.com/NubeIO/module-core-loraraw/blob/d482e2d18b0e8420afa2d41d8ae1a2bf7ee0a7c6/pkg/router.go#L34 Are you referring to something different from this?

Shiny380 commented 1 month ago
maharjanaman commented 1 month ago

@Shiny380 Have made points writable. For this, there are a few changes on rubix-ce and lib-models-go for which have opened these two PRs,

Also, added functions to encrypt the encoded data and to write the data in the serial port. This needs testing though which will continue after the encoding part. ATM, the device address is added to PointWriter struct itself and hence can be extracted after unmarshal.

https://github.com/NubeIO/module-core-loraraw/blob/61c21ea5e7d113ba52a58fcf96b9ccd6293b9d0d/pkg/router.go#L154

Shiny380 commented 3 weeks ago

@maharjanaman you can start on the data encoding part too when you're ready.

Rubix-Data-Encoding:

Each point is associated to one data-point. Build the encoder in a way that you can encode multiple data points in multiple calls by passing in the SerialData object each time. This should be independent to any LoRaRAW protocol stuff (i.e. address, encryption, etc.) which should happen after the encoding. As we maybe discussed before, we'll need some kind of Queue system to handle the writes, I'll describe in a separate comment