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: DigiLogger
Fork of XBeeLib_vs by
Diff: XBeeZB/XBeeZB.cpp
- Revision:
- 6:06522f3a6642
- Parent:
- 4:629712865107
- Child:
- 8:b5f4a0e92249
--- a/XBeeZB/XBeeZB.cpp Thu Mar 31 11:39:30 2016 +0200
+++ b/XBeeZB/XBeeZB.cpp Thu Jul 28 10:17:20 2016 +0200
@@ -27,6 +27,13 @@
RadioStatus XBeeZB::init()
{
RadioStatus retval = XBee::init();
+ uint16_t addr16;
+ RadioStatus error = get_network_address(&addr16);
+ if (error == Success) {
+ digi_log(LogLevelInfo, "ADDR16: %04x\r\n", addr16);
+ } else {
+ digi_log(LogLevelInfo, "ADDR16: UNKNOWN\r\n");
+ }
const RadioProtocol radioProtocol = get_radio_protocol();
if (radioProtocol != ZigBee) {
@@ -185,6 +192,48 @@
return Success;
}
+RadioStatus XBeeZB::get_network_address(uint16_t * const addr16)
+{
+ if (addr16 == NULL) {
+ return Failure;
+ }
+ AtCmdFrame::AtCmdResp cmdresp;
+
+ uint32_t var32;
+ cmdresp = get_param("MY", &var32);
+ if (cmdresp != AtCmdFrame::AtCmdRespOk) {
+ return Failure;
+ }
+ *addr16 = var32;
+ return Success;
+}
+
+RadioStatus XBeeZB::get_node_discovery_timeout(uint16_t * const timeout_ms)
+{
+ AtCmdFrame::AtCmdResp cmdresp;
+ uint32_t var32;
+
+ cmdresp = get_param("NT", &var32);
+ if (cmdresp != AtCmdFrame::AtCmdRespOk) {
+ return Failure;
+ }
+ *timeout_ms = (uint16_t)var32;
+
+ /* No N? command available for this protocol. Add a fix 1s guard time */
+ *timeout_ms += 1000;
+
+ return Success;
+}
+
+RadioStatus XBeeZB::get_node_discovery_timeout(uint16_t * const timeout_ms, bool * const wait_for_complete_timeout)
+{
+ const RadioStatus status = get_node_discovery_timeout(timeout_ms);
+
+ *wait_for_complete_timeout = false;
+
+ return status;
+}
+
RadioStatus XBeeZB::check_for_coordinator_at_start(bool enable)
{
AtCmdFrame::AtCmdResp cmdresp;
