public void receiveData(byte[] data) {
          SetBusyEvent();
          selectedGame = ConversionUtils.stringFromBytes(data).toUpperCase();

          if (games == null
              || games.isEmpty()
              || portController == null
              || selectedConsole == null
              || selectedGame == null) return;

          int index = games.get(selectedConsole).indexOf(selectedGame);
          if (index < 0) {
            selectedGame = games.get(selectedConsole).get(0);
            SetReadyEvent();
            return;
          }

          if (games.get(selectedConsole).get(index) != null) {
            setMode(selectedConsole, games.get(selectedConsole).get(index));
            selectedGame = games.get(selectedConsole).get(index);
          } else if (games.get(selectedConsole).get(0) != null) {
            setMode(selectedConsole, games.get(selectedConsole).get(0));
            selectedGame = games.get(selectedConsole).get(0);
          }

          OutputGame(selectedGame);
          SetReadyEvent();
        }
示例#2
0
        public void receiveData(byte[] data) {
          String text = ConversionUtils.stringFromBytes(data);
          // Logger.getAnonymousLogger().info("KNX received: " + text);

          if (text.startsWith("@KNX:")) {
            try {

              StringTokenizer st = new StringTokenizer(text.substring(5), "#");
              // Logger.getAnonymousLogger().info("Tokenizing: " + text.substring(5));
              sendKNX(st.nextToken(), st.nextToken(), st.nextToken());
            } catch (Exception e) {
              Logger.getAnonymousLogger().severe(e.toString());
            }
          }
        }
        public void receiveData(byte[] data) {
          selectedConsole = ConversionUtils.stringFromBytes(data).toUpperCase();

          if (consoles == null
              || consoles.isEmpty()
              || portController == null
              || selectedConsole == null) return;

          if (consoles.indexOf(selectedConsole) < 0) {
            System.out.println("Console " + selectedConsole + " does not exist in config file!");
            if (consoles.get(0) != null) {
              selectedConsole = consoles.get(0);
            }
          }
          OutputConsole(selectedConsole);

          loadNewModel(selectedConsole);
        }