KEYBOARD(3R)

NAME
keyboard: P->state, SCRLOCKREQD, SCR_LOCK, NOPFEXPAND, NOCURSEXPAND, NOPADEXPAND, NOTRANSLATE, reqkbdID( ) - per process keyboard states, keyboard ID

SYNOPSIS
#include <dmd.h>

long P->state;

void reqkbdID ( )

DESCRIPTION
P->state is the state variable for an application running in the 630 MTG.

An application can give different interpretations on groups of 630 MTG supported keyboard keys by setting corresponding bits in the process state variable. The groups are Scroll Lock key, programmable function keys, arrow keys, numerical keypad keys, or the whole keyboard. If the bits are not set, when a key is depressed, the keyboard will send to the process the ASCII/hexadecimal code(s) as specified by the 630 MTG Terminal User's Guide. An exception is the Scroll Lock key which is a "dead" key (no special processing) if it is not requested and processed by the application itself.

If an application program wishes to implement local terminal flow control with the keyboard Scroll Lock key, it must request the use of the Scroll Lock key by setting the SCRLOCKREQD in the state variable as follows:

P->state |= SCRLOCKREQD;

The application program can then determine if the Scroll Lock key has been depressed by checking the SCR_LOCK bit as follows:

P->state & SCR_LOCK;

The SCR_LOCK bit is set whenever the Scroll Lock key is depressed. It is automatically cleared by the keyboard when the Scroll Lock key is depressed a second time.

The programmable function (PF) keys, when depressed are expanded by default, i.e., the corresponding character strings (minus the NULL character) stored in the non-volatile BRAM memory will be sent to the process as would be typed from the keyboard. If an application prefers to have its own interpretation of the programmable function keys, it is necessary to set a bit in the process state variable:

P->state |= NOPFEXPAND;

In this case, the keyboard will only send to the process the PF key keycode which is 0x80 for PF key F1, 0x81 for PF key F2, and so forth.

If a program wants to interpret the arrow keys without having to parse their entire sequence, it can set a bit in the process state variable:

P->state |= NOCURSEXPAND;

When an arrow key is then depressed, it will have the value:

up arrow | 0xE0
down arrow | 0xE1
right arrow | 0xE2
left arrow | 0xE3
home key | 0xE4

If a program wants to have its own interpretation of the numerical keypad keys, it is necessary to set a bit in the process state variable:

P->state |= NOPADEXPAND;

When a numerical keypad key is then depressed, it will have the value:

Enter | 0xC0
\= | 0xC1
* | 0xC2
/ | 0xC3
+ | 0xC4
7 | 0xC5
8 | 0xC6
9 | 0xC7
- | 0xC8
4 | 0xC9
5 | 0xCA
6 | 0xCB
, | 0xCC
1 | 0xCD
2 | 0xCE
3 | 0xCF
0 | 0xD0
\. | 0xD1

If a program wants to remap the entire keyboard, it must set a bit in the state variable:

P->state |= NOTRANSLATE;

The application will then receive from the keyboard the raw keycodes as listed in the 630 MTG Terminal User's Guide. Also, the keyboard LEDs will no longer be automatically updated. At this point, calling the reqkbdID function will ask the keyboard for its identity (ID). The keyboard will send back its ID and all keys currently depressed, followed again by the ID. Refer to the 630 MTG Software Development Guide for more information.

SEE ALSO
kbdchar(3R), state(3R), pfkey(3R), resources(3R), setled(3L).
630 MTG Terminal User's Guide.
630 MTG Software Development Guide.

WARNING
If the process has not requested the keyboard (see resources(3r)), all per process keyboard states will be ignored, and the key's ASCII/hexadecimal code(s) as specified in the 630 MTG Terminal User's Guide will be sent to the host (if the process is connected) or ignored (if the process runs locally).

The exception is the Scroll Lock key which does not require the application to request the whole keyboard. However in order to process that key, the application has to set the SCRLOCKREQD bit in P->state.