Basic xdot code to check how many memory is available for user APP after initializing libxdot lorawan stack
Diff: examples/src/dot_util.cpp
- Revision:
- 10:4d0b765f7b9e
- Parent:
- 8:e667f4a507b1
- Child:
- 11:d2e31743433a
diff -r 72d3203279b2 -r 4d0b765f7b9e examples/src/dot_util.cpp --- a/examples/src/dot_util.cpp Fri Oct 07 15:48:23 2016 -0500 +++ b/examples/src/dot_util.cpp Mon Oct 10 15:04:22 2016 -0500 @@ -14,34 +14,38 @@ void display_config() { // display configuration and library version information - logInfo("version: %s", dot->getId().c_str()); + logInfo("====================="); logInfo("general configuration"); - logInfo("---------------------"); - logInfo("\tdevice ID/EUI: %s", mts::Text::bin2hexString(dot->getDeviceId()).c_str()); - logInfo("\tfrequency band: %s", mDot::FrequencyBandStr(dot->getFrequencyBand()).c_str()); + logInfo("====================="); + logInfo("version ------------------ %s", dot->getId().c_str()); + logInfo("device ID/EUI ------------ %s", mts::Text::bin2hexString(dot->getDeviceId()).c_str()); + logInfo("frequency band ----------- %s", mDot::FrequencyBandStr(dot->getFrequencyBand()).c_str()); if (dot->getFrequencySubBand() != mDot::FB_EU868) { - logInfo("\tfrequency sub band: %u", dot->getFrequencySubBand()); + logInfo("frequency sub band ------- %u", dot->getFrequencySubBand()); } - logInfo("\tpublic network: %s", dot->getPublicNetwork() == true ? "on" : "off"); + logInfo("public network ----------- %s", dot->getPublicNetwork() ? "on" : "off"); + logInfo("========================="); logInfo("credentials configuration"); - logInfo("-------------------------"); - logInfo("\tnetwork join mode: %s", mDot::JoinModeStr(dot->getJoinMode()).c_str()); + logInfo("========================="); + logInfo("device class ------------- %s", dot->getClass().c_str()); + logInfo("network join mode -------- %s", mDot::JoinModeStr(dot->getJoinMode()).c_str()); if (dot->getJoinMode() == mDot::MANUAL) { - logInfo("\tnetwork address: %s", mts::Text::bin2hexString(dot->getNetworkAddress()).c_str()); - logInfo("\tnetwork session key: %s", mts::Text::bin2hexString(dot->getNetworkSessionKey()).c_str()); - logInfo("\tdata session key: %s", mts::Text::bin2hexString(dot->getDataSessionKey()).c_str()); + logInfo("network address ---------- %s", mts::Text::bin2hexString(dot->getNetworkAddress()).c_str()); + logInfo("network session key------- %s", mts::Text::bin2hexString(dot->getNetworkSessionKey()).c_str()); + logInfo("data session key---------- %s", mts::Text::bin2hexString(dot->getDataSessionKey()).c_str()); } else { - logInfo("\tnetwork name: %s", dot->getNetworkName().c_str()); - logInfo("\tnetwork phrase: %s", dot->getNetworkPassphrase().c_str()); - logInfo("\tnetwork EUI: %s", mts::Text::bin2hexString(dot->getNetworkId()).c_str()); - logInfo("\tnetwork KEY: %s", mts::Text::bin2hexString(dot->getNetworkKey()).c_str()); + logInfo("network name ------------- %s", dot->getNetworkName().c_str()); + logInfo("network phrase ----------- %s", dot->getNetworkPassphrase().c_str()); + logInfo("network EUI -------------- %s", mts::Text::bin2hexString(dot->getNetworkId()).c_str()); + logInfo("network KEY -------------- %s", mts::Text::bin2hexString(dot->getNetworkKey()).c_str()); } + logInfo("========================"); logInfo("communication parameters"); - logInfo("------------------------"); - logInfo("\tacks: %s, %u attempts", dot->getAck() > 0 ? "on" : "off", dot->getAck()); - logInfo("\tTX datarate: %s", mDot::DataRateStr(dot->getTxDataRate()).c_str()); - logInfo("\tTX power: %lu dBm", dot->getTxPower()); - logInfo("\tatnenna gain: %u dBm", dot->getAntennaGain()); + logInfo("========================"); + logInfo("acks --------------------- %s, %u attempts", dot->getAck() > 0 ? "on" : "off", dot->getAck()); + logInfo("TX datarate -------------- %s", mDot::DataRateStr(dot->getTxDataRate()).c_str()); + logInfo("TX power ----------------- %lu dBm", dot->getTxPower()); + logInfo("atnenna gain ------------- %u dBm", dot->getAntennaGain()); } void update_ota_config_name_phrase(std::string network_name, std::string network_passphrase, uint8_t frequency_sub_band, bool public_network, uint8_t ack) { @@ -73,9 +77,9 @@ } if (current_public_network != public_network) { - logInfo("changing public network from %s to %s", current_public_network ? "true" : "false", public_network ? "true" : "false"); + logInfo("changing public network from %s to %s", current_public_network ? "on" : "off", public_network ? "on" : "off"); if (dot->setPublicNetwork(public_network) != mDot::MDOT_OK) { - logError("failed to set public network to %s", public_network ? "true" : "false"); + logError("failed to set public network to %s", public_network ? "on" : "off"); } } @@ -119,9 +123,9 @@ } if (current_public_network != public_network) { - logInfo("changing public network from %s to %s", current_public_network ? "true" : "false", public_network ? "true" : "false"); + logInfo("changing public network from %s to %s", current_public_network ? "on" : "off", public_network ? "on" : "off"); if (dot->setPublicNetwork(public_network) != mDot::MDOT_OK) { - logError("failed to set public network to %s", public_network ? "true" : "false"); + logError("failed to set public network to %s", public_network ? "on" : "off"); } } @@ -174,9 +178,9 @@ } if (current_public_network != public_network) { - logInfo("changing public network from %s to %s", current_public_network ? "true" : "false", public_network ? "true" : "false"); + logInfo("changing public network from %s to %s", current_public_network ? "on" : "off", public_network ? "on" : "off"); if (dot->setPublicNetwork(public_network) != mDot::MDOT_OK) { - logError("failed to set public network to %s", public_network ? "true" : "false"); + logError("failed to set public network to %s", public_network ? "on" : "off"); } }