Aircraft category number

    Args:
        msg (string): 28 bytes hexadecimal message string

    Returns:
        int: category number
354957
def category(msg):
    

    if common.typecode(msg) < 1 or common.typecode(msg) > 4:
        raise RuntimeError("%s: Not a identification message" % msg)

    msgbin = common.hex2bin(msg)
    return common.bin2int(msgbin[5:8])
1148775
def temp45(msg):
    
    d = hex2bin(data(msg))

    sign = int(d[16])
    value = bin2int(d[17:26])

    if sign:
        value = value - 512

    temp = value * 0.25   # celsius
    temp = round(temp, 1)

    return temp
1101336
def p40baro(msg):
    
    d = hex2bin(data(msg))

    if d[26] == '0':
        return None

    p = bin2int(d[27:39]) * 0.1 + 800    # millibar
    return p
1131613
def fetch_html(self, msg_nums):
        
        if not msg_nums:
            raise Exception("Invalid Message Number!")

        return self.__imap_fetch_content_type(msg_nums, self.HTML)
75414
def process_message(message):
    
    message["type"] = message.pop("MsgType").lower()
    if message["type"] == 'event':
        message["type"] = str(message.pop("Event")).lower() + '_event'
        message_type = EventMetaClass.TYPES.get(message["type"], UnknownEvent)
    else:
        message_type = MessageMetaClass.TYPES.get(
            message["type"], UnknownMessage
        )
    return message_type(message)
859989
def post_message(self, msg):
        ''''''
        if '_posted' in msg.__dict__:
            return
        msg._posted = True
        msg._timestamp = time.time()
        type = msg.get_type()
        if type != 'HEARTBEAT' or (msg.type != mavlink.MAV_TYPE_GCS and msg.type != mavlink.MAV_TYPE_GIMBAL):
            self.messages[type] = msg

        if 'usec' in msg.__dict__:
            self.uptime = msg.usec * 1.0e-6
        if 'time_boot_ms' in msg.__dict__:
            self.uptime = msg.time_boot_ms * 1.0e-3

        if self._timestamp is not None:
            if self.notimestamps:
                msg._timestamp = self.uptime
            else:
                msg._timestamp = self._timestamp

        src_system = msg.get_srcSystem()
        src_component = msg.get_srcComponent()
        src_tuple = (src_system, src_component)
        radio_tuple = (ord('3'), ord('D'))
        if not (src_tuple == radio_tuple or msg.get_type() == 'BAD_DATA'):
            if not src_tuple in self.last_seq:
                last_seq = -1
            else:
                last_seq = self.last_seq[src_tuple]
            seq = (last_seq+1) % 256
            seq2 = msg.get_seq()
            if seq != seq2 and last_seq != -1:
                diff = (seq2 - seq) % 256
                self.mav_loss += diff
                #print("lost %u seq=%u seq2=%u last_seq=%u src_system=%u %s" % (diff, seq, seq2, last_seq, src_system, msg.get_type()))
            self.last_seq[src_tuple] = seq2
            self.mav_count += 1
        
        self.timestamp = msg._timestamp
        if type == 'HEARTBEAT' and msg.get_srcComponent() != mavlink.MAV_COMP_ID_GIMBAL:
            self.target_system = msg.get_srcSystem()
            self.target_component = msg.get_srcComponent()
            if float(mavlink.WIRE_PROTOCOL_VERSION) >= 1 and msg.type != mavlink.MAV_TYPE_GCS:
                self.flightmode = mode_string_v10(msg)
                self.mav_type = msg.type
                self.base_mode = msg.base_mode
        elif type == 'PARAM_VALUE':
            s = str(msg.param_id)
            self.params[str(msg.param_id)] = msg.param_value
            if msg.param_index+1 == msg.param_count:
                self.param_fetch_in_progress = False
                self.param_fetch_complete = True
        elif type == 'SYS_STATUS' and mavlink.WIRE_PROTOCOL_VERSION == '0.9':
            self.flightmode = mode_string_v09(msg)
        elif type == 'GPS_RAW':
            if self.messages['HOME'].fix_type < 2:
                self.messages['HOME'] = msg
        elif type == 'GPS_RAW_INT':
            if self.messages['HOME'].fix_type < 3:
                self.messages['HOME'] = msg
        for hook in self.message_hooks:
            hook(self, msg)

        if (msg.get_signed() and
            self.mav.signing.link_id == 0 and
            msg.get_link_id() != 0 and
            self.target_system == msg.get_srcSystem() and
            self.target_component == msg.get_srcComponent()):
            # change to link_id from incoming packet
            self.mav.signing.link_id = msg.get_link_id()
681940
async def load_message(obj, msg_type, msg=None, field_archiver=None):
    
    msg = msg_type() if msg is None else msg

    fields = msg_type.f_specs() if msg_type else msg.__class__.f_specs()
    for field in fields:
        await load_message_field(obj, msg, field, field_archiver=field_archiver)

    return msg
976611
def report_message_type(self, msg):
        
        desc = get_message_description(self.linter, msg.msg_id)
        self.tc.message('inspectionType', id=msg.msg_id, name=msg.symbol, description=desc, category=msg.category)
210142
def handle_msg(self, msg, **config):
        
        match = self.__prefix__.match(msg['topic'])
        if match:
            return match.groups()[-1] or ""
1284523
def is20(msg):
    

    if allzeros(msg):
        return False

    d = hex2bin(data(msg))

    if d[0:8] != '00100000':
        return False

    cs = cs20(msg)

    if '#' in cs:
        return False

    return True
105965
def hum44(msg):
    
    d = hex2bin(data(msg))

    if d[49] == '0':
        return None

    hm = bin2int(d[50:56]) * 100.0 / 64    # %

    return round(hm, 1)
1316475
def tas50(msg):
    
    d = hex2bin(data(msg))

    if d[45] == '0':
        return None

    tas = bin2int(d[46:56]) * 2   # kts
    return tas
806849
def handle_message(self, msg):
        
        if msg.msg_id not in self.msg_types:
            self.report_message_type(msg)
            self.msg_types.add(msg.msg_id)

        self.tc.message('inspection', typeId=msg.msg_id, message=msg.msg,
                        file=os.path.relpath(msg.abspath).replace('\\', '/'),
                        line=str(msg.line),
                        SEVERITY=TC_SEVERITY.get(msg.category))
42135
def is50(msg):
    

    if allzeros(msg):
        return False

    d = hex2bin(data(msg))

    # status bit 1, 12, 24, 35, 46

    if wrongstatus(d, 1, 3, 11):
        return False

    if wrongstatus(d, 12, 13, 23):
        return False

    if wrongstatus(d, 24, 25, 34):
        return False

    if wrongstatus(d, 35, 36, 45):
        return False

    if wrongstatus(d, 46, 47, 56):
        return False

    roll = roll50(msg)
    if (roll is not None) and abs(roll) > 60:
        return False

    gs = gs50(msg)
    if gs is not None and gs > 600:
        return False

    tas = tas50(msg)
    if tas is not None and tas > 500:
        return False

    if (gs is not None) and (tas is not None) and (abs(tas - gs) > 200):
        return False

    return True
555308
def is60(msg):
    

    if allzeros(msg):
        return False

    d = hex2bin(data(msg))

    # status bit 1, 13, 24, 35, 46

    if wrongstatus(d, 1, 2, 12):
        return False

    if wrongstatus(d, 13, 14, 23):
        return False

    if wrongstatus(d, 24, 25, 34):
        return False

    if wrongstatus(d, 35, 36, 45):
        return False

    if wrongstatus(d, 46, 47, 56):
        return False

    ias = ias60(msg)
    if ias is not None and ias > 500:
        return False

    mach = mach60(msg)
    if mach is not None and mach > 1:
        return False

    vr_baro = vr60baro(msg)
    if vr_baro is not None and abs(vr_baro) > 6000:
        return False

    vr_ins = vr60ins(msg)
    if vr_ins is not None and abs(vr_ins) > 6000:
        return False

    return True
347134
def mach53(msg):
    
    d = hex2bin(data(msg))

    if d[23] == '0':
        return None

    mach = bin2int(d[24:33]) * 0.008
    return round(mach, 3)
1321056
def mb45(msg):
    
    d = hex2bin(data(msg))
    if d[6] == '0':
        return None

    mb = bin2int(d[7:9])
    return mb