sensor.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // sensor.h; 1-channel LoRa Gateway for ESP8266
  2. // Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
  3. // Version 6.1.0
  4. // Date: 2019-10-20
  5. //
  6. // based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
  7. // and many other contributors.
  8. //
  9. // All rights reserved. This program and the accompanying materials
  10. // are made available under the terms of the MIT License
  11. // which accompanies this distribution, and is available at
  12. // https://opensource.org/licenses/mit-license.php
  13. //
  14. // NO WARRANTY OF ANY KIND IS PROVIDED
  15. //
  16. // Author: Maarten Westenberg (mw12554@hotmail.com)
  17. //
  18. // This file contains a number of compile-time settings and declarations that are
  19. // specific to the LoRa rfm95, sx1276, sx1272 radio of the gateway.
  20. //
  21. //
  22. // ------------------------------------------------------------------------------------
  23. #if _TRUSTED_NODES >= 1
  24. struct nodex {
  25. uint32_t id; // This is the LoRa ID (coded in 4 bytes uint32_t
  26. char nm[32]; // Name of the node
  27. };
  28. // Add all your named and trusted nodes to this list
  29. nodex nodes[] = {
  30. { 0x2601148C , "lora-36 test node" }, // F=0
  31. { 0x00000000 , "lora-00 well known sensor" } // F=0
  32. };
  33. #endif //_TRUSTED_NODES
  34. // In some cases we like to decode the lora message at the single channel gateway.
  35. // In thisase, we need the NkwSKey and the AppsSKey of the node so that we can decode
  36. // its messages.
  37. // Although this is probably overkill in normal gateway situations, it greatly helps
  38. // in debugging the node messages before they reach the TTN severs.
  39. //
  40. #if _LOCALSERVER==1
  41. struct codex {
  42. uint32_t id; // This is the device ID (coded in 4 bytes uint32_t
  43. char nm[32]; // A name string which is free to choose
  44. uint8_t nwkKey[16]; // The Network Session Key of 16 bytes
  45. uint8_t appKey[16]; // The Application Session Key of 16 bytes
  46. };
  47. // Sometimes we want to decode the sensor completely as we do in the TTN server
  48. // This means that for all nodes we want to view the data of, we need to provide
  49. // the AppsSKey and the NwkSKey
  50. // Definition of all nodes that we want to decode locally on the gateway.
  51. //
  52. codex decodes[] = {
  53. { 0x2601148C , "lora-36", // F=0
  54. { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
  55. { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 }
  56. },
  57. { 0x00000000 , "lora-00", // F=0
  58. { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
  59. { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 }
  60. }
  61. };
  62. #endif //_LOCALSERVER