Skip to content

Schema #2

Description

@jf-eng

Board to Client

Data Format

Data is transferred in the JSON string format

...
{'axes': [-23, -14, 249], 'buttons': 3, 'switches': 1023}
{'axes': [-23, -14, 249], 'buttons': 3, 'switches': 1023}
{'axes': [-23, -14, 249], 'buttons': 3, 'switches': 1023}
...

Data format:

  • 'axes[0]' is x-tilt, 'axes[1]' is y-tilt, 'axes[2]' is z-tilt (Range -255 to 255)

  • 'buttons'
    3: Both not pressed
    2: KEY0 (top button) pressed
    1: KEY1 (bottom button) pressed
    0: both pressed

  • 'switches'
    10 bit number. Each bit set to '1' which indicates switch flipped on and '0' to indicate switch off.

Client to Server

Topic names

  1. node/0/data/direction
  2. node/0/data/buttons
  3. node/0/data/switches

Data sent for each topic
node/0/data/direction - a list containing 2 bit elements. 4 directions encoded in 2 bits (00-up, 01-down, 10-left, 11-right)
node/0/data/buttons - follow encoding above
node/0/data/switches - 10 bit number. Each bit set to '1' which indicates switch flipped on and '0' to indicate switch off.

Server to Client

For NuttyMode, upon pressing the top button, the client will publish 1 to all other topics except itself.
Topic names

  1. node/1/data/nuttymode
  2. node/2/data/nuttymode
  3. node/3/data/nuttymode
  4. node/4/data/nuttymode
  5. node/5/data/nuttymode

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions