Ejemplo n.º 1
0
  public synchronized void setActivePilot(int pilotMbx) {
    currentSequenceNo++;
    try {
      ChassisSetActivePilotMsg cmdMsg = new ChassisSetActivePilotMsg(pilotMbx);

      TimsMsgRouter.send(
          MSG_CHASSIS_SET_ACTIVE_PILOT, commandMbx, replyMbx, (byte) 0, currentSequenceNo, cmdMsg);

      TimsDataMsg reply;
      do {
        reply = TimsMsgRouter.receive(replyMbx, onTimeout);
      } while (reply.seq_nr != currentSequenceNo);

      if (reply.type == RackMsgType.MSG_OK) {
        System.out.println(
            RackName.nameString(replyMbx)
                + ": "
                + RackName.nameString(commandMbx)
                + ".setActivePilot");
      } else {
        System.out.println(
            RackName.nameString(replyMbx)
                + ": "
                + RackName.nameString(commandMbx)
                + ".setActivePilot replied error");
      }
    } catch (MsgException e) {
      System.out.println(
          RackName.nameString(replyMbx) + ": " + RackName.nameString(commandMbx) + ".on " + e);
    }
  }
Ejemplo n.º 2
0
  public synchronized ChassisParamMsg getParam() {
    currentSequenceNo++;
    try {
      TimsMsgRouter.send0(
          MSG_CHASSIS_GET_PARAMETER, commandMbx, replyMbx, (byte) 0, currentSequenceNo);

      TimsDataMsg reply;
      do {
        reply = TimsMsgRouter.receive(replyMbx, 1000);
      } while ((reply.seq_nr != currentSequenceNo) & (reply.type == MSG_CHASSIS_PARAMETER));

      ChassisParamMsg data = new ChassisParamMsg(reply);
      return (data);
    } catch (MsgException e) {
      System.out.println(e);
      return (null);
    }
  }