@@ -40,7 +40,7 @@ static bool transmitCanFrame(CanardFrame const & f)
4040
4141static void onHeatbeat_1_0_Received (CanardTransfer const & transfer, ArduinoUAVCAN & /* uavcan */ )
4242{
43- Heartbeat_1_0 const received_hb = Heartbeat_1_0::create (transfer);
43+ Heartbeat_1_0 const received_hb = Heartbeat_1_0::deserialize (transfer);
4444
4545 hb_node_id = transfer.remote_node_id ;
4646 hb_data.uptime = received_hb.data .uptime ;
@@ -65,10 +65,10 @@ TEST_CASE("A '32085.Heartbeat.1.0.uavcan' message is sent", "[heartbeat-01]")
6565 uavcan.publish (hb);
6666 while (uavcan.transmitCanFrame ()) { }
6767 /*
68- * pyuavcan publish 32085 .uavcan.node.Heartbeat.1.0 '{uptime: 9876, health: 0 , mode: 3 , vendor_specific_status_code: 5}' --tr='CAN(can.media.socketcan.SocketCANMedia("vcan0",8),13)'
68+ * pyuavcan publish 7509 .uavcan.node.Heartbeat.1.0 '{uptime: 9876, health: {value: 0} , mode: {value: 3} , vendor_specific_status_code: 5}' --tr='CAN(can.media.socketcan.SocketCANMedia("vcan0",8),13)'
6969 */
7070 REQUIRE (can_frame.id == 0x107D550D );
71- REQUIRE (can_frame.data == std::vector<uint8_t >{0x94 , 0x26 , 0x00 , 0x00 , 0xAC , 0x00 , 0x00 , 0xE0 });
71+ REQUIRE (can_frame.data == std::vector<uint8_t >{0x94 , 0x26 , 0x00 , 0x00 , 0x00 , 0x03 , 0x05 , 0xE0 });
7272
7373 hb.data .uptime = 9881 ;
7474 hb = Heartbeat_1_0::Health::ADVISORY;
@@ -77,34 +77,34 @@ TEST_CASE("A '32085.Heartbeat.1.0.uavcan' message is sent", "[heartbeat-01]")
7777 uavcan.publish (hb);
7878 while (uavcan.transmitCanFrame ()) { }
7979 /*
80- * pyuavcan publish 32085 .uavcan.node.Heartbeat.1.0 '{uptime: 9881, health: 1 , mode: 2 , vendor_specific_status_code: 123}' --tr='CAN(can.media.socketcan.SocketCANMedia("vcan0",8),13)'
80+ * pyuavcan publish 7509 .uavcan.node.Heartbeat.1.0 '{uptime: 9881, health: {value: 1} , mode: {value: 2} , vendor_specific_status_code: 123}' --tr='CAN(can.media.socketcan.SocketCANMedia("vcan0",8),13)'
8181 */
8282 REQUIRE (can_frame.id == 0x107D550D );
83- REQUIRE (can_frame.data == std::vector<uint8_t >{0x99 , 0x26 , 0x00 , 0x00 , 0x69 , 0x0F , 0x00 , 0xE1 });
83+ REQUIRE (can_frame.data == std::vector<uint8_t >{0x99 , 0x26 , 0x00 , 0x00 , 0x01 , 0x02 , 0x7B , 0xE1 });
8484}
8585
8686TEST_CASE (" A '32085.Heartbeat.1.0.uavcan' message is received" , " [heartbeat-02]" )
8787{
88- uavcan_node_Heartbeat_1_0_init (&hb_data);
88+ uavcan_node_Heartbeat_1_0_initialize_ (&hb_data);
8989 ArduinoUAVCAN uavcan (util::LOCAL_NODE_ID, nullptr );
9090
9191 REQUIRE (uavcan.subscribe <Heartbeat_1_0>(onHeatbeat_1_0_Received));
9292
9393 /* Create:
94- * pyuavcan publish 32085 .uavcan.node.Heartbeat.1.0 '{uptime: 1337, health: 2 , mode: 7 , vendor_specific_status_code: 42}' --tr='CAN(can.media.socketcan.SocketCANMedia("vcan0",8),59)'
94+ * pyuavcan publish 7509 .uavcan.node.Heartbeat.1.0 '{uptime: 1337, health: {value: 2} , mode: {value: 2} , vendor_specific_status_code: 42}' --tr='CAN(can.media.socketcan.SocketCANMedia("vcan0",8),59)'
9595 *
9696 * Capture:
9797 * sudo modprobe vcan
9898 * sudo ip link add dev vcan0 type vcan
9999 * sudo ip link set up vcan0
100100 * candump -decaxta vcan0
101101 */
102- std::vector<uint8_t > const data{0x39 , 0x05 , 0x00 , 0x00 , 0x5E , 0x05 , 0x00 , 0xE1 };
102+ std::vector<uint8_t > const data{0x39 , 0x05 , 0x00 , 0x00 , 0x02 , 0x02 , 0x2A , 0xE1 };
103103 uavcan.onCanFrameReceived (util::toCanardFrame (0x107D553B , data));
104104
105105 REQUIRE (hb_node_id == 59 );
106106 REQUIRE (hb_data.uptime == 1337 );
107- REQUIRE (hb_data.health == arduino::_107_::uavcan::to_integer (Heartbeat_1_0::Health::CAUTION));
108- REQUIRE (hb_data.mode == arduino::_107_::uavcan::to_integer (Heartbeat_1_0::Mode::OFFLINE ));
107+ REQUIRE (hb_data.health . value == arduino::_107_::uavcan::to_integer (Heartbeat_1_0::Health::CAUTION));
108+ REQUIRE (hb_data.mode . value == arduino::_107_::uavcan::to_integer (Heartbeat_1_0::Mode::MAINTENANCE ));
109109 REQUIRE (hb_data.vendor_specific_status_code == 42 );
110110}
0 commit comments