@@ -522,6 +522,17 @@ void httpClientUpdate()
522
522
break ;
523
523
}
524
524
525
+ // Check if the JSON blob contains a certificate and private key
526
+ // If this is the first time this device has connected to ThingStream, they
527
+ // will not be present and we need to retry
528
+ // httpClientConnectLimitReached will prevent excessive retries
529
+ if (((const char *)((*jsonZtp)[" certificate" ]) == nullptr ) || ((const char *)((*jsonZtp)[" privateKey" ]) == nullptr ))
530
+ {
531
+ systemPrintln (" ERROR - certificate or privateKey not found!\r\n " );
532
+ httpClientRestart (); // Try again - allow time for ThingStream to finish activating the device on plan
533
+ break ;
534
+ }
535
+
525
536
strncpy (tempHolderPtr, (const char *)((*jsonZtp)[" certificate" ]), MQTT_CERT_SIZE - 1 );
526
537
recordFile (" certificate" , tempHolderPtr, strlen (tempHolderPtr));
527
538
@@ -613,6 +624,17 @@ void httpClientUpdate()
613
624
// We received a JSON blob containing NTRIP credentials
614
625
systemPrintf (" PointPerfect response: %s\r\n " , response.c_str ());
615
626
627
+ // Check if the JSON blob contains rtcmCredentials
628
+ // If this is the first time this device has connected to ThingStream, rtcmCredentials
629
+ // will not be present and we need to retry
630
+ // httpClientConnectLimitReached will prevent excessive retries
631
+ if ((const char *)((*jsonZtp)[" rtcmCredentials" ]) == nullptr )
632
+ {
633
+ systemPrintln (" ERROR - rtcmCredentials not found!\r\n " );
634
+ httpClientRestart (); // Try again - allow time for ThingStream to finish activating the device on plan
635
+ break ;
636
+ }
637
+
616
638
strncpy (settings.ntripClient_CasterHost , (const char *)((*jsonZtp)[" rtcmCredentials" ][" endpoint" ]),
617
639
sizeof (settings.ntripClient_CasterHost ));
618
640
settings.ntripClient_CasterPort = (*jsonZtp)[" rtcmCredentials" ][" httpPort" ];
0 commit comments