File tree 3 files changed +39
-1
lines changed
3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -51,9 +51,40 @@ UDP & CellularConnectionHandler::getUDP()
51
51
PROTECTED MEMBER FUNCTIONS
52
52
******************************************************************************/
53
53
54
+ #if defined(ARDUINO_OPTA) && defined(BOARD_HAS_CELLULAR)
55
+ CellularExpansion ce;
56
+ static void beginOptaCellular () {
57
+ static bool first_call = true ;
58
+
59
+ if (first_call) {
60
+ first_call = false ;
61
+ OptaController.registerCustomExpansion (CellularExpansion::getProduct (),
62
+ CellularExpansion::makeExpansion,
63
+ CellularExpansion::startUp);
64
+ OptaController.begin ();
65
+ delay (500 );
66
+ for (int i = 0 ; i < OptaController.getExpansionNum (); i++) {
67
+ ce = OptaController.getExpansion (i);
68
+ if (ce) {
69
+ ce.ctrlModem (true );
70
+ delay (100 );
71
+ break ;
72
+ }
73
+ }
74
+ }
75
+ else {
76
+ OptaController.update ();
77
+ }
78
+ }
79
+ #endif
80
+
54
81
NetworkConnectionState CellularConnectionHandler::update_handleInit ()
55
82
{
83
+ #if defined(ARDUINO_OPTA) && defined(BOARD_HAS_CELLULAR)
84
+ beginOptaCellular ();
85
+ #else
56
86
_cellular.begin ();
87
+ #endif
57
88
_cellular.setDebugStream (Serial);
58
89
if (String (_pin).length () > 0 && !_cellular.unlockSIM (_pin)) {
59
90
Debug.print (DBG_ERROR, F (" SIM not present or wrong PIN" ));
Original file line number Diff line number Diff line change 20
20
21
21
#if defined(ARDUINO_PORTENTA_C33) || defined(ARDUINO_PORTENTA_H7_M7)
22
22
#include < Arduino_Cellular.h>
23
+ #elif defined(ARDUINO_OPTA)
24
+ #include < Arduino_OptaCellular.h>
23
25
#endif
24
26
25
27
#ifndef BOARD_HAS_CELLULAR
@@ -57,8 +59,12 @@ class CellularConnectionHandler : public ConnectionHandler
57
59
const char * _apn;
58
60
const char * _login;
59
61
const char * _pass;
60
-
62
+
63
+ #if defined(ARDUINO_OPTA)
64
+ ArduinoCellular &_cellular = CellularExpansion::getCellular();
65
+ #else
61
66
ArduinoCellular _cellular;
67
+ #endif
62
68
TinyGsmClient _gsm_client = _cellular.getNetworkClient();
63
69
};
64
70
Original file line number Diff line number Diff line change 81
81
#if defined(ARDUINO_OPTA )
82
82
#define BOARD_HAS_WIFI
83
83
#define BOARD_HAS_ETHERNET
84
+ #define BOARD_HAS_CELLULAR
84
85
#define NETWORK_HARDWARE_ERROR WL_NO_SHIELD
85
86
#define NETWORK_IDLE_STATUS WL_IDLE_STATUS
86
87
#define NETWORK_CONNECTED WL_CONNECTED
You can’t perform that action at this time.
0 commit comments