Exemplo n.º 1
0
  private void writeNative(byte[] bs) throws SerialPortException {
    Memory mem = new Memory(Byte.SIZE * bs.length + 1);
    mem.clear();

    PointerByReference inipar = new PointerByReference();
    inipar.setPointer(mem);
    for (int i = 0; i < bs.length; i++) {
      inipar.getPointer().setByte(i * Byte.SIZE / 8, bs[i]);
    }
    byte c = '\n';
    inipar.getPointer().setByte((bs.length + 1) * Byte.SIZE / 8, c);
    int rt = NativeLoader.getInstance().serialport_write(getFd(), inipar);
    if (rt != 0) {
      logger.error("Warning fail to write store " + bs.length);
      throw new SerialPortException("The serial port is closed " + getFd());
    }
  }
Exemplo n.º 2
0
 public final long getAddress() {
   PointerByReference ref = new PointerByReference(ptr);
   return ADDRESS_SIZE == 32
       ? (ref.getPointer().getInt(0) & 0xffffffffL)
       : ref.getPointer().getLong(0);
 }
Exemplo n.º 3
0
 public Collection<String> getLogFiles() {
   PointerByReference ptrRef = s_lib.CExternalEntry_getLogFilePaths();
   String[] strs = ptrRef.getPointer().getStringArray(0);
   return Arrays.asList(strs);
 }