diff --git a/src/CatenaBase.h b/src/CatenaBase.h index df96e4f..1aa73f4 100644 --- a/src/CatenaBase.h +++ b/src/CatenaBase.h @@ -47,6 +47,9 @@ Copyright notice: #include +#include +#include + #if ! (defined(ARDUINO_LORAWAN_VERSION) && ARDUINO_LORAWAN_VERSION >= ARDUINO_LORAWAN_VERSION_CALC(0,6,0,20)) # error Arduino_LoRaWAN library is out of date. Check ARDUINO_LORAWAN_VERSION. #endif @@ -284,6 +287,9 @@ class CatenaBase bool addLoRaWanCommands(void); + bool GetSigfoxConfiguringInfo(MCCI_Catena_Sigfox::SigfoxConfiguringInfo *); + bool addSigfoxCommands(void); + // calibrate the system clock, if possible virtual uint32_t CalibrateSystemClock(void) { diff --git a/src/CatenaFeatherM0.h b/src/CatenaFeatherM0.h index 0088c71..2bd3e4e 100644 --- a/src/CatenaFeatherM0.h +++ b/src/CatenaFeatherM0.h @@ -24,6 +24,9 @@ Copyright notice: #include +#include +#include + namespace McciCatena { class CatenaFeatherM0 : public CatenaSamd21 @@ -37,6 +40,9 @@ class CatenaFeatherM0 : public CatenaSamd21 // forward reference class LoRaWAN; + // Sigfox binding + class Sigfox /* forward */; + // all FeatherM0s put vbat on A7 enum ANALOG_PINS { @@ -116,6 +122,42 @@ class CatenaFeatherM0::LoRaWAN : public Arduino_LoRaWAN_network, CatenaFeatherM0 *m_pCatena; }; +class CatenaFeatherM0::Sigfox : public MCCI_Catena_Sigfox, + public cPollableObject + { +public: + using Super = MCCI_Sigfox; + + /* + || the constructor. + */ + Sigfox() {}; + + /* + || the begin function loads data from the local + || platform's stable storage and initializes + || the connection. + */ + virtual bool begin(CatenaFeatherM0 *pCatena); + + virtual void poll() { sigfox_loop(); }; + +protected: + /* + || we have to provide these for the lower level + */ + virtual bool GetSigfoxConfiguringInfo( + SigfoxConfiguringInfo *pProvisioningInfo + ) override; + + // + // TODO(tmm@mcci.com) -- the following are not used but are always + // hanging around even when we have better ways to do things. + // +private: + CatenaFeatherM0 *m_pCatena; + }; + } /* namespace McciCatena */ /**** end of CatenaFeatherM0.h ****/ diff --git a/src/CatenaStm32L0.h b/src/CatenaStm32L0.h index 92e7052..7adaf66 100644 --- a/src/CatenaStm32L0.h +++ b/src/CatenaStm32L0.h @@ -33,6 +33,7 @@ Copyright notice: #include #include +#include namespace McciCatena { @@ -47,6 +48,9 @@ class CatenaStm32L0 : public CatenaStm32 // forward reference class LoRaWAN; + // Sigfox binding + class Sigfox /* forward */; + // start the Stm32L0 level virtual bool begin(void) override; @@ -159,11 +163,11 @@ class CatenaStm32L0::LoRaWAN : public Arduino_LoRaWAN_network, CatenaStm32L0 *m_pCatena; }; -class CatenaStm32L0::Sigfox : public MCCI_Sigfox, +class CatenaStm32L0::Sigfox : public MCCI_Catena_Sigfox, public McciCatena::cPollableObject { public: - using Super = MCCI_Sigfox; + using Super = MCCI_Catena_Sigfox; /* || the constructor. @@ -177,20 +181,15 @@ class CatenaStm32L0::Sigfox : public MCCI_Sigfox, */ virtual bool begin(CatenaStm32L0 *pCatena); - virtual void poll() { this->Super::loop(); }; + virtual void poll() { sigfox_loop(); }; protected: /* || we have to provide these for the lower level */ virtual bool GetSigfoxConfiguringInfo( - Arduino_LoRaWAN::OtaaProvisioningInfo * + MCCI_Catena_Sigfox::SigfoxConfiguringInfo * ) override; - - // - // TODO(tmm@mcci.com) -- the following are not used but are always - // hanging around even when we have better ways to do things. - // private: CatenaStm32L0 *m_pCatena; }; diff --git a/src/Catena_FramStorage.h b/src/Catena_FramStorage.h index 4a405c1..d275d82 100644 --- a/src/Catena_FramStorage.h +++ b/src/Catena_FramStorage.h @@ -47,12 +47,12 @@ class cFramStorage kBootCount = 14, kOperatingFlags = 15, kBme680Cal = 16, - kAppConf = 17, - kDevID = 18, - kPAC = 19, - kKey = 20, - kRegion = 21, - kEncryption = 22, + kDevID = 17, + kPAC = 18, + kKey = 19, + kRegion = 20, + kEncryption = 21, + kAppConf = 22, // when you add something, also update McciCatena::cFramStorage::vItemDefs[]! kMAX }; diff --git a/src/lib/CatenaBase_GetSigfoxConfiguringInfo.cpp b/src/lib/CatenaBase_GetSigfoxConfiguringInfo.cpp index e5f78fa..00f6dce 100644 --- a/src/lib/CatenaBase_GetSigfoxConfiguringInfo.cpp +++ b/src/lib/CatenaBase_GetSigfoxConfiguringInfo.cpp @@ -64,7 +64,7 @@ Name: CatenaBase::GetSigfoxConfiguringInfo() Definition: public: virtual bool CatenaBase::GetSigfoxConfiguringInfo( - Arduino_LoRaWAN::OtaaProvisioningInfo *pInfo + MCCI_Catena_Sigfox::SigfoxConfiguringInfo *pInfo ) override; Description: @@ -84,7 +84,7 @@ Name: CatenaBase::GetSigfoxConfiguringInfo() bool CatenaBase::GetSigfoxConfiguringInfo( - Arduino_LoRaWAN::OtaaProvisioningInfo *pInfo + MCCI_Catena_Sigfox::SigfoxConfiguringInfo *pInfo ) { auto const pFram = this->getFram(); @@ -93,7 +93,7 @@ CatenaBase::GetSigfoxConfiguringInfo( { gLog.printf( gLog.kError, - "?CatenaBase::GetOtaaProvisioningInfo: no FRAM\n" + "?CatenaBase::GetSigfoxConfiguringInfo: no FRAM\n" ); if (pInfo != nullptr) @@ -102,6 +102,8 @@ CatenaBase::GetSigfoxConfiguringInfo( return false; } + /* cFram::Cursor framSigfoxCredentials(pFram); */ + cFram::Cursor framDevID(pFram), framPAC(pFram), framKey(pFram), @@ -118,11 +120,14 @@ CatenaBase::GetSigfoxConfiguringInfo( framEncryption.locate(cFramStorage::vItemDefs[cFramStorage::kEncryption])) fResult = true; + /* if (framSigfoxCredentials.locate(cFramStorage::vItemDefs[cFramStorage::kSigfoxCredentials])) + fResult = true; */ + if (! fResult) { gLog.printf( gLog.kError, - "?CatenaBase::GetOtaaProvisioningInfo: failing\n" + "?CatenaBase::GetSigfoxConfiguringInfo: failing\n" ); if (pInfo != nullptr) @@ -135,13 +140,20 @@ CatenaBase::GetSigfoxConfiguringInfo( return true; /* copy the data */ - framDevID.get(pInfo->AppKey, sizeof(pInfo->AppKey)); - framPAC.get(pInfo->DevEUI, sizeof(pInfo->DevEUI)); - framKey.get(pInfo->AppEUI, sizeof(pInfo->AppEUI)); - framRegion.get(pInfo->DevEUI, sizeof(pInfo->DevEUI)); - framEncryption.get(pInfo->AppEUI, sizeof(pInfo->AppEUI)); + framDevID.get(pInfo->DevID, sizeof(pInfo->DevID)); + framPAC.get(pInfo->PAC, sizeof(pInfo->PAC)); + framKey.get(pInfo->Key, sizeof(pInfo->Key)); + framRegion.get(pInfo->Region, sizeof(pInfo->Region)); + framEncryption.get(pInfo->Encryption, sizeof(pInfo->Encryption)); + + /* copy the data */ + /* framSigfoxCredentials.get(pInfo->AppKey, sizeof(pInfo->AppKey)); + framSigfoxCredentials.get(pInfo->DevEUI, sizeof(pInfo->DevEUI)); + framSigfoxCredentials.get(pInfo->AppEUI, sizeof(pInfo->AppEUI)); + framSigfoxCredentials.get(pInfo->DevEUI, sizeof(pInfo->DevEUI)); + framSigfoxCredentials.get(pInfo->AppEUI, sizeof(pInfo->AppEUI)); */ return true; } -/**** end of CatenaBase_GetOtaaProvisioningInfo.cpp ****/ +/**** end of CatenaBase_GetSigfoxConfiguringInfo.cpp ****/ diff --git a/src/lib/CatenaBase_addSigfoxCommands.cpp b/src/lib/CatenaBase_addSigfoxCommands.cpp index b2e8d4c..3a2999f 100644 --- a/src/lib/CatenaBase_addSigfoxCommands.cpp +++ b/src/lib/CatenaBase_addSigfoxCommands.cpp @@ -16,6 +16,7 @@ Copyright notice: #include "CatenaBase.h" #include +#include #include "Catena_Log.h" diff --git a/src/lib/Catena_Fram.cpp b/src/lib/Catena_Fram.cpp index 655537b..9072d29 100644 --- a/src/lib/Catena_Fram.cpp +++ b/src/lib/Catena_Fram.cpp @@ -544,9 +544,9 @@ McciCatena::cFram::writeItemData( { gLog.printf( gLog.kBug, - "%s: offset for uKey(%u) invalid!\n", + "%s: offset for uKey(%u) invalid!, offset:(%u)\n", __FUNCTION__, - uKey + uKey, offset ); return false; diff --git a/src/lib/Catena_FramStorage.cpp b/src/lib/Catena_FramStorage.cpp index 7bfcc2c..dbb5d2f 100644 --- a/src/lib/Catena_FramStorage.cpp +++ b/src/lib/Catena_FramStorage.cpp @@ -65,14 +65,14 @@ McciCatena::cFramStorage::vItemDefs[cFramStorage::kMAX] = cFramStorage::StandardItem(kAppKey, sizeof(uint8_t[16]), /* number */ false), cFramStorage::StandardItem(kBootCount, sizeof(uint32_t), /* number */ true), cFramStorage::StandardItem(kOperatingFlags, sizeof(uint32_t), /* number */ true), - cFramStorage::StandardItem(kDevID, sizeof(uint32_t), /* number */ true), - cFramStorage::StandardItem(kPAC, sizeof(uint32_t), /* number */ true), - cFramStorage::StandardItem(kKey, sizeof(uint8_t[16]), /* number */ false), - cFramStorage::StandardItem(kRegion, sizeof(uint32_t), /* number */ true), - cFramStorage::StandardItem(kEncryption, sizeof(uint32_t), /* number */ true), /* the size field should match BSEC_MAX_STATE_BLOB_SIZE, which is 139 */ cFramStorage::StandardItem(kBme680Cal, 139, /* number */ false), + cFramStorage::StandardItem(kDevID, sizeof(uint8_t[4]), /* number */ true), + cFramStorage::StandardItem(kPAC, sizeof(uint8_t[8]), /* number */ true), + cFramStorage::StandardItem(kKey, sizeof(uint8_t[16]), /* number */ false), + cFramStorage::StandardItem(kRegion, sizeof(uint8_t), /* number */ true), + cFramStorage::StandardItem(kEncryption, sizeof(uint8_t), /* number */ true), cFramStorage::StandardItem(kAppConf, cFramStorage::MaxAppConfSize, false) }; diff --git a/src/lib/samd/catenawingfram2k/CatenaWingFram2k_Sigfox_begin.cpp b/src/lib/samd/catenawingfram2k/CatenaWingFram2k_Sigfox_begin.cpp index 49650e6..b6724b2 100644 --- a/src/lib/samd/catenawingfram2k/CatenaWingFram2k_Sigfox_begin.cpp +++ b/src/lib/samd/catenawingfram2k/CatenaWingFram2k_Sigfox_begin.cpp @@ -1,39 +1,15 @@ -/* CatenaWingFram2k_LoRaWAN_begin.cpp Wed Jan 09 2019 14:24:20 chwon */ - /* -Module: CatenaWingFram2k_LoRaWAN_begin.cpp +Module: CatenaWingFram2k_Sigfox_begin.cpp Function: - CatenaWingFram2k::LoRaWAN::begin() - -Version: - V0.13.0 Wed Jan 09 2019 14:24:20 chwon Edit level 3 + CatenaWingFram2k::Sigfox::begin() Copyright notice: - This file copyright (C) 2017-2019 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 accompanying LICENSE file. Author: - Terry Moore, MCCI Corporation March 2017 - -Revision history: - 0.5.0 Sun Mar 12 2017 19:31:15 tmm - Module created. - - 0.12.0 Wed Dec 05 2018 14:27:52 chwon - Call Arduino_LoRaWAN::begin() and use Catena addLoRaWanCommands(). - - 0.13.0 Wed Jan 09 2019 14:24:20 chwon - Need to set up LoRaWan command before call Arduino_LoRaWAN::begin(). + Dhinesh Kumar Pitchai, MCCI Corporation December 2020 */ @@ -48,13 +24,13 @@ using namespace McciCatena; /* -Name: CatenaWingFram2k::LoRaWAN::begin() +Name: CatenaWingFram2k::Sigfox::begin() Function: - Record linkage to main Catena object and set up LoRaWAN. + Record linkage to main Catena object and set up Sigfox. Definition: - bool CatenaWingFram2k::LoRaWAN::begin( + bool CatenaWingFram2k::Sigfox::begin( CatenaWingFram2k *pParent ); @@ -67,25 +43,25 @@ Name: CatenaWingFram2k::LoRaWAN::begin() */ bool -CatenaWingFram2k::LoRaWAN::begin( +CatenaWingFram2k::Sigfox::begin( CatenaWingFram2k *pParent ) { - gLog.printf(gLog.kTrace, "+CatenaWingFram2k::LoRaWAN::begin()\n"); + gLog.printf(gLog.kTrace, "+CatenaWingFram2k::Sigfox::begin()\n"); + MCCI_Sigfox m_Sigfox; this->m_pCatena = pParent; - this->m_ulDebugMask |= LOG_VERBOSE | LOG_ERRORS | LOG_BASIC; /* first set up command processor -- just in case begin() failed */ - pParent->addLoRaWanCommands(); + pParent->addSigfoxCommands(); /* call the base begin */ - if (! this->Arduino_LoRaWAN::begin()) + if (! m_Sigfox.isReady()) { gLog.printf( gLog.kError, - "?CatenaWingFram2k::LoRaWAN::begin:" - " Arduino_LoRaWAN:begin failed\n" + "?CatenaWingFram2k::Sigfox::begin:" + " MCCI_Catena_Sigfox:begin failed\n" ); return false; } diff --git a/src/lib/samd/catenawingfram2k/CatenaWingFram2k_Sigfox_storage.cpp b/src/lib/samd/catenawingfram2k/CatenaWingFram2k_Sigfox_storage.cpp index cc9c00d..bd0091c 100644 --- a/src/lib/samd/catenawingfram2k/CatenaWingFram2k_Sigfox_storage.cpp +++ b/src/lib/samd/catenawingfram2k/CatenaWingFram2k_Sigfox_storage.cpp @@ -1,36 +1,15 @@ -/* CatenaWingFram2k_LoRaWAN_storage.cpp Wed Dec 05 2018 14:31:54 chwon */ - /* -Module: CatenaWingFram2k_LoRaWAN_storage.cpp +Module: CatenaWingFram2k_Sigfox_storage.cpp Function: - Interface from LoRaWAN to FRAM. - -Version: - V0.12.0 Wed Dec 05 2018 14:31:54 chwon Edit level 2 + Interface from Sigfox to FRAM. 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 accompanying LICENSE file. Author: - Terry Moore, MCCI Corporation March 2017 - -Revision history: - 0.5.0 Fri Mar 17 2017 22:49:16 tmm - Module created. - - 0.12.0 Wed Dec 05 2018 14:31:54 chwon - Use Catena provisioning and NetSave methods. + Dhinesh Kumar Pitchai, MCCI Corporation December 2020 */ @@ -43,64 +22,24 @@ Revision history: using namespace McciCatena; -/* - -Name: CatenaWingFram2k::LoRaWAN::GetAbpProvisioningInfo() - -Function: - Get the ABP info (which is also what's saved after an OTAA Join) - -Definition: - public: virtual bool - CatenaWingFram2k::LoRaWAN::GetAbpProvisioningInfo( - CatenaWingFram2k::LoRaWAN::AbpProvisioningInfo *pInfo - ) override; - -Description: - This routine fills in an ABP info table with saved FRAM data: - - NwkSkey (the network session key) - AppSkey (the app session key) - DevAddr (the assigned device address) - NwId (the assigned network ID) - FCntUp (the uplink frame count) - FCntDown (the downlink frame count) - - (When provisioning a device for ABP, you'll want to reset the frame - counts, as these are maintained on uplink/downlink) - -Returns: - true if the data was filled in, false if not. - -*/ -bool -CatenaWingFram2k::LoRaWAN::GetAbpProvisioningInfo( - CatenaWingFram2k::LoRaWAN::AbpProvisioningInfo *pInfo - ) - { - CatenaWingFram2k * const pCatena = this->m_pCatena; - - return pCatena->GetAbpProvisioningInfo(pInfo); - } - /* -Name: CatenaWingFram2k::LoRaWAN::GetOtaaProvisioningInfo() +Name: CatenaWingFram2k::Sigfox::GetSigfoxConfiguringInfo() Function: - Fetch OTAA provisioning info from FRAM (if availalbe) + Fetch Sigfox provisioning info from FRAM (if availalbe) Definition: public: virtual bool - CatenaWingFram2k::LoRaWAN::GetOtaaProvisioningInfo( - CatenaWingFram2k::LoRaWAN::OtaaProvisioningInfo *pInfo + CatenaWingFram2k::Sigfox::GetSigfoxConfiguringInfo( + CatenaWingFram2k::Sigfox::SigfoxConfiguringInfo *pInfo ) override; Description: - This routine fetches the OTAA provisioning info from FRAM if + This routine fetches the Sigfox provisioning info from FRAM if available, formatting it into *pInfo. For this to work, FRAM - must be initialized and the AppKey, AppEUI and DevEUI must be + must be initialized and the DevID, PAC, Key and Region must be available. If pInfo is nullptr, the routine simply checks whether the info @@ -113,55 +52,13 @@ Name: CatenaWingFram2k::LoRaWAN::GetOtaaProvisioningInfo() */ bool -CatenaWingFram2k::LoRaWAN::GetOtaaProvisioningInfo( - CatenaWingFram2k::LoRaWAN::OtaaProvisioningInfo *pInfo +CatenaWingFram2k::Sigfox::GetSigfoxConfiguringInfo( + CatenaWingFram2k::Sigfox::SigfoxConfiguringInfo *pInfo ) { CatenaWingFram2k * const pCatena = this->m_pCatena; - return pCatena->GetOtaaProvisioningInfo(pInfo); - } - -CatenaWingFram2k::LoRaWAN::ProvisioningStyle -CatenaWingFram2k::LoRaWAN::GetProvisioningStyle( - void - ) - { - CatenaWingFram2k * const pCatena = this->m_pCatena; - - return pCatena->GetProvisioningStyle(); - } - -void -CatenaWingFram2k::LoRaWAN::NetSaveFCntUp( - uint32_t uFCntUp - ) - { - CatenaWingFram2k * const pCatena = this->m_pCatena; - - pCatena->NetSaveFCntUp(uFCntUp); - } - -void -CatenaWingFram2k::LoRaWAN::NetSaveFCntDown( - uint32_t uFCntDown - ) - { - CatenaWingFram2k * const pCatena = this->m_pCatena; - - pCatena->NetSaveFCntDown(uFCntDown); - } - -void -CatenaWingFram2k::LoRaWAN::NetSaveSessionInfo( - const SessionInfo &Info, - const uint8_t *pExtraInfo, - size_t nExtraInfo - ) - { - CatenaWingFram2k * const pCatena = this->m_pCatena; - - pCatena->NetSaveSessionInfo(Info, pExtraInfo, nExtraInfo); + return pCatena->GetSigfoxConfiguringInfo(pInfo); } #endif // ARDUINO_ARCH_SAMD diff --git a/src/lib/samd/featherm0/catenafeatherm0_sigfox_begin.cpp b/src/lib/samd/featherm0/catenafeatherm0_sigfox_begin.cpp index 58acc5a..f142760 100644 --- a/src/lib/samd/featherm0/catenafeatherm0_sigfox_begin.cpp +++ b/src/lib/samd/featherm0/catenafeatherm0_sigfox_begin.cpp @@ -1,37 +1,15 @@ -/* begin.cpp Wed Dec 05 2018 14:30:26 chwon */ - /* -Module: begin.cpp +Module: catenafeatherm0_sigfox_begin.cpp Function: - Catena4410::LoRaWAN::begin() - -Version: - V0.12.0 Wed Dec 05 2018 14:30:26 chwon Edit level 2 + CatenaFeatherM0::Sigfox::begin() 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 accompanying LICENSE file. Author: - Terry Moore, MCCI Corporation October 2016 - -Revision history: - 0.1.0 Tue Oct 25 2016 03:42:18 tmm - Module created. Note that since this lives in a library with - lib/begin.cpp, we must have a different file name. - - 0.12.0 Wed Dec 05 2018 14:30:26 chwon - Add debug message. + Dhinesh Kumar Pitchai, MCCI Corporation December 2020 */ @@ -79,17 +57,17 @@ using namespace McciCatena; | \****************************************************************************/ -bool CatenaFeatherM0::LoRaWAN::begin( +bool CatenaFeatherM0::Sigfox::begin( CatenaFeatherM0 *pParent ) { - gLog.printf(gLog.kTrace, "+CatenaFeatherM0::LoRaWAN::begin()\n"); + gLog.printf(gLog.kTrace, "+CatenaFeatherM0::Sigfox::begin()\n"); + MCCI_Sigfox m_Sigfox; this->m_pCatena = pParent; - this->m_ulDebugMask |= LOG_VERBOSE | LOG_ERRORS | LOG_BASIC; /* first call the base begin */ - if (! this->Arduino_LoRaWAN::begin()) + if (! m_Sigfox.isReady()) { gLog.printf( gLog.kBug, diff --git a/src/lib/samd/featherm0/catenafeatherm0_sigfox_getconfiguringinfo.cpp b/src/lib/samd/featherm0/catenafeatherm0_sigfox_getconfiguringinfo.cpp index c51019f..38095cd 100644 --- a/src/lib/samd/featherm0/catenafeatherm0_sigfox_getconfiguringinfo.cpp +++ b/src/lib/samd/featherm0/catenafeatherm0_sigfox_getconfiguringinfo.cpp @@ -1,11 +1,11 @@ -/* catenafeatherm0_lorawan_getotaaprovisioninginfo.cpp Mon Dec 5 2016 02:09:31 tmm */ +/* catenafeatherm0_sigfox_getsigfoxconfiguringinfo.cpp Mon Dec 5 2016 02:09:31 tmm */ /* -Module: catenafeatherm0_lorawan_getotaaprovisioninginfo.cpp +Module: catenafeatherm0_sigfox_getsigfoxconfiguringinfo.cpp Function: - CatenaFeatherM0::LoRaWAN::GetOtaaProvisioningInfo() + CatenaFeatherM0::Sigfox::GetSigfoxConfiguringInfo() Version: V0.4.0 Mon Dec 5 2016 02:09:31 tmm Edit level 2 @@ -61,15 +61,14 @@ using namespace McciCatena; bool -CatenaFeatherM0::LoRaWAN::GetOtaaProvisioningInfo( - CatenaFeatherM0::LoRaWAN::OtaaProvisioningInfo *pInfo +CatenaFeatherM0::Sigfox::GetSigfoxConfiguringInfo( + Sigfox::SigfoxConfiguringInfo *pInfo ) { CatenaFeatherM0 * const pCatena = this->m_pCatena; const ProvisioningInfo * const pInstance = pCatena->GetProvisioningInfo(); - if (! pInstance || - pInstance->Style != ProvisioningStyle::kOTAA) + if (! pInstance) { if (pInfo) { diff --git a/src/lib/stm32/catena461x/Catena461x_Sigfox_begin.cpp b/src/lib/stm32/catena461x/Catena461x_Sigfox_begin.cpp index a63bccd..35adc95 100644 --- a/src/lib/stm32/catena461x/Catena461x_Sigfox_begin.cpp +++ b/src/lib/stm32/catena461x/Catena461x_Sigfox_begin.cpp @@ -1,33 +1,15 @@ -/* Catena461x_LoRaWAN_begin.cpp Thu Nov 15 2018 14:54:47 chwon */ - /* -Module: Catena461x_LoRaWAN_begin.cpp +Module: Catena461x_Sigfox_begin.cpp Function: - Catena461x::LoRaWAN::begin() - -Version: - V0.11.0 Thu Nov 15 2018 14:54:47 chwon Edit level 1 + Catena461x::Sigfox::begin() Copyright notice: - This file copyright (C) 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 accompanying LICENSE file. Author: - ChaeHee Won, MCCI Corporation November 2018 - -Revision history: - 0.11.0 Thu Nov 15 2018 14:54:47 chwon - Module created. + Dhinesh Kumar Pitchai, MCCI Corporation December 2020 */ @@ -42,13 +24,13 @@ using namespace McciCatena; /* -Name: Catena461x::LoRaWAN::begin() +Name: Catena461x::Sigfox::begin() Function: Record linkage to main Catena object and set up LoRaWAN. Definition: - bool Catena461x::LoRaWAN::begin( + bool Catena461x::Sigfox::begin( Catena461x *pParent ); @@ -61,18 +43,18 @@ Name: Catena461x::LoRaWAN::begin() */ bool -Catena461x::LoRaWAN::begin( +Catena461x::Sigfox::begin( Catena461x *pParent ) { - gLog.printf(gLog.kTrace, "+Catena461x::LoRaWAN::begin()\n"); + gLog.printf(gLog.kTrace, "+Catena461x::Sigfox::begin()\n"); /* call the base begin */ if (! this->Super::begin(pParent)) { gLog.printf( gLog.kBug, - "?Catena461x::LoRaWAN::begin: Super::begin() failed\n" + "?Catena461x::Sigfox::begin: Super::begin() failed\n" ); return false; } @@ -83,4 +65,4 @@ Catena461x::LoRaWAN::begin( #endif // ARDUINO_ARCH_STM32 -/**** end of Catena461x_LoRaWAN_begin.cpp ****/ +/**** end of Catena461x_Sigfox_begin.cpp ****/ diff --git a/src/lib/stm32/catena463x/Catena463x_Sigfox_begin.cpp b/src/lib/stm32/catena463x/Catena463x_Sigfox_begin.cpp index 86a8200..e56a657 100644 --- a/src/lib/stm32/catena463x/Catena463x_Sigfox_begin.cpp +++ b/src/lib/stm32/catena463x/Catena463x_Sigfox_begin.cpp @@ -1,15 +1,15 @@ /* -Module: Catena463x_LoRaWAN_begin.cpp +Module: Catena463x_Sigfox_begin.cpp Function: - Catena463x::LoRaWAN::begin() + Catena463x::Sigfox::begin() Copyright notice: See accompanying LICENSE file. Author: - Dhinesh Kumar Pitchai, MCCI Corporation April 2019 + Dhinesh Kumar Pitchai, MCCI Corporation December 2020 */ @@ -24,13 +24,13 @@ using namespace McciCatena; /* -Name: Catena463x::LoRaWAN::begin() +Name: Catena463x::Sigfox::begin() Function: - Record linkage to main Catena object and set up LoRaWAN. + Record linkage to main Catena object and set up Sigfox. Definition: - bool Catena463x::LoRaWAN::begin( + bool Catena463x::Sigfox::begin( Catena463x *pParent ); @@ -43,18 +43,18 @@ Name: Catena463x::LoRaWAN::begin() */ bool -Catena463x::LoRaWAN::begin( +Catena463x::Sigfox::begin( Catena463x *pParent ) { - gLog.printf(gLog.kTrace, "+Catena463x::LoRaWAN::begin()\n"); + gLog.printf(gLog.kTrace, "+Catena463x::Sigfox::begin()\n"); /* call the base begin */ if (! this->Super::begin(pParent)) { gLog.printf( gLog.kBug, - "?Catena463x::LoRaWAN::begin: Super::begin() failed\n" + "?Catena463x::Sigfox::begin: Super::begin() failed\n" ); return false; } @@ -65,4 +65,4 @@ Catena463x::LoRaWAN::begin( #endif // ARDUINO_ARCH_STM32 -/**** end of Catena463x_LoRaWAN_begin.cpp ****/ +/**** end of Catena463x_Sigfox_begin.cpp ****/ diff --git a/src/lib/stm32/catena480x/Catena480x_Sigfox_begin.cpp b/src/lib/stm32/catena480x/Catena480x_Sigfox_begin.cpp index b466adb..37ec31e 100644 --- a/src/lib/stm32/catena480x/Catena480x_Sigfox_begin.cpp +++ b/src/lib/stm32/catena480x/Catena480x_Sigfox_begin.cpp @@ -1,5 +1,3 @@ -/* Catena480x_LoRaWAN_begin.cpp Thu Nov 15 2018 14:54:47 chwon */ - /* Module: Catena480x_LoRaWAN_begin.cpp @@ -7,27 +5,11 @@ Module: Catena480x_LoRaWAN_begin.cpp Function: Catena480x::LoRaWAN::begin() -Version: - V0.11.0 Thu Nov 15 2018 14:54:47 chwon Edit level 1 - Copyright notice: - This file copyright (C) 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 accompanying LICENSE file. Author: - ChaeHee Won, MCCI Corporation November 2018 - -Revision history: - 0.11.0 Thu Nov 15 2018 14:54:47 chwon - Module created. + Dhinesh Kumar Pitchai, MCCI Corporation December 2020 */ diff --git a/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_begin.cpp b/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_begin.cpp index c8afcab..5809e44 100644 --- a/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_begin.cpp +++ b/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_begin.cpp @@ -1,46 +1,15 @@ -/* CatenaStm32L0_LoRaWAN_begin.cpp Mon Jan 07 2019 11:36:38 chwon */ - /* -Module: CatenaStm32L0_LoRaWAN_begin.cpp +Module: CatenaStm32L0_Sigfox_begin.cpp Function: - CatenaStm32L0::LoRaWAN::begin() - -Version: - V0.13.0 Mon Jan 07 2019 11:36:38 chwon Edit level 5 + CatenaStm32L0::Sigfox::begin() 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 accompanying LICENSE file. Author: - ChaeHee Won, MCCI Corporation October 2017 - -Revision history: - 0.6.0 Fri Oct 13 2017 15:19:30 chwon - Module created. - - 0.10.0 Wed May 09 2018 12:15:37 chwon - Use PIN_SX1276_ANT_SWITCH_TX_BOOST and PIN_SX1276_ANT_SWITCH_TX_RFO. - - 0.12.0 Mon Nov 26 2018 15:48:10 chwon - Remvoe PIN_SX1276_ANT_SWITCH_TX_BOOST and PIN_SX1276_ANT_SWITCH_TX_RFO - pin initialization. - - 0.12.0 Wed Dec 05 2018 14:27:41 chwon - Use Catena addLoRaWanCommands(). - - 0.13.0 Mon Jan 07 2019 11:36:39 chwon - Need to set up LoRaWan command before call Arduino_LoRaWAN::begin(). + Dhinesh Kumar Pitchai, MCCI Corporation December 2020 */ @@ -50,7 +19,6 @@ Revision history: #include #include -#include using namespace McciCatena; @@ -88,34 +56,29 @@ using namespace McciCatena; | \****************************************************************************/ -bool CatenaStm32L0::LoRaWAN::begin( +bool CatenaStm32L0::Sigfox::begin( CatenaStm32L0 *pParent ) { - gLog.printf(gLog.kTrace, "+CatenaStm32L0::LoRaWAN::begin()\n"); + gLog.printf(gLog.kTrace, "+CatenaStm32L0::Sigfox::begin()\n"); + MCCI_Sigfox m_Sigfox; this->m_pCatena = pParent; - this->m_ulDebugMask |= LOG_VERBOSE | LOG_ERRORS | LOG_BASIC; /* first set up command processor -- just in case begin() failed */ - pParent->addLoRaWanCommands(); + pParent->addSigfoxCommands(); /* call the base begin */ - if (! this->Arduino_LoRaWAN::begin()) + if (! m_Sigfox.isReady()) { gLog.printf( gLog.kError, - "?CatenaStm32L0::LoRaWAN::begin:" - " Arduino_LoRaWAN:begin failed\n" + "?CatenaStm32L0::Sigfox::begin:" + " MCCI_Sigfox:begin failed\n" ); return false; } - if (pParent->GetSystemClockRate() < 16000000) - { - LMIC_setClockError(5*65536/100); - } - /* indicate success to the client */ return true; } diff --git a/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_getconfiguringinfo.cpp b/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_getconfiguringinfo.cpp index f5fd912..2601639 100644 --- a/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_getconfiguringinfo.cpp +++ b/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_getconfiguringinfo.cpp @@ -1,36 +1,15 @@ -/* CatenaStm32L0_LoRaWAN_getotaaprovisioninginfo.cpp Wed Dec 05 2018 14:36:22 chwon */ - /* -Module: CatenaStm32L0_LoRaWAN_getotaaprovisioninginfo.cpp +Module: CatenaStm32L0_Sigfox_getsigfoxconfiguringinfo.cpp Function: - CatenaStm32L0::LoRaWAN::GetOtaaProvisioningInfo() - -Version: - V0.12.0 Wed Dec 05 2018 14:36:22 chwon Edit level 2 + CatenaStm32L0::Sigfox::GetSigfoxConfiguringInfo() 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 accompanying LICENSE file. Author: - ChaeHee Won, MCCI Corporation October 2017 - -Revision history: - 0.6.0 Fri Oct 13 2017 15:19:30 chwon - Module created. - - 0.12.0 Wed Dec 05 2018 14:36:22 chwon - Use Catena provisioning method. + Dhinesh Kumar Pitchai, MCCI Corporation December 2020 */ @@ -66,21 +45,21 @@ using namespace McciCatena; /* -Name: CatenaStm32L0::LoRaWAN::GetOtaaProvisioningInfo() +Name: CatenaStm32L0::Sigfox::GetSigfoxConfiguringInfo() Function: - Fetch OTAA provisioning info from FRAM (if availalbe) + Fetch Sigfox provisioning info from FRAM (if availalbe) Definition: public: virtual bool - CatenaStm32L0::LoRaWAN::GetOtaaProvisioningInfo( - CatenaStm32L0::LoRaWAN::OtaaProvisioningInfo *pInfo + CatenaStm32L0::Sigfox::GetSigfoxConfiguringInfo( + CatenaStm32L0::Sigfox::OtaaProvisioningInfo *pInfo ) override; Description: This routine fetches the OTAA provisioning info from FRAM if available, formatting it into *pInfo. For this to work, FRAM - must be initialized and the AppKey, AppEUI and DevEUI must be + must be initialized and the Key, PAC and DevID must be available. If pInfo is nullptr, the routine simply checks whether the info @@ -93,15 +72,15 @@ Name: CatenaStm32L0::LoRaWAN::GetOtaaProvisioningInfo() */ bool -CatenaStm32L0::LoRaWAN::GetOtaaProvisioningInfo( - CatenaStm32L0::LoRaWAN::OtaaProvisioningInfo *pInfo +CatenaStm32L0::Sigfox::GetSigfoxConfiguringInfo( + CatenaStm32L0::Sigfox::SigfoxConfiguringInfo *pInfo ) { CatenaStm32L0 * const pCatena = this->m_pCatena; - return pCatena->GetOtaaProvisioningInfo(pInfo); + return pCatena->GetSigfoxConfiguringInfo(pInfo); } #endif // ARDUINO_ARCH_STM32 -/**** end of CatenaStm32L0_LoRaWAN_getotaaprovisioninginfo.cpp ****/ +/**** end of CatenaStm32L0_Sigfox_getsigfoxconfiguringinfo.cpp ****/ diff --git a/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_storage.cpp b/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_storage.cpp index 574045b..a7c187b 100644 --- a/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_storage.cpp +++ b/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_storage.cpp @@ -1,36 +1,15 @@ -/* CatenaStm32L0_LoRaWAN_storage.cpp Wed Dec 05 2018 14:31:03 chwon */ - /* -Module: CatenaStm32L0_LoRaWAN_storage.cpp +Module: CatenaStm32L0_Sigfox_storage.cpp Function: - Interface from LoRaWAN to FRAM. - -Version: - V0.12.0 Wed Dec 05 2018 14:31:03 chwon Edit level 2 + Interface from Sigfox to FRAM. 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 accompanying LICENSE file. Author: - ChaeHee Won, MCCI Corporation October 2017 - -Revision history: - 0.6.0 Fri Oct 13 2017 15:19:30 chwon - Module created. - - 0.12.0 Wed Dec 05 2018 14:31:03 chwon - Use Catena NetSave methods. + Dhinesh Kumar Pitchai, MCCI Corporation December 2020 */ @@ -43,38 +22,6 @@ Revision history: using namespace McciCatena; -void -CatenaStm32L0::LoRaWAN::NetSaveFCntUp( - uint32_t uFCntUp - ) - { - CatenaStm32L0 * const pCatena = this->m_pCatena; - - pCatena->NetSaveFCntUp(uFCntUp); - } - -void -CatenaStm32L0::LoRaWAN::NetSaveFCntDown( - uint32_t uFCntDown - ) - { - CatenaStm32L0 * const pCatena = this->m_pCatena; - - pCatena->NetSaveFCntDown(uFCntDown); - } - -void -CatenaStm32L0::LoRaWAN::NetSaveSessionInfo( - const SessionInfo &Info, - const uint8_t *pExtraInfo, - size_t nExtraInfo - ) - { - CatenaStm32L0 * const pCatena = this->m_pCatena; - - pCatena->NetSaveSessionInfo(Info, pExtraInfo, nExtraInfo); - } - #endif // ARDUINO_ARCH_STM32 /**** end of CatenaStm32L0_LoRaWAN_storage.cpp ****/