Skip to content

Commit e36fc1a

Browse files
committed
feat: Device functions ADR
Formatting fixes and language clarification Add parameter range limits and defaults Signed-off-by: Iain Anderson <[email protected]>
1 parent bf39a23 commit e36fc1a

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

docs_src/design/adr/device-service/0020-invoking-functions.md

+22-14
Original file line numberDiff line numberDiff line change
@@ -24,51 +24,59 @@ this is unintuitive.
2424

2525
## Decision
2626

27-
1. Add a new section to device profiles describing functions
27+
**Add a new section to device profiles describing functions**
2828

29+
```
2930
{
3031
"deviceFunctions":
3132
[
3233
{
3334
"name": "Name by which the function is accessed",
3435
"description": "Readable description of the function",
35-
"attributes": { device-specific parameters which select this function },
36+
"attributes": { device-service-specific attributes which select this function },
3637
"parameters":
3738
{
3839
"in":
3940
[
4041
{
4142
"name": "Parameter name",
42-
"description": "description of what the parameter controls",
43-
"type": "Any of the usual EdgeX data types"
43+
"description": "(optional) description of what the parameter controls",
44+
"type": "Any of the usual EdgeX data types",
45+
"defaultValue": "(optional) value to use if param is not supplied",
46+
"maximum": "(optional) for numerics, maximum allowed value",
47+
"minimum": "(optional) for numerics, minimum allowed value"
4448
}
4549
],
4650
"out":
4751
[
4852
{
49-
"name": "Parameter name",
50-
"description": "description of what the parameter controls",
53+
"name": "Name of returned value",
54+
"description": "(optional) description of what the value indicates",
5155
"type": "Any of the usual EdgeX data types"
5256
}
5357
]
5458
}
5559
}
5660
]
5761
}
62+
```
5863

59-
2. Add a REST endpoint to the device service for performing functions
64+
Note: the `attributes` structure is analagous to `attributes` in a `deviceResource`. Each device service should document and implement a scheme of required attributes that will allow for selection of the relevant funtion. The function's `name` is intended for UI and logging purposes and should not be used for actual function selection on the device.
6065

61-
api/v2/device-funtion/<device-name>/<function-name>
66+
**Add a REST endpoint to the device service for performing functions**
67+
68+
`api/v2/device-funtion/<device-name>/<function-name>`
6269

6370
This shold accept POST requests with parameters sent in a JSON (or CBOR) payload
6471

65-
A successful invocation should return HTTP 200 with the out parameters in JSON
72+
A successful invocation should return HTTP 200 with the out values in JSON
6673
or CBOR format.
6774

6875
Returnable errors should be
69-
BAD REQUEST: parameters were missing or wrong type
70-
INTERNAL SERVER ERROR: the DS implementation was unable to fulfill the request
71-
NOT FOUND: no such device, or no such function
72-
LOCKED: device or service is locked or down (adminstate, operating state)
7376

74-
3. Add a REST endpoint to core-command for performing functions
77+
* BAD REQUEST: parameters were missing, wrong type, or out-of-range
78+
* INTERNAL SERVER ERROR: the DS implementation was unable to fulfill the request
79+
* NOT FOUND: no such device, or no such function
80+
* LOCKED: device or service is locked or down (adminstate, operating state)
81+
82+
**Add a REST endpoint to core-command for performing functions**

0 commit comments

Comments
 (0)