Exemple #1
0
  public int getButtons() throws Exception {
    int[] intIOType = {0};
    int[] intChannel = {0};
    double[] dblValue = {0};
    // Variables to satisfy certain method signatures
    int[] dummyInt = {0};
    double[] dummyDouble = {0};
    long lngIteration;
    int intErrorcode;
    int ValueDIPort = 0;

    intErrorcode = LJUD.GoOne(intHandle[0]);
    ErrorHandler(intErrorcode, 0, new Exception());

    intErrorcode =
        LJUD.GetFirstResult(intHandle[0], intIOType, intChannel, dblValue, dummyInt, dummyDouble);
    ErrorHandler(intErrorcode, 0, new Exception());
    lngIteration = 0; // Used by the error handling function.
    while (intErrorcode < LJUD.LJE_MIN_GROUP_ERROR) {
      if (intIOType[0] == LJUDJavaConstants.LJ_ioGET_DIGITAL_PORT) {
        ValueDIPort = (int) dblValue[0];
      }

      intErrorcode =
          LJUD.GetNextResult(intHandle[0], intIOType, intChannel, dblValue, dummyInt, dummyDouble);

      if (intErrorcode != LJUD.LJE_NO_MORE_DATA_AVAILABLE) {
        ErrorHandler(intErrorcode, lngIteration, new Exception());
      }
      lngIteration++;
    }
    return ValueDIPort;
  }