# Get Started

On the application card there is a select and edit button. By clicking on the select button, you will go to the active devices page. Tap on the edit button, you will got to the application page.

On the application page you will find pid and url. PID is an application identifier. The URL field contains a link for connecting to the server (credential key is used for connection).

# Device Connection

To create a debug sessions, copy the link from the application page and send a post request for it:

Name Type Description
did string Identifier of the connected device
name string The name of the device for display
state dict The structure of Debug Menu, which will be displayed (optional)

POST example data:

{
    "did": "SAF124",
    "name": "DEVICE-01",
    "state": {
        "tabs": {
            "Example tab": {
                "hide": false,
                "widgets": [
                    {
                        "id": "text-widget",
                        "type": "text",
                        "data": { "content": "hello world" }
                    },
                    ...
                ]
            }
        }
    }
}

In the body of the answer will be the url and throttle field. URL is the main address (base_workspace_url) with which you will need to work. Throttle contains a number of requests per minute that will take the server.

{
    "url": "https://api.devdebugger.com/workspaces/{uuid}/", // base workspace url
    "status": "pending",
    "throttle": 60
}

status indicates that the device is waiting for the user to connect.

# Handshake

You can get the current general information on the session at: http://api.localhost.localdomain:8000/workspaces/{UUID}/status/

{
  "id": "{UUID}",
  "did": "29th",
  "is_watched": false,
  "is_connected": false,
  "device_name": "test",
  "state_revision": 0,
  "widget_revision": 0,
  "confirmed_revision": 0
}

When the user connects the value of is_watched changes to true. After that the device should send to the address http://api.localhost.localdomain:8000/workspaces/{UUID}/status/ POST request with body:

{
    "is_connected": true
}

# Work Process

To connect to your devices, open the active devices page and select a device by name. When choosing your device, you will be redirected to debug menu.

On the debug menu page, each action is assigned a serial number (activity_revision) and is recorded in the activity work session. The button is blocked until the device sends the corresponding revision number in the confirmed_revision field. For example:

{
    "worker": {
        "confirmed_revision": 23
    }
}

The server will answer:

{
    "activity": {
        "revision_from": 23,
        "revision_to": 24,
        "activity": {
            "24": { "id": "btn_id", ... }
        }
    }
}

The server makes activity from confirmed_revision to the last current activity number. The content of Activity depends on the component, more about them here.

GET method will return information about the current worker. POST method returns information depending on the body of the request, more about them here

# State

To update the condition, send a request to the base_workspace_url. There are the following methods to change the state:

  • new_state - fully rewrites the existing state (increases by 1 state_revision);
  • change_state - updates the existing state. If there is a widget with a new ID, which does not exist in the current state, an error will be returned (increases by 1 widget_revision).

If both of these keys are in the request, then only new_state will work.

{
    "worker": {
        "new_state": {
            "tabs": {
                "Example tab": {
                    "hide": false,
                    "widgets": [ ... ]
                }
            }
        },
        "change_state": {
            "tabs": {
                "Example tab": {
                    "hide": false,
                    "widgets": [ ... ]
                }
            }
        },
    }
}

# End of work

When you finish the debugging process, you can send POST to the address http://api.devdebugger.com/workspaces/{uuid}/close/. The same action is equivalent if you press close button on debug menu page.

# Tips

When the device is connected, the session status is set to "pending".

# More About

Last Updated: 4/12/2023, 11:09:07 AM