From 583a1f08d3a6bfa24fe9d0985f41e2cf7c9384b6 Mon Sep 17 00:00:00 2001 From: PaulZC Date: Thu, 17 Mar 2022 11:53:51 +0000 Subject: [PATCH] Add ZED-F9P Example20 (L-Band keys via MQTT) --- .../Example18_PointPerfectClient/secrets.h | 2 +- ...ample19_LBand_Corrections_with_NEO-D9S.ino | 2 +- .../secrets.h | 19 +- ...xample20_PMP_with_L-Band_Keys_via_MQTT.ino | 377 ++++++++++++++++++ .../secrets.h | 44 ++ 5 files changed, 434 insertions(+), 10 deletions(-) create mode 100644 examples/ZED-F9P/Example20_PMP_with_L-Band_Keys_via_MQTT/Example20_PMP_with_L-Band_Keys_via_MQTT.ino create mode 100644 examples/ZED-F9P/Example20_PMP_with_L-Band_Keys_via_MQTT/secrets.h diff --git a/examples/ZED-F9P/Example18_PointPerfectClient/secrets.h b/examples/ZED-F9P/Example18_PointPerfectClient/secrets.h index 171d674..a40ca5d 100644 --- a/examples/ZED-F9P/Example18_PointPerfectClient/secrets.h +++ b/examples/ZED-F9P/Example18_PointPerfectClient/secrets.h @@ -5,7 +5,7 @@ const char password[] = ""; // Below infomation you can set after signing up with u-blox Thingstream portal // and after add a new New PointPerfect Thing // https://portal.thingstream.io/app/location-services/things -// in the new PointPerfect Thing you go to the credentials page and copy past the values and certificate into this. +// in the new PointPerfect Thing you go to the credentials page and copy paste the values and certificate into this. // -> Credentials -> Hostname const char AWS_IOT_ENDPOINT[] = "pp.services.u-blox.com"; diff --git a/examples/ZED-F9P/Example19_LBand_Corrections_with_NEO-D9S/Example19_LBand_Corrections_with_NEO-D9S.ino b/examples/ZED-F9P/Example19_LBand_Corrections_with_NEO-D9S/Example19_LBand_Corrections_with_NEO-D9S.ino index a642ed7..31e721e 100644 --- a/examples/ZED-F9P/Example19_LBand_Corrections_with_NEO-D9S/Example19_LBand_Corrections_with_NEO-D9S.ino +++ b/examples/ZED-F9P/Example19_LBand_Corrections_with_NEO-D9S/Example19_LBand_Corrections_with_NEO-D9S.ino @@ -10,7 +10,7 @@ This is a proof of concept to show how the UBX-RXM-PMP corrections control the accuracy. - You will need a Thingstream PointPerfect account to be able to access the SPARTN Credentials (IP Dynamic Keys). + You will need a Thingstream PointPerfect account to be able to access the SPARTN Credentials (L-Band or L-Band + IP Dynamic Keys). Copy and paste the Current Key and Next Key into secrets.h. Feel like supporting open source hardware? diff --git a/examples/ZED-F9P/Example19_LBand_Corrections_with_NEO-D9S/secrets.h b/examples/ZED-F9P/Example19_LBand_Corrections_with_NEO-D9S/secrets.h index 158e11c..1d118ea 100644 --- a/examples/ZED-F9P/Example19_LBand_Corrections_with_NEO-D9S/secrets.h +++ b/examples/ZED-F9P/Example19_LBand_Corrections_with_NEO-D9S/secrets.h @@ -1,24 +1,27 @@ // You can set the information below after signing up with the u-blox Thingstream portal -// and adding a new New PointPerfect Thing +// and adding a new New PointPerfect Thing (L-Band or L-Band + IP) // https://portal.thingstream.io/app/location-services/things // In the new PointPerfect Thing, you go to the credentials tab and copy and paste the IP Dynamic Keys here. // // The keys are valid from a particular GPS Week Number and Time of Week. // Looking at the credentials tab, the current key expires 23:59 Feb 11th 2022. // This means the next key is valid _from_ Midnight Feb 12th 2022. -// That is GPS Week 2196. The GPS Time of Week in seconds is 518418. +// That is GPS Week 2196. The GPS Time of Week in seconds is 518400. // Working backwards, the current key became valid exactly 4 weeks earlier (Midnight Jan 15th 2022). // // See: https://www.labsat.co.uk/index.php/en/gps-time-calculator // // The keys are given as: 32 hexadecimal digits = 128 bits = 16 Bytes +// +// The next example shows how to retrieve the keys using ESP32 WiFi and MQTT. +// You can cut and paste the keys and GPS week/time-of-week from that example into here. const uint8_t currentKeyLengthBytes = 16; -const char currentDynamicKey[] = "f742bd6b7248043177dd649141d8fb0b"; -const uint16_t currentKeyGPSWeek = 2192; -const uint32_t currentKeyGPSToW = 518418; +const char currentDynamicKey[] = ""; +const uint16_t currentKeyGPSWeek = 2192; // Update this when you add new keys +const uint32_t currentKeyGPSToW = 518400; const uint8_t nextKeyLengthBytes = 16; -const char nextDynamicKey[] = "8206........................29f4"; -const uint16_t nextKeyGPSWeek = 2196; -const uint32_t nextKeyGPSToW = 518418; +const char nextDynamicKey[] = ""; +const uint16_t nextKeyGPSWeek = 2196; // Update this when you add new keys +const uint32_t nextKeyGPSToW = 518400; diff --git a/examples/ZED-F9P/Example20_PMP_with_L-Band_Keys_via_MQTT/Example20_PMP_with_L-Band_Keys_via_MQTT.ino b/examples/ZED-F9P/Example20_PMP_with_L-Band_Keys_via_MQTT/Example20_PMP_with_L-Band_Keys_via_MQTT.ino new file mode 100644 index 0000000..9b01791 --- /dev/null +++ b/examples/ZED-F9P/Example20_PMP_with_L-Band_Keys_via_MQTT/Example20_PMP_with_L-Band_Keys_via_MQTT.ino @@ -0,0 +1,377 @@ +/* + Use ESP32 WiFi to get the L-Band dynamic keys from PointPerfect, allowing a ZED-F9x to use + the PMP data from a NEO-D9S correction data receiver. + By: SparkFun / Paul Clark + Based on original code by: u-blox AG / Michael Ammann + Date: March 17th, 2022 + License: MIT. See license file for more information but you can + basically do whatever you want with this code. + + This example shows how to obtain the L-Band dynamic keys from PointPerfect over ESP32 WiFi + and push them over I2C to a ZED-F9x. The ZED will then be able to decrypt the PMP correction data + from a NEO-D9S correction data receiver. + + You can copy the keys directly from the Thingstream portal and paste them into your code - the + previous example shows how to do this - but calculating the "valid from" week and time is a chore. + This example requests the keys for you (using your client key and certificates) via MQTT. + It prints them too, so you can copy and paste them into the previous example if you wish. + + You will need to have a valid u-blox Thingstream account and have a PointPerfect L-Band or L-Band + IP + Location Thing and payed plan. + + Thingstream offers SSR corrections to SPARTN capable RTK receivers such as the u-blox ZED-F9 series + in continental Europe and US. Their Network is planned to be expanded to other regions over the next years. + To sign up, go to: https://portal.thingstream.io/app/location-services/things + + For more information about MQTT, SPARTN and PointPerfect Correction Services + please see: https://www.u-blox.com/en/product/pointperfect + + Feel like supporting open source hardware? + Buy a board from SparkFun! + ZED-F9P RTK2: https://www.sparkfun.com/products/16481 + NEO-D9S Correction Data Receiver: https://www.sparkfun.com/products/19390 + + RTK Surveyor: https://www.sparkfun.com/products/18443 + RTK Express: https://www.sparkfun.com/products/18442 + + Recommended Hardware: + MicroMod GNSS Carrier Board: https://www.sparkfun.com/products/17722 + ESP32 Micromod https://www.sparkfun.com/products/16781 + + Hardware Connections: + Plug a Qwiic cable into the GNSS and a ESP32 Thing Plus + If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425) + Open the serial monitor at 115200 baud to see the output +*/ + +#include +#include +#include // Click here to get the library: http://librarymanager/All#ArduinoMqttClient +#include "secrets.h" + +#include // Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS +SFE_UBLOX_GNSS myGNSS; // ZED-F9x +SFE_UBLOX_GNSS myLBand; // NEO-D9S + +const uint32_t myLBandFreq = 1556290000; // Uncomment this line to use the US SPARTN 1.8 service +//const uint32_t myLBandFreq = 1545260000; // Uncomment this line to use the EU SPARTN 1.8 service + +#define OK(ok) (ok ? F(" -> OK") : F(" -> ERROR!")) // Convert uint8_t into OK/ERROR + +//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +// Callback: pushRXMPMP will be called when new PMP data arrives +// See u-blox_structs.h for the full definition of UBX_RXM_PMP_message_data_t +// _____ You can use any name you like for the callback. Use the same name when you call setRXMPMPmessageCallbackPtr +// / _____ This _must_ be UBX_RXM_PMP_message_data_t +// | / _____ You can use any name you like for the struct +// | | / +// | | | +void pushRXMPMP(UBX_RXM_PMP_message_data_t *pmpData) +{ + //Extract the raw message payload length + uint16_t payloadLen = ((uint16_t)pmpData->lengthMSB << 8) | (uint16_t)pmpData->lengthLSB; + Serial.print(F("New RXM-PMP data received. Message payload length is ")); + Serial.print(payloadLen); + Serial.println(F(" Bytes. Pushing it to the GNSS...")); + + //Push the PMP data to the GNSS + //The payload length could be variable, so we need to push the header and payload, then checksum + myGNSS.pushRawData(&pmpData->sync1, (size_t)payloadLen + 6); // Push the sync chars, class, ID, length and payload + myGNSS.pushRawData(&pmpData->checksumA, (size_t)2); // Push the checksum bytes +} + +//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +// Callback: printPVTdata will be called when new NAV PVT data arrives +// See u-blox_structs.h for the full definition of UBX_NAV_PVT_data_t +// _____ You can use any name you like for the callback. Use the same name when you call setAutoPVTcallbackPtr +// / _____ This _must_ be UBX_NAV_PVT_data_t +// | / _____ You can use any name you like for the struct +// | | / +// | | | +void printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct) +{ + double latitude = ubxDataStruct->lat; // Print the latitude + Serial.print(F("Lat: ")); + Serial.print(latitude / 10000000.0, 7); + + double longitude = ubxDataStruct->lon; // Print the longitude + Serial.print(F(" Long: ")); + Serial.print(longitude / 10000000.0, 7); + + double altitude = ubxDataStruct->hMSL; // Print the height above mean sea level + Serial.print(F(" Height: ")); + Serial.print(altitude / 1000.0, 3); + + uint8_t fixType = ubxDataStruct->fixType; // Print the fix type + Serial.print(F(" Fix: ")); + Serial.print(fixType); + if (fixType == 0) + Serial.print(F(" (None)")); + else if (fixType == 1) + Serial.print(F(" (Dead Reckoning)")); + else if (fixType == 2) + Serial.print(F(" (2D)")); + else if (fixType == 3) + Serial.print(F(" (3D)")); + else if (fixType == 3) + Serial.print(F(" (GNSS + Dead Reckoning)")); + else if (fixType == 5) + Serial.print(F(" (Time Only)")); + else + Serial.print(F(" (UNKNOWN)")); + + uint8_t carrSoln = ubxDataStruct->flags.bits.carrSoln; // Print the carrier solution + Serial.print(F(" Carrier Solution: ")); + Serial.print(carrSoln); + if (carrSoln == 0) + Serial.print(F(" (None)")); + else if (carrSoln == 1) + Serial.print(F(" (Floating)")); + else if (carrSoln == 2) + Serial.print(F(" (Fixed)")); + else + Serial.print(F(" (UNKNOWN)")); + + uint32_t hAcc = ubxDataStruct->hAcc; // Print the horizontal accuracy estimate + Serial.print(F(" Horizontal Accuracy Estimate: ")); + Serial.print(hAcc); + Serial.print(F(" (mm)")); + + Serial.println(); +} + +//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +//Global variables + +long lastReceived_ms = 0; //5 RTCM messages take approximately ~300ms to arrive at 115200bps +int maxTimeBeforeHangup_ms = 10000; //If we fail to get a complete RTCM frame after 10s, then disconnect from caster + +//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +void setup() +{ + Serial.begin(115200); + while (!Serial); + Serial.println(F("NEO-D9S SPARTN Corrections")); + + Wire.begin(); //Start I2C + + //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + // Begin and configure the ZED-F9x + + //myGNSS.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial + + while (myGNSS.begin() == false) //Connect to the u-blox module using Wire port + { + Serial.println(F("u-blox GNSS module not detected at default I2C address. Please check wiring.")); + delay(2000); + } + Serial.println(F("u-blox GNSS module connected")); + + uint8_t ok = myGNSS.setI2COutput(COM_TYPE_UBX); //Turn off NMEA noise + if (ok) ok = myGNSS.setPortInput(COM_PORT_I2C, COM_TYPE_UBX | COM_TYPE_NMEA | COM_TYPE_SPARTN); //Be sure SPARTN input is enabled + + if (ok) ok = myGNSS.setDGNSSConfiguration(SFE_UBLOX_DGNSS_MODE_FIXED); // Set the differential mode - ambiguities are fixed whenever possible + + if (ok) ok = myGNSS.setNavigationFrequency(1); //Set output in Hz. + + if (ok) ok = myGNSS.setVal8(UBLOX_CFG_SPARTN_USE_SOURCE, 1); // use LBAND PMP message + + //if (ok) ok = myGNSS.saveConfiguration(VAL_CFG_SUBSEC_IOPORT | VAL_CFG_SUBSEC_MSGCONF); //Optional: Save the ioPort and message settings to NVM + + Serial.print(F("GNSS: configuration ")); + Serial.println(OK(ok)); + + myGNSS.setAutoPVTcallbackPtr(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata so we can watch the carrier solution go to fixed + + //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + // Begin and configure the NEO-D9S L-Band receiver + + //myLBand.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial + + while (myLBand.begin(Wire, 0x43) == false) //Connect to the u-blox NEO-D9S using Wire port. The D9S default I2C address is 0x43 (not 0x42) + { + Serial.println(F("u-blox NEO-D9S not detected at default I2C address. Please check wiring.")); + delay(2000); + } + Serial.println(F("u-blox NEO-D9S connected")); + + ok = myLBand.setVal32(UBLOX_CFG_PMP_CENTER_FREQUENCY, myLBandFreq); // Default 1539812500 Hz + if (ok) ok = myLBand.setVal16(UBLOX_CFG_PMP_SEARCH_WINDOW, 2200); // Default 2200 Hz + if (ok) ok = myLBand.setVal8(UBLOX_CFG_PMP_USE_SERVICE_ID, 0); // Default 1 + if (ok) ok = myLBand.setVal16(UBLOX_CFG_PMP_SERVICE_ID, 21845); // Default 50821 + if (ok) ok = myLBand.setVal16(UBLOX_CFG_PMP_DATA_RATE, 2400); // Default 2400 bps + if (ok) ok = myLBand.setVal8(UBLOX_CFG_PMP_USE_DESCRAMBLER, 1); // Default 1 + if (ok) ok = myLBand.setVal16(UBLOX_CFG_PMP_DESCRAMBLER_INIT, 26969); // Default 23560 + if (ok) ok = myLBand.setVal8(UBLOX_CFG_PMP_USE_PRESCRAMBLING, 0); // Default 0 + if (ok) ok = myLBand.setVal64(UBLOX_CFG_PMP_UNIQUE_WORD, 16238547128276412563ull); + if (ok) ok = myLBand.setVal(UBLOX_CFG_MSGOUT_UBX_RXM_PMP_I2C, 1); // Ensure UBX-RXM-PMP is enabled on the I2C port + if (ok) ok = myLBand.setVal(UBLOX_CFG_MSGOUT_UBX_RXM_PMP_UART1, 1); // Output UBX-RXM-PMP on UART1 + if (ok) ok = myLBand.setVal(UBLOX_CFG_UART2OUTPROT_UBX, 1); // Enable UBX output on UART2 + if (ok) ok = myLBand.setVal(UBLOX_CFG_MSGOUT_UBX_RXM_PMP_UART2, 1); // Output UBX-RXM-PMP on UART2 + if (ok) ok = myLBand.setVal32(UBLOX_CFG_UART1_BAUDRATE, 38400); // match baudrate with ZED default + if (ok) ok = myLBand.setVal32(UBLOX_CFG_UART2_BAUDRATE, 38400); // match baudrate with ZED default + + Serial.print(F("L-Band: configuration ")); + Serial.println(OK(ok)); + + myLBand.softwareResetGNSSOnly(); // Do a restart + + myLBand.setRXMPMPmessageCallbackPtr(&pushRXMPMP); // Call pushRXMPMP when new PMP data arrives. Push it to the GNSS + + //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + // Connect to WiFi so we can request the dynamic keys via MQTT + + Serial.print(F("Connecting to local WiFi")); + WiFi.begin(ssid, password); + while (WiFi.status() != WL_CONNECTED) { + delay(500); + Serial.print(F(".")); + } + Serial.println(); + + Serial.print(F("WiFi connected with IP: ")); + Serial.println(WiFi.localIP()); + + while (Serial.available()) Serial.read(); + + Serial.println(F("Press any key to start MQTT Client.")); + +} + +void loop() +{ + if (Serial.available()) + { + beginClient(); + + while (Serial.available()) Serial.read(); //Empty buffer of any newline chars + + Serial.println(F("Press any key to start MQTT Client.")); + } + + myGNSS.checkUblox(); // Check for the arrival of new GNSS data and process it. + myGNSS.checkCallbacks(); // Check if any GNSS callbacks are waiting to be processed. + + myLBand.checkUblox(); // Check for the arrival of new PMP data and process it. + myLBand.checkCallbacks(); // Check if any LBand callbacks are waiting to be processed. +} + +WiFiClientSecure wifiClient = WiFiClientSecure(); +MqttClient mqttClient(wifiClient); + +void mqttMessageHandler(int messageSize) { + uint8_t spartnData[512 * 4]; //Most incoming data is around 500 bytes but may be larger + int spartnCount = 0; + Serial.print(F("Pushed data from ")); + Serial.print(mqttClient.messageTopic()); + Serial.println(F(" topic to ZED")); + while (mqttClient.available()) + { + char ch = mqttClient.read(); + //Serial.write(ch); //Pipe to serial port is fine but beware, it's a lot of binary data + spartnData[spartnCount++] = ch; + if (spartnCount == sizeof(spartnData)) + break; + } + + if (spartnCount > 0) + { + //Push KEYS or SPARTN data to GNSS module over I2C + myGNSS.pushRawData(spartnData, spartnCount, false); + lastReceived_ms = millis(); + + if ((spartnData[0] == 0xB5) // Check if this is UBX-RXM-SPARTNKEY + && (spartnData[1] == 0x62) + && (spartnData[2] == 0x02) // Class: RXM + && (spartnData[3] == 0x36)) // ID: SPARTNKEY + { + uint8_t numKeys = spartnData[7]; // Get the number of keys + uint8_t keyStart = 10 + (numKeys * 8); // Point to the start of the first key + for (uint8_t key = 0; key < numKeys; key++) + { + Serial.print(F("SPARTNKEY: ")); + Serial.println(key); + Serial.print(F("Valid from GPS week number: ")); + uint16_t validFromWno = ((uint16_t)spartnData[12 + (key * 8)]) | ((uint16_t)spartnData[13 + (key * 8)] << 8); // Little endian + Serial.println(validFromWno); + Serial.print(F("Valid from GPS time of week: ")); + uint32_t validFromTow = ((uint32_t)spartnData[14 + (key * 8)]) | ((uint32_t)spartnData[15 + (key * 8)] << 8) | ((uint32_t)spartnData[16 + (key * 8)] << 16) | ((uint32_t)spartnData[17 + (key * 8)] << 24); + Serial.println(validFromTow); + uint8_t keyLengthBytes = spartnData[11 + (key * 8)]; + Serial.print(F("Key length (bytes): ")); + Serial.println(keyLengthBytes); + Serial.print(F("Key: \"")); + for (uint8_t digit = 0; digit < keyLengthBytes; digit++) + { + Serial.print(spartnData[keyStart + digit], HEX); // Print the key as ASCII Hex + } + Serial.println(F("\"")); + keyStart += keyLengthBytes; // Update keyStart for the next key + } + } + } +} + +//Connect to MQTT broker, receive dynamic keys and push to ZED module over I2C +void beginClient() +{ + Serial.println(F("Subscribing to Broker. Press key to stop")); + delay(10); //Wait for any serial to arrive + while (Serial.available()) Serial.read(); //Flush + + while (Serial.available() == 0) + { + //Connect if we are not already + if (wifiClient.connected() == false) + { + // Connect to AWS IoT + wifiClient.setCACert(AWS_CERT_CA); + wifiClient.setCertificate(AWS_CERT_CRT); + wifiClient.setPrivateKey(AWS_CERT_PRIVATE); + mqttClient.setId(MQTT_CLIENT_ID); + mqttClient.setKeepAliveInterval(60*1000); + mqttClient.setConnectionTimeout( 5*1000); + if (!mqttClient.connect(AWS_IOT_ENDPOINT, AWS_IOT_PORT)) { + Serial.print(F("MQTT connection failed! Error code = ")); + Serial.println(mqttClient.connectError()); + return; + } else { + Serial.println(F("You're connected to the PointPerfect MQTT broker: ")); + Serial.println(AWS_IOT_ENDPOINT); + // Subscribe to MQTT and register a callback + Serial.println(F("Subscribe to Topics")); + mqttClient.onMessage(mqttMessageHandler); + mqttClient.subscribe(MQTT_TOPIC_KEY); + lastReceived_ms = millis(); + } //End attempt to connect + } //End connected == false + else { + mqttClient.poll(); + } + + //Close socket if we don't have new data for 10s + if (millis() - lastReceived_ms > maxTimeBeforeHangup_ms) + { + Serial.println(F("MQTT timeout. Disconnecting...")); + if (mqttClient.connected() == true) + mqttClient.stop(); + return; + } + + myGNSS.checkUblox(); // Check for the arrival of new GNSS data and process it. + myGNSS.checkCallbacks(); // Check if any GNSS callbacks are waiting to be processed. + + myLBand.checkUblox(); // Check for the arrival of new PMP data and process it. + myLBand.checkCallbacks(); // Check if any LBand callbacks are waiting to be processed. + + delay(10); + } + + Serial.println(F("User pressed a key")); + Serial.println(F("Disconnecting...")); + wifiClient.stop(); +} diff --git a/examples/ZED-F9P/Example20_PMP_with_L-Band_Keys_via_MQTT/secrets.h b/examples/ZED-F9P/Example20_PMP_with_L-Band_Keys_via_MQTT/secrets.h new file mode 100644 index 0000000..a3cbf36 --- /dev/null +++ b/examples/ZED-F9P/Example20_PMP_with_L-Band_Keys_via_MQTT/secrets.h @@ -0,0 +1,44 @@ +//Your WiFi credentials +const char ssid[] = ""; +const char password[] = ""; + +// Below infomation you can set after signing up with u-blox Thingstream portal +// and after add a new New PointPerfect Thing (L-Band or L-Band + IP) +// https://portal.thingstream.io/app/location-services/things +// in the new PointPerfect Thing you go to the credentials page and copy paste the values and certificate into this. + +// -> Credentials -> Hostname +const char AWS_IOT_ENDPOINT[] = "pp.services.u-blox.com"; +const unsigned short AWS_IOT_PORT = 8883; +// -> Credentials -> IP key distribution topic +//const char MQTT_TOPIC_KEY[] = "/pp/key/ip"; // This topic provides the IP only dynamic keys in JSON format +//const char MQTT_TOPIC_KEY[] = "/pp/key/Lb"; // This topic provides the L-Band + IP dynamic keys in JSON format +//const char MQTT_TOPIC_KEY[] = "/pp/ubx/0236/ip"; // This topic provides the IP only dynamic keys in UBX format +const char MQTT_TOPIC_KEY[] = "/pp/ubx/0236/Lb"; // This topic provides the L-Band + IP dynamic keys in UBX format +// -> Credentials -> IP correction topic for EU/US region +const char MQTT_TOPIC_SPARTN[] = "/pp/ip/eu"; // choice of {eu, us} + +// -> Credentials -> Client Id +static const char MQTT_CLIENT_ID[] = ""; + +// -> Credentials -> Amazon Root Certificate +static const char AWS_CERT_CA[] PROGMEM = R"EOF( +-----BEGIN CERTIFICATE----- + +-----END CERTIFICATE----- +)EOF"; + +// -> Credentials -> Client Certificate +static const char AWS_CERT_CRT[] PROGMEM = R"KEY( +-----BEGIN CERTIFICATE----- + +-----END CERTIFICATE----- +)KEY"; + +// Get this from Thingstream Portal +// -> Credentials -> Client Key +static const char AWS_CERT_PRIVATE[] PROGMEM = R"KEY( +-----BEGIN RSA PRIVATE KEY----- + +-----END RSA PRIVATE KEY----- +)KEY";