Keys

The D-Series phones provide a set of user definable keys. For D-100 and D-200 the user can define 18 self labeling keys. These are aligned in 3 layers to each side of the display.

The XT20 modules provide 60 self labeling keys. It displays 20 keys on 3 layers.

The user can set the keys from a set of templates. Via Provisioning it is possible to configure keys directly and also provide a set of custom Templates for the user.

A key can contain invocations, reactions, and a lua script.

The phone invokes each configured invocation on key press. Each reaction can modify the led state of the configured key. The last led state persists.

Invocations

Reactions

In contrast to the somewhat limited possibilities of the xml defined keys, you can also provide a lua script.

The script is defined for a specific key and has control over the key press and the LED state of said key. The environment contains interfaces to invoke calls, prepare subscriptions, send http requests or register handlers for incoming http. The key can keep a state during the phones activity and is therefore able to perform more complex tasks than the stateless xml configuration.

The environment uses a lua 5.2. The basic functions and modules ''bit32'', ''math'', ''string'' and ''table'' are available.

Furthermore, there is a phone specific Lua API.

Example:

<key>
  <keyConfiguration>
    <lua>
      <code>
      --[===]simple script used for setting LEDs[===]--
      local state = 0
      --[===]onKeyUp is called when the key is released[===]--
      function onKeyUp()
        state = (state + 1) % 7
        if state == 0  then
            --[===]set the configured key LED to off[===]--
            key:setLed( "off" )
        elseif state == 1 then
            key:setLed( "red" )
        elseif state == 2 then
            key:setLed( "red", true )
        elseif state == 3 then
            key:setLed( "orange" )
        elseif state == 4 then
            key:setLed( "orange", true )
        elseif state == 5 then
            key:setLed( "green" )
        else
            key:setLed( "green", true )
        end
    end</code>
    </lua>
  </keyConfiguration>
</key>

The configuration can define parameters, which will be added to the Environment. An Example for this is given in the Templates.