Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
  }
Пример #8
0
 private static EventObject newEventLokSpeed(EventMessage eventMessage) {
   int slot = eventMessage.getByte(1);
   int speed = eventMessage.getByte(2);
   return new EventLokSpeed(slot, speed);
 }
Пример #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);
 }
Пример #10
0
 private static EventObject newEventLissySignal(EventMessage eventMessage) {
   if (eventMessage.getByte(3) != 32) {
     return newEventLissySignalP1(eventMessage);
   }
   return newEventLissySignalP2(eventMessage);
 }
Пример #11
0
 private static EventObject newEventLokFstate(EventMessage eventMessage) {
   int slot = eventMessage.getByte(1);
   int fstate = eventMessage.getByte(2) >> 3;
   return new EventLokFstate(slot, fstate);
 }
Пример #12
0
 private static EventObject newEventTrnState(EventMessage eventMessage) {
   return new EventTrnState(
       eventMessage.getByte(1) + 1, (eventMessage.getByte(2) >> 5) == 0 ? false : true);
 }
Пример #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);
 }