Пример #1
0
static int
brl_writeWindow (BrailleDisplay *brl, const wchar_t *text) {
  if (cellsHaveChanged(dataArea, brl->buffer, dataCells, NULL, NULL, NULL)) {
    refreshCells(brl);
  }
  return 1;
}
Пример #2
0
static int
brl_construct (BrailleDisplay *brl, char **parameters, const char *device) {
  if (!isSerialDevice(&device)) {
     unsupportedDevice(device);
     return 0;
  }

  if ((serialDevice = serialOpenDevice(device))) {
    if (serialRestartDevice(serialDevice, serialBaud)) {
      static const unsigned char request[] = {BNO_DESCRIBE};
      charactersPerSecond = serialBaud / 10;
      if (writePacket(brl, request, sizeof(request)) != -1) {
        while (serialAwaitInput(serialDevice, 100)) {
          ResponsePacket response;
          int size = getPacket(&response);
          if (size) {
            if (response.data.code == BNI_DESCRIBE) {
              statusCells = response.data.values.description.statusCells;
              brl->textColumns = response.data.values.description.textCells;
              brl->textRows = 1;
              brl->keyBindings = "keys";

              if ((statusCells == 5) && (brl->textColumns == 30)) {
                statusCells -= 2;
                brl->textColumns += 2;
              }
              dataCells = brl->textColumns * brl->textRows;
              cellCount = statusCells + dataCells;

              makeOutputTable(dotsTable_ISO11548_1);
              makeInputTable();

              if ((cellBuffer = malloc(cellCount))) {
                memset(cellBuffer, 0, cellCount);
                statusArea = cellBuffer;
                dataArea = statusArea + statusCells;
                refreshCells(brl);
                persistentKeyboardMode = KBM_NAVIGATE;
                temporaryKeyboardMode = persistentKeyboardMode;
                persistentRoutingOperation = BRL_BLK_ROUTE;
                temporaryRoutingOperation = persistentRoutingOperation;
                return 1;
              } else {
                logSystemError("cell buffer allocation");
              }
            } else {
              logUnexpectedPacket(response.bytes, size);
            }
          }
        }
      }
    }
    serialCloseDevice(serialDevice);
    serialDevice = NULL;
  }
  return 0;
}
Пример #3
0
void relaxationShape::refreshSigma()
{
    refreshCells();

    if (refreshIndexSigma_ != mesh_.time().timeIndex())
    {
        computeSigmaCoordinate();
    }

    refreshIndexSigma_ = mesh_.time().timeIndex();
}
Пример #4
0
static void
writePrompt (BrailleDisplay *brl, const char *prompt) {
  int length = strlen(prompt);
  int index = 0;
  if (length > dataCells) length = dataCells;
  while (index < length) {
    dataArea[index] = convertCharacterToDots(textTable, (unsigned char)prompt[index]);
     ++index;
  }
  while (index < dataCells) dataArea[index++] = 0;
  refreshCells(brl);
}
Пример #5
0
static int
brl_construct (BrailleDisplay *brl, char **parameters, const char *device) {
  if (connectResource(device)) {
    ResponsePacket response;

    if (probeBrailleDisplay(brl, 0, gioEndpoint, 100,
                              writeIdentifyRequest,
                              readResponse, &response, sizeof(response),
                              isIdentityResponse)) {
      statusCells = response.data.values.description.statusCells;
      brl->textColumns = response.data.values.description.textCells;
      brl->textRows = 1;

      if ((statusCells == 5) && (brl->textColumns == 30)) {
        statusCells -= 2;
        brl->textColumns += 2;
      }

      dataCells = brl->textColumns * brl->textRows;
      cellCount = statusCells + dataCells;

      {
        const KeyTableDefinition *ktd = &KEY_TABLE_DEFINITION(all);
        brl->keyBindings = ktd->bindings;
        brl->keyNameTables = ktd->names;
      }

      makeOutputTable(dotsTable_ISO11548_1);
      makeInputTable();

      if ((cellBuffer = malloc(cellCount))) {
        memset(cellBuffer, 0, cellCount);
        statusArea = cellBuffer;
        dataArea = statusArea + statusCells;
        refreshCells(brl);
        return 1;
      } else {
        logSystemError("cell buffer allocation");
      }
    }

    disconnectResource();
  }

  return 0;
}
Пример #6
0
static wchar_t
getCharacter (BrailleDisplay *brl) {
  for (;;) {
    switch (getByte()) {
      default:
        break;
      case BNI_CHARACTER:
        return convertDotsToCharacter(textTable, translateInputCell(getByte()));
      case BNI_SPACE:
        switch (getByte()) {
          default:
            break;
          case BNC_SPACE:
            return WC_C(' ');
        }
        break;
      case BNI_BACKSPACE:
        switch (getByte() & 0X3F) {
          default:
            break;
          case BNC_SPACE:
            return WC_C('\b');
        }
        break;
      case BNI_ENTER:
        switch (getByte()) {
          default:
            break;
          case BNC_SPACE:
            return WC_C('\r');
        }
        break;
    }
    refreshCells(brl);
  }
}