Exemplo n.º 1
0
    def setData(self,
                index: QModelIndex,
                value: typing.Any,
                role: int = ...) -> bool:
        print("set data!")
        if role == Qt.EditRole:
            if index.column() == 1:
                if value != self.axi_data[index.row()][index.column()] \
                        and ValidCheck.filter(ValidCheck.HEX_RE, value) is not None:
                    value = ValidCheck.reg_format(value)
                    print("Origin:" +
                          self.axi_data[index.row()][index.column()] + " to " +
                          value + " Changed and valid")
                    self.axi_data[index.row()][index.column()] = value
                    self.dataChanged.emit(QtCore.QModelIndex(),
                                          QtCore.QModelIndex())
                    self.addr_in_change.append(
                        take_addr(self.axi_data[index.row()]))
                    self.sigSendConfig.emit([
                        take_addr(self.axi_data[index.row()]),
                        RRUCmd.change(
                            ValidCheck.addr_transfer(
                                self.axi_data[index.row()][0],
                                RRUCmd.SET_AXI_REG), value)
                    ])

                elif ValidCheck.filter(ValidCheck.HEX_RE, value) is None:
                    self.sigWarning.emit("Input Should be in HEX format!")
        return False
Exemplo n.º 2
0
    def _get_cpri_loop_mode(self):
        cmd = RRUCmd.get_cpri_loop_mode(self.parentWidget.get_option())

        thread_cpri_loop_mode_get = WorkThread(self, RRUCmd.GET_CPRI_LOOP_MODE, cmd)
        thread_cpri_loop_mode_get.sigConnectionOut.connect(self.slot_connection_out_signal)
        thread_cpri_loop_mode_get.sigGetRes.connect(self.get_resp_handler)
        thread_cpri_loop_mode_get.start()
        thread_cpri_loop_mode_get.exec()
Exemplo n.º 3
0
    def _get_dl_frame_offset(self):
        cmd = RRUCmd.get_dl_frame_offset(self.parentWidget.get_option(), self.parentWidget.get_ant_num())

        thread_dl_frame_offset_get = WorkThread(self, RRUCmd.GET_DL_OFFSET, cmd)
        thread_dl_frame_offset_get.sigConnectionOut.connect(self.slot_connection_out_signal)
        thread_dl_frame_offset_get.sigGetRes.connect(self.get_resp_handler)
        thread_dl_frame_offset_get.start()
        thread_dl_frame_offset_get.exec()
Exemplo n.º 4
0
    def _get_cpri_status(self):
        cmd = RRUCmd.get_cpri(self.parentWidget.get_option())

        thread_cpri_get = WorkThread(self, RRUCmd.GET_CPRI_STATUS, cmd)
        thread_cpri_get.sigConnectionOut.connect(self.slot_connection_out_signal)
        thread_cpri_get.sigGetRes.connect(self.get_resp_handler)
        thread_cpri_get.start()
        thread_cpri_get.exec()
Exemplo n.º 5
0
    def _set_cpri_loop_mode(self):
        # TODO Valid Check not added yet
        loopMode2set = self.cpriLoopModeEdit.text().strip()
        if loopMode2set != self.cpriValueLabel.text():
            if len(loopMode2set) != 0:
                self.cpriValueLabel.setStyleSheet(NonQSSStyle.displayValueTempStyle)
                cmd = RRUCmd.config_cpri_loop_mode(self.parentWidget.get_option(), loopMode2set)

                thread_cpri_loop_mode_set = WorkThread(self, RRUCmd.SET_CPRI_LOOP_MODE, cmd)
                thread_cpri_loop_mode_set.sigConnectionOut.connect(self.slot_connection_out_signal)
                thread_cpri_loop_mode_set.sigSetOK.connect(self.set_resp_handler)
                thread_cpri_loop_mode_set.start()
                thread_cpri_loop_mode_set.exec()
            else:
                self.cpriLoopModeEdit.setStyleSheet(NonQSSStyle.warningStyle)
Exemplo n.º 6
0
    def _set_axis_offset(self):
        axiOffset2set = self.axisOffsetEdit.text().strip()
        if axiOffset2set != self.axisOffsetValueLabel.text():
            match = ValidCheck.filter(ValidCheck.HEX_RE, axiOffset2set)
            if match is not None:
                self.axisOffsetValueLabel.setStyleSheet(NonQSSStyle.displayValueTempStyle)
                cmd = RRUCmd.config_axis_offset(self.parentWidget.get_option(), str(match.group()))

                thread_axi_offset_set = WorkThread(self, RRUCmd.SET_AXI_OFFSET, cmd)
                thread_axi_offset_set.sigConnectionOut.connect(self.slot_connection_out_signal)
                thread_axi_offset_set.sigSetOK.connect(self.set_resp_handler)
                thread_axi_offset_set.start()
                thread_axi_offset_set.exec()
            else:
                self.axisOffsetEdit.setStyleSheet(NonQSSStyle.warningStyle)
Exemplo n.º 7
0
    def _send(self):
        self._set_axis_offset()

        # TODO Valid Check not added yet
        ulOffset2set = self.ulOffsetEdit.text().strip()
        if len(ulOffset2set) != 0:
            self.ulOffsetValueLabel.setStyleSheet(NonQSSStyle.displayValueTempStyle)
            if ulOffset2set != self.ulOffsetValueLabel.text():
                cmd = RRUCmd.set_ul_frame_offset(self.parentWidget.get_option(), 
                                                 self.parentWidget.get_ant_num(), ulOffset2set)
                self.antenna_bean_arr[self.antenna_index].ulFrameOffsetOutDated = True

                thread_ul_offset_Set = WorkThread(self, RRUCmd.SET_UL_OFFSET, cmd)
                thread_ul_offset_Set.sigConnectionOut.connect(self.slot_connection_out_signal)
                thread_ul_offset_Set.sigSetOK.connect(self.set_resp_handler)
                thread_ul_offset_Set.start()
                thread_ul_offset_Set.exec()
        else:
            self.ulOffsetEdit.setStyleSheet(NonQSSStyle.warningStyle)

        # TODO Valid Check not added yet
        dlOffset2set = self.udlOffsetEdit.text().strip()
        if len(dlOffset2set) != 0:
            self.ulOffsetValueLabel.setStyleSheet(NonQSSStyle.displayValueTempStyle)
            if dlOffset2set != self.dlOffsetValueLabel.text():
                cmd = RRUCmd.set_dl_frame_offset(self.parentWidget.get_option(), 
                                                 self.parentWidget.get_ant_num(), dlOffset2set)
                self.antenna_bean_arr[self.antenna_index].dlFrameOffsetOutDated = True

                thread_dl_offset_Set = WorkThread(self, RRUCmd.SET_DL_OFFSET, cmd)
                thread_dl_offset_Set.sigConnectionOut.connect(self.slot_connection_out_signal)
                thread_dl_offset_Set.sigSetOK.connect(self.set_resp_handler)
                thread_dl_offset_Set.start()
                thread_dl_offset_Set.exec()
        else:
            self.dlOffsetEdit.setStyleSheet(NonQSSStyle.warningStyle)
Exemplo n.º 8
0
    def _send_change(self):
        if len(self.set_cmd_pool) != 0:
            cmd = RRUCmd.set_axis_reg(self.parentWidget.get_option(),
                                      self.set_cmd_pool.pop(0)[1])

            print("Generate CMD: " + cmd)

            thread = TelnetWorker(RRUCmd.SET_AXI_REG, cmd)
            thread.signals.connectionLost.connect(
                self.slot_connection_out_signal)
            thread.signals.result.connect(self.set_resp_handler)
            thread.signals.consoleDisplay.connect(self._console_slot)
            QThreadPool.globalInstance().start(thread)
        else:
            self.sendButton.setEnabled(False)
Exemplo n.º 9
0
    def refresh_axi(self):
        self.sendButton.setEnabled(False)
        self.set_cmd_pool.clear()
        self.regModel.addr_in_change.clear()

        self.regModel.resort()

        for ele in self.regModel.axi_data:
            self.refresh_cmd_pool.append(
                RRUCmd.get_axis_reg(
                    self.parentWidget.get_option(),
                    ValidCheck.addr_transfer(take_addr(ele),
                                             RRUCmd.SET_AXI_REG)))

        self.regModel.clear()
        self._pop_and_refresh()
Exemplo n.º 10
0
    def _add_axi(self):
        addr, okPressed = QtWidgets.QInputDialog.getText(
            self, "Get Addr", "Axi Offset Addr:", QtWidgets.QLineEdit.Normal,
            "")
        match = ValidCheck.filter(ValidCheck.HEX_RE, addr)
        if okPressed and match is not None:
            cmd = RRUCmd.get_axis_reg(self.parentWidget.get_option(),
                                      match.group())

            thread = TelnetWorker(RRUCmd.GET_AXI_REG, cmd)
            thread.signals.connectionLost.connect(
                self.slot_connection_out_signal)
            thread.signals.result.connect(self.get_resp_handler)
            thread.signals.consoleDisplay.connect(self._console_slot)
            QThreadPool.globalInstance().start(thread)
        elif okPressed and match is None:
            self.warning("Invalid Offset Address")
Exemplo n.º 11
0
    def refresh_ip_addr(self):
        if self.isTelnetLogined:
            cmd = RRUCmd.get_ipaddr("ipaddr")

            thread = TelnetWorker(RRUCmd.GET_IP_ADDR, cmd)
            thread.signals.connectionLost.connect(self.health_failure)
            thread.signals.consoleDisplay.connect(self._console_slot)
            thread.signals.result.connect(self.refresh_resp_handler)
            QThreadPool.globalInstance().start(thread)
        else:
            msgBox = QtWidgets.QMessageBox()

            msgBox.setWindowTitle('Warning')
            msgBox.setIcon(QtWidgets.QMessageBox.Warning)
            msgBox.setText('Login before Refreshing the IP Address')

            msgBox.exec()
Exemplo n.º 12
0
    def set_ip_addr(self):
        if self.isTelnetLogined:
            ipaddr2set = ValidCheck.filter(ValidCheck.IPADDR_RE,
                                           self.ipaddrEdit.text().strip())
            if ipaddr2set is not None:
                cmd = RRUCmd.config_ipaddr("ipaddr", ipaddr2set.group())

                thread = TelnetWorker(RRUCmd.SET_IP_ADDR, cmd)
                thread.signals.connectionLost.connect(self.health_failure)
                thread.signals.consoleDisplay.connect(self._console_slot)
                thread.signals.result.connect(self.set_handler)
                QThreadPool.globalInstance().start(thread)
            else:
                self.ipaddrEdit.setStyleSheet(NonQSSStyle.warningStyle)
        else:
            msgBox = QtWidgets.QMessageBox()

            msgBox.setWindowTitle('Warning')
            msgBox.setIcon(QtWidgets.QMessageBox.Warning)
            msgBox.setText('Login before Setting the IP Address')

            msgBox.exec()
Exemplo n.º 13
0
 def reboot(self):
     if self.warning("是否进行设备复位?"):
         cmd = RRUCmd.reboot(self.get_option())
         self._process_cmd(RRUCmd.CMD_TYPE_SET, RRUCmd.REBOOT, cmd)
Exemplo n.º 14
0
 def refresh_version(self):
     cmd = RRUCmd.get_version()
     self.emit_trans_signal(cmd)
     res = TelRepository.telnet_instance.execute_command(cmd)
     self.emit_rvd_signal(res)
     self.versionEdit.setText(res)