@@ -442,6 +442,19 @@ class LTE : public SARA_R5 {
442
442
int32_t ntripGgaMs; // !< time tag (millis()) of next GGA to be sent
443
443
int ntripSocket; // !< the socket handle
444
444
445
+ #if 1
446
+ // override until this API is natively avialable in Sparkfun SARA-R5 library
447
+ // https://github.com/sparkfun/SparkFun_u-blox_SARA-R5_Arduino_Library/pull/43
448
+ SARA_R5_error_t socketSetSecure (int profile, bool secure, int secprofile = -1 )
449
+ {
450
+ char command[64 ];
451
+ sprintf (command, ((secprofile == -1 ) || !secure) ? " %s=%d,%d" : " %s=%d,%d,%d" ,
452
+ SARA_R5_SECURE_SOCKET, profile, secure, secprofile);
453
+ return sendCommandWithResponse (command, SARA_R5_RESPONSE_OK_OR_ERROR, nullptr ,
454
+ SARA_R5_STANDARD_RESPONSE_TIMEOUT);
455
+ }
456
+ #endif
457
+
445
458
/* * Connect to a NTRIP server
446
459
* \param ntrip the server:port/mountpoint to connect to
447
460
* \return connection success
@@ -473,15 +486,13 @@ class LTE : public SARA_R5 {
473
486
" User-Agent: " CONFIG_DEVICE_TITLE " \r\n "
474
487
" %s\r\n " , mntpnt.c_str (), authHead.c_str ());
475
488
LTE_CHECK_INIT;
476
- #if 0 // requires latest Sparkfun SARA-R5 socketSetSecure API
477
489
LTE_CHECK (1 ) = LTE_IGNORE_LENA ( resetSecurityProfile (LTE_SEC_PROFILE_NTRIP) );
478
490
LTE_CHECK (2 ) = configSecurityProfile (LTE_SEC_PROFILE_NTRIP, SARA_R5_SEC_PROFILE_PARAM_CERT_VAL_LEVEL, SARA_R5_SEC_PROFILE_CERTVAL_OPCODE_NO); // no certificate and url/sni check
479
491
LTE_CHECK (3 ) = configSecurityProfile (LTE_SEC_PROFILE_NTRIP, SARA_R5_SEC_PROFILE_PARAM_TLS_VER, SARA_R5_SEC_PROFILE_TLS_OPCODE_ANYVER);
480
492
LTE_CHECK (4 ) = configSecurityProfile (LTE_SEC_PROFILE_NTRIP, SARA_R5_SEC_PROFILE_PARAM_CYPHER_SUITE, SARA_R5_SEC_PROFILE_SUITE_OPCODE_PROPOSEDDEFAULT);
481
493
LTE_CHECK (5 ) = configSecurityProfileString (LTE_SEC_PROFILE_NTRIP, SARA_R5_SEC_PROFILE_PARAM_SNI, server.c_str ());
482
494
bool isSecure = server.equalsIgnoreCase (" ppntrip.services.u-blox.com" ) && (2102 == port); // we try to autodetect the secure thingstream server
483
495
LTE_CHECK (6 ) = socketSetSecure (ntripSocket, isSecure, LTE_SEC_PROFILE_NTRIP);
484
- #endif
485
496
LTE_CHECK (7 ) = socketConnect (ntripSocket, server.c_str (), port);
486
497
LTE_CHECK (8 ) = socketWrite (ntripSocket, buf, len);
487
498
int avail = 0 ;
0 commit comments