Eventdefinition.md

Kinemic ZMQ Interface

Document Version: 0.5

Date: 09.11.2017

Event Publication

We provide events over a ZMQ pub server broadcasting on port 9999 on our machine. A client has to connect a ZMQ sub socket to tcp://ip.of.server:9999 to listen for incoming events.

Events are JSON encoded and follow the following basic scheme:

{
    'type': string,
    'parameters': {}
}

The following subtypes are possible:

Gestures

{
    'type': 'Gesture',
    'parameters': {
        'name': string
    }
}

The gesture parameter contains the name of the recognized gesture, being one of the following:

"Swipe R", "Swipe L",
"Rotate RL", "Rotate LR",
"Circle R", "Circle L",
"Eartouch R", "Eartouch L",
"Check Mark", "X Mark",
"Swipe Up", "Swipe Down"

Mouse Pointer

{
    'type': 'MouseEvent',
    'parameters': {
        'dx': float,
        'dy': float,
        'down': boolean
    }
}

The dx parameter contains the displacement in x-direction. The dy parameter contains the displacement in y-direction. The down parameter is set to true, if the wrist is rotated 90° clockwise from its initial orientation. See Orientation Reset Requests for details on how to set the initial orientation.


{
    'type': 'MouseToggle',
    'parameters': {
    }
}

This event is emitted if the wrist is quickly rotated 90° clockwise from its inital orientation and afterwards quickly returned to its initial orientation. This can be used to generate events when using the Mouse Pointer mode, e.g. for emulating clicks or for switching between interacting and respositioning.

Writing

{
    'type': 'Writing',
    'parameters': {
        'vocabulary': string,
        'hypothesis': string,
        'final': boolean
    }
}

The vocabulary parameter contains the name of the recognition vocabulary the result came from (default: 'checklist' or 'phonebook'). The hypothesis parameter contains the recognized text. The final parameter informs whether the hypothesis is the final result of the recognition (default: always true).


{
    'type': 'WritingSegment',
    'parameters': {
        'started': boolean
    }
}

A WritingSegment Event is published each time a segment containing motion that might be writing is encountered. The started parameter informs whether a segment just started or ended.

Activation Event

{
    'type': 'Activation',
    'parameters': {
        'active': boolean
    }
}

An Activation Event is published each time a button press was registered that can be used to signal the request for inactivity. The active parameter informs, whether the system should be active or inactive.

Heartbeat

{
    'type': 'Heartbeat',
    'parameters': {
        'active': boolean,
        'flags': integer,
        'last': integer,
        'sensor': string,
        'stream': string
    }
}

Every 2s a Heartbeat Event is published to allow clients to monitor the connection. The active parameter informs of the current Activation Status (see Activation Event). The flags parameter is currently only used for debug purposes. The last parameter gives the time in s since the last sensor data was received. The sensor parameter contains the MAC address of the sensor currently used, or an emptry string if no sensor is currently connected. The stream parameter contains the source of the sensor stream currently used.

Orientation Reset Requests

We listen on tcp://ip.of.server:9998 for incoming messages from a ZMQ pub socket.

Once such a message (the content is irrelevant) is received, the current orientation of the sensor is used as the reference to generate mouse down events when rotating the wrist 90° clockwise.