Example #1
0
 def re_esam_certi(self, re_text):
     m_data = common.text2list(re_text)
     data = common.get_apdu_list(m_data)
     offset = 4
     res_sum = True
     offset += 4
     if data[offset] == '01':
         offset += 1
         ret = param.get_octet(data[offset:])
         self.esam_certi_ver_box.setText(ret['octet'])
         offset += ret['offset']
     else:
         offset += 1
         res_sum = False
         self.esam_certi_ver_box.setText(
             '失败:' + base_data.get_dar(int(data[offset], 16)))
     offset += 4
     if data[offset] == '01':
         offset += 1
         ret = param.get_octet(data[offset:])
         self.esam_certi_box.setText(ret['octet'])
         self.esam_certi_len_box.setText(str(ret['len']) + '字节')
         offset += ret['offset']
     else:
         offset += 1
         res_sum = False
         self.esam_certi_box.setText(
             '失败:' + base_data.get_dar(int(data[offset], 16)))
     if res_sum is True:
         self.res_b.setStyleSheet('color: green')
         self.res_b.setText('成功')
     config.MASTER_WINDOW.receive_signal.disconnect(self.re_esam_certi)
Example #2
0
 def re_local_net(self, re_text):
     m_data = common.text2list(re_text)
     data = common.get_apdu_list(m_data)
     offset = 7
     if data[offset] == '01':
         self.res_b.setStyleSheet('color: green')
         self.res_b.setText('成功')
         offset += 4
         self.local_ip_mode_l.setCurrentIndex({
             '00': 0,
             '01': 1,
             '02': 2
         }[data[offset]])
         offset += 3
         self.local_ip_box.setText(param.get_ip(data[offset:]))
         offset += 6
         self.local_mask_box.setText(param.get_ip(data[offset:]))
         offset += 6
         self.local_gate_addr_box.setText(param.get_ip(data[offset:]))
         offset += 4
         ret = param.get_visible(data[offset:])
         self.ppp_usr_box.setText(ret['visible'])
         offset += ret['offset']
         ret = param.get_visible(data[offset:])
         self.ppp_pw_box.setText(ret['visible'])
         offset += ret['offset']
     else:
         self.res_b.setStyleSheet('color: red')
         self.res_b.setText('失败:' +
                            base_data.get_dar(int(data[offset + 1], 16)))
     config.MASTER_WINDOW.receive_signal.disconnect(self.re_local_net)
Example #3
0
 def re_DT_param(self, re_text):
     m_data = common.text2list(re_text)
     data = common.get_apdu_list(m_data)
     offset = 8
     if data[offset] == '01':
         self.res_b.setStyleSheet('color: green')
         self.res_b.setText('成功')
         offset += 2
         self.DT_mode_l.setCurrentIndex({
             '00': 0,
             '01': 1,
             '02': 2,
             'FF': 3
         }[data[offset]])
         offset += 9
         self.DT_tot_num_box.setText(str(int(data[offset], 16)))
         offset += 2
         self.DT_biggest_num_box.setText(str(int(data[offset], 16)))
         offset += 2
         self.DT_smallest_num_box.setText(str(int(data[offset], 16)))
         offset += 2
         self.DT_dly_max_box.setText(str(int(data[offset], 16)))
         offset += 2
         self.DT_valid_num_min_box.setText(str(int(data[offset], 16)))
         offset += 2
     else:
         self.res_b.setStyleSheet('color: red')
         self.res_b.setText('失败:' +
                            base_data.get_dar(int(data[offset + 1], 16)))
     config.MASTER_WINDOW.receive_signal.disconnect(self.re_DT_param)
Example #4
0
 def take_DAR(self, m_list, brief='', depth=0):
     """take_DAR"""
     offset = 0
     explain = base_data.get_dar(int(m_list[0], 16))
     offset += 1
     self.trans_res.add_row(m_list[:offset], brief, 'DAR', explain, depth=depth)
     return offset
Example #5
0
def read_set_dar(re_text):
    m_data = common.text2list(re_text)
    data = common.get_apdu_list(m_data)
    offset = 1
    if data[offset] == '01':
        offset += 6
        if data[offset] == '00':
            return 'ok'
        else:
            return base_data.get_dar(int(data[offset], 16))
    if data[offset] == '02':
        offset += 2
        dar_sum = int(data[offset], 16)
        offset += 5
        for _ in range(dar_sum):
            if data[offset] != '00':
                return base_data.get_dar(int(data[offset], 16))
            else:
                offset += 5
        return 'ok'
Example #6
0
 def re_evt(self, re_text):
     m_data = common.text2list(re_text)
     data = common.get_apdu_list(m_data)
     offset = 7
     if data[offset] == '01':
         self.res_b.setStyleSheet('color: green')
         self.res_b.setText('成功')
         offset += 4
         bit_string_len = int(data[offset], 16)
         byte_len = bit_string_len // 8 if bit_string_len % 8 == 0 else bit_string_len // 8 + 1
         offset += 1
         for byte_index in range(byte_len):
             byte_int = int(data[offset], 16)
             offset += 1
             for bit_index in range(8):
                 evt_no = byte_index * 8 + bit_index + 1
                 if evt_no <= 85:
                     if (byte_int >> (7 - bit_index)) & 0x01 == 1:
                         eval('self.valid_c_' + str(evt_no) +
                              '.setChecked(True)')
                     else:
                         eval('self.valid_c_' + str(evt_no) +
                              '.setChecked(False)')
         offset += 1
         bit_string_len = int(data[offset], 16)
         byte_len = bit_string_len // 8 if bit_string_len % 8 == 0 else bit_string_len // 8 + 1
         offset += 1
         for byte_index in range(byte_len):
             byte_int = int(data[offset], 16)
             offset += 1
             for bit_index in range(8):
                 evt_no = byte_index * 8 + bit_index + 1
                 if evt_no <= 85:
                     if (byte_int >> (7 - bit_index)) & 0x01 == 1:
                         eval('self.rpt_c_' + str(evt_no) +
                              '.setChecked(True)')
                     else:
                         eval('self.rpt_c_' + str(evt_no) +
                              '.setChecked(False)')
     else:
         self.res_b.setStyleSheet('color: red')
         self.res_b.setText('失败:' +
                            base_data.get_dar(int(data[offset + 1], 16)))
     config.MASTER_WINDOW.receive_signal.disconnect(self.re_evt)
Example #7
0
 def re_SA(self, re_text):
     m_data = common.text2list(re_text)
     data = common.get_apdu_list(m_data)
     offset = 7
     if data[offset] == '01':
         self.res_b.setStyleSheet('color: green')
         self.res_b.setText('成功')
         offset += 2
         SA_len = int(data[offset], 16)
         self.SA_len_box.setText(str(SA_len))
         SA_text = ''
         for d in data[offset + 1:offset + 1 + SA_len]:
             SA_text += d
         self.SA_box.setText(SA_text)
     else:
         self.res_b.setStyleSheet('color: red')
         self.res_b.setText('失败:' +
                            base_data.get_dar(int(data[offset + 1], 16)))
     config.MASTER_WINDOW.receive_signal.disconnect(self.re_SA)
Example #8
0
 def re_DT(self, re_text):
     m_data = common.text2list(re_text)
     data = common.get_apdu_list(m_data)
     offset = 7
     if data[offset] == '01':
         self.res_b.setStyleSheet('color: green')
         self.res_b.setText('成功')
         offset += 2
         DT_read = QtCore.QDateTime(
             (int(data[offset], 16) << 8) | int(data[offset + 1], 16),
             int(data[offset + 2], 16),
             int(data[offset + 3], 16),
             int(data[offset + 4], 16),
             int(data[offset + 5], 16),
             int(data[offset + 6], 16),
         )
         # print('DT_read', DT_read)
         self.DT_box.setDateTime(DT_read)
     else:
         self.res_b.setStyleSheet('color: red')
         self.res_b.setText('失败:' +
                            base_data.get_dar(int(data[offset + 1], 16)))
     config.MASTER_WINDOW.receive_signal.disconnect(self.re_DT)
Example #9
0
    def re_rpt(self, re_text):
        m_data = common.text2list(re_text)
        data = common.get_apdu_list(m_data)
        offset = 4
        res_sum = True
        offset += 4
        if data[offset] == '01':
            offset += 2
            self.rpt_follow_cb.setCurrentIndex(1 if data[offset] ==
                                               '01' else 0)
            offset += 1
        else:
            offset += 1
            res_sum = False
            self.esam_no_box.setText(
                '失败:' + base_data.get_dar(int(data[offset + 1], 16)))
        offset += 4
        if data[offset] == '01':
            offset += 2
            self.rpt_cb.setCurrentIndex(1 if data[offset] == '01' else 0)
            offset += 1
        else:
            offset += 1
            res_sum = False
            self.esam_ver_box.setText(
                '失败:' + base_data.get_dar(int(data[offset + 1], 16)))
        offset += 4
        if data[offset] == '01':
            offset += 2
            self.conn_sever_cb.setCurrentIndex(1 if data[offset] ==
                                               '01' else 0)
            offset += 1
        else:
            offset += 1
            res_sum = False
            self.esam_key_box.setText(
                '失败:' + base_data.get_dar(int(data[offset + 1], 16)))
        offset += 4
        if data[offset] == '01':
            offset += 2
            array_sum = int(data[offset], 16)
            offset += 1
            channel = ''
            for array_count in range(array_sum):
                offset += 1
                channel += data[offset] + data[offset +
                                               1] + data[offset +
                                                         2] + data[offset + 3]
                if array_count < array_sum - 1:
                    channel += ','
                offset += 4
            self.rpt_channel_box.setText(channel)
        else:
            offset += 1
            res_sum = False
            self.esam_dialog_tm_box.setText(
                '失败:' + base_data.get_dar(int(data[offset + 1], 16)))

        if res_sum is True:
            self.res_b.setStyleSheet('color: green')
            self.res_b.setText('成功')
        config.MASTER_WINDOW.receive_signal.disconnect(self.re_rpt)
Example #10
0
    def re_esam_info(self, re_text):
        res_sum = True
        m_data = common.text2list(re_text)
        data = common.get_apdu_list(m_data)
        offset = common.list2text(data).replace(' ',
                                                '').find('F1000200') // 2 + 4
        if data[offset] == '01':
            offset += 1
            ret = param.get_octet(data[offset:])
            self.esam_no_box.setText(ret['octet'])
            offset += ret['offset']
        else:
            res_sum = False
            self.esam_no_box.setText(
                '失败:' + base_data.get_dar(int(data[offset + 1], 16)))

        offset = common.list2text(data).replace(' ',
                                                '').find('F1000300') // 2 + 4
        if data[offset] == '01':
            offset += 1
            ret = param.get_octet(data[offset:])
            self.esam_ver_box.setText(ret['octet'])
            offset += ret['offset']
        else:
            res_sum = False
            self.esam_ver_box.setText(
                '失败:' + base_data.get_dar(int(data[offset + 1], 16)))

        offset = common.list2text(data).replace(' ',
                                                '').find('F1000400') // 2 + 4
        if data[offset] == '01':
            offset += 1
            ret = param.get_octet(data[offset:])
            self.esam_key_box.setText(ret['octet'])
            offset += ret['offset']
        else:
            res_sum = False
            self.esam_key_box.setText(
                '失败:' + base_data.get_dar(int(data[offset + 1], 16)))

        offset = common.list2text(data).replace(' ',
                                                '').find('F1000500') // 2 + 4
        if data[offset] == '01':
            offset += 1
            self.esam_dialog_tm_box.setText(
                str(param.get_double_long_unsigned(data[offset:])))
            offset += 5
        else:
            res_sum = False
            self.esam_dialog_tm_box.setText(
                '失败:' + base_data.get_dar(int(data[offset + 1], 16)))

        offset = common.list2text(data).replace(' ',
                                                '').find('F1000600') // 2 + 4
        if data[offset] == '01':
            offset += 1
            self.esam_dialog_remain_box.setText(
                str(param.get_double_long_unsigned(data[offset:])))
            offset += 5
        else:
            res_sum = False
            self.esam_dialog_remain_box.setText(
                '失败:' + base_data.get_dar(int(data[offset + 1], 16)))

        offset = common.list2text(data).replace(' ',
                                                '').find('F1000700') // 2 + 4
        if data[offset] == '01':
            offset += 3
            self.esam_addr_ctr_box.setText(
                str(param.get_double_long_unsigned(data[offset:])))
            offset += 5
            self.esam_rpt_ctr_box.setText(
                str(param.get_double_long_unsigned(data[offset:])))
            offset += 5
            self.esam_app_radio_box.setText(
                str(param.get_double_long_unsigned(data[offset:])))
            offset += 5
        else:
            res_sum = False
            self.esam_addr_ctr_box.setText(
                '失败:' + base_data.get_dar(int(data[offset + 1], 16)))
            self.esam_rpt_ctr_box.setText(
                '失败:' + base_data.get_dar(int(data[offset + 1], 16)))
            self.esam_app_radio_box.setText(
                '失败:' + base_data.get_dar(int(data[offset + 1], 16)))

        offset = common.list2text(data).replace(' ',
                                                '').find('F1000800') // 2 + 4
        if data[offset] == '01':
            offset += 3
            ret = param.get_octet(data[offset:])
            self.esam_terminal_ver_box.setText(ret['octet'])
            offset += ret['offset']
            ret = param.get_octet(data[offset:])
            self.esam_host_ver_box.setText(ret['octet'])
            offset += ret['offset']
        else:
            res_sum = False
            self.esam_terminal_ver_box.setText(
                '失败:' + base_data.get_dar(int(data[offset + 1], 16)))
            self.esam_host_ver_box.setText(
                '失败:' + base_data.get_dar(int(data[offset + 1], 16)))

        if res_sum is True:
            self.res_b.setStyleSheet('color: green')
            self.res_b.setText('成功')
        config.MASTER_WINDOW.receive_signal.disconnect(self.re_esam_info)
Example #11
0
 def re_communication(self, re_text):
     m_data = common.text2list(re_text)
     data = common.get_apdu_list(m_data)
     offset = 7
     if data[offset] == '01':
         self.res_b.setStyleSheet('color: green')
         self.res_b.setText('成功')
         offset += 4
         self.C_work_mode_l.setCurrentIndex({
             '00': 0,
             '01': 1,
             '02': 2
         }[data[offset]])
         offset += 2
         self.C_online_mode_l.setCurrentIndex({
             '00': 0,
             '01': 1
         }[data[offset]])
         offset += 2
         self.C_connect_mode_l.setCurrentIndex({
             '00': 0,
             '01': 1
         }[data[offset]])
         offset += 2
         self.C_connect_app_mode_l.setCurrentIndex({
             '00': 0,
             '01': 1
         }[data[offset]])
         offset += 2
         array_num = int(data[offset], 16)
         offset += 1
         listen_port_text = ''
         for count in range(array_num):
             listen_port_text += str(param.get_long_unsigned(
                 data[offset:])) + ' '
             offset += 3
         self.C_listen_port_box.setText(listen_port_text)
         ret = param.get_visible(data[offset:])
         self.C_APN_box.setText(ret['visible'])
         offset += ret['offset']
         ret = param.get_visible(data[offset:])
         self.C_usr_box.setText(ret['visible'])
         offset += ret['offset']
         ret = param.get_visible(data[offset:])
         self.C_pw_box.setText(ret['visible'])
         offset += ret['offset']
         ret = param.get_octet(data[offset:])
         self.C_proxy_addr_box.setText(ret['octet'])
         offset += ret['offset']
         self.C_proxy_prot_box.setText(
             str(param.get_long_unsigned(data[offset:])))
         offset += 3
         offset += 1
         overtm_retry_num_byte = int(data[offset], 16)
         self.C_retry_box.setText(str(overtm_retry_num_byte & 0x03))
         self.C_over_tm_box.setText(str(overtm_retry_num_byte >> 2))
         offset += 1
         self.C_heart_tm_box.setText(
             str(param.get_long_unsigned(data[offset:])))
         offset += 3
     else:
         self.res_b.setStyleSheet('color: red')
         self.res_b.setText('失败:' +
                            base_data.get_dar(int(data[offset + 1], 16)))
     config.MASTER_WINDOW.receive_signal.disconnect(self.re_communication)