From 951240e0190e92ffbf15ca17d3183316a1dbb78b Mon Sep 17 00:00:00 2001 From: dhineshkumarmcci Date: Wed, 23 Dec 2020 19:37:56 +0530 Subject: [PATCH] initial commit --- src/Catena4410.h | 3 + src/Catena4420.h | 24 ++ src/Catena455x.h | 24 ++ src/Catena461x.h | 24 ++ src/Catena463x.h | 24 ++ src/Catena480x.h | 24 ++ src/CatenaStm32L0.h | 38 +++ src/Catena_FramStorage.h | 5 + .../CatenaBase_GetSigfoxConfiguringInfo.cpp | 147 ++++++++++ src/lib/CatenaBase_addSigfoxCommands.cpp | 261 ++++++++++++++++++ src/lib/Catena_FramStorage.cpp | 5 + .../CatenaWingFram2k_Sigfox_begin.cpp | 97 +++++++ .../CatenaWingFram2k_Sigfox_storage.cpp | 167 +++++++++++ .../catenafeatherm0_sigfox_begin.cpp | 109 ++++++++ ...enafeatherm0_sigfox_getconfiguringinfo.cpp | 92 ++++++ .../catena455x/Catena455x_Sigfox_begin.cpp | 89 ++++++ .../catena461x/Catena461x_Sigfox_begin.cpp | 86 ++++++ .../catena463x/Catena463x_Sigfox_begin.cpp | 68 +++++ .../catena480x/Catena480x_Sigfox_begin.cpp | 86 ++++++ .../stm32l0/CatenaStm32L0_Sigfox_begin.cpp | 125 +++++++++ ...atenaStm32L0_Sigfox_getconfiguringinfo.cpp | 107 +++++++ .../stm32l0/CatenaStm32L0_Sigfox_storage.cpp | 80 ++++++ 22 files changed, 1685 insertions(+) create mode 100644 src/lib/CatenaBase_GetSigfoxConfiguringInfo.cpp create mode 100644 src/lib/CatenaBase_addSigfoxCommands.cpp create mode 100644 src/lib/samd/catenawingfram2k/CatenaWingFram2k_Sigfox_begin.cpp create mode 100644 src/lib/samd/catenawingfram2k/CatenaWingFram2k_Sigfox_storage.cpp create mode 100644 src/lib/samd/featherm0/catenafeatherm0_sigfox_begin.cpp create mode 100644 src/lib/samd/featherm0/catenafeatherm0_sigfox_getconfiguringinfo.cpp create mode 100644 src/lib/stm32/catena455x/Catena455x_Sigfox_begin.cpp create mode 100644 src/lib/stm32/catena461x/Catena461x_Sigfox_begin.cpp create mode 100644 src/lib/stm32/catena463x/Catena463x_Sigfox_begin.cpp create mode 100644 src/lib/stm32/catena480x/Catena480x_Sigfox_begin.cpp create mode 100644 src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_begin.cpp create mode 100644 src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_getconfiguringinfo.cpp create mode 100644 src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_storage.cpp diff --git a/src/Catena4410.h b/src/Catena4410.h index 83b5f38..f9c005f 100644 --- a/src/Catena4410.h +++ b/src/Catena4410.h @@ -74,6 +74,9 @@ class Catena4410 : public CatenaFeatherM0 */ class LoRaWAN /* forward */; + // Sigfox binding + class Sigfox /* forward */; + virtual const char *CatenaName() const override { return "Catena 4410"; }; protected: diff --git a/src/Catena4420.h b/src/Catena4420.h index e10ea75..032069c 100644 --- a/src/Catena4420.h +++ b/src/Catena4420.h @@ -35,6 +35,9 @@ class Catena4420 : public CatenaFeatherM0 */ class LoRaWAN /* forward */; + // Sigfox binding + class Sigfox /* forward */; + virtual const char *CatenaName() const override { return "Catena 4420"; }; protected: @@ -77,6 +80,27 @@ class Catena4420::LoRaWAN : public CatenaFeatherM0::LoRaWAN private: }; +/* +|| The Sigfox class for the Catena4420. +*/ +class Catena4420::Sigfox : public CatenaFeatherM0::Sigfox + { +public: + using Super = CatenaFeatherM0::Sigfox; + + /* + || the constructor. + */ + Sigfox() {}; + +protected: + /* + || we use the CatenaFeatherM0 defaults + */ + +private: + }; + } /* namespace McciCatena */ diff --git a/src/Catena455x.h b/src/Catena455x.h index c1bb0c2..21d6e37 100644 --- a/src/Catena455x.h +++ b/src/Catena455x.h @@ -65,6 +65,9 @@ class Catena455x : public CatenaStm32L0 // LoRaWAN binding class LoRaWAN /* forward */; + // Sigfox binding + class Sigfox /* forward */; + enum ANALOG_PINS { APIN_VBAT_SENSE = A3, @@ -108,6 +111,27 @@ class Catena455x::LoRaWAN : public CatenaStm32L0::LoRaWAN protected: +private: + }; + +/* +|| The Sigfox class for the Catena 455x. +*/ +class Catena455x::Sigfox : public CatenaStm32L0::Sigfox + { +public: + using Super = CatenaStm32L0::Sigfox; + + /* + || the constructor. We don't do anything at this level, the + || Super constructor does most of the work. + */ + Sigfox() {}; + + bool begin(Catena455x *pParent); + +protected: + private: }; diff --git a/src/Catena461x.h b/src/Catena461x.h index fab9b7e..5c9980f 100644 --- a/src/Catena461x.h +++ b/src/Catena461x.h @@ -69,6 +69,9 @@ class Catena461x : public CatenaStm32L0 // LoRaWAN binding class LoRaWAN /* forward */; + // Sigfox binding + class Sigfox /* forward */; + enum ANALOG_PINS { APIN_VBAT_SENSE = A3, @@ -122,6 +125,27 @@ class Catena461x::LoRaWAN : public CatenaStm32L0::LoRaWAN protected: +private: + }; + +/* +|| The Sigfox class for the Catena 461x. +*/ +class Catena461x::Sigfox : public CatenaStm32L0::Sigfox + { +public: + using Super = CatenaStm32L0::Sigfox; + + /* + || the constructor. We don't do anything at this level, the + || Super constructor does most of the work. + */ + Sigfox() {}; + + bool begin(Catena461x *pParent); + +protected: + private: }; diff --git a/src/Catena463x.h b/src/Catena463x.h index 4fa32ff..c784ce7 100644 --- a/src/Catena463x.h +++ b/src/Catena463x.h @@ -44,6 +44,9 @@ class Catena463x : public CatenaStm32L0 // LoRaWAN binding class LoRaWAN /* forward */; + // Sigfox binding + class Sigfox /* forward */; + enum ANALOG_PINS { APIN_VBAT_SENSE = A1, @@ -97,6 +100,27 @@ class Catena463x::LoRaWAN : public CatenaStm32L0::LoRaWAN protected: +private: + }; + +/* +|| The Sigfox class for the Catena 463x. +*/ +class Catena463x::Sigfox : public CatenaStm32L0::Sigfox + { +public: + using Super = CatenaStm32L0::Sigfox; + + /* + || the constructor. We don't do anything at this level, the + || Super constructor does most of the work. + */ + Sigfox() {}; + + bool begin(Catena463x *pParent); + +protected: + private: }; diff --git a/src/Catena480x.h b/src/Catena480x.h index 1e3702e..d206bd4 100644 --- a/src/Catena480x.h +++ b/src/Catena480x.h @@ -67,6 +67,9 @@ class Catena480x : public CatenaStm32L0 // LoRaWAN binding class LoRaWAN /* forward */; + // Sigfox binding + class Sigfox /* forward */; + enum ANALOG_PINS { APIN_VBAT_SENSE = A0, @@ -120,6 +123,27 @@ class Catena480x::LoRaWAN : public CatenaStm32L0::LoRaWAN protected: +private: + }; + +/* +|| The Sigfox class for the Catena 480x. +*/ +class Catena480x::Sigfox : public CatenaStm32L0::Sigfox + { +public: + using Super = CatenaStm32L0::Sigfox; + + /* + || the constructor. We don't do anything at this level, the + || Super constructor does most of the work. + */ + Sigfox() {}; + + bool begin(Catena480x *pParent); + +protected: + private: }; diff --git a/src/CatenaStm32L0.h b/src/CatenaStm32L0.h index 3b50c40..92e7052 100644 --- a/src/CatenaStm32L0.h +++ b/src/CatenaStm32L0.h @@ -32,6 +32,8 @@ Copyright notice: #include +#include + namespace McciCatena { class CatenaStm32L0 : public CatenaStm32 @@ -157,6 +159,42 @@ class CatenaStm32L0::LoRaWAN : public Arduino_LoRaWAN_network, CatenaStm32L0 *m_pCatena; }; +class CatenaStm32L0::Sigfox : public MCCI_Sigfox, + public McciCatena::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(CatenaStm32L0 *pCatena); + + virtual void poll() { this->Super::loop(); }; + +protected: + /* + || we have to provide these for the lower level + */ + virtual bool GetSigfoxConfiguringInfo( + Arduino_LoRaWAN::OtaaProvisioningInfo * + ) 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; + }; + // this function is called from a trampoline C function that // needs to invoke analog reads for checking USB presence. bool CatenaStm32L0_ReadAnalog( diff --git a/src/Catena_FramStorage.h b/src/Catena_FramStorage.h index fa169a3..4a405c1 100644 --- a/src/Catena_FramStorage.h +++ b/src/Catena_FramStorage.h @@ -48,6 +48,11 @@ class cFramStorage kOperatingFlags = 15, kBme680Cal = 16, kAppConf = 17, + kDevID = 18, + kPAC = 19, + kKey = 20, + kRegion = 21, + kEncryption = 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 new file mode 100644 index 0000000..e5f78fa --- /dev/null +++ b/src/lib/CatenaBase_GetSigfoxConfiguringInfo.cpp @@ -0,0 +1,147 @@ +/* + +Module: CatenaBase_GetSigfoxConfiguringInfo.cpp + +Function: + CatenaBase::GetSigfoxConfiguringInfo() + +Copyright notice: + See accompanying LICENSE file. + +Author: + Dhinesh Kumar Pitchai, MCCI Corporation December 2020 + +*/ + +#include + +#include +#include + +using namespace McciCatena; + +/****************************************************************************\ +| +| Manifest constants & typedefs. +| +| This is strictly for private types and constants which will not +| be exported. +| +\****************************************************************************/ + + +/****************************************************************************\ +| +| Read-only data. +| +| If program is to be ROM-able, these must all be tagged read-only +| using the ROM storage class; they may be global. +| +\****************************************************************************/ + + +/****************************************************************************\ +| +| VARIABLES: +| +| If program is to be ROM-able, these must be initialized +| using the BSS keyword. (This allows for compilers that require +| every variable to have an initializer.) Note that only those +| variables owned by this module should be declared here, using the BSS +| keyword; this allows for linkers that dislike multiple declarations +| of objects. +| +\****************************************************************************/ + + +/* + +Name: CatenaBase::GetSigfoxConfiguringInfo() + +Function: + Fetch OTAA provisioning info from FRAM (if availalbe) + +Definition: + public: virtual bool + CatenaBase::GetSigfoxConfiguringInfo( + Arduino_LoRaWAN::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 + available. + + If pInfo is nullptr, the routine simply checks whether the info + is availalbe. + +Returns: + This routine returns true if and only if the provisioning info + is available. + +*/ + +bool +CatenaBase::GetSigfoxConfiguringInfo( + Arduino_LoRaWAN::OtaaProvisioningInfo *pInfo + ) + { + auto const pFram = this->getFram(); + + if (pFram == nullptr) + { + gLog.printf( + gLog.kError, + "?CatenaBase::GetOtaaProvisioningInfo: no FRAM\n" + ); + + if (pInfo != nullptr) + memset(pInfo, 0, sizeof(pInfo)); + + return false; + } + + cFram::Cursor framDevID(pFram), + framPAC(pFram), + framKey(pFram), + framRegion(pFram), + framEncryption(pFram); + bool fResult; + + fResult = false; + + if (framDevID.locate(cFramStorage::vItemDefs[cFramStorage::kDevID]) && + framPAC.locate(cFramStorage::vItemDefs[cFramStorage::kPAC]) && + framKey.locate(cFramStorage::vItemDefs[cFramStorage::kKey]) && + framRegion.locate(cFramStorage::vItemDefs[cFramStorage::kRegion]) && + framEncryption.locate(cFramStorage::vItemDefs[cFramStorage::kEncryption])) + fResult = true; + + if (! fResult) + { + gLog.printf( + gLog.kError, + "?CatenaBase::GetOtaaProvisioningInfo: failing\n" + ); + + if (pInfo != nullptr) + memset(pInfo, 0, sizeof(pInfo)); + + return false; + } + + if (pInfo == nullptr) + 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)); + + return true; + } + +/**** end of CatenaBase_GetOtaaProvisioningInfo.cpp ****/ diff --git a/src/lib/CatenaBase_addSigfoxCommands.cpp b/src/lib/CatenaBase_addSigfoxCommands.cpp new file mode 100644 index 0000000..b2e8d4c --- /dev/null +++ b/src/lib/CatenaBase_addSigfoxCommands.cpp @@ -0,0 +1,261 @@ +/* + +Module: CatenaBase_addSigfoxCommands.cpp + +Function: + The command engine for sigfox commands on the Catena base platform + +Copyright notice: + See accompanying LICENSE file. + +Author: + Dhinesh Kumar Pitchai, MCCI Corporation December 2020 + +*/ + +#include "CatenaBase.h" + +#include + +#include "Catena_Log.h" + +#include + +using namespace McciCatena; + +/****************************************************************************\ +| +| The command table +| +\****************************************************************************/ + +static cCommandStream::CommandFn doConfigure; + +static const cCommandStream::cEntry sDispatchEntries[] = + { + { "configure", doConfigure }, + }; + +static cCommandStream::cDispatch +sDispatch(sDispatchEntries, sizeof(sDispatchEntries), "sigfox"); + + +struct KeyMap + { + const char *pName; + cFramStorage::StandardKeys uKey; + }; + +static KeyMap sKeyMap[] = + { + { "devid", cFramStorage::StandardKeys::kDevID }, + { "pac", cFramStorage::StandardKeys::kPAC }, + { "key", cFramStorage::StandardKeys::kKey, }, + { "region", cFramStorage::StandardKeys::kRegion, }, + { "encryption", cFramStorage::StandardKeys::kEncryption, }, + }; + +/* + +Name: CatenaBase::addSigfoxCommands() + +Function: + Add the sigfox commands to the Catena command table. + +Definition: + private: bool CatenaBase::addSigfoxCommands(void); + +Description: + All the commands are added to the system command table. + +Returns: + true for success. + +*/ + +bool +CatenaBase::addSigfoxCommands( + void + ) + { + if (this->getFram() == nullptr) + { + gLog.printf( + gLog.kError, + "?CatenaBase::addSigfoxCommands(): no FRAM\n" + ); + return false; + } + + gLog.printf( + gLog.kTrace, + "CatenaBase::addSigfoxCommands(): adding\n" + ); + this->addCommands( + sDispatch, + static_cast(this) + ); + return true; + } + +/* + +Name: doConfigure() + +Function: + Implement the Sigfox value set/get commands + +Definition: + static cCommandStream::CommandFn doConfigure; + + static cCommandStream::CommandStatus + doConfigure( + cCommandStream *pThis, + void *pContext, + int argc, + char **argv + ); + +Description: + This function dispatches the various commands, parsing the input + parameters if any to set the corresponding value, or displaying + the values. + + The parsed syntax: + + sigfox configure [ {param} [ {value} ] ] + +Returns: + Command status + +*/ + +static cCommandStream::CommandStatus +doConfigure( + cCommandStream *pThis, + void *pContext, + int argc, + char **argv + ) + { + CatenaBase * const pCatena = static_cast(pContext); + cFram::Cursor cursor(pCatena->getFram()); + static constexpr unsigned databuf_size = 16; + + auto printValue = [](cCommandStream *pThis, cFram::Cursor &cursor, const char *pName) -> cCommandStream::CommandStatus + { + uint8_t databuf[databuf_size]; + if (! cursor.islocated()) + { + pThis->printf("%s: not initialized\n", pName); + return cCommandStream::CommandStatus::kNotInitialized; + } + else + { + char strbuf[64]; + size_t size; + + size = cursor.getitemsize(); + if (size > sizeof(databuf)) + size = sizeof(databuf); + + + if (! cursor.get(databuf, size)) + { + pThis->printf("%s: read error\n", pName); + return cCommandStream::CommandStatus::kReadError; + } + + cursor.formatvalue( + strbuf, sizeof(strbuf), 0, + databuf, size + ); + + pThis->printf("%s\n", strbuf); + return cCommandStream::CommandStatus::kSuccess; + } + }; + + if (argc < 2) + { + // TODO(tmm@mcci.com) display values + for (auto const & p : sKeyMap) + { + cursor.locate(p.uKey); + if (! cursor.isbound()) + continue; + + pThis->printf("sigfox %s %s ", argv[0], p.pName); + (void) printValue(pThis, cursor, p.pName); + } + + return cCommandStream::CommandStatus::kSuccess; + } + + const char * const pName = argv[1]; + + for (auto const & p : sKeyMap) + { + if (strcasecmp(p.pName, pName) == 0) + { + // matched! + cursor.locate(p.uKey); + } + } + + if (! cursor.isbound()) + { + pThis->printf( + "%s: unknown\n", + __func__, + pName + ); + return cCommandStream::CommandStatus::kInvalidParameter; + } + + // display + if (argc <= 2) + { + return printValue(pThis, cursor, pName); + } + else + { + const char * const pValue = argv[2]; + uint8_t databuf[databuf_size]; + size_t size; + + size = cursor.getitemsize(); + if (size > sizeof(databuf)) + size = sizeof(databuf); + + // parse the argument according to the cursor (which + // specifies what will receive it + if (! cursor.parsevalue( + pValue, + databuf, + size + )) + { + pThis->printf("%s: invalid parameter: %s\n", + pName, pValue + ); + return cCommandStream::CommandStatus::kInvalidParameter; + } + else if (! cursor.create()) + { + pThis->printf("%s: could not create entry\n", + pName + ); + return cCommandStream::CommandStatus::kCreateError; + } + else + { + return cursor.put(databuf, size) + ? cCommandStream::CommandStatus::kSuccess + : cCommandStream::CommandStatus::kWriteError + ; + } + } + } + +/**** end of CatenaBase_addSigfoxCommands.cpp ****/ diff --git a/src/lib/Catena_FramStorage.cpp b/src/lib/Catena_FramStorage.cpp index c9d937d..7bfcc2c 100644 --- a/src/lib/Catena_FramStorage.cpp +++ b/src/lib/Catena_FramStorage.cpp @@ -65,6 +65,11 @@ 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), diff --git a/src/lib/samd/catenawingfram2k/CatenaWingFram2k_Sigfox_begin.cpp b/src/lib/samd/catenawingfram2k/CatenaWingFram2k_Sigfox_begin.cpp new file mode 100644 index 0000000..49650e6 --- /dev/null +++ b/src/lib/samd/catenawingfram2k/CatenaWingFram2k_Sigfox_begin.cpp @@ -0,0 +1,97 @@ +/* CatenaWingFram2k_LoRaWAN_begin.cpp Wed Jan 09 2019 14:24:20 chwon */ + +/* + +Module: CatenaWingFram2k_LoRaWAN_begin.cpp + +Function: + CatenaWingFram2k::LoRaWAN::begin() + +Version: + V0.13.0 Wed Jan 09 2019 14:24:20 chwon Edit level 3 + +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. + +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(). + +*/ + +#ifdef ARDUINO_ARCH_SAMD + +#include "CatenaWingFram2k.h" + +#include "Catena_Log.h" +#include "mcciadk_baselib.h" + +using namespace McciCatena; + +/* + +Name: CatenaWingFram2k::LoRaWAN::begin() + +Function: + Record linkage to main Catena object and set up LoRaWAN. + +Definition: + bool CatenaWingFram2k::LoRaWAN::begin( + CatenaWingFram2k *pParent + ); + +Description: + We record parent pointers, and other useful things for later. + +Returns: + true for success, false for failure. + +*/ + +bool +CatenaWingFram2k::LoRaWAN::begin( + CatenaWingFram2k *pParent + ) + { + gLog.printf(gLog.kTrace, "+CatenaWingFram2k::LoRaWAN::begin()\n"); + + 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(); + + /* call the base begin */ + if (! this->Arduino_LoRaWAN::begin()) + { + gLog.printf( + gLog.kError, + "?CatenaWingFram2k::LoRaWAN::begin:" + " Arduino_LoRaWAN:begin failed\n" + ); + return false; + } + + /* indicate success to the client */ + return true; + } + +#endif // ARDUINO_ARCH_SAMD diff --git a/src/lib/samd/catenawingfram2k/CatenaWingFram2k_Sigfox_storage.cpp b/src/lib/samd/catenawingfram2k/CatenaWingFram2k_Sigfox_storage.cpp new file mode 100644 index 0000000..cc9c00d --- /dev/null +++ b/src/lib/samd/catenawingfram2k/CatenaWingFram2k_Sigfox_storage.cpp @@ -0,0 +1,167 @@ +/* CatenaWingFram2k_LoRaWAN_storage.cpp Wed Dec 05 2018 14:31:54 chwon */ + +/* + +Module: CatenaWingFram2k_LoRaWAN_storage.cpp + +Function: + Interface from LoRaWAN to FRAM. + +Version: + V0.12.0 Wed Dec 05 2018 14:31:54 chwon Edit level 2 + +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. + +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. + +*/ + +#ifdef ARDUINO_ARCH_SAMD + +#include "CatenaWingFram2k.h" + +#include "Catena_Fram.h" +#include "Catena_Log.h" + +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() + +Function: + Fetch OTAA provisioning info from FRAM (if availalbe) + +Definition: + public: virtual bool + CatenaWingFram2k::LoRaWAN::GetOtaaProvisioningInfo( + CatenaWingFram2k::LoRaWAN::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 + available. + + If pInfo is nullptr, the routine simply checks whether the info + is availalbe. + +Returns: + This routine returns true if and only if the provisioning info + is available. + +*/ + +bool +CatenaWingFram2k::LoRaWAN::GetOtaaProvisioningInfo( + CatenaWingFram2k::LoRaWAN::OtaaProvisioningInfo *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); + } + +#endif // ARDUINO_ARCH_SAMD diff --git a/src/lib/samd/featherm0/catenafeatherm0_sigfox_begin.cpp b/src/lib/samd/featherm0/catenafeatherm0_sigfox_begin.cpp new file mode 100644 index 0000000..58acc5a --- /dev/null +++ b/src/lib/samd/featherm0/catenafeatherm0_sigfox_begin.cpp @@ -0,0 +1,109 @@ +/* begin.cpp Wed Dec 05 2018 14:30:26 chwon */ + +/* + +Module: begin.cpp + +Function: + Catena4410::LoRaWAN::begin() + +Version: + V0.12.0 Wed Dec 05 2018 14:30:26 chwon Edit level 2 + +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. + +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. + +*/ + +#ifdef ARDUINO_ARCH_SAMD + +#include + +#include + +#include +using namespace McciCatena; + + +/****************************************************************************\ +| +| Manifest constants & typedefs. +| +| This is strictly for private types and constants which will not +| be exported. +| +\****************************************************************************/ + + + +/****************************************************************************\ +| +| Read-only data. +| +| If program is to be ROM-able, these must all be tagged read-only +| using the ROM storage class; they may be global. +| +\****************************************************************************/ + + +/****************************************************************************\ +| +| VARIABLES: +| +| If program is to be ROM-able, these must be initialized +| using the BSS keyword. (This allows for compilers that require +| every variable to have an initializer.) Note that only those +| variables owned by this module should be declared here, using the BSS +| keyword; this allows for linkers that dislike multiple declarations +| of objects. +| +\****************************************************************************/ + +bool CatenaFeatherM0::LoRaWAN::begin( + CatenaFeatherM0 *pParent + ) + { + gLog.printf(gLog.kTrace, "+CatenaFeatherM0::LoRaWAN::begin()\n"); + + this->m_pCatena = pParent; + this->m_ulDebugMask |= LOG_VERBOSE | LOG_ERRORS | LOG_BASIC; + + /* first call the base begin */ + if (! this->Arduino_LoRaWAN::begin()) + { + gLog.printf( + gLog.kBug, + "?CatenaFeatherM0::LoRaWAN::begin:" + " Arduino_LoRaWAN::begin() failed\n" + ); + return false; + } + + /* here's where we do any required post-processing */ + /* (none at the moment) */ + + /* indicate success to the client */ + return true; + } + +#endif // ARDUINO_ARCH_SAMD diff --git a/src/lib/samd/featherm0/catenafeatherm0_sigfox_getconfiguringinfo.cpp b/src/lib/samd/featherm0/catenafeatherm0_sigfox_getconfiguringinfo.cpp new file mode 100644 index 0000000..c51019f --- /dev/null +++ b/src/lib/samd/featherm0/catenafeatherm0_sigfox_getconfiguringinfo.cpp @@ -0,0 +1,92 @@ +/* catenafeatherm0_lorawan_getotaaprovisioninginfo.cpp Mon Dec 5 2016 02:09:31 tmm */ + +/* + +Module: catenafeatherm0_lorawan_getotaaprovisioninginfo.cpp + +Function: + CatenaFeatherM0::LoRaWAN::GetOtaaProvisioningInfo() + +Version: + V0.4.0 Mon Dec 5 2016 02:09:31 tmm Edit level 2 + +Copyright notice: + This file copyright (C) 2016 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. + +Author: + Terry Moore, MCCI Corporation October 2016 + +Revision history: + 0.3.0 Mon Oct 31 2016 18:04:04 tmm + Module created. + +*/ + +#ifdef ARDUINO_ARCH_SAMD + +#include + +#include +using namespace McciCatena; + + +/****************************************************************************\ +| +| Manifest constants & typedefs. +| +\****************************************************************************/ + + +/****************************************************************************\ +| +| Read-only data. +| +\****************************************************************************/ + + +/****************************************************************************\ +| +| VARIABLES: +| +\****************************************************************************/ + + +bool +CatenaFeatherM0::LoRaWAN::GetOtaaProvisioningInfo( + CatenaFeatherM0::LoRaWAN::OtaaProvisioningInfo *pInfo + ) + { + CatenaFeatherM0 * const pCatena = this->m_pCatena; + const ProvisioningInfo * const pInstance = pCatena->GetProvisioningInfo(); + + if (! pInstance || + pInstance->Style != ProvisioningStyle::kOTAA) + { + if (pInfo) + { + // ensure consistent behavior + memset(pInfo, 0, sizeof(*pInfo)); + } + + return false; + } + + // got instance data + if (pInfo) + { + *pInfo = pInstance->OtaaInfo; + } + + return true; + } + +#endif // ARDUINO_ARCH_SAMD diff --git a/src/lib/stm32/catena455x/Catena455x_Sigfox_begin.cpp b/src/lib/stm32/catena455x/Catena455x_Sigfox_begin.cpp new file mode 100644 index 0000000..66ade8b --- /dev/null +++ b/src/lib/stm32/catena455x/Catena455x_Sigfox_begin.cpp @@ -0,0 +1,89 @@ +/* Catena455x_LoRaWAN_begin.cpp Tue Nov 20 2018 13:55:23 chwon */ + +/* + +Module: Catena455x_LoRaWAN_begin.cpp + +Function: + Catena455x::LoRaWAN::begin() + +Version: + V0.11.0 Tue Nov 20 2018 13:55:23 chwon Edit level 2 + +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. + +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 Tue Nov 20 2018 13:55:23 chwon + Move common code to CatenaStm32L0::LoRaWAN::begin(). + +*/ + +#ifdef ARDUINO_ARCH_STM32 + +#include "Catena455x.h" + +#include "Catena_Log.h" +#include "mcciadk_baselib.h" + +using namespace McciCatena; + +/* + +Name: Catena455x::LoRaWAN::begin() + +Function: + Record linkage to main Catena object and set up LoRaWAN. + +Definition: + bool Catena455x::LoRaWAN::begin( + Catena455x *pParent + ); + +Description: + We record parent pointers, and other useful things for later. + +Returns: + true for success, false for failure. + +*/ + +bool +Catena455x::LoRaWAN::begin( + Catena455x *pParent + ) + { + gLog.printf(gLog.kTrace, "+Catena455x::LoRaWAN::begin()\n"); + + /* call the base begin */ + if (! this->Super::begin(pParent)) + { + gLog.printf( + gLog.kBug, + "?Catena455x::LoRaWAN::begin: Super::begin() failed\n" + ); + return false; + } + + /* indicate success to the client */ + return true; + } + +#endif // ARDUINO_ARCH_STM32 + +/**** end of Catena455x_LoRaWAN_begin.cpp ****/ diff --git a/src/lib/stm32/catena461x/Catena461x_Sigfox_begin.cpp b/src/lib/stm32/catena461x/Catena461x_Sigfox_begin.cpp new file mode 100644 index 0000000..a63bccd --- /dev/null +++ b/src/lib/stm32/catena461x/Catena461x_Sigfox_begin.cpp @@ -0,0 +1,86 @@ +/* Catena461x_LoRaWAN_begin.cpp Thu Nov 15 2018 14:54:47 chwon */ + +/* + +Module: Catena461x_LoRaWAN_begin.cpp + +Function: + Catena461x::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 + +Author: + ChaeHee Won, MCCI Corporation November 2018 + +Revision history: + 0.11.0 Thu Nov 15 2018 14:54:47 chwon + Module created. + +*/ + +#ifdef ARDUINO_ARCH_STM32 + +#include "Catena461x.h" + +#include "Catena_Log.h" +#include "mcciadk_baselib.h" + +using namespace McciCatena; + +/* + +Name: Catena461x::LoRaWAN::begin() + +Function: + Record linkage to main Catena object and set up LoRaWAN. + +Definition: + bool Catena461x::LoRaWAN::begin( + Catena461x *pParent + ); + +Description: + We record parent pointers, and other useful things for later. + +Returns: + true for success, false for failure. + +*/ + +bool +Catena461x::LoRaWAN::begin( + Catena461x *pParent + ) + { + gLog.printf(gLog.kTrace, "+Catena461x::LoRaWAN::begin()\n"); + + /* call the base begin */ + if (! this->Super::begin(pParent)) + { + gLog.printf( + gLog.kBug, + "?Catena461x::LoRaWAN::begin: Super::begin() failed\n" + ); + return false; + } + + /* indicate success to the client */ + return true; + } + +#endif // ARDUINO_ARCH_STM32 + +/**** end of Catena461x_LoRaWAN_begin.cpp ****/ diff --git a/src/lib/stm32/catena463x/Catena463x_Sigfox_begin.cpp b/src/lib/stm32/catena463x/Catena463x_Sigfox_begin.cpp new file mode 100644 index 0000000..86a8200 --- /dev/null +++ b/src/lib/stm32/catena463x/Catena463x_Sigfox_begin.cpp @@ -0,0 +1,68 @@ +/* + +Module: Catena463x_LoRaWAN_begin.cpp + +Function: + Catena463x::LoRaWAN::begin() + +Copyright notice: + See accompanying LICENSE file. + +Author: + Dhinesh Kumar Pitchai, MCCI Corporation April 2019 + +*/ + +#ifdef ARDUINO_ARCH_STM32 + +#include "Catena463x.h" + +#include "Catena_Log.h" +#include "mcciadk_baselib.h" + +using namespace McciCatena; + +/* + +Name: Catena463x::LoRaWAN::begin() + +Function: + Record linkage to main Catena object and set up LoRaWAN. + +Definition: + bool Catena463x::LoRaWAN::begin( + Catena463x *pParent + ); + +Description: + We record parent pointers, and other useful things for later. + +Returns: + true for success, false for failure. + +*/ + +bool +Catena463x::LoRaWAN::begin( + Catena463x *pParent + ) + { + gLog.printf(gLog.kTrace, "+Catena463x::LoRaWAN::begin()\n"); + + /* call the base begin */ + if (! this->Super::begin(pParent)) + { + gLog.printf( + gLog.kBug, + "?Catena463x::LoRaWAN::begin: Super::begin() failed\n" + ); + return false; + } + + /* indicate success to the client */ + return true; + } + +#endif // ARDUINO_ARCH_STM32 + +/**** end of Catena463x_LoRaWAN_begin.cpp ****/ diff --git a/src/lib/stm32/catena480x/Catena480x_Sigfox_begin.cpp b/src/lib/stm32/catena480x/Catena480x_Sigfox_begin.cpp new file mode 100644 index 0000000..b466adb --- /dev/null +++ b/src/lib/stm32/catena480x/Catena480x_Sigfox_begin.cpp @@ -0,0 +1,86 @@ +/* Catena480x_LoRaWAN_begin.cpp Thu Nov 15 2018 14:54:47 chwon */ + +/* + +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 + +Author: + ChaeHee Won, MCCI Corporation November 2018 + +Revision history: + 0.11.0 Thu Nov 15 2018 14:54:47 chwon + Module created. + +*/ + +#ifdef ARDUINO_ARCH_STM32 + +#include "Catena480x.h" + +#include "Catena_Log.h" +#include "mcciadk_baselib.h" + +using namespace McciCatena; + +/* + +Name: Catena480x::LoRaWAN::begin() + +Function: + Record linkage to main Catena object and set up LoRaWAN. + +Definition: + bool Catena480x::LoRaWAN::begin( + Catena480x *pParent + ); + +Description: + We record parent pointers, and other useful things for later. + +Returns: + true for success, false for failure. + +*/ + +bool +Catena480x::LoRaWAN::begin( + Catena480x *pParent + ) + { + gLog.printf(gLog.kTrace, "+Catena480x::LoRaWAN::begin()\n"); + + /* call the base begin */ + if (! this->Super::begin(pParent)) + { + gLog.printf( + gLog.kBug, + "?Catena480x::LoRaWAN::begin: Super::begin() failed\n" + ); + return false; + } + + /* indicate success to the client */ + return true; + } + +#endif // ARDUINO_ARCH_STM32 + +/**** end of Catena480x_LoRaWAN_begin.cpp ****/ diff --git a/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_begin.cpp b/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_begin.cpp new file mode 100644 index 0000000..c8afcab --- /dev/null +++ b/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_begin.cpp @@ -0,0 +1,125 @@ +/* CatenaStm32L0_LoRaWAN_begin.cpp Mon Jan 07 2019 11:36:38 chwon */ + +/* + +Module: CatenaStm32L0_LoRaWAN_begin.cpp + +Function: + CatenaStm32L0::LoRaWAN::begin() + +Version: + V0.13.0 Mon Jan 07 2019 11:36:38 chwon Edit level 5 + +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. + +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(). + +*/ + +#ifdef ARDUINO_ARCH_STM32 + +#include + +#include +#include +#include + +using namespace McciCatena; + +/****************************************************************************\ +| +| Manifest constants & typedefs. +| +| This is strictly for private types and constants which will not +| be exported. +| +\****************************************************************************/ + + + +/****************************************************************************\ +| +| Read-only data. +| +| If program is to be ROM-able, these must all be tagged read-only +| using the ROM storage class; they may be global. +| +\****************************************************************************/ + + +/****************************************************************************\ +| +| VARIABLES: +| +| If program is to be ROM-able, these must be initialized +| using the BSS keyword. (This allows for compilers that require +| every variable to have an initializer.) Note that only those +| variables owned by this module should be declared here, using the BSS +| keyword; this allows for linkers that dislike multiple declarations +| of objects. +| +\****************************************************************************/ + +bool CatenaStm32L0::LoRaWAN::begin( + CatenaStm32L0 *pParent + ) + { + gLog.printf(gLog.kTrace, "+CatenaStm32L0::LoRaWAN::begin()\n"); + + 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(); + + /* call the base begin */ + if (! this->Arduino_LoRaWAN::begin()) + { + gLog.printf( + gLog.kError, + "?CatenaStm32L0::LoRaWAN::begin:" + " Arduino_LoRaWAN:begin failed\n" + ); + return false; + } + + if (pParent->GetSystemClockRate() < 16000000) + { + LMIC_setClockError(5*65536/100); + } + + /* indicate success to the client */ + return true; + } + +#endif // ARDUINO_ARCH_STM32 + +/**** end of CatenaStm32L0_LoRaWAN_begin.cpp ****/ diff --git a/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_getconfiguringinfo.cpp b/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_getconfiguringinfo.cpp new file mode 100644 index 0000000..f5fd912 --- /dev/null +++ b/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_getconfiguringinfo.cpp @@ -0,0 +1,107 @@ +/* CatenaStm32L0_LoRaWAN_getotaaprovisioninginfo.cpp Wed Dec 05 2018 14:36:22 chwon */ + +/* + +Module: CatenaStm32L0_LoRaWAN_getotaaprovisioninginfo.cpp + +Function: + CatenaStm32L0::LoRaWAN::GetOtaaProvisioningInfo() + +Version: + V0.12.0 Wed Dec 05 2018 14:36:22 chwon Edit level 2 + +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. + +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. + +*/ + +#ifdef ARDUINO_ARCH_STM32 + +#include + +#include +#include + +using namespace McciCatena; + +/****************************************************************************\ +| +| Manifest constants & typedefs. +| +\****************************************************************************/ + + +/****************************************************************************\ +| +| Read-only data. +| +\****************************************************************************/ + + +/****************************************************************************\ +| +| VARIABLES: +| +\****************************************************************************/ + + +/* + +Name: CatenaStm32L0::LoRaWAN::GetOtaaProvisioningInfo() + +Function: + Fetch OTAA provisioning info from FRAM (if availalbe) + +Definition: + public: virtual bool + CatenaStm32L0::LoRaWAN::GetOtaaProvisioningInfo( + CatenaStm32L0::LoRaWAN::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 + available. + + If pInfo is nullptr, the routine simply checks whether the info + is availalbe. + +Returns: + This routine returns true if and only if the provisioning info + is available. + +*/ + +bool +CatenaStm32L0::LoRaWAN::GetOtaaProvisioningInfo( + CatenaStm32L0::LoRaWAN::OtaaProvisioningInfo *pInfo + ) + { + CatenaStm32L0 * const pCatena = this->m_pCatena; + + return pCatena->GetOtaaProvisioningInfo(pInfo); + } + +#endif // ARDUINO_ARCH_STM32 + +/**** end of CatenaStm32L0_LoRaWAN_getotaaprovisioninginfo.cpp ****/ diff --git a/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_storage.cpp b/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_storage.cpp new file mode 100644 index 0000000..574045b --- /dev/null +++ b/src/lib/stm32/stm32l0/CatenaStm32L0_Sigfox_storage.cpp @@ -0,0 +1,80 @@ +/* CatenaStm32L0_LoRaWAN_storage.cpp Wed Dec 05 2018 14:31:03 chwon */ + +/* + +Module: CatenaStm32L0_LoRaWAN_storage.cpp + +Function: + Interface from LoRaWAN to FRAM. + +Version: + V0.12.0 Wed Dec 05 2018 14:31:03 chwon Edit level 2 + +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. + +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. + +*/ + +#ifdef ARDUINO_ARCH_STM32 + +#include + +#include +#include + +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 ****/