From 35fe312214f517b7dbe7e35fc20d1ea9c0ece881 Mon Sep 17 00:00:00 2001 From: Alexander Lenz Date: Wed, 13 Sep 2017 17:00:31 +0200 Subject: [PATCH] doc: fix format. Change-Id: I13b33706ba160b0402eb2a06323e9cd74179fc72 --- doc/source/protocol/jsonstruct.rst | 70 ++++++++++++++++-------------- doc/source/protocol/messages.rst | 26 ++++++----- 2 files changed, 52 insertions(+), 44 deletions(-) diff --git a/doc/source/protocol/jsonstruct.rst b/doc/source/protocol/jsonstruct.rst index 79b060c..a35c51c 100644 --- a/doc/source/protocol/jsonstruct.rst +++ b/doc/source/protocol/jsonstruct.rst @@ -54,37 +54,41 @@ Siehe auch diskussion im HZB-wiki hierzu.... verwirrend.... vorerst folgende Festlegung: -{"equipment_id": "cryo_7", - "firmware": "The SECoP playground", - "modules": ["cryo", {"commands": ["stop", {"resulttype": "None", - "arguments": "[]", - "description": "Testing command implementation\\n\\nwait a second" - }, - "start", {"resulttype": "None", - "arguments": "[]", - "description": "normally does nothing,\\n\\nbut there may be modules which _start_ the action here\\n" - } - ], - "group": "very important/stuff", - "implementation": "secop.devices.cryo.Cryostat", - "interfaces": ["Drivable", "Readable", "Device"], - "parameters": ["status", {"readonly": true, - "datatype": ["tuple", ["enum", {"unknown":-1,"idle":100, "warn":200, "unstable":250, "busy":300,"error":400}], "string"], - "description": "current status of the device" - }, - "value", {"readonly": true, - "datatype": ["double",0,null], - "description": "regulation temperature", - "unit": "K" - }, - "target", {"readonly": false, - "datatype": ["double",0,null], - "description": "target temperature", - "unit": "K" - } - ] - } - ], - "version": "2017.01" -} + +.. code-block:: json + + {"equipment_id": "cryo_7", + "firmware": "The SECoP playground", + "modules": ["cryo", {"commands": ["stop", {"resulttype": "None", + "arguments": "[]", + "description": "Testing command implementation\\n\\nwait a second" + }, + "start", {"resulttype": "None", + "arguments": "[]", + "description": "normally does nothing,\\n\\nbut there may be modules which _start_ the action here\\n" + } + ], + "group": "very important/stuff", + "implementation": "secop.devices.cryo.Cryostat", + "interfaces": ["Drivable", "Readable", "Device"], + "parameters": ["status", {"readonly": true, + "datatype": ["tuple", ["enum", {"unknown":-1,"idle":100, "warn":200, "unstable":250, "busy":300,"error":400}], "string"], + "description": "current status of the device" + }, + "value", {"readonly": true, + "datatype": ["double",0,null], + "description": "regulation temperature", + "unit": "K" + }, + "target", {"readonly": false, + "datatype": ["double",0,null], + "description": "target temperature", + "unit": "K" + } + ] + } + ], + "version": "2017.01" + } + diff --git a/doc/source/protocol/messages.rst b/doc/source/protocol/messages.rst index aa91c1b..5d23211 100644 --- a/doc/source/protocol/messages.rst +++ b/doc/source/protocol/messages.rst @@ -23,7 +23,7 @@ On change-requests the parameter is assumed to be 'target', on trigger-requests Clients should not rely on this and explicitly state the parametername! All names and keywords are defined to be identifiers in the sense, that they are not longer than 63 characters and consist only of letters, digits and underscore and do not start with a digit. (i.e. T_9 is ok, whereas t{9} is not!) -No rule is without exception, there is exactly ONE special case: the identify request consists of the literal string '*IDN?\\n' and its answer is formatted like an valid SCPI response for *IDN?. +No rule is without exception, there is exactly ONE special case: the identify request consists of the literal string '\*IDN?\\n' and its answer is formatted like an valid SCPI response for \*IDN?. We rely on the underlying transport to not split messages, i.e. all messages are transported as a whole and no message interrupts another. @@ -59,11 +59,11 @@ Allowed combinations as examples: Identify -------- - * Request: type A: '*IDN?' + * Request: type A: '\*IDN?' * Reply: special: 'SECoP, SECoPTCP, V2016-11-30, rc1' * queries if SECoP protocol is supported and which version it is - Format is intentionally choosen to be compatible to SCPI (for this query only). - It is NOT intended to transport information about the manufacturer of the hardware, but to identify this as a SECoP device and transfer the protocol version! + Format is intentionally choosen to be compatible to SCPI (for this query only). + It is NOT intended to transport information about the manufacturer of the hardware, but to identify this as a SECoP device and transfer the protocol version! Describe @@ -72,8 +72,8 @@ Describe * Request: type A: 'describe' * Reply: type C: 'describing {"modules":{"T1":{"baseclass":"Readable", ....' * request the 'descriptive data'. The format needs to be better defined and - may possibly just follow the reference implementation. - identifies the equipment. It should be unique. Our suggestion is to use something along _, i.e. MLZ_ccr12 or PSI_oven4. + may possibly just follow the reference implementation. + identifies the equipment. It should be unique. Our suggestion is to use something along _, i.e. MLZ_ccr12 or PSI_oven4. Activate Async Events @@ -82,7 +82,7 @@ Activate Async Events * Request: type A: 'activate' * Reply: several EVENT lines (initial value transfer) followed by: type A: 'active' * Activates sending of Async Events after transferring all live quantities once - and an 'end-of-initial-transfer' marker. After this events are enabled. + and an 'end-of-initial-transfer' marker. After this events are enabled. Deactivate Async Events @@ -109,7 +109,7 @@ Write * Request: type C: 'change [:] JSON_value' * Reply: type C: 'changed : JSON_read_back_value' * initiate setting a new value for the module or a parameter of it. - Once this is done, the read_back value is confirmed by the reply. + Once this is done, the read_back value is confirmed by the reply. Trigger @@ -128,7 +128,7 @@ Heartbeat * Reply: type A: 'pong' * Reply: type B: 'pong ' * Replies the given argument to check the round-trip-time or to confirm that the connection is still working. - may not contain . It is suggested to limit to a string of up to 63 chars consisting of letters, digits and underscore not beginning with a digit. If is not given (Type A), reply without it. + may not contain . It is suggested to limit to a string of up to 63 chars consisting of letters, digits and underscore not beginning with a digit. If is not given (Type A), reply without it. EVENT @@ -139,11 +139,13 @@ Events can be emitted any time from the SEC-node (except if they would interrupt * Request: None. Events can be requested by Trigger or by Activating Async Mode. * Reply: type C: 'event : JSON_VALUE' * Informs the client that a parameter got changed its value. - In any case the JSON_value contain the available qualifiers as well: + In any case the JSON_value contain the available qualifiers as well: + * "t" for the timestamp of the event. * "e" for the error of the value. * "u" for the unit of the value, if deviating from the descriptive data * further qualifiers, if needed, may be specified. + The qualifiers are a dictionary at position 2 of a list, where the value occupies position 1. This holds true also for complex datatypes (of value)! @@ -160,6 +162,7 @@ ERROR * Request: None. can only be a reply if some request fails. * Reply: type C: 'ERROR JSON_additional_stuff' * Following are defined so far: + * NoSuchDevice: The action can not be performed as the specified device is non-existent. * NoSuchParameter: The action can not be performed as the specified parameter is non-existent. * NoSuchCommand: The specified command does not exist. @@ -173,6 +176,7 @@ ERROR * Disabled: The requested action can not be performed at the moment. (Interlocks?) * SyntaxError: A malformed Request was send * InternalError: Something that should never happen just happened. + The JSON part should reference the offending request and give an explanatory string. examples: @@ -186,7 +190,7 @@ Examples -------- (client connects): -(client) '*IDN?' +(client) '\*IDN?' (SEC-node) 'Sine2020WP7.1&ISSE, SECoP, V2016-11-30, rc1' (client) 'describe' (SEC-node) 'describing SECoP_Testing {"modules":{"T1":{"baseclass":"Readable", ...