configNode.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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.3
  4. // Date: 2019-11-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. // It is possible to use the gateway as a normal sensor node also. In this case,
  24. // substitute the node info below.
  25. #if GATEWAYNODE==1
  26. #define _DEVADDR { 0x33, 0x33, 0x33, 0x33 }
  27. #define _APPSKEY { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
  28. #define _NWKSKEY { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 }
  29. #define _SENSOR_INTERVAL 300
  30. // For ESP32 based T_BEAM/TTGO boards these two are normally included
  31. // If included make value 1, else if not, make them 0
  32. #define _GPS 1
  33. #define _BATTERY 1
  34. #endif
  35. // Wifi definitions
  36. // WPA is an array with SSID and password records. Set WPA size to number of entries in array
  37. // When using the WiFiManager, we will overwrite the first entry with the
  38. // accesspoint we last connected to with WifiManager
  39. // NOTE: Structure needs at least one (empty) entry.
  40. // So WPASIZE must be >= 1
  41. struct wpas {
  42. char login[32]; // Maximum Buffer Size (and allocated memory)
  43. char passw[64];
  44. };
  45. // Please fill in at least ONE SSID and password from your own WiFI network
  46. // below. This is needed to get the gateway working
  47. // Note: DO NOT use the first and the last line of the stucture, these should be empty strings and
  48. // the first line in te struct is reserved for WifiManager.
  49. //
  50. wpas wpa[] = {
  51. { "" , "" }, // Reserved for WiFi Manager
  52. { "YourSSID", "YourPassword" },
  53. { "Livebox-yyy", "xxxxxxxxxxxx"}
  54. };
  55. #if _TRUSTED_NODES >= 1
  56. struct nodex {
  57. uint32_t id; // This is the LoRa ID (coded in 4 bytes uint32_t
  58. char nm[32]; // Name of the node
  59. };
  60. // Add all your named and trusted nodes to this list
  61. nodex nodes[] = {
  62. { 0x2601148C , "lora-36 test node" }, // F=0
  63. { 0x00000000 , "lora-00 well known sensor" } // F=0
  64. };
  65. #endif //_TRUSTED_NODES
  66. // In some cases we like to decode the lora message at the single channel gateway.
  67. // In thisase, we need the NkwSKey and the AppsSKey of the node so that we can decode
  68. // its messages.
  69. // Although this is probably overkill in normal gateway situations, it greatly helps
  70. // in debugging the node messages before they reach the TTN severs.
  71. //
  72. #if _LOCALSERVER==1
  73. struct codex {
  74. uint32_t id; // This is the device ID (coded in 4 bytes uint32_t
  75. char nm[32]; // A name string which is free to choose
  76. uint8_t nwkKey[16]; // The Network Session Key of 16 bytes
  77. uint8_t appKey[16]; // The Application Session Key of 16 bytes
  78. };
  79. // Sometimes we want to decode the sensor completely as we do in the TTN server
  80. // This means that for all nodes we want to view the data of, we need to provide
  81. // the AppsSKey and the NwkSKey
  82. // Definition of all nodes that we want to decode locally on the gateway.
  83. //
  84. codex decodes[] = {
  85. { 0x2601148C , "lora-36", // F=0
  86. { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
  87. { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 }
  88. },
  89. { 0x00000000 , "lora-00", // F=0
  90. { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
  91. { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 }
  92. }
  93. };
  94. #endif //_LOCALSERVER