Esempio n. 1
0
 private static EventObject newEventLokGlobalState(EventMessage eventMessage) {
   int slot = eventMessage.getByte(2);
   int addr = eventMessage.getByte(4);
   int speed = eventMessage.getByte(5);
   boolean direction = ((eventMessage.getByte(6) << 5) == 0 ? false : true);
   int fstate = eventMessage.getByte(6) >> 3;
   return new EventLokGlobalState(addr, slot, speed, direction, fstate);
 }
Esempio n. 2
0
 private static EventObject newEventSlotState(EventMessage eventMessage) {
   int slot = eventMessage.getByte(1);
   byte slot_s = (byte) (eventMessage.getByte(2) >> 7);
   byte consist_s = (byte) ((eventMessage.getByte(2) & 0x60) >> 5);
   byte busy_act = (byte) ((eventMessage.getByte(2) & 0x18) >> 3);
   byte type_cod = (byte) (eventMessage.getByte(2) & 0x07);
   return new EventSlotState(slot, slot_s, consist_s, busy_act, type_cod);
 }
Esempio n. 3
0
 private static EventObject newEventLissySignalP2(EventMessage eventMessage) {
   int id;
   int lok;
   int speed = 0;
   id = eventMessage.getByte(4);
   lok = eventMessage.getByte(3);
   speed = eventMessage.getByte(6);
   return new EventLissySignalP2(id, lok, speed);
 }
Esempio n. 4
0
 private static EventObject newEventLissySignalP1(EventMessage eventMessage) {
   int id;
   int lok;
   boolean direction;
   id = eventMessage.getByte(4);
   lok = eventMessage.getByte(6);
   direction = eventMessage.getByte(3) != 32 ? false : true;
   return new EventLissySignalP1(id, lok, direction);
 }
Esempio n. 5
0
 private static EventObject newEventSensorState2(EventMessage eventMessage) {
   int addr = ((byte) (eventMessage.getByte(1) | ((eventMessage.getByte(2) & 0x0F) << 7)));
   byte s_x = (byte) ((eventMessage.getByte(2) & 0x40) >> 6);
   byte s_i = (byte) ((eventMessage.getByte(2) & 0x20) >> 5); // source
   byte s_l = (byte) ((byte) (eventMessage.getByte(2) & 0x10) >> 4); // sensor level
   byte[] bitcontrol = new byte[3];
   bitcontrol[0] = s_x;
   bitcontrol[1] = s_i;
   bitcontrol[2] = s_l;
   return new EventSensorState(addr, bitcontrol);
 }
Esempio n. 6
0
 private static EventObject newEventSensorState(EventMessage eventMessage) {
   int byteaddr = ((byte) (eventMessage.getByte(1) | ((eventMessage.getByte(2) & 0x0F) << 7)));
   int dispaddr = (byteaddr / 8) + 1;
   int s_l = (eventMessage.getByte(2) & 0x20) >> 5; // source
   boolean s_i = (((eventMessage.getByte(2) & 0x10) >> 4) == 0 ? false : true); // sensor level
   int sensoraddr = ((((byteaddr * 2) + 1) % 16) + s_l);
   //	String codepos = dispaddr+"."+sensoraddr;
   //      return new EventSensorState(byteaddr, codepos, s_i);
   int id = (dispaddr - 1) * 16 + sensoraddr;
   return new EventSensorState(id, s_i);
 }
Esempio n. 7
0
  private static EventObject newEventDecoderState(EventMessage eventMessage) {
    int id = eventMessage.getByte(1);
    int state = 4;

    switch (eventMessage.getByte(0)) {
      case 130:
        state = 0;
        break;
      case 131:
        state = 1;
        break;
      case 129:
        state = 2;
        break;
      case 133:
        state = 3;
        break;
    }
    return new EventDecoderState(id, state);
  }
Esempio n. 8
0
 private static EventObject newEventLokSpeed(EventMessage eventMessage) {
   int slot = eventMessage.getByte(1);
   int speed = eventMessage.getByte(2);
   return new EventLokSpeed(slot, speed);
 }
Esempio n. 9
0
 private static EventObject newEventLokDirection(EventMessage eventMessage) {
   int slot = eventMessage.getByte(1);
   boolean direction = ((eventMessage.getByte(2) >> 5) == 0 ? false : true);
   int func = (eventMessage.getByte(2) & ~(1 << 5));
   return new EventLokDirection(slot, direction, func);
 }
Esempio n. 10
0
 private static EventObject newEventLissySignal(EventMessage eventMessage) {
   if (eventMessage.getByte(3) != 32) {
     return newEventLissySignalP1(eventMessage);
   }
   return newEventLissySignalP2(eventMessage);
 }
Esempio n. 11
0
 private static EventObject newEventLokFstate(EventMessage eventMessage) {
   int slot = eventMessage.getByte(1);
   int fstate = eventMessage.getByte(2) >> 3;
   return new EventLokFstate(slot, fstate);
 }
Esempio n. 12
0
 private static EventObject newEventTrnState(EventMessage eventMessage) {
   return new EventTrnState(
       eventMessage.getByte(1) + 1, (eventMessage.getByte(2) >> 5) == 0 ? false : true);
 }
Esempio n. 13
0
 private static EventObject newEventSlotConsist(EventMessage eventMessage) {
   int slot = eventMessage.getByte(1);
   byte consist_s = (byte) eventMessage.getByte(2);
   ;
   return new EventSlotConsist(slot, consist_s);
 }