Пример #1
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();
   }
 }
Пример #2
0
  public void flashDevice() {
    try {
      MyLogger.getLogger().info("Start Flashing");
      MyLogger.initProgress(getNumberPasses());

      init();

      sendImages();
      sendSystemAndUserData();

      if (_bundle.hasTA()) {
        setFlashState(true);
        if (_bundle.hasPreset()) sendTA(_bundle.getPreset().getInputStream(), "preset");
        // if (_bundle.hasSimlock()) sendTA(_bundle.getSimlock().getInputStream(),"simlock");
        setFlashState(false);
      }

      cmd.send(Command.CMD10, Command.VALNULL, false);
      cmd.send(Command.CMD04, Command.VALNULL, false);

      closeDevice();

      MyLogger.getLogger().info("Flashing finished.");
      MyLogger.getLogger().info("Please wait. Phone will reboot");
      MyLogger.getLogger()
          .info("For flashtool, Unknown Sources and Debugging must be checked in phone settings");
      MyLogger.initProgress(0);
      DeviceChangedListener.pause(false);
    } catch (Exception ioe) {
      closeDevice();
      MyLogger.getLogger().error(ioe.getMessage());
      MyLogger.getLogger().error("Error flashing. Aborted");
      MyLogger.initProgress(0);
      DeviceChangedListener.pause(false);
    }
  }