sparkfun / SparkFun_u-blox_Cellular_Arduino_Library

Other
0 stars 2 forks source link

Add SARA network examples #17

Open sfe-SparkFro opened 11 months ago

sfe-SparkFro commented 11 months ago

From @PaulZC in #13:

The SARA-R5 does need the PDP / PSD stuff to set up its data connection... I'm fine with you creating a SARA-specific examples folder and copying in a subset of the examples from the SARA-R5 library. I will help you refactor them and test them when I get some spare time.

PaulZC commented 10 months ago

Here are my notes as I test the Cellular Library examples on the SARA-R510M8S. Separate Pull Requests will follow as I add SARA-specific examples (with the extra PDP commands needed by the SARA).

Hardware:

SparkFun MicroMod Asset Tracker Carrier Board DEV-17272 SparkFun MicroMod Artemis Processor DEV-16401 SparkFun Apollo3 Boards v2.2.1

Example1_DeviceIdentification:

SparkFun_ublox_SARA_R510M8S_61B myModule; Uncomment myModule.invertPowerPin(true);

First time, the example runs correctly. I see Manu ID, Model ID, IMEI, IMSI etc. But if I upload and run it again, it fails. The Artemis is sending AT commands, but the SARA is not replying. I suspect it has something to do with the power pin, or the way the Artemis is reset when (re)uploading the example? Investigating...

PaulZC commented 10 months ago

I'm trying to define the power pin - Artemis MicroMod PB pin G2:

This compiles OK: SparkFun_ublox_Cellular myModule(G2);

But this fails: SparkFun_ublox_SARA_R510M8S_61B myModule(G2);

Example1_DeviceIdentification:14:44: error: no matching function for call to 'SparkFun_ublox_SARA_R510M8S_61B::SparkFun_ublox_SARA_R510M8S_61B(PinName)'
 SparkFun_ublox_SARA_R510M8S_61B myModule(G2);
                                            ^
In file included from C:\Users\pc235\Documents\Arduino\libraries\SparkFun_u-blox_AT_Commands_Arduino_Library\src/SparkFun_u-blox_Cellular_Arduino_Library.h:2,
                 from C:\Users\pc235\AppData\Local\Temp\arduino_modified_sketch_873765\Example1_DeviceIdentification.ino:1:
C:\Users\pc235\Documents\Arduino\libraries\SparkFun_u-blox_AT_Commands_Arduino_Library\src/sfe_sara_r5.h:65:7: note: candidate: 'SparkFun_ublox_SARA_R510M8S_61B::SparkFun_ublox_SARA_R510M8S_61B()'
 class SparkFun_ublox_SARA_R510M8S_61B : public SparkFun_ublox_SARA_R5
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\pc235\Documents\Arduino\libraries\SparkFun_u-blox_AT_Commands_Arduino_Library\src/sfe_sara_r5.h:65:7: note:   candidate expects 0 arguments, 1 provided
C:\Users\pc235\Documents\Arduino\libraries\SparkFun_u-blox_AT_Commands_Arduino_Library\src/sfe_sara_r5.h:65:7: note: candidate: 'SparkFun_ublox_SARA_R510M8S_61B::SparkFun_ublox_SARA_R510M8S_61B(const SparkFun_ublox_SARA_R510M8S_61B&)'
C:\Users\pc235\Documents\Arduino\libraries\SparkFun_u-blox_AT_Commands_Arduino_Library\src/sfe_sara_r5.h:65:7: note:   no known conversion for argument 1 from 'PinName' to 'const SparkFun_ublox_SARA_R510M8S_61B&'
C:\Users\pc235\Documents\Arduino\libraries\SparkFun_u-blox_AT_Commands_Arduino_Library\src/sfe_sara_r5.h:65:7: note: candidate: 'SparkFun_ublox_SARA_R510M8S_61B::SparkFun_ublox_SARA_R510M8S_61B(SparkFun_ublox_SARA_R510M8S_61B&&)'
C:\Users\pc235\Documents\Arduino\libraries\SparkFun_u-blox_AT_Commands_Arduino_Library\src/sfe_sara_r5.h:65:7: note:   no known conversion for argument 1 from 'PinName' to 'SparkFun_ublox_SARA_R510M8S_61B&&'

@sfe-SparkFro : how do I define the power pin on the SARA-R510M8S? Thanks!

sfe-SparkFro commented 10 months ago

Ah, looks like the problem is that you can only use the default constructor for all the inherited classes. @gigapod any suggestions on how to best fix this? Would prefer to not have to define the same constructor for each class if possible.

gigapod commented 10 months ago

You need to bring up the superclasses constructors using a using statement.

From something I did in Flux:

// use superclasses other constructors (besides default)
       using flxStorageJSONPref::flxStorageJSONPref;

Here in context https://github.com/sparkfun/SparkFun_Flux/blob/981a4b6ec2080532b6405beff6390049e8a481b1/src/Flux/flxStorageJSONPref.h#L187

sfe-SparkFro commented 10 months ago

See #23, should be working there!

gigapod commented 10 months ago

Looks good, merged in the branch!

gigapod commented 10 months ago

The use of using is discussed in detail in a section on this page: https://en.cppreference.com/w/cpp/language/using_declaration

PaulZC commented 9 months ago

My RTK EVK examples (currently private):

Note: both examples need a GNSS, so they're not great 'generic' examples. Maybe we could adapt 8_5 so it transfers data to / from ThingSpeak using MQTT?

PaulZC commented 9 months ago

Hah! Except you almost did that already!