Парсинг бинарного хедера rsb в JSON.

    @header -- бинарный хедер (2048 bytes)
    @return -- параметры в формате JSON (dfparser.def_values.DEF_RSH_PARAMS)

def parse_from_rsb(header: bytearray) -> dict:
    """Парсинг бинарного хедера rsb в JSON.

    @header -- бинарный хедер (2048 bytes)
    @return -- параметры в формате JSON (dfparser.def_values.DEF_RSH_PARAMS)

    """
    params = {}

    params["text_header_size"] = struct.unpack('I', header[0:4])[0]

    params["events_num"] = struct.unpack('i', header[8:12])[0]

    start_time = struct.unpack('Q', header[16:24])[0]
    params["start_time"] = datetime.fromtimestamp(start_time).isoformat()
    end_time = struct.unpack('Q', header[24:32])[0]
    params["end_time"] = datetime.fromtimestamp(end_time).isoformat()

    params["filepath"] = header[32: 32 + 255].rstrip(b'\0').decode("cp1251")

    params["num_blocks"] = struct.unpack('i', header[288:292])[0]

    params["aquisition_time"] = struct.unpack('i', header[292:296])[0]

    params["blocks_in_file"] = struct.unpack('i', header[296:300])[0]

    params["waitTime"] = struct.unpack('i', header[300:304])[0]

    params["threshold"] = struct.unpack('d', header[312:320])[0]

    sync_params_num = struct.unpack('I', header[336:340])[0]
    sync_params = np.unique(np.frombuffer(header[320:336], np.uint32)
                            [:sync_params_num])
    params["synchro_control"] = []
    for param in sync_params:
        if param == 0:
            params["synchro_control"].append("Default")
        else:
            params["synchro_control"].append(list(synchro_control.keys())
                                             [list(synchro_control.values())
                                              .index(param)])

    params["sample_freq"] = struct.unpack('d', header[344:352])[0]
    params["pre_history"] = struct.unpack('I', header[352:356])[0]

    params["packet_number"] = struct.unpack('i', header[356:360])[0]

    params["b_size"] = struct.unpack('I', header[360:364])[0]

    params["hysteresis"] = struct.unpack('I', header[364:368])[0]

    params["channel_number"] = struct.unpack('I', header[368:372])[0]

    ch_params = []

    for i in range(params["channel_number"]):
        ch_data = header[372 + 56 * i: 372 + 56 * (i + 1)]
        ch_param = {}

        param_num = struct.unpack('I', ch_data[36:40])[0]
        ch_params_raw = np.unique(np.frombuffer(ch_data[4:36],
                                                np.uint32)[:param_num])
        ch_param["params"] = []
        for param in ch_params_raw:
            if param == 0:
                ch_param["params"].append("Default")
            else:
                ch_param["params"].append(list(channel_control.keys())
                                          [list(channel_control.values())
                                           .index(param)])

        ch_param["adjustment"] = struct.unpack('d', ch_data[44:52])[0]
        ch_param["gain"] = struct.unpack('I', ch_data[52:56])[0]
        ch_params.append(ch_param)

    params["channel"] = ch_params

    synchro_channel = {}
    sync_ch_par_num = struct.unpack('I', header[632:636])[0]
    sync_ch_params_raw = np.unique(np.frombuffer(header[600:632],
                                                 np.uint32)[:sync_ch_par_num])

    synchro_channel["params"] = []
    for param in sync_ch_params_raw:
        if param == 0:
            synchro_channel["params"].append("Default")
        else:
            synchro_channel["params"] \
                .append(list(synchro_channel_control.keys())
                        [list(synchro_channel_control.values()).index(param)])

    synchro_channel_type = struct.unpack('I', header[304:308])[0]
    synchro_channel["type"] = list(synchro_channel_types.keys())[
        list(synchro_channel_types.values()).index(synchro_channel_type)]

    synchro_channel["gain"] = struct.unpack('I', header[636:640])[0]

    params["synchro_channel"] = synchro_channel

    params["err_lang"] = struct.unpack('I', header[640:644])[0]
    params["board_name"] = header[644:644 + 255].rstrip(b'\0').decode("cp1251")

    params["board_id"] = struct.unpack('I', header[900:904])[0]

    return params