# Get Remote node ID when heartbeat is recevied

**URL:** <https://forum.opencyphal.org/t/get-remote-node-id-when-heartbeat-is-recevied/1901>\
**Category:** Libcanard\
**Created:** [May 31, 2023, 9:13am UTC](https://forum.opencyphal.org/t/get-remote-node-id-when-heartbeat-is-recevied/1901 "2023-05-31T09:13:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rebeccaRossRobotics](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/rebeccarossrobotics/32/1387_2.png) [@rebeccaRossRobotics](https://forum.opencyphal.org/u/rebeccaRossRobotics)\
**Post date:** [May 31, 2023, 9:13am UTC](https://forum.opencyphal.org/t/get-remote-node-id-when-heartbeat-is-recevied/1901/1 "2023-05-31T09:13:16Z")

</div>

Hi!

I’m currently migrating all our CAN devices from a previous version of 107-Arduino-Cyphal (data types were still .uavcan). In the previous version the callback function for a subscription also passed through the CanardRxTransfer where I could extract the remote\_node\_id from the metadata. I’d like to do the same with the latest 107-Arduino-Cyphal, I’ve had a look around and can’t see anything that tells me how to do this… Is this possible? If so how do I get retrieve it. I’ve put the code below where I initialise the Node, subscription and its callback function for reference.

```auto
Node node_hdl(
  node_heap.data(),
  node_heap.size(),
  micros,
  [] (CanardFrame const & frame) { return mcp2515.transmit(frame); },
  OPEN_CYPHAL_NODE_ID);

Subscription heartbeat_subscription = node_hdl.create_subscription<uavcan::node::Heartbeat_1_0>(
  heartbeat::on_heartbeat_received);

```

```auto
void on_heartbeat_received(const uavcan::node::Heartbeat_1_0 & msg)
{
  if (DEBUG) {
    char msg_buf[64];
    snprintf(msg_buf, sizeof(msg_buf),
            "Uptime = %d, Health = %d, Mode = %d, VSSC = %d",
            msg.uptime, msg.health.value, msg.mode.value, msg.vendor_specific_status_code);

    Serial.println(msg_buf);
  }

* this is where i'd like to be able to do some filtering based on the remote node id *

```

Thanks  
Rebecca

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [May 31, 2023, 11:58am UTC](https://forum.opencyphal.org/t/get-remote-node-id-when-heartbeat-is-recevied/1901/2 "2023-05-31T11:58:38Z")

</div>

That’s a good question, but it’s not really related to libcanard. It is rather related to @aentinger’s Arduino library built on top of it (libcanard itself does not issue any callbacks). It might even be worthy of an issue at [Issues · 107-systems/107-Arduino-Cyphal · GitHub](https://github.com/107-systems/107-Arduino-Cyphal/issues)

---

<div class="post-metadata">

**Author:** ![rebeccaRossRobotics](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/rebeccarossrobotics/32/1387_2.png) [@rebeccaRossRobotics](https://forum.opencyphal.org/u/rebeccaRossRobotics)\
**Post date:** [May 31, 2023, 11:59am UTC](https://forum.opencyphal.org/t/get-remote-node-id-when-heartbeat-is-recevied/1901/3 "2023-05-31T11:59:57Z")

</div>

Ok will do.

Thank Pavel

---

<div class="post-metadata">

**Author:** ![aentinger](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/aentinger/32/1428_2.png) [@aentinger](https://forum.opencyphal.org/u/aentinger)\
**Post date:** [May 31, 2023, 2:30pm UTC](https://forum.opencyphal.org/t/get-remote-node-id-when-heartbeat-is-recevied/1901/4 "2023-05-31T14:30:37Z")

</div>

Issue, design rationale and further discussion over [here](https://github.com/107-systems/107-Arduino-Cyphal/issues/232). 😉 🙇‍♂️ .

---

<div class="post-metadata">

**Author:** ![aentinger](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/aentinger/32/1428_2.png) [@aentinger](https://forum.opencyphal.org/u/aentinger)\
**Post date:** [June 5, 2023, 8:51am UTC](https://forum.opencyphal.org/t/get-remote-node-id-when-heartbeat-is-recevied/1901/5 "2023-06-05T08:51:46Z")

</div>

Implemented by @rebeccaRossRobotics (thank you 🙇‍♂️ 🚀 ) and merged in [#235](https://github.com/107-systems/107-Arduino-Cyphal/pull/235) ▶ and a new version of [107-Arduino-Cyphal](https://github.com/107-systems/107-Arduino-Cyphal) has been released here ([v3.2.0](https://github.com/107-systems/107-Arduino-Cyphal/releases/tag/3.2.0)).
