Esempio n. 1
0
 public static void open() throws IOException {
   try {
     JKernel32.openDevice();
     readReply();
   } catch (Exception e) {
     if (lastreply == null) throw new IOException("Unable to read from device");
   }
 }
Esempio n. 2
0
 private static void readReply() throws X10FlashException, IOException {
   S1Packet p = null;
   boolean finished = false;
   while (!finished) {
     byte[] read = JKernel32.readBytes(0x10000);
     if (p == null) {
       p = new S1Packet(read);
     } else {
       p.addData(read);
     }
     finished = !p.hasMoreToRead();
   }
   p.validate();
   lastreply = p.getDataArray();
   lastflags = p.getFlags();
 }
Esempio n. 3
0
 public static boolean write(S1Packet p) throws IOException, X10FlashException {
   JKernel32.writeBytes(p.getByteArray());
   readReply();
   return true;
 }
Esempio n. 4
0
 public static void close() {
   JKernel32.closeDevice();
 }