_tcpTTN.ino 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // 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 others.
  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. // Description:
  19. // _tcpTTN.ino:
  20. //
  21. // This file contains the tcp specific code enabling to receive
  22. // and transmit packages/messages to the TTN server using their new protocol.
  23. //
  24. // The TTN code has been developed as an alternative to the Semtech UDP code.
  25. // According to the TTN website the Semtech gateway interface code is less secure and
  26. // works on UDP which is less reliable. The new protocol of TTN should solve these issues.
  27. //
  28. // Initial look at the code of TTN shows that it is overly complex and not written for C++
  29. // or other languages (except for Go). The old Semtech protocol may be too simple but
  30. // the new code is a brainiac.
  31. // As of half 2018 the code is on hold. Some does work, but acording to the documentation
  32. // it should be simpler to use.
  33. //
  34. // ========================================================================================
  35. #if defined(_TTNROUTER)
  36. #if defined(_UDPROUTER)
  37. #error "Error: Please undefine _UDPROUTER if you like to use _TTNROUTER"
  38. #endif
  39. // The following functions ae defined in this modue:
  40. //
  41. // int readTtn(int Packetsize)
  42. // int sendTtn(IPAddress server, int port, uint8_t *msg, int length)
  43. // bool connectTtn()
  44. // void pullData()
  45. // void sendstat();
  46. // Add gateway code of functions here
  47. void connectTtn() {
  48. #error "Error: Please define and use _UDPROUTER instead of _TTNROUTER"
  49. }
  50. int readTtn(int Packetsize) {
  51. #error "Error: Please define and use _UDPROUTER instead of _TTNROUTER"
  52. }
  53. int sendTtn(IPAddress server, int port, uint8_t *msg, int length) {
  54. #error "Error: Please define and use _UDPROUTER instead of _TTNROUTER"
  55. }
  56. #endif// _TTNROUTER