@@ -522,3 +522,63 @@ void test_zwapi_protocol_rx_dispatch_protocol_cc_encryption_request()
522522 TEST_ASSERT_EQUAL (1 ,
523523 zwapi_protocol_cc_encryption_request_test_function_call_count );
524524}
525+
526+ void test_zwapi_protocol_rx_dispatch_beam_flags_both_false ()
527+ {
528+ // Test with beam flags both false (bit 5 and 6 clear: 0x00)
529+ zwave_api_get_callbacks_IgnoreAndReturn (& test_zwapi_callbacks );
530+ zwapi_send_data_callback = & zwapi_send_data_test_callback ;
531+ uint8_t frame [] = {0x1D , 0x00 , 0x13 , 0x00 , 0x00 , 0x12 , 0x23 , 0x05 , 0xCF , 0x7D ,
532+ 0x7F , 0x6F , 0x7F , 0x01 , 0x01 , 0x03 , 0x00 , 0x00 , 0x00 , 0x00 ,
533+ 0x00 , 0x01 , 0x00 , 0x00 }; // Byte 20 = 0x00 (no beam flags set)
534+ zwave_api_protocol_rx_dispatch (frame , sizeof (frame ));
535+
536+ TEST_ASSERT_EQUAL (1 , zwapi_send_data_test_callback_call_count );
537+ TEST_ASSERT_EQUAL (false, received_tx_report .beam_1000ms );
538+ TEST_ASSERT_EQUAL (false, received_tx_report .beam_250ms );
539+ }
540+
541+ void test_zwapi_protocol_rx_dispatch_beam_flags_250ms_only ()
542+ {
543+ // Test with only beam_250ms flag set (bit 5 set: 0x20)
544+ zwave_api_get_callbacks_IgnoreAndReturn (& test_zwapi_callbacks );
545+ zwapi_send_data_callback = & zwapi_send_data_test_callback ;
546+ uint8_t frame [] = {0x1D , 0x00 , 0x13 , 0x00 , 0x00 , 0x12 , 0x23 , 0x05 , 0xCF , 0x7D ,
547+ 0x7F , 0x6F , 0x7F , 0x01 , 0x01 , 0x03 , 0x00 , 0x00 , 0x00 , 0x00 ,
548+ 0x20 , 0x01 , 0x00 , 0x00 }; // Byte 20 = 0x20 (bit 5 set)
549+ zwave_api_protocol_rx_dispatch (frame , sizeof (frame ));
550+
551+ TEST_ASSERT_EQUAL (1 , zwapi_send_data_test_callback_call_count );
552+ TEST_ASSERT_EQUAL (false, received_tx_report .beam_1000ms );
553+ TEST_ASSERT_EQUAL (true, received_tx_report .beam_250ms );
554+ }
555+
556+ void test_zwapi_protocol_rx_dispatch_beam_flags_1000ms_only ()
557+ {
558+ // Test with only beam_1000ms flag set (bit 6 set: 0x40)
559+ zwave_api_get_callbacks_IgnoreAndReturn (& test_zwapi_callbacks );
560+ zwapi_send_data_callback = & zwapi_send_data_test_callback ;
561+ uint8_t frame [] = {0x1D , 0x00 , 0x13 , 0x00 , 0x00 , 0x12 , 0x23 , 0x05 , 0xCF , 0x7D ,
562+ 0x7F , 0x6F , 0x7F , 0x01 , 0x01 , 0x03 , 0x00 , 0x00 , 0x00 , 0x00 ,
563+ 0x40 , 0x01 , 0x00 , 0x00 }; // Byte 20 = 0x40 (bit 6 set)
564+ zwave_api_protocol_rx_dispatch (frame , sizeof (frame ));
565+
566+ TEST_ASSERT_EQUAL (1 , zwapi_send_data_test_callback_call_count );
567+ TEST_ASSERT_EQUAL (true, received_tx_report .beam_1000ms );
568+ TEST_ASSERT_EQUAL (false, received_tx_report .beam_250ms );
569+ }
570+
571+ void test_zwapi_protocol_rx_dispatch_beam_flags_both_true ()
572+ {
573+ // Test with both beam flags set (bits 5 and 6 set: 0x60)
574+ zwave_api_get_callbacks_IgnoreAndReturn (& test_zwapi_callbacks );
575+ zwapi_send_data_callback = & zwapi_send_data_test_callback ;
576+ uint8_t frame [] = {0x1D , 0x00 , 0x13 , 0x00 , 0x00 , 0x12 , 0x23 , 0x05 , 0xCF , 0x7D ,
577+ 0x7F , 0x6F , 0x7F , 0x01 , 0x01 , 0x03 , 0x00 , 0x00 , 0x00 , 0x00 ,
578+ 0x60 , 0x01 , 0x00 , 0x00 }; // Byte 20 = 0x60 (bits 5 and 6 set)
579+ zwave_api_protocol_rx_dispatch (frame , sizeof (frame ));
580+
581+ TEST_ASSERT_EQUAL (1 , zwapi_send_data_test_callback_call_count );
582+ TEST_ASSERT_EQUAL (true, received_tx_report .beam_1000ms );
583+ TEST_ASSERT_EQUAL (true, received_tx_report .beam_250ms );
584+ }
0 commit comments