Esempio n. 1
0
 /**
  * �� �����κ��� �߿��� ������ üũ�ϰ�, �߿��� ������Ʈ�� �� �� �ֵ��� �ϴ� �Լ�. PCR�� ������ �� ���¿���
  * �� ó���� �ѹ��� üũ�մϴ�. �߿��� ������ �������� �޾ƿ� ��, �� ������ PCR ������ ������ Ȯ�� �� �ٸ���
  * �������κ��� ���ο� �߿�� �޾Ƽ� PCR�� ���ε� ��ŵ�ϴ�. ���ε尡 �Ϸ�Ǹ� PCR�� Reset ��ŵ�ϴ�. �� ������
  * ���������� ������ �� ���ٴ� �޽����� ���ɴϴ�. �� ����� ����� �����Ϸ��� �ٸ� BootLoader ���α׷���
  * �����Ͻʽÿ�.
  *
  * @see BootLoader
  */
 public void setSerialNumber(String serialNumber) {
   this.serialNumber = serialNumber;
   m_Callback_DeviceChange.setSerialNumber(serialNumber);
 }
Esempio n. 2
0
  /**
   * UI�� �ʱ�ȭ �ϰų�, ��ü���� �ʱ�ȭ �ϴ� ������ �Ѵ�. MainUI() �����ڿ����� ȣ���� �� �ִ�. �� �ѹ��� ȣ��ȴ�.
   */
  private void init() {
    // �������� ũ�� ����
    setBounds(
        (Resolution.X * 2 / 5), Resolution.Y / 4, UIConstant.MYPCR_WIDTH, UIConstant.MYPCR_HEIGHT);
    // Ÿ��Ʋ ����
    setTitle("MyPCR version 3.2");

    // ����� ���α׷� ����
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // �ִ�ȭ ����
    setResizable(false);

    // title icon ����
    setIconImage(new ImageIcon(getClass().getClassLoader().getResource("icon.png")).getImage());

    // ���� ������Ʈ�� ������� Panel
    // ���̾ƿ��� ������ǥ�� ����ϱ� ���� null�� ����
    m_Panel = new JPanel();
    m_Panel.setLayout(null);
    m_Panel.setBackground(UIConstant.BACKGROUND_COLOR);

    // 3���� GroupBox�� title
    String[] titles = {"Serial Number", "CHAMBER", "LID HEATER"};

    /** ������Ʈ ���� * */
    m_ProtocolText = new ProtocolText();
    m_PCRStatusText = StatusText.getInstance(UIConstant.GROUP_SIZE, titles);
    m_ProtocolList = ProtocolList.getInstance();
    m_ButtonUI = ButtonUI.getInstance(this);
    m_LidText = new JTextField();
    m_LidText.setLayout(null);
    m_LidText.setBounds(310, 55, 40, 20);
    m_LidText.setText("104");
    m_LidText.addKeyListener(this);

    // �ΰ� �߰�
    JLabel labelLogo =
        new JLabel(new ImageIcon(getClass().getClassLoader().getResource("logo.jpg")));
    labelLogo.setBounds(100, 385, 182, 37);

    // for bootloader mode
    labelLogo.addMouseListener(
        new MouseListener() {
          public void mouseReleased(MouseEvent e) {}

          public void mousePressed(MouseEvent e) {}

          public void mouseExited(MouseEvent e) {}

          public void mouseEntered(MouseEvent e) {}

          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 3 && currentVersion != null) {
              String res =
                  JOptionPane.showInputDialog(
                      null,
                      "Please input admin password for bootloader",
                      "Admin Mode(Firmware V" + currentVersion + ")",
                      JOptionPane.OK_CANCEL_OPTION);

              if (res != null) {
                if (res.equals(Constants.ADMIN_PASSWORD)) {
                  if (m_ButtonUI.isEnable(ButtonUI.BUTTON_START))
                    OnHandleMessage(MESSAGE_STOP_PCR, null);
                  Thread tempThread =
                      new Thread() {
                        public void run() {
                          try {
                            Thread.sleep(1000);
                            OnMessage(DISCONNECTED, null, 0);
                            Thread.sleep(1000);
                            m_Device.write(m_PCRTask.m_TxAction.Tx_BootLoader());
                          } catch (Exception e1) {
                            // TODO Auto-generated catch block
                            e1.printStackTrace();
                          }
                        }
                      };
                  tempThread.start();
                } else
                  JOptionPane.showMessageDialog(
                      null, "Wrong password!", "Admin Mode", JOptionPane.WARNING_MESSAGE);
              }
            }
          }
        });

    // LED added
    icon_blueOff = new ImageIcon(url_blueOff);
    icon_blueOn = new ImageIcon(url_blueOn);
    icon_greenOff = new ImageIcon(url_greenOff);
    icon_greenOn = new ImageIcon(url_greenOn);
    icon_redOff = new ImageIcon(url_redOff);
    icon_redOn = new ImageIcon(url_redOn);

    ledBlue = new JLabel(icon_blueOff);
    ledBlue.setBounds(310, 1, 22, 29);
    ledRed = new JLabel(icon_redOff);
    ledRed.setBounds(332, 1, 22, 29);
    ledGreen = new JLabel(icon_greenOff);
    ledGreen.setBounds(354, 1, 22, 29);

    m_Panel.add(m_ProtocolText);
    m_Panel.add(m_PCRStatusText);
    m_Panel.add(m_ProtocolList.getPane());
    m_Panel.add(m_ButtonUI.getPanel());
    m_Panel.add(m_LidText);

    // 150509 logo and led added
    m_Panel.add(labelLogo);
    m_Panel.add(ledBlue);
    m_Panel.add(ledGreen);
    m_Panel.add(ledRed);
    /** ������Ʈ ���� * */

    // �dz��� ���� �����ӿ� ����
    add(m_Panel);

    // 150507 ȭ�鿡 UI �� ���� ���� ��ġ Ȯ���� ���� �ϱ� ���� ó��
    // ȭ�鿡 ���̵���
    // setVisible(true);

    // Device ���� üũ�� �ݹ� �Լ� ����
    try {
      // DeviceManager �ν��Ͻ� ����
      m_Manager = HIDManager.getInstance();
      // Device ���� ���¸� ǥ�����ִ� �ݹ��Լ� ���
      m_Callback_DeviceChange = CallbackDeviceChange.getInstance(m_Manager, this);
      m_Callback_DeviceChange.setDaemon(true);
      m_Callback_DeviceChange.start();
    } catch (IOException e) {
      e.printStackTrace();
    }

    // MyPCR ���� ����� ��� �ִ� ��ü�� �ν��Ͻ��� ����
    m_PCRTask = PCR_Task.getInstance(this);
  }