_tcpTTN.ino 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // 1-channel LoRa Gateway for ESP8266
  2. // Copyright (c) 2016-2020 Maarten Westenberg version for ESP8266
  3. //
  4. // based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
  5. // and many others.
  6. //
  7. // All rights reserved. This program and the accompanying materials
  8. // are made available under the terms of the MIT License
  9. // which accompanies this distribution, and is available at
  10. // https://opensource.org/licenses/mit-license.php
  11. //
  12. // NO WARRANTY OF ANY KIND IS PROVIDED
  13. //
  14. // Author: Maarten Westenberg (mw12554@hotmail.com)
  15. //
  16. // Description:
  17. // _tcpTTN.ino:
  18. //
  19. // This file contains the tcp specific code enabling to receive
  20. // and transmit packages/messages to the TTN server using their new protocol.
  21. //
  22. // The TTN code has been developed as an alternative to the Semtech UDP code.
  23. // According to the TTN website the Semtech gateway interface code is less secure and
  24. // works on UDP which is less reliable. The new protocol of TTN should solve these issues.
  25. //
  26. // Initial look at the code of TTN shows that it is overly complex and not written for C++
  27. // or other languages (except for Go). The old Semtech protocol may be too simple but
  28. // the new code is a brainiac.
  29. // As of half 2018 the code is on hold. Some does work, but acording to the documentation
  30. // it should be simpler to use.
  31. //
  32. // ========================================================================================
  33. #if defined(_TTNROUTER)
  34. #if defined(_UDPROUTER)
  35. # error "Error: Please undefine _UDPROUTER if you like to use _TTNROUTER"
  36. #endif
  37. // The following functions ae defined in this modue:
  38. //
  39. // int readTtn(int Packetsize)
  40. // int sendTtn(IPAddress server, int port, uint8_t *msg, int length)
  41. // bool connectTtn()
  42. // void pullData()
  43. // void sendstat();
  44. // Add gateway code of functions here
  45. void connectTtn() {
  46. # error "Error: Please define and use _UDPROUTER instead of _TTNROUTER"
  47. }
  48. int readTtn(int Packetsize) {
  49. #error "Error: Please define and use _UDPROUTER instead of _TTNROUTER"
  50. }
  51. int sendTtn(IPAddress server, int port, uint8_t *msg, int length) {
  52. #error "Error: Please define and use _UDPROUTER instead of _TTNROUTER"
  53. }
  54. #endif// _TTNROUTER