@Override
public int getDeviceServiceVersion() throws JposException {
- return this.deviceVersion12;
+ return MyPOSKeyboard.deviceVersion12;
}
@Override
this.deviceDriver.addEventListener(eventListener);
+ //estaria genial poner esto en el jpos.xml y asi puede tambien cambiar el firethread
+ //Lo malo es que no tengo interfaz para ello :( Luego nada :/
}
@Override
public void inputAvailable(int input) {
try {
- this.jposEventQueue.putEvent(new DataEvent(this.callbacks, input));
+ this.jposEventQueue.putEvent(new DataEvent(this.callbacks.getEventSource(), input));
} catch (InterruptedException e) {
//restore interrupt status.
Thread.currentThread().interrupt();
}
/**
+ * Not thread-safe.!!!!!
*
* NO OLVIDAR try/finally PARA DEJAR EL DISPOSITIVO CORRECTAMENTE
* @throws JposException
private void runBatchTask() {
- //OS 64 bits timeval 8 bytes -> struct input_event 16 bytes
- //OS 32 bits timeval 16 bytes -> struct input_event 24 bytes
+ //OS 64 bits timeval 16 bytes -> struct input_event 24 bytes
+ //OS 32 bits timeval 8 bytes -> struct input_event 16 bytes
byte []buffer = new byte[16];
//byte []buffer = new byte[24];
short code = 0;
public void putEvent(JposEvent paramJposEvent) throws InterruptedException;
- public void clearAllEvents();
+ public JposEvent getEvent() throws InterruptedException;
public void clearInputEvents();
public void clearOutputEvents();
-
+
public int getNumberOfEvents();
public void checkEvents();
- public boolean eventQueueIsFull();
+ public void removeAllEvents();
+
+ public boolean removeEvent(JposEvent paramJposEvent);
+
+ public JposEvent peekElement(int paramInt);
+
+ public boolean isFull();
+ public int getSize();
}
}
@Override
- public void clearAllEvents() {
- this.linkedBlockingQueue.clear();
+ public JposEvent getEvent() throws InterruptedException {
+ return this.linkedBlockingQueue.take();
}
@Override
}
@Override
- public boolean eventQueueIsFull() {
+ public void removeAllEvents() {
+ this.linkedBlockingQueue.clear();
+ }
+
+ @Override
+ public boolean removeEvent(JposEvent paramJposEvent) {
+ return this.linkedBlockingQueue.remove(paramJposEvent);
+ }
+
+ @Override
+ public JposEvent peekElement(int paramInt) {
+ return null;
+ }
+
+ @Override
+ public boolean isFull() {
//No seguro de esto :/
return false;
}
+
+ @Override
+ public int getSize() {
+ return this.linkedBlockingQueue.size();
+ }
}