From 2e51144a757f96bc75b9ffd5bb1f69c1f2dbc549 Mon Sep 17 00:00:00 2001 From: Terry Moore Date: Thu, 3 Oct 2019 12:05:23 -0400 Subject: [PATCH] Fix #222: change all LoRaWAN classes to use Arduino_LoRaWAN_network --- README.md | 3 ++- assets/Catena_LoRaWAN.plantuml | 23 ++++++++++------- src/Catena4420.h | 46 ++-------------------------------- src/CatenaBase.h | 2 +- src/CatenaFeatherM0.h | 45 +++++---------------------------- src/CatenaStm32L0.h | 36 +++----------------------- src/CatenaWingFram2k.h | 33 ++++-------------------- 7 files changed, 34 insertions(+), 154 deletions(-) diff --git a/README.md b/README.md index 0204c95..a27ef8d 100644 --- a/README.md +++ b/README.md @@ -777,7 +777,7 @@ void Arduino_LoRaWAN::SetReceiveBufferBufferCb( In order to allow code to be portable across networks and regions, we've done a lot of work with abstraction classes. If you're curious, here's a somewhat simplified diagram. -[![**LoRaWAN class structure**](http://www.plantuml.com/plantuml/png/bPNFRkCs4CRFcgSOvBANjToaQ92uFQpXzG8fx7JhTD5ZCA8c4XkH5FXdNM6xxrv9hBfg6idmKJFy3R-Fd17VEK_M1rN1yWt0tkIXubMo8S-Q7dVcGB-lxzEw8jslWGz12o-DNa7oiGj-sk_GyXDRreBHcM05uvEn62kiLl-KG56HSvXBAYof51BOcBgniYXzM-g16Ka8eshIZTG5xkuss_k7BJx9Yf4y9ANtjLkjbij2-Z9aQRjsgOIG2z7liupRBTOs3rARHQlDjoeK9B0ElZIstUGtjhR1lJ6Mt-9-ixd3ZR6riTJvINuELODNtrtU0jmRpsviK2egsA7KUDYkz--tgSgHB6F1cbkSSymQhCdvJhelfOkwfVO64byoEhQVsI9vx7oqBex7ux-7sdiPFjuYwHmBIraMYp4abbse-jgV3ZkN0hnP0fGoPsHL-mOLguoj0wX9F5F1E9p2SFRayA8pF2HmIEnaPias5_W5A7FUal3neeQLGmV0YVoZ8b5ApRy-PkIutp1D_nky03Y11dTx-SE87KLFmYS5Ug_7skBtjAm8SBYvlXaHCN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poIjPb7ic5EI2PFFquntgRkL8upGIwUalmZ4zDQu2k08Ss-9S6u4qAcZp9-6NuLugDLYah5VvJ_i0Yf-loFmiWJ8DvPpIVjYl-LuOYDh2esl_QTM9vuzbWnAJp8q635dwLWm0un3xAEwUkElRqF-zKE4AEdUcmJdedgW_f24XGPq-b4NYp_2k_OL56h_m40 "Click for SVG version") As the diagram shows, Catena::LoRaWAN objects are primarily `Arduino_LoRaWAN` derivatives, but they also can be viewed as `McciCatena::cPollableObject` instances, and therefore can participate in [polling](#polling-framework). @@ -1261,6 +1261,7 @@ This sketch demonstrates the use of the Catena FSM class to implement the `Turns - HEAD includes the following changes. + - [#222](https://github.com/mcci-catena/Catena-Arduino-Platform/issues/222) Use `Arduino_LoRaWAN_network` consistently as base for `LoRaWAN` classes. (0.17.0.20) - [#213](https://github.com/mcci-catena/Catena-Arduino-Platform/issues/213) Vbat voltage read is inaccurate on STM32L0 platform. (0.17.0.12) - [#211](https://github.com/mcci-catena/Catena-Arduino-Platform/issues/211) `Catena_Si1133` cannot be copied or moved. (0.17.0.11) - [#208](https://github.com/mcci-catena/Catena-Arduino-Platform/issues/208) Add `McciCatena::cTimer` class to simplify timing. (0.17.0.10) diff --git a/assets/Catena_LoRaWAN.plantuml b/assets/Catena_LoRaWAN.plantuml index 7bbd4d7..f05fbec 100644 --- a/assets/Catena_LoRaWAN.plantuml +++ b/assets/Catena_LoRaWAN.plantuml @@ -5,11 +5,11 @@ Module: Catena_LoRaWAN.plantuml Function: PlantUML reference source for Catena::LoRaWAN class diagram. - + Copyright: See accompanying LICENSE file at https:://github.com/mcci-catena/Catena-Arduino-Platform - + Author: Terry Moore, MCCI Corporation July 2019 @@ -50,6 +50,8 @@ note right on link by IDE or command line end note +class Arduino_LoRaWAN_network + Arduino_LoRaWAN_ttn_base <|-- Arduino_LoRaWAN_ttn_eu868 Arduino_LoRaWAN_ttn_base <|-- Arduino_LoRaWAN_ttn_us915 Arduino_LoRaWAN_ttn_base <|-- Arduino_LoRaWAN_ttn_au921 @@ -61,6 +63,14 @@ Arduino_LoRaWAN_ttn_us915 <|.. Arduino_LoRaWAN_ttn Arduino_LoRaWAN_ttn_au921 <|.. Arduino_LoRaWAN_ttn Arduino_LoRaWAN_ttn_as923 <|.. Arduino_LoRaWAN_ttn Arduino_LoRaWAN_ttn_in866 <|.. Arduino_LoRaWAN_ttn + +Arduino_LoRaWAN_machineQ <|.. Arduino_LoRaWAN_network +note right on link + Network selected at compile time + by IDE or command line. +end note +Arduino_LoRaWAN_ttn <|.. Arduino_LoRaWAN_network + } namespace McciCatena { @@ -69,19 +79,14 @@ class cPollableObject class Catena::LoRaWAN note right Some complexity hidden; - Subclasses deal with device + Subclasses deal with device configuration and FRAM usage. end note cPollableObject <|- Catena::LoRaWAN -.Arduino_LoRaWAN_machineQ <|.. Catena::LoRaWAN -note right on link - Network selected at compile time - by IDE or command line. -end note -.Arduino_LoRaWAN_ttn <|.. Catena::LoRaWAN +.Arduino_LoRaWAN_network <|.. Catena::LoRaWAN } @enduml \ No newline at end of file diff --git a/src/Catena4420.h b/src/Catena4420.h index a794db9..e10ea75 100644 --- a/src/Catena4420.h +++ b/src/Catena4420.h @@ -1,5 +1,3 @@ -/* Catena4420.h Wed Dec 05 2018 14:20:58 chwon */ - /* Module: Catena4420.h @@ -7,33 +5,11 @@ Module: Catena4420.h Function: class Catena4420 (Aduino header file) -Version: - V0.12.0 Wed Dec 05 2018 14:20:58 chwon Edit level 2 - Copyright notice: - This file copyright (C) 2016, 2018 by - - MCCI Corporation - 3520 Krums Corners Road - Ithaca, NY 14850 + See LICENSE file accompanying this project. - An unpublished work. All rights reserved. - - This file is proprietary information, and may not be disclosed or - copied without the prior permission of MCCI Corporation. - Author: - Terry Moore, MCCI Corporation December 2016 - -Revision history: - 0.4.0 Sun Dec 4 2016 23:45:17 tmm - Module created. - - 0.11.0 Wed Nov 21 2018 13:41:46 chwon - Add CatenaName() method. - - 0.12.0 Wed Dec 05 2018 14:20:58 chwon - Add getCpuIdPlatformTable() method override. + Terry Moore, MCCI Corporation December 2016 */ @@ -44,8 +20,6 @@ Revision history: # include "CatenaFeatherM0.h" #endif -#include - namespace McciCatena { class Catena4420 : public CatenaFeatherM0 @@ -95,26 +69,10 @@ class Catena4420::LoRaWAN : public CatenaFeatherM0::LoRaWAN */ LoRaWAN() {}; - /* - || the begin function loads data from the local - || platform's stable storage and initializes - || the connection. - */ - // bool begin(CatenaFeatherM0 *pCatena4420); - protected: /* || we use the CatenaFeatherM0 defaults */ - // ProvisioningStyle GetProvisioningStyle(void); - - // bool GetAbpProvisioningInfo( - // AbpProvisioningInfo *pProvisioningInfo - // ); - - // bool GetOtaaProvisioningInfo( - // OtaaProvisioningInfo *pProvisioningInfo - // ); private: }; diff --git a/src/CatenaBase.h b/src/CatenaBase.h index 3d3bb0b..fa72cc8 100644 --- a/src/CatenaBase.h +++ b/src/CatenaBase.h @@ -55,7 +55,7 @@ Copyright notice: #define CATENA_ARDUINO_PLATFORM_VERSION_CALC(major, minor, patch, local) \ (((major) << 24u) | ((minor) << 16u) | ((patch) << 8u) | (local)) -#define CATENA_ARDUINO_PLATFORM_VERSION CATENA_ARDUINO_PLATFORM_VERSION_CALC(0, 17, 0, 12) /* v0.17.0.12 */ +#define CATENA_ARDUINO_PLATFORM_VERSION CATENA_ARDUINO_PLATFORM_VERSION_CALC(0, 17, 0, 20) /* v0.17.0.20 */ #define CATENA_ARDUINO_PLATFORM_VERSION_GET_MAJOR(v) \ (((v) >> 24u) & 0xFFu) diff --git a/src/CatenaFeatherM0.h b/src/CatenaFeatherM0.h index be96603..0088c71 100644 --- a/src/CatenaFeatherM0.h +++ b/src/CatenaFeatherM0.h @@ -1,36 +1,15 @@ -/* CatenaFeatherM0.h Wed Dec 05 2018 14:12:40 chwon */ - /* -Module: CatenaFeatherM0.h +Module: CateenaFeatherM0.h Function: Class CatenaFeatherM0 -Version: - V0.12.0 Wed Dec 05 2018 14:12:40 chwon Edit level 3 - Copyright notice: - This file copyright (C) 2016-2018 by - - MCCI Corporation - 3520 Krums Corners Road - Ithaca, NY 14850 - - An unpublished work. All rights reserved. - - This file is proprietary information, and may not be disclosed or - copied without the prior permission of MCCI Corporation. + See LICENSE file accompanying this project. Author: - Terry Moore, MCCI Corporation December 2016 - -Revision history: - 0.4.0 Sun Dec 4 2016 19:57:13 tmm - Module created. - - 0.12.0 Wed Dec 05 2018 14:12:41 chwon - Add CatenaFeatherM0::begin() and override provisioning stuff. + Terry Moore, MCCI Corporation December 2016 */ @@ -43,19 +22,7 @@ Revision history: # include "CatenaSamd21.h" #endif -//#define ARDUINO_LORAWAN_NETWORK_MACHINEQ 1 - -#ifdef ARDUINO_LORAWAN_NETWORK_TTN -# include -using Arduino_LoRaWAN_Network = Arduino_LoRaWAN_ttn; -#elif defined(ARDUINO_LORAWAN_NETWORK_MACHINEQ) -# include -using Arduino_LoRaWAN_Network = Arduino_LoRaWAN_machineQ; -#else -// **** default **** : assume TTN -# include -using Arduino_LoRaWAN_Network = Arduino_LoRaWAN_ttn; -#endif +#include namespace McciCatena { @@ -107,11 +74,11 @@ class CatenaFeatherM0 : public CatenaSamd21 private: }; -class CatenaFeatherM0::LoRaWAN : public Arduino_LoRaWAN_Network, +class CatenaFeatherM0::LoRaWAN : public Arduino_LoRaWAN_network, public cPollableObject { public: - using Super = Arduino_LoRaWAN_Network; + using Super = Arduino_LoRaWAN_network; /* || the constructor. diff --git a/src/CatenaStm32L0.h b/src/CatenaStm32L0.h index 90c72bb..3b50c40 100644 --- a/src/CatenaStm32L0.h +++ b/src/CatenaStm32L0.h @@ -1,5 +1,3 @@ -/* CatenaStm32L0.h Fri Dec 28 2018 14:03:19 chwon */ - /* Module: CatenaStm32L0.h @@ -7,38 +5,12 @@ Module: CatenaStm32L0.h Function: Class CatenaStm32L0 -Version: - V0.13.0 Fri Dec 28 2018 14:03:19 chwon Edit level 3 - Copyright notice: - This file copyright (C) 2017-2018 by - - MCCI Corporation - 3520 Krums Corners Road - Ithaca, NY 14850 - - An unpublished work. All rights reserved. - - This file is proprietary information, and may not be disclosed or - copied without the prior permission of MCCI Corporation. + See LICENSE file accompanying this project. Author: ChaeHee Won, MCCI Corporation October 2017 -Revision history: - 0.6.0 Fri Oct 13 2017 15:19:30 chwon - Module created. - - 0.11.0 Mon Nov 19 2018 12:11:25 chwon - Add Sleep() method override and add m_Rtc in the private context. - - 0.12.0 Wed Dec 05 2018 14:10:13 chwon - Remove GetSysEUI() and GetPlatformForID() methods override. - Add getFRAM() method override. - - 0.13.0 Fri Dec 28 2018 14:03:19 chwon - Add ReadAnalog() method and add CatenaStm32L0_ReadAnalog() prototype. - */ #ifndef _CATENASTM32L0_H_ /* prevent multiple includes */ @@ -58,7 +30,7 @@ Revision history: # include "CatenaStm32L0Rtc.h" #endif -#include +#include namespace McciCatena { @@ -138,11 +110,11 @@ class CatenaStm32L0 : public CatenaStm32 McciCatena::CatenaStm32L0Rtc m_Rtc; }; -class CatenaStm32L0::LoRaWAN : public Arduino_LoRaWAN_ttn, +class CatenaStm32L0::LoRaWAN : public Arduino_LoRaWAN_network, public McciCatena::cPollableObject { public: - using Super = Arduino_LoRaWAN_ttn; + using Super = Arduino_LoRaWAN_network; /* || the constructor. diff --git a/src/CatenaWingFram2k.h b/src/CatenaWingFram2k.h index 6415ce2..90bea3c 100644 --- a/src/CatenaWingFram2k.h +++ b/src/CatenaWingFram2k.h @@ -1,40 +1,17 @@ -/* CatenaWingFram2k.h Wed Dec 05 2018 14:15:16 chwon */ - /* Module: CatenaWingFram2k.h Function: class CatenaWingFram2k: CatenaBase Platform to represent a Catena - Feather Wing with 2k FRAM and the DIO1>D6 loopback. - -Version: - V0.12.0 Wed Dec 05 2018 14:15:17 chwon Edit level 3 + Feather Wing with 2k FRAM and the DIO1>D6 loopback. Copyright notice: - This file copyright (C) 2017-2018 by - - MCCI Corporation - 3520 Krums Corners Road - Ithaca, NY 14850 + See LICENSE file accompanying this project. - An unpublished work. All rights reserved. - - This file is proprietary information, and may not be disclosed or - copied without the prior permission of MCCI Corporation. - Author: Terry Moore, MCCI Corporation March 2017 -Revision history: - 0.5.0 Sun Mar 12 2017 18:16:07 tmm - Module created. - - 0.12.0 Wed Dec 05 2018 14:15:17 chwon - Use CatenaSamd21 super class instead of CatenaFeatherM0LoRa class. - Remove GetSysEUI() and GetPlatformForID() methods override. - Add ReadVbat() and add getFRAM() method override. - */ #ifndef _CATENAWINGFRAM2K_H_ /* prevent multiple includes */ @@ -50,7 +27,7 @@ Revision history: # include "Catena_Fram2k.h" #endif -#include +#include // // TODO(tmm@mcci.com) @@ -126,11 +103,11 @@ class CatenaWingFram2k : public CatenaSamd21 || The LoRaWAN class for the Catena Wings. Needed because we have a || specific storage implementation and pin table. */ -class CatenaWingFram2k::LoRaWAN : public Arduino_LoRaWAN_ttn, +class CatenaWingFram2k::LoRaWAN : public Arduino_LoRaWAN_network, public McciCatena::cPollableObject { public: - using Super = Arduino_LoRaWAN_ttn; + using Super = Arduino_LoRaWAN_network; /* || the constructor. We don't do anything at this level, the