Exemplo n.º 1
0
  private ScanReportPerFixed generateScanReportPerFixed(Map<HANDLE, Object> measures) {
    ScanReportPerFixed srpf = new ScanReportPerFixed();
    List<ObservationScanFixed> obslist = new ArrayList<ObservationScanFixed>();

    Set<HANDLE> handles = measures.keySet();
    Iterator<HANDLE> it = handles.iterator();
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    while (it.hasNext()) {
      HANDLE handle = it.next();
      ArrayList<Object> measure = (ArrayList<Object>) measures.get(handle);
      Iterator<Object> eleit = measure.iterator();
      while (eleit.hasNext()) {
        Object ele = eleit.next();
        try {
          IEncoder<Object> encoder = CoderFactory.getInstance().newEncoder("MDER");
          encoder.encode(ele, output);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
      ObservationScanFixed obs = new ObservationScanFixed();
      obs.setObj_handle(handle);
      obs.setObs_val_data(output.toByteArray());
      obslist.add(obs);
    }
    srpf.setObs_scan_fixed(obslist);
    srpf.setPerson_id(new PersonId(1));
    return srpf;
  }
Exemplo n.º 2
0
 public synchronized void sendAPDU(ApduType apdu) throws Exception {
   if (!initialized) throw new InitializedException("Channel is not initialized");
   encoder.encode(apdu, output);
 }