Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BME280 SerialGPS libmDot mbed-rtos mbed
Revision 3:5c2bcba214b5, committed 2016-07-04
- Comitter:
- AshuJoshi
- Date:
- Mon Jul 04 22:42:27 2016 +0000
- Parent:
- 2:866a72c3c3bf
- Child:
- 4:97f9ad3f2566
- Commit message:
- Added support to print mDot Config
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Jul 04 22:29:31 2016 +0000
+++ b/main.cpp Mon Jul 04 22:42:27 2016 +0000
@@ -47,6 +47,7 @@
void readandprintBME280();
void mDotConfig();
void mDotGotoDeepSleep(int seconds);
+void mDotConfigPrint();
@@ -58,6 +59,8 @@
// Simple Test Functions, "Hello World on UDK
setUpLEDBlink();
mDotConfig();
+ mDotConfigPrint();
+ wait(15);
endLessTestLoop();
return 0;
@@ -87,6 +90,66 @@
}
+void mDotConfigPrint() {
+
+ // Display what is set
+ printf("\r\n");
+ printf(" ********** mDot Configuration ************ \n");
+ std::vector<uint8_t> tmp = dot->getNetworkSessionKey();
+ printf("Network Session Key: ");
+ printf("%s\n", mts::Text::bin2hexString(tmp, " ").c_str());
+
+ tmp = dot->getDataSessionKey();
+ printf("Data Session Key: ");
+ printf("%s\n", mts::Text::bin2hexString(tmp, " ").c_str());
+
+ // App EUI
+ tmp = dot->getNetworkId();
+ printf("App EUI: ");
+ printf("%s\n", mts::Text::bin2hexString(tmp, " ").c_str());
+
+ // App Key
+ tmp = dot->getNetworkKey();
+ printf("App Key: ");
+ printf("%s\n", mts::Text::bin2hexString(tmp, " ").c_str());
+
+
+ printf("Device ID ");
+ std::vector<uint8_t> deviceId;
+ deviceId = dot->getDeviceId();
+ for (std::vector<uint8_t>::iterator it = deviceId.begin() ; it != deviceId.end(); ++it)
+ printf("%2.2x",*it );
+ printf("\n");
+
+ std::vector<uint8_t> netAddress;
+
+ printf("Network Address ");
+ netAddress = dot->getNetworkAddress();
+ for (std::vector<uint8_t>::iterator it = netAddress.begin() ; it != netAddress.end(); ++it)
+ printf("%2.2x",*it );
+
+ printf("\n");
+
+ // Display LoRa parameters
+ // Display label and values in different colours, show pretty values not numeric values where applicable
+ printf("Public Network: %s\n", (char*)(dot->getPublicNetwork() ? "Yes" : "No") );
+ printf("Frequency: %s\n", (char*)mDot::FrequencyBandStr(dot->getFrequencyBand()).c_str() );
+ printf("Sub Band: %s\n", (char*)mDot::FrequencySubBandStr(dot->getFrequencySubBand()).c_str() );
+ printf("Join Mode: %s\n", (char*)mDot::JoinModeStr(dot->getJoinMode()).c_str() );
+ printf("Join Retries: %d\n", dot->getJoinRetries() );
+ printf("Join Byte Order: %s\n", (char*)(dot->getJoinByteOrder() == 0 ? "LSB" : "MSB") );
+ printf("Link Check Count: %d\n", dot->getLinkCheckCount() );
+ printf("Link Check Thold: %d\n", dot->getLinkCheckThreshold() );
+ printf("Tx Data Rate: %s\n", (char*)mDot::DataRateStr(dot->getTxDataRate()).c_str() );
+ printf("Tx Power: %d\n", dot->getTxPower() );
+ printf("TxWait: %s, ", (dot->getTxWait() ? "Y" : "N" ));
+ printf("CRC: %s, ", (dot->getCrc() ? "Y" : "N") );
+ printf("Ack: %s\n", (dot->getAck() ? "Y" : "N") );
+
+
+
+}
+
/*****************************************************