Пример #1
0
 public String dumpProperty(int prnumber) throws IOException, X10FlashException {
   MyLogger.getLogger().info("Start Reading property");
   MyLogger.getLogger()
       .debug((new StringBuilder("%%% read property id=")).append(prnumber).toString());
   cmd.send(Command.CMD12, BytesUtil.getBytesWord(prnumber, 4), false);
   MyLogger.updateProgress();
   String reply = cmd.getLastReplyHex();
   reply = reply.replace("[", "");
   reply = reply.replace("]", "");
   reply = reply.replace(",", "");
   MyLogger.getLogger().info("Reading property finished.");
   return reply;
 }
Пример #2
0
 public void dumpProperties() throws IOException, X10FlashException {
   TextFile tazone = new TextFile("./tazone.ta", "ISO8859-1");
   tazone.open(false);
   TextFile tazoneS = new TextFile("./tazoneString.ta", "ISO8859-1");
   tazoneS.open(false);
   try {
     MyLogger.getLogger().info("Start Dumping properties");
     MyLogger.initProgress(4920);
     for (int i = 0; i < 4920; i++) {
       MyLogger.getLogger()
           .debug((new StringBuilder("%%% read property id=")).append(i).toString());
       cmd.send(Command.CMD12, BytesUtil.getBytesWord(i, 4), false);
       String reply = cmd.getLastReplyHex();
       String replyS = cmd.getLastReplyString();
       reply = reply.replace("[", "");
       reply = reply.replace("]", "");
       reply = reply.replace(",", "");
       if (cmd.getLastReplyLength() > 0) {
         tazone.writeln(
             HexDump.toHex(i)
                 + " "
                 + HexDump.toHex(cmd.getLastReplyLength())
                 + " "
                 + reply.trim());
         tazoneS.writeln(
             HexDump.toHex(i)
                 + " "
                 + HexDump.toHex(cmd.getLastReplyLength())
                 + " "
                 + replyS.trim());
       }
     }
     MyLogger.initProgress(0);
     tazone.close();
     tazoneS.close();
     MyLogger.getLogger().info("Dumping properties finished.");
     DeviceChangedListener.pause(false);
     closeDevice();
   } catch (Exception ioe) {
     tazone.close();
     tazoneS.close();
     MyLogger.initProgress(0);
     MyLogger.getLogger().error(ioe.getMessage());
     MyLogger.getLogger().error("Error dumping properties. Aborted");
     DeviceChangedListener.pause(false);
     closeDevice();
   }
 }