code: def extract_message_info():
      
      base_path = BASE_PACKAGE.replace('.', '/')
      filename = os.path.join(base_path, 'ProtocolMessage.proto')
  
      with open(filename, 'r') as file:
          types_found = False
  
          for line in file:
              stripped = line.lstrip().rstrip()
  
              # Look for the Type enum
              if stripped == 'enum Type {':
                  types_found = True
                  continue
              elif types_found and stripped == '}':
                  break
              elif not types_found:
                  continue
  
              constant = stripped.split(' ')[0]
              title = constant.title().replace(
                  '_', '').replace('Hid', 'HID')  # Hack...
              accessor = title[0].lower() + title[1:]
  
              if not os.path.exists(os.path.join(base_path, title + '.proto')):
                  continue
  
              yield MessageInfo(
                  title + '_pb2', title, accessor, constant)
docs: Get information about all messages of interest.