score-back/API.md
Artur Mukhamadiev cbe56d9193 [base] hail vibe-coding
Minimal API functionality with unit tests,
could be used for integration tests with Unity server.
For internal testing used RPC_server implementation
2026-01-26 00:14:19 +03:00

126 lines
1.8 KiB
Markdown

# JSON-RPC API Documentation
The Cloud Point RPC server implements the **JSON-RPC 2.0** protocol over TCP.
## General Format
All requests and responses are JSON objects.
### Request
```json
{
"jsonrpc": "2.0",
"method": "<method_name>",
"params": {},
"id": <integer|string>
}
```
*Note: `params` is currently ignored by the implemented methods but is part of the standard.*
### Response (Success)
```json
{
"jsonrpc": "2.0",
"result": <method_specific_result>,
"id": <matching_request_id>
}
```
### Response (Error)
```json
{
"jsonrpc": "2.0",
"error": {
"code": <integer>,
"message": "<string>"
},
"id": <matching_request_id>
}
```
---
## Methods
### `get-intrinsic-params`
Retrieves the intrinsic camera parameters as a flat 3x3 matrix (row-major).
**Request:**
```json
{
"jsonrpc": "2.0",
"method": "get-intrinsic-params",
"id": 1
}
```
**Response:**
```json
{
"jsonrpc": "2.0",
"result": [
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0
],
"id": 1
}
```
*Type: `vector<double>` (size 9)*
### `get-extrinsic-params`
Retrieves the extrinsic camera parameters as a flat 4x4 matrix (row-major).
**Request:**
```json
{
"jsonrpc": "2.0",
"method": "get-extrinsic-params",
"id": 2
}
```
**Response:**
```json
{
"jsonrpc": "2.0",
"result": [
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0
],
"id": 2
}
```
*Type: `vector<double>` (size 16)*
### `get-cloud-point`
Retrieves the current field of view point cloud.
**Request:**
```json
{
"jsonrpc": "2.0",
"method": "get-cloud-point",
"id": 3
}
```
**Response:**
```json
{
"jsonrpc": "2.0",
"result": [
[0.1, 0.2, 0.3],
[1.1, 1.2, 1.3],
[5.5, 6.6, 7.7]
],
"id": 3
}
```
*Type: `vector<vector<double>>` (List of [x, y, z] points)*