Skip to content

Turn Android into a controller by transmitting commands over WebSocket, MQTT, TCP, and UDP protocols.

License

Notifications You must be signed in to change notification settings

umer0586/DroidPad

Repository files navigation

GitHub License Jetpack Compose Badge GitHub Release

Create custom control interfaces with a simple drag-and-drop and transform your Android device into a controller by transmitting commands over WebSocket, MQTT, TCP, and UDP protocols.

Key Features:

  1. Drag-and-Drop Control Pad Creation
    Design your control pads by dragging and dropping components like buttons, sliders, and switches.

  2. Multi-Protocol Support and Seamless Server Connections
    Easily configure your control pad to act as a client for network protocols such as WebSocket, MQTT, TCP, and UDP. Once configured, the control pad can connect to servers using any of these protocols. Interact with your control pad’s components—like buttons, switches, and sliders—to send real-time commands directly to the connected server and process those commands at server side

How It Works (4 steps)

Step 1: Create a Control Pad

Start by creating a new control pad. Provide a unique name to identify your control pad.

Step 2: Design Your Control Pad

After creating the control pad, click on the Build icon and use the drag-and-drop interface to add components like switches, buttons, and sliders etc.

Assign a unique ID to each component. This ID will be sent to the server during interactions.

Step 3: Configure Connection Settings

Tap 'Settings, choose a connection type (TCP, UDP, WebSocket, or MQTT), enter the server address and port. You can switch between connection types anytime

Step 4: Connect and Interact

a. Click on the Play icon to start interacting with your control pad.
b. Tap the Connect button in the bottom-right corner to establish a connection with the server.

Reading Interactions at the Server Side

When users interact with the control pad, JSON-formatted messages are generated based on the type of component used. These JSON messages enable servers to understand and process interactions sent from the control pad. Below are the formats and details for each interaction:


Switch

Toggling a switch generates the following JSON:

{
  "id": "the id you specified",
  "type": "SWITCH",
  "state": true
}
  • The state field indicates whether the switch is on (true) or off (false).

Button

Pressing or releasing a button generates this JSON:

{
  "id": "the id you specified",
  "type": "BUTTON",
  "state": "PRESS"
}
  • The state field can have two values:
    • "PRESS": When the button is being pressed (finger on the button).
    • "RELEASE": When the button is released (finger lifted off after pressing).

Click Button

A Click Button differs from a regular button as it sends a single tap gesture instead of separate PRESS or RELEASE events. The generated JSON is:

{
  "id": "the id you specified",
  "type": "CLICK_BUTTON",
  "state": "CLICK"
}
  • The state field is always "CLICK" to indicate the tap gesture.

Slider

Dragging the slider thumb generates the following JSON:

{
  "id": "the id you specified",
  "type": "SLIDER",
  "value": 1.4
}
  • The value field represents the current position of the slider.
  • The value is always within the range of the minimum and maximum values specified during the slider's configuration.

TODO

  1. Bluetooth classic support
  2. Bluetooth Low Energy support
  3. Attaching sensors to control pads
  4. TouchPad
  5. Directional Pad

Installlation

Download APK from Release Page