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.
Fork of XBeeLib by
Diff: XBeeZB/XBeeZB.cpp
- Revision:
- 1:794d1d3e4a08
- Parent:
- 0:fcaad0dfa051
- Child:
- 2:2ee1b6d51df2
diff -r fcaad0dfa051 -r 794d1d3e4a08 XBeeZB/XBeeZB.cpp
--- a/XBeeZB/XBeeZB.cpp Fri May 08 11:50:56 2015 +0200
+++ b/XBeeZB/XBeeZB.cpp Mon May 11 17:58:00 2015 +0200
@@ -334,14 +334,6 @@
return send_data(&frame);
}
-RemoteXBeeZB XBeeZB::get_remote_node_by_id(const char * const node_id)
-{
- uint64_t addr64;
- uint16_t addr16;
- _get_remote_node_by_id(node_id, &addr64, &addr16);
- return RemoteXBeeZB(addr64, addr16);
-}
-
NetworkRole XBeeZB::get_network_role()
{
return _nw_role;
@@ -409,6 +401,37 @@
}
}
+XBeeZB * XBeeZB::get_device_by_id(const char * const node_id)
+{
+ return NULL;
+}
+
+RadioStatus XBeeZB::get_device_by_id(const char * const node_id, uint64_t * const dev_addr)
+{
+ AtCmdFrame::AtCmdResp cmdresp;
+ uint32_t dh, dl;
+
+ if (strlen(node_id) > MAX_NI_PARAM_LEN)
+ return Failure;
+
+ cmdresp = set_param("DN", (const uint8_t *)node_id, strlen(node_id));
+ if (cmdresp != AtCmdFrame::AtCmdRespOk)
+ return Failure;
+
+ /* Read the address of the remote device from the DH, DL parameters */
+ cmdresp = get_param("DH", &dh);
+ if (cmdresp != AtCmdFrame::AtCmdRespOk)
+ return Failure;
+
+ cmdresp = get_param("DL", &dl);
+ if (cmdresp != AtCmdFrame::AtCmdRespOk)
+ return Failure;
+
+ *dev_addr = UINT64(dh, dl);
+
+ return Success;
+}
+
AtCmdFrame::AtCmdResp XBeeZB::get_param(const RemoteXBee& remote, const char * const param, uint32_t * const data)
{
if (!remote.is_valid_addr64b())
