Tasks
Jump to navigation
Jump to search
All communications between a Device, Server, and App are done through tasks.
| Task | Args | REST | Websocket | Sender -> Receiver | Description |
|---|---|---|---|---|---|
| p | (string)hex_bytes | X | App -> Server, Server -> Device | Sends a hex string to set the intensity of all motors. When sent from app to server, the first byte is the device to target. When sent to the device, each byte is a motor, big endian. Ex: Device -> Server 00FFAA00FF sets the first controlled device's motors to Motor1: FF, motor2: AA, Motor3: 00, Motor4 FF
| |
| ps | (string)hex_bytes | X | App -> Server, Server -> Device | Similar to above, but you send blocks of 2 bytes where the first byte is the motor and the second byte is the PWM value. When sent from the device, the first value is the device to target. Ex: Device -> Server 0001FF03AA targets the first controlled device and sets its second port to FF and 4th port to AA.
| |
| vib | (obj)program | X | X | Server -> Device | Sends a vib program object to the device. |
| id | (str)deviceID / (obj){id:(str)deviceID, ...meta_keys} | X | Device -> Server | Sent from a device to the server to list itself on the server. | |
| app | (str)name | X | App -> Server, Server -> Device | Sent by an app to a server to list itself. When an app claims a device, this is also sent to the device, but with two args: (str)app_name, (str)app_connection_id | |
| whois | (str)deviceID | X | App -> Server | Request info about a connected device by deviceID. See [Device | |
| app_offline | (str)name, (str)connectionID | X | Server -> Device | Sent to a device when an app that had connected to it has gone offline | |
| hookup | (str)deviceID / (arr)deviceIDs | X | App -> Server | Sent by the app to start controlling one or many devices. Sends a callback with a list of all hooked up deviceIDs. The index of this list is used in p / ps calls. | |
| hookdown | (str)deviceID / (arr)deviceIDs | X | App -> Server | Sent by the app to stop controlling one or may devices. Sends a callback with a list of all hooked up deviceIDs. The index of this list is used in p / ps calls. | |
| dev_online | (str)deviceID, (str)socketID, (obj)meta | X | Server -> App | Sent to the app when a device comes online. | |
| dev_offline | (str)deviceID, (str)socketID | X | Server -> App | Sent to the app when a device goes offline. | |
| dCustom | (str)deviceID, (var)customData / (str)appName, (str)socketID, (var)customData | X | App -> Server, Server -> Device | Relays a custom message to a device. When sending from App to Server, you use deviceID and the custom data. The Device receives appName, the device's socket ID, and the custom data | |
| aCustom | (str)socketID, (var)customData / (str)deviceID, (str)socketID, (var)customData | X | Device -> Server, Server -> App | Relays a custom message from a Device to an App. When sending from Device to Server, you use the socketID (which you can get from the "app" event or dCustom when an app requests data from a device). The app then receives (str)deviceID, (str)socketID_of_device, (var)customData | |
| GET | (obj){id:(str)deviceID, type:(str)type, data:(obj)data} | X | App -> Server | Emulates a call to the REST endpoint with websockets. |