protocol_descriptors.py
def check_crc_received_message(message):
    ''' This function takes as an argument whole received message
    with included crc. Calculated crc from stripped message (without crc)
    and compares it to the crc in the message. '''
    # Crc value from stripped message
    crc_value = get_crc(bytes(message[:-BODY_END_CRC_LENGTH]))
    crc_byte_value = crc_value.to_bytes(BODY_END_CRC_LENGTH,'big')

    # Read crc byte data from message
    crc_start_idx = len(message) - BODY_END_CRC_LENGTH
    crc_body_body_byte_value = message[crc_start_idx:] #

    if  isinstance(crc_body_body_byte_value, bytes):
        pass
    elif isinstance(crc_body_body_byte_value, np.ndarray):
        print(f"arr.dtype: {crc_body_body_byte_value.dtype}")
        print(f"crc_body_body_byte_value len: {len(crc_body_body_byte_value)}")
        crc_body_body_byte_value = (crc_body_body_byte_value.astype('int8')).tobytes()
        print(f"** crc_body_body_byte_value len: {len(crc_body_body_byte_value)}")
    else:
        print("ERROR: BAD TYPE OF CRC IN check_crc_received_message()")
        exit() 

    print(f"crc_body_body_byte_value: {crc_body_body_byte_value}")
    print(f"crc_body_body_byte_value type: {type(crc_body_body_byte_value)}")
    # print(f"crc_body_body_byte_value type: {type(crc_body_body_byte_value.tobytes())}")
    print(f"crc_byte_value type: {type(crc_byte_value)}")

    print(f"crc_value == parsed_crc_value: {crc_byte_value} == {crc_body_body_byte_value}")
    if crc_byte_value == crc_body_body_byte_value:
        print("Crc is matching")
        return True
    else:
        print("Crc is not matching")
        return False
 This function takes as an argument whole received message
    with included crc. Calculated crc from stripped message (without crc)
    and compares it to the crc in the message. 
This function takes as an argument whole received message
with included crc. Calculated crc from stripped message (without crc)
and compares it to the crc in the message.
This function takes as an argument whole received message with included crc . Calculated crc from stripped message ( without crc ) and compares it to the crc in the message .
def check_crc_received_message(message):
    crc_value = get_crc(bytes(message[:-BODY_END_CRC_LENGTH]))
    crc_byte_value = crc_value.to_bytes(BODY_END_CRC_LENGTH,'big')
    crc_start_idx = len(message) - BODY_END_CRC_LENGTH
    crc_body_body_byte_value = message[crc_start_idx:] 
    if  isinstance(crc_body_body_byte_value, bytes):
        pass
    elif isinstance(crc_body_body_byte_value, np.ndarray):
        print(f"arr.dtype: {crc_body_body_byte_value.dtype}")
        print(f"crc_body_body_byte_value len: {len(crc_body_body_byte_value)}")
        crc_body_body_byte_value = (crc_body_body_byte_value.astype('int8')).tobytes()
        print(f"** crc_body_body_byte_value len: {len(crc_body_body_byte_value)}")
    else:
        print("ERROR: BAD TYPE OF CRC IN check_crc_received_message()")
        exit() 
    print(f"crc_body_body_byte_value: {crc_body_body_byte_value}")
    print(f"crc_body_body_byte_value type: {type(crc_body_body_byte_value)}")
    print(f"crc_byte_value type: {type(crc_byte_value)}")
    print(f"crc_value == parsed_crc_value: {crc_byte_value} == {crc_body_body_byte_value}")
    if crc_byte_value == crc_body_body_byte_value:
        print("Crc is matching")
        return True
    else:
        print("Crc is not matching")
        return False
def check_crc_received_message ( message ) : crc_value = get_crc ( bytes ( message [ : - BODY_END_CRC_LENGTH ] ) ) crc_byte_value = crc_value . to_bytes ( BODY_END_CRC_LENGTH , 'big' ) crc_start_idx = len ( message ) - BODY_END_CRC_LENGTH crc_body_body_byte_value = message [ crc_start_idx : ] if isinstance ( crc_body_body_byte_value , bytes ) : pass elif isinstance ( crc_body_body_byte_value , np . ndarray ) : print ( f"arr.dtype: {crc_body_body_byte_value.dtype}" ) print ( f"crc_body_body_byte_value len: {len(crc_body_body_byte_value)}" ) crc_body_body_byte_value = ( crc_body_body_byte_value . astype ( 'int8' ) ) . tobytes ( ) print ( f"** crc_body_body_byte_value len: {len(crc_body_body_byte_value)}" ) else : print ( "ERROR: BAD TYPE OF CRC IN check_crc_received_message()" ) exit ( ) print ( f"crc_body_body_byte_value: {crc_body_body_byte_value}" ) print ( f"crc_body_body_byte_value type: {type(crc_body_body_byte_value)}" ) print ( f"crc_byte_value type: {type(crc_byte_value)}" ) print ( f"crc_value == parsed_crc_value: {crc_byte_value} == {crc_body_body_byte_value}" ) if crc_byte_value == crc_body_body_byte_value : print ( "Crc is matching" ) return True else : print ( "Crc is not matching" ) return False
This function takes as an argument whole received message
with included crc.
This function takes as an argument whole received message with included crc .
''' This function takes as an argument whole received message
    with included crc. Calculated crc from stripped message (without crc)
    and compares it to the crc in the message. ''' # Crc value from stripped message
 # Read crc byte data from message
 #
 # print(f"crc_body_body_byte_value type: {type(crc_body_body_byte_value.tobytes())}")

message