Skip to content

Commit d424b1f

Browse files
More protocol documentation updates
1 parent ff2188b commit d424b1f

File tree

1 file changed

+44
-23
lines changed

1 file changed

+44
-23
lines changed

Documentation/OpenRGBSDK.md

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The protocol mimics the [RGBController API](The-RGBController-API) closely. It
1212
| 1 | 0.5 | Add versioning, add vendor string |
1313
| 2 | 0.6 | Add profile controls |
1414
| 3 | 0.7 | Add brightness field to modes, add SaveMode() |
15-
| 4 | 0.9 | Add segments field to zones |
15+
| 4 | 0.9 | Add segments field to zones, plugin interface |
1616

1717
\* Denotes unreleased version, reflects status of current pipeline
1818

@@ -49,11 +49,11 @@ The following IDs represent different SDK commands. Each ID packet has a certai
4949
| 1 | [NET_PACKET_ID_REQUEST_CONTROLLER_DATA](#net_packet_id_request_controller_data) | Request RGBController data block | 0 |
5050
| 40 | [NET_PACKET_ID_REQUEST_PROTOCOL_VERSION](#net_packet_id_request_protocol_version) | Request OpenRGB SDK protocol version from server | 1* |
5151
| 50 | [NET_PACKET_ID_SET_CLIENT_NAME](#net_packet_id_set_client_name) | Send client name string to server | 0 |
52-
| 100 | [NET_PACKET_ID_DEVICE_LIST_UPDATED](#net_packet_id_device_list_updated) | Indicate to clients that device list has updated | 0 |
53-
| 150 | [NET_PACKET_ID_REQUEST_PROFILE_LIST](#net_packet_id_request_profile_list) | Request profile list | 0 |
54-
| 151 | [NET_PACKET_ID_REQUEST_SAVE_PROFILE](#net_packet_id_request_save_profile) | Save current configuration in a new profile | 0 |
55-
| 152 | [NET_PACKET_ID_REQUEST_LOAD_PROFILE](#net_packet_id_request_load_profile) | Load a given profile | 0 |
56-
| 153 | [NET_PACKET_ID_REQUEST_DELETE_PROFILE](#net_packet_id_request_delete_profile) | Delete a given profile | 0 |
52+
| 100 | [NET_PACKET_ID_DEVICE_LIST_UPDATED](#net_packet_id_device_list_updated) | Indicate to clients that device list has updated | 1 |
53+
| 150 | [NET_PACKET_ID_REQUEST_PROFILE_LIST](#net_packet_id_request_profile_list) | Request profile list | 2 |
54+
| 151 | [NET_PACKET_ID_REQUEST_SAVE_PROFILE](#net_packet_id_request_save_profile) | Save current configuration in a new profile | 2 |
55+
| 152 | [NET_PACKET_ID_REQUEST_LOAD_PROFILE](#net_packet_id_request_load_profile) | Load a given profile | 2 |
56+
| 153 | [NET_PACKET_ID_REQUEST_DELETE_PROFILE](#net_packet_id_request_delete_profile) | Delete a given profile | 2 |
5757
| 200 | [NET_PACKET_ID_REQUEST_PLUGIN_LIST](#net_packet_id_request_plugin_list) | Request plugin list | 4 |
5858
| 201 | [NET_PACKET_ID_PLUGIN_SPECIFIC](#net_packet_id_plugin_specific) | Plugin specific | 4 |
5959
| 1000 | [NET_PACKET_ID_RGBCONTROLLER_RESIZEZONE](#net_packet_id_rgbcontroller_resizezone) | RGBController::ResizeZone() | 0 |
@@ -62,7 +62,7 @@ The following IDs represent different SDK commands. Each ID packet has a certai
6262
| 1052 | [NET_PACKET_ID_RGBCONTROLLER_UPDATESINGLELED](#net_packet_id_rgbcontroller_updatesingleled) | RGBController::UpdateSingleLED() | 0 |
6363
| 1100 | [NET_PACKET_ID_RGBCONTROLLER_SETCUSTOMMODE](#net_packet_id_rgbcontroller_setcustommode) | RGBController::SetCustomMode() | 0 |
6464
| 1101 | [NET_PACKET_ID_RGBCONTROLLER_UPDATEMODE](#net_packet_id_rgbcontroller_updatemode) | RGBController::UpdateMode() | 0 |
65-
| 1102 | [NET_PACKET_ID_RGBCONTROLLER_SAVEMODE](#net_packet_id_rgbcontroller_savemode) | RGBController::SaveMode() | 0 |
65+
| 1102 | [NET_PACKET_ID_RGBCONTROLLER_SAVEMODE](#net_packet_id_rgbcontroller_savemode) | RGBController::SaveMode() | 3 |
6666
6767
\* The NET_PACKET_ID_REQUEST_PROTOCOL_VERSION packet was not present in protocol version 0, but clients supporting protocol versions 1+ should always send this packet. If no response is received, it should be assumed that the server is using protocol 0.
6868

@@ -213,6 +213,21 @@ The client uses this ID to request the server's profile list. The request conta
213213

214214
The server responds to this request with a data block. The format of the block is shown below.
215215

216+
| Size | Format | Name | Protocol Version | Description |
217+
| -------- | -------------------------- | ------------ | ---------------- | -------------------------------------------------------------------------------- |
218+
| 4 | unsigned int | data_size | 2 | Size of all data in packet |
219+
| 2 | unsigned short | num_profiles | 2 | Number of profiles on server |
220+
| Variable | Profile Data[num_profiles] | profiles | 2 | See [Profile Data](#profile-data) block format table. Repeat num_profiles times |
221+
222+
## Profile Data
223+
224+
The profile data block represents the information of one profile. This data block was introduced in protocol version 2.
225+
226+
| Size | Format | Name | Protocol Version | Description |
227+
| ---------------- | ---------------------- | ---------------- | ---------------- | --------------------------------------------------------- |
228+
| 2 | unsigned short | profile_name_len | 2 | Length of profile name string, including null termination |
229+
| profile_name_len | char[profile_name_len] | profile_name | 2 | Profile name string value, including null termination |
230+
216231
## NET_PACKET_ID_REQUEST_SAVE_PROFILE
217232

218233
### Client Only [Size: Variable]
@@ -243,30 +258,36 @@ The client uses this ID to request the server's plugin list. The request contai
243258

244259
The server responds to this request with a data block. The format of the block is shown below.
245260

246-
| Size | Format | Name | Description |
247-
| -------- | ------------------------ | ----------- | ----------------------------------------------------------------------------- |
248-
| 4 | unsigned int | data_size | Size of all data in packet |
249-
| 2 | unsigned short | num_plugins | Number of plugins on server |
250-
| Variable | Plugin Data[num_plugins] | plugins | See [Plugin Data](#plugin-data) block format table. Repeat num_plugins times |
261+
| Size | Format | Name | Protocol Version | Description |
262+
| -------- | ------------------------ | ----------- | ---------------- | ----------------------------------------------------------------------------- |
263+
| 4 | unsigned int | data_size | 4 | Size of all data in packet |
264+
| 2 | unsigned short | num_plugins | 4 | Number of plugins on server |
265+
| Variable | Plugin Data[num_plugins] | plugins | 4 | See [Plugin Data](#plugin-data) block format table. Repeat num_plugins times |
251266

252267
## Plugin Data
253268

254269
The plugin data block represents the information of one plugin. This data block was introduced in protocol version 4.
255270

256-
| Size | Format | Name | Description |
257-
| ---------------------- | ---------------------------- | ----------------------- | --------------------------------------------------------------- |
258-
| 2 | unsigned short | plugin_name_len | Length of plugin name string, including null termination |
259-
| plugin_name_len | char[plugin_name_len] | plugin_name | Plugin name string value, including null termination |
260-
| 2 | unsigned short | plugin_description_len | Length of plugin description string, including null termination |
261-
| plugin_description_len | char[plugin_description_len] | plugin_description | Plugin description string value, including null termination |
262-
| 2 | unsigned short | plugin_version_len | Length of plugin version string, including null termination |
263-
| plugin_version_len | char[plugin_version_len] | plugin_version | Plugin version string value, including null termination |
264-
| 4 | unsigned int | plugin_index | Plugin index value |
265-
| 4 | unsigned int | plugin_protocol_version | Plugin protocol version value |
271+
| Size | Format | Name | Protocol Version | Description |
272+
| ---------------------- | ---------------------------- | ----------------------- | ---------------- | --------------------------------------------------------------- |
273+
| 2 | unsigned short | plugin_name_len | 4 | Length of plugin name string, including null termination |
274+
| plugin_name_len | char[plugin_name_len] | plugin_name | 4 | Plugin name string value, including null termination |
275+
| 2 | unsigned short | plugin_description_len | 4 | Length of plugin description string, including null termination |
276+
| plugin_description_len | char[plugin_description_len] | plugin_description | 4 | Plugin description string value, including null termination |
277+
| 2 | unsigned short | plugin_version_len | 4 | Length of plugin version string, including null termination |
278+
| plugin_version_len | char[plugin_version_len] | plugin_version | 4 | Plugin version string value, including null termination |
279+
| 4 | unsigned int | plugin_index | 4 | Plugin index value |
280+
| 4 | unsigned int | plugin_protocol_version | 4 | Plugin protocol version value |
266281

267282
## NET_PACKET_ID_PLUGIN_SPECIFIC
268283

269-
This packet is used to send data to a plugin.
284+
### Request [Size: Variable]
285+
286+
This packet is used to send data to a plugin. The `pkt_dev_idx` field in the header specifies which plugin to send to and corresponds to the `plugin_index` field in the plugin list. The first 4 bytes of the data is the plugin packet type, the rest of the packet is plugin-specific.
287+
288+
### Response [Size: Variable]
289+
290+
The response is optionally generated by the plugin. The data in the packet is plugin-specific.
270291

271292
## NET_PACKET_ID_RGBCONTROLLER_RESIZEZONE
272293

0 commit comments

Comments
 (0)