IEEE1722

  • IEEE1722 messages are handled in the same way as other message types:

  1. API with specific methods for accessing the information of the message

  2. Same concept for receiving and sending of messages

  • Some specific functionalities have been integrated for handling of IEEE1722 messages in ANDi

  1. Internal verification of sequence number

  • The user can register a callback function which will be called when an error is detected (on_sequence_number_packet_loss)

  1. Internal verification of frame counter

  • The user can register a callback function which will be called when an error is detected (on_frame_counter_packet_loss)

  1. Replay of pcap files with auto increment of sequence numbers

  • Video packets of cameras have a sequence number which is incremented by 1 with each packet

Verification of sequence number

from globals import *
import time

# used to store the received sequence number
last_seq_number = None

def on_msg_received(msg):
        global last_seq_number

        if last_seq_number is None:
                # initialize sequence number for the first time
                last_seq_number = msg.seq_number
        else:
                # check whether current sequence number is last sequence number + 1
                if msg.seq_number != (last_seq_number + 1) % 256:
                        print("Error - Last counter: {0} - received: {1}".format(last_seq_number, msg.seq_number))
                # store received sequence number
                last_seq_number = msg.seq_number

msg_1722.on_message_received += on_msg_received
msg_1722.start_capture()

time.sleep(5)

msg_1722.on_message_received -= on_msg_received
msg_1722.stop_capture()

Automatic verification of sequence number

  • Here ANDi oversees the verification of the sequence number and runs the registered callback function when an error is detected

from globals import *

def on_error_detected(msg, last, current, diff):
        print("IEEE1722 message: {0}".format(msg))
        print("last_counter: {0} - current_counter: {1} - missing: {2}".format(last, current, diff))

msg_1722.on_sequence_number_packet_loss += on_error_detected
msg_1722.start_capture(ieee1722_auto_check_sequence_number.TestProject.DirectoryName + "\\pcap\\ieee1722_sequence_missing_packets.pcap",True)

msg_1722.on_sequence_number_packet_loss -= on_error_detected
msg_1722.stop_capture()

Pcap replay

  • Camera streams can be simulated by replaying a stored pcap file which contains the video frames

  • For this purpose the start_pcap_player() method of an adapter can be used

adapter0.start_pcap_player(string file_path, int times, bool is_asynchronous, bool respect_timestamp)
adapter0.stop_pcap_player()