This is historical information of device classes implemented in WebSocketDS device server.

Use this link to find the valid information.

Development status: Released
Information status: Updated

Contact:



Class Description


WebSocket access to tango device-server attributes.

Configuration should be done via properties:

Port - port to listen incoming ws connections; DeviceServer - tango id of a required device server; Attributes - list of required DS attributes, you wish to read via WS; Commands - list of required DS commandes, you wish to executed via WS; AuthDS - Tango web authentication device server (TangoWebAuth ) name. Secure - It will be used wss connection (websocket secure). (true if you want) Certificate - Certificate file name (crt) with full path (if Secure = true) Key - Private key file name (if Secure = true) Options - Various options for the device server

Then you should set polling to the UpdateData command. (1000 means that all connected clients would read attributes once per second).

Data format: JSON string with array of attrubute objects {atrrtibute name, attribute value, quality, timestamp};

if you want to record in the logs, define uselog in Property Options. The database (defined in AuthDS) must contain a table command_history with columns:

System Message: ERROR/3 (<string>, line 21)

Unexpected indentation.
// id - autoincrement // argin[0] = timestamp_string UNIX_TIMESTAMP // argin[1] = login // argin[2] = deviceName // argin[3] = IP // argin[4] = commandName // argin[5] = commandJson // argin[6] = statusBool // argin[7] = isGroup

Families: Communication

Key words:

Platform: All Platforms

Language: Cpp

License: GPL

Contact:

Hardware


Manufacturer: none

Bus: Not Applicable

Class interface


Attributes:

Name Description
JSONScalar: DevString
TimestampDiffScalar: DevULong The difference between the timestamps from UpdateData and CheckPoll
NumberOfConnectionsScalar: DevULong Number of WS clients

Commands:

Name Description
StateInput: DevVoid
Output: State
Device state
This command gets the device state (stored in its device_state data member) and returns it to the caller.
StatusInput: DevVoid
Output: ConstDevString
Device status
This command gets the device status (stored in its device_status data member) and returns it to the caller.
OnInput: DevVoid
Output: DevVoid
OffInput: DevVoid
Output: DevVoid
UpdateDataInput: DevVoid
Output: DevVoid
ResetInput: DevVoid
Output: DevVoid
Restart websocket server
CheckPollInput: DevVoid
Output: DevVoid

Pipes:

Properties:

Name Description
ModeDevString Device operating mode ser - Server mode ser_cli_all - Server mode. Client mode (You can use all devices) ser_cli_all_ro - Server mode. Client mode (You can use all devices only for reading attributes and pipes) ser_cli_ali - Server mode. Client mode. (You can use devices that have an alias.) ser_cli_ali_ro - Server mode. Client mode. (You can use devices that have an alias only for reading attributes and pipes) cli_all - Client mode (You can use all devices) cli_all_ro - Client mode (You can use all devices only for reading attributes and pipes) cli_ali - Client mode. (You can use devices that have an alias.) cli_ali_ro - Client mode. (You can use devices that have an alias only for reading attributes and pipes)
PortDevShort Using port of WebSocket
DeviceServerDevString Using DeviceServer name or a device name pattern (e.g. domain_* / family/ member_*) for communicate with a group of devices. Used only if any server mode is selected.
AttributesArray of DevString A list of device attributes you want to read, if reading all attributes is required, add __all_attrs__ (not operational in group mode); Used only if any server mode is selected.
CommandsArray of DevString a list of device commands you want to execute through WS Used only if any server mode is selected.
PipeNameArray of DevString Name of DevicePipe for reading. [0] When using GROUP, the DevicePipe name must be the same for all devices. If you want to set properties for specific attributes, add them in the format ``NameAttr;property`` Used only if any server mode is selected.
SecureDevBoolean Shall we use SSL encryption? set true, for secure wss connection, otherwise false;
CertificateDevString full path to the certificate in use (if Secure = true) example: /etc/ssl/certs/ssl-cert-snakeoil.pem
KeyDevString full path to the file in use with Private key (if Secure = true) Example: /etc/ssl/private/ssl-cert-snakeoil.key
AuthDSDevString Tango web authentication device server (TangoWebAuth ) name. responsible for user authentication in case of commands execution
MaxNumberOfConnectionsDevUShort maximum number of connections. If the limit is reached, further connections will be lost with 400 Bad Request error. If 0 is set, the number of connections will be unlimited.
MaximumBufferSizeDevUShort maximum buffer size for each connection, KiB. The Default value is 1000. Possible values range from1 to 10000 (if setting a value outside the range, the default value will be set). If exceeding the set maximum buffer size, the connection will be lost by the server;
ResetTimestampDifferenceDevUShort The difference in timestamps (seconds) after which a WS server is reset. The difference is counted by CheckPoll method between update timestamp in UpdateData method and current timestamp. Minimum value is 60. Default and MinValue = 60 Used only if any server mode is selected
OptionsArray of DevString Options for device. Format of options: nameOfOption or nameOfOption=value
list_subscr_event_changeArray of DevString List of subscriptions to change events
list_subscr_event_periodicArray of DevString List of subscriptions to periodic events
list_subscr_event_userArray of DevString List of subscriptions to user events
list_subscr_event_archiveArray of DevString List of subscriptions to archive events

README

b'WebSocketDS\r\n===========\r\n\r\n- Introduction\r\n\r\n- Server mode\r\n - Data from device\r\n - Data from group of devices\r\n - Reading data from pipe\r\n - Running commands\r\n - Write attribute\r\n \r\n- Client mode\r\n - Timer control\r\n - Reading data from attributes and pipe\r\n - Client running of commands\r\n - Client attribute writing\r\n\r\n- Work with events\r\n - Subscribing to events\r\n - Full unsubscription from events\r\n - Partial unsubscription from events\r\n - Get the subscriber id \r\n\r\n- Authorization and authentication\r\n - Method SIMPLE\r\n - Method USERANDIDENT\r\n - Method USERANDIDENT2\r\n - Method USERANDIDENT3\r\n \r\n- Logging\r\n\r\n- Additional parameters for attributes, pipe and commands\r\n - Changing the precision and formatting the output values of attributes, pipe, and commands\r\n - Setting the periodicity of the output of values for attributes\r\n\r\n- The format of the returned error messages\r\n- Property list for defining Tango device\r\n\r\n- Device operating mode\r\n\r\n## Introduction\r\n\r\nFor successful compilation TANGO libraries and a c++11 compiler must be installed. libboost-system libboost-system-dev libssl must also be installed.\r\nThe directory has Makefile for g++. This Makefile was generated by POGO, and is suitable in most cases of TANGO standard assembly. For successful running of Makefile, there must be a directory, defined in MAKE_ENV = /usr/local/share/pogo/preferences\xc2\xa0(default. Correct if necessary).\r\n\r\nAs a default, compilation runs in OPTIMIZED (-O2) mode. For compilation in DEBUG (-g -D_DEBUG) mode, start make RTYPE=debug, inputting\xc2\xa0make clean\r\n\r\nRead Property list for defining Tango device. \r\n\r\nFor testing, you can use scripts from the directory "scripts_for_test"\r\n\r\n## Server mode\r\n\r\nServer mode is ser or ser_cli_all_ro or ser_cli_all or ser_cli_ali or ser_cli_ali_ro.\r\nMore about the modes and list of modes here\r\n\r\nThe listening device must be written in the property DeviceServer\r\n\r\nThe list of readable attributes must be listed in the property Attributes\r\n\r\nIf you want to listen to a group of devices, the "Options" property must contain a string group. DeviceServer must contain name pattern for group (e.g., domain_/family/member_)\r\n\r\n#### Data from device\r\n\r\nIf the device (output):\r\n\r\njson\r\n{\r\n\t"event": "read",\r\n\t"type_req":"attribute",\r\n\t"data": [\r\n\t\t{\r\n\t\t\t"attr": "attribute_name",\r\n\t\t\t"data": "data"\r\n\t\t},\r\n\t\t{\r\n\t\t\t"attr": "attribute_name2",\r\n\t\t\t"data": ["data", "array"]\r\n\t\t}\r\n\t],\r\n\t"pipe":\r\n\t\t{\r\n\t\t\t"attrName1" : "Data in format dependent on type",\r\n\t\t\t"attrName2" : ["Data in format", "dependent on type"]\r\n\t\t}\r\n}\r\n\r\n\r\n\r\n#### Data from group of devices\r\n\r\nIf you want to listen to a group of devices, the "Options" property must contain a string group.\r\n\r\nIf a group of devices (output):\r\n\r\njson\r\n{\r\n\t"event": "read",\r\n\t"type_req":"group_attribute",\r\n\t"data":\r\n\t{\r\n\t\t"name/tango/device_from_group" :\r\n\t\t[\r\n\t\t\t{\r\n\t\t\t\t"attr": "attribute_name",\r\n\t\t\t\t"data": "data"\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\t"attr": "attribute_name2",\r\n\t\t\t\t"data": ["data", "array"]\r\n\t\t\t}\r\n\t\t]\r\n\t},\r\n\t"pipe":\r\n\t\t{\r\n\t\t\t"nameof/tango/device_from_group":\r\n\t\t\t{\r\n\t\t\t\t"attrName1" : "Data in format dependent on type",\r\n\t\t\t\t"attrName2" : ["Data in format", "dependent on type"]\r\n\t\t\t}\r\n\t\t}\r\n}\r\n\r\n\r\n#### Reading data from pipe\r\n\r\nInput message:\r\n\r\njson\r\n{ \r\n\t"type_req": "read_pipe or read_pipe_dev or read_pipe_gr",\r\n\t"pipe_name": "PipeName",\r\n\t"device_name": "!!!Only when reading from a specific device in a group mode!!!",\r\n\t"id": "Id to identify the request"\r\n}\r\n\r\n\r\n - "read_pipe" - Single device. If the property DeviceServer is device.\r\n - "read_pipe_dev" - Single device. If the property DeviceServer is group of devices.\r\n - "read_pipe_gr" - Group of devices. If the property DeviceServer is group of devices.\r\n \r\nOutput message:\r\n\r\nFor "read_pipe"\r\n\r\n json\r\n {\r\n \t"event": "read",\r\n \t"type_req": "read_pipe",\r\n \t"id_req": 1,\r\n \t"data": {\r\n \t\t"AttrName": "data",\r\n \t\t"AttrName2": ["data", "data"]\r\n \t}\r\n }\r\n\r\n \r\nFor "read_pipe_dev" in mode group:\r\n\r\n json\r\n {\r\n \t"event": "read",\r\n \t"type_req": "read_pipe_dev",\r\n \t"device_name": "name/tango/device_from_group",\r\n \t"id_req": "id",\r\n \t"data": {\r\n \t\t"AttrName": "data",\r\n \t\t"AttrName2": ["data", "data"]\r\n \t}\r\n }\r\n\r\n \r\n- For reading from all devices from the group "read_pipe_gr" in mode group:\r\n\r\n json\r\n {\r\n \t"event": "read",\r\n \t"type_req": "read_pipe_gr",\r\n \t"device_name": "name/tango/device_from_group",\r\n \t"id_req": "id",\r\n \t"data" : {\r\n \t\t"name/tango/device_from_group": {\r\n \t\t\t"AttrName": "data",\r\n \t\t\t"AttrName2": ["data", "data"]\r\n \t\t},\r\n \t\t"name/tango/other_device_from_group": "error message\xd0\xbe [or Message array]"\r\n \t}\r\n }\r\n\r\n \r\n#### Running commands\r\n\r\nThe list of available commands must be listed in the property Commands\r\n\r\njson\r\n{\r\n\t"type_req": "command or command_device or command_group",\r\n\t"id": "Request id",\r\n\t"device_name": "!!!Only when reading from a specific device in a group mode!!!",\r\n\t"command_name": "Command name",\r\n\t"argin" : "value or array"\r\n}\r\n\r\n\r\n - "command" - Single device. If the property DeviceServer is device.\r\n - "command_device" - Single device. If the property DeviceServer is group of devices.\r\n - "command_group" - Group of devices. If the property DeviceServer is group of devices.\r\n \r\n Output message:\r\n \r\n For "command"\r\n \r\n json\r\n{\r\n\t"event": "read",\r\n\t"type_req": "command",\r\n\t"id_req": "Request id",\r\n\t"data": {\r\n\t\t"command_name": "Command name",\r\n\t\t"argout": "value or array"\r\n\t}\r\n}\r\n\r\n\r\n For "command_device"\r\n \r\n json\r\n {\r\n \t"event": "read",\r\n \t"type_req": "command_device",\r\n \t"id_req": "Request id",\r\n \t"data": {\r\n \t\t"command_name": "Command name",\r\n \t\t"device_name": "name/tango/device_from_group",\r\n \t\t"argout": "value or array"\r\n \t}\r\n }\r\n\r\n \r\n For "command_group"\r\n \r\n json\r\n {\r\n \t"event": "read",\r\n \t"type_req": "command_group",\r\n \t"id_req": "Request id",\r\n \t"data": {\r\n \t\t"command_name": "Command name",\r\n \t\t"argout": {\r\n \t\t\t"name/tango/device_from_group" : "value or array",\r\n \t\t\t"name/tango/other_device_from_group": {\r\n \t\t\t\t"errors": "Possible error message, or [message array]"\r\n \t\t\t}\r\n \t\t}\r\n \t}\r\n }\r\n\r\n\r\n#### Write attribute\r\n\r\nThe list of writable attributes must be listed in the property Attributes with postfix ;wrt or ;onlywrt (if only for writing)\r\n\r\ntext\r\nAttributeName;wrt\r\nor\r\nAttributeName;onlywrt\r\n\r\n\r\nInput JSON:\r\n\r\njson\r\n{\r\n\t"type_req": "write_attr or write_attr_gr or write_attr_dev",\r\n\t"attr_name": "Attribute name",\r\n\t"device_name": "Device name if write_attr_dev",\r\n\t"id": "Request id",\r\n\t"argin": "value or [array]",\r\n\t"dimX": "only for Image type",\r\n\t"dimY": "only for Image type"\r\n}\r\n\r\n\r\nRequest types:\r\n \r\n - "write_attr" - Single device. If the property DeviceServer is device.\r\n - "write_attr_dev" - Single device. If the property DeviceServer is group of devices.\r\n - "write_attr_gr" - Group of devices. If the property DeviceServer is group of devices.\r\n \r\n Output message (if succesfull):\r\n \r\njson\r\n{\r\n\t"event":"read", \r\n\t"type_req": "write_attr", \r\n\t"id_req": 0, \r\n\t"resp": "Was written to the attribute."\r\n}\r\n\r\n \r\n "resp" Can contain devices for which the write operation is not successful (If using the group mode)\r\n \r\n## Client mode\r\n\r\nClient mode is everything except ser. (ser_cli_all_ro, ser_cli_all, ser_cli_ali_ro, ser_cli_ali, cli_all_ro, cli_all, cli_ali_ro, cli_ali)\r\n\r\nMore about the modes and list of modes here\r\n\r\n#### Timer control\r\n\r\nInput message for timer control\r\n\r\njson\r\n{\r\n "type_req" : "(always) Type request",\r\n "id_req": "(always) Request id",\r\n "msec": "(Depending on the type) Values for the timer in milliseconds (int). minimum 1000",\r\n "devices" : "(Depending on the type) object or value or array",\r\n "group": "(Depending on the type) object or value"\r\n}\r\n\r\n\r\nTypes of requests:\r\n\r\n - timer_start - Start the timer. Also should be sent "msec": value and devices (object)\r\n - timer_stop - Stop the timer. Request type only.\r\n - timer_change - Changes in the data update period. Also should be sent "msec": value\r\n - timer_add_devs - Adding devices to the list of listeners. Also should be sent devices (object)\r\n - timer_remove_devs - Removal of devices from the list of listeners. Also should be sent devices (value or array)\r\n - timer_upd_devs_add - Adding attributes or pipe. If the device is already in the list. Also should be sent devices (object)\r\n - timer_upd_devs_rem - Removing attributes or pipe. If the device is already in the list. Also should be sent devices (object)\r\n - timer_check - Check the status of the timer.\r\n \r\nFor devices and group of object type:\r\n\r\njson\r\n{\r\n\t"other" : "data",\r\n\t"devices": {\r\n\t\t"name/of/device": {\r\n\t\t\t"attr": "attribute name or array of names",\r\n\t\t\t"pipe": "PipeName and (If it is needed) Properties for attributes"\r\n\t\t}\r\n\t},\r\n\t"group": {\r\n\t\t"pattern/for/group*": {\r\n\t\t\t"attr": "attribute name or array of names",\r\n\t\t\t"pipe": "PipeName and (If it is needed) Properties for attributes"\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\nA group can contain only one key. A device can contain any number of keys\r\n\r\nYou can specify the output frequency (Once in N iterations) and the iteration in which the output is made. Read more here \r\n\r\nFor devices a value type or an array, and group a value type\r\n\r\njson\r\n{\r\n\t"other" : "data",\r\n\t"devices" : "name/of/device or Array of names",\r\n\t"group": "pattern/for/group*"\r\n}\r\n\r\n\r\nOutput message:\r\n\r\njson\r\n{\r\n\t"event": "read",\r\n\t"type_req": "from_timer",\r\n\t"data": {\r\n\t\t"name/of/tangodevice": {\r\n\t\t\t"attrs": [{\r\n\t\t\t\t"attr": "Attribute name",\r\n\t\t\t\t"data": "value or array"\r\n\t\t\t}, {\r\n\t\t\t\t"attr": "Name of another attribute",\r\n\t\t\t\t"data": "value or array"\r\n\t\t\t}],\r\n\t\t\t"pipe": {\r\n\t\t\t\t"Attribute name": "value or array",\r\n\t\t\t\t"Name of another attribute": "value or array"\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n\r\n\r\n#### Reading data from attributes and pipe\r\n\r\nInput message:\r\n\r\njson\r\n{\r\n\t"type_req": "attr_device_cl or attr_group_cl",\r\n\t"id": "Request id",\r\n\t"device_name": "Name of the device or alias or pattern for group",\r\n\t"attributes": "attribute name or array of names",\r\n\t"pipe": ["pipe_name","attr_name;param"]\r\n}\r\n\r\n\r\n"type_req" : \r\n - attr_device_cl - for device\r\n - attr_group_cl - for group\r\n\r\nIn order to read data from all attributes of the tango module.\r\n\r\n\r\n"attributes": "__all_attrs__"\r\n\r\n\r\nOutput message:\r\n\r\nFor device:\r\njson\r\n{\r\n\t"event": "read",\r\n\t"type_req": "attr_device_cl",\r\n\t"device_name": "device_name or alias",\r\n\t"id_req": "Request id",\r\n\t"data": {\r\n\t\t"attrs":\r\n\t\t\t[\r\n\t\t\t\t{\r\n\t\t\t\t\t"attr": "Attribute name",\r\n\t\t\t\t\t"data": "value or array",\r\n\t\t\t\t\t"dimX": "for spectrum or image",\r\n\t\t\t\t\t"dimY": "for image"\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t"pipe": {\r\n\t\t\t"attr_name": "value or array",\r\n\t\t\t"attr_name_2": "value or array"\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\nFor Group: \r\njson\r\n{\r\n\t"event": "read",\r\n\t"type_req": "attr_group_cl",\r\n\t"id_req": "Request id",\r\n\t"data": {\r\n\t\t"attrs": {\r\n\t\t\t"device_name": [\r\n\t\t\t\t{\r\n\t\t\t\t\t"attr": "Attribute name",\r\n\t\t\t\t\t"data": "value or array",\r\n\t\t\t\t\t"dimX": "for spectrum or image",\r\n\t\t\t\t\t"dimY": "for image"\r\n\t\t\t\t}\r\n\t\t\t]\r\n\t\t},\t\t\t\r\n\t\t"pipe": {\r\n\t\t\t"device_name": {\r\n\t\t\t"attr_name": "value or array",\r\n\t\t\t"attr_name_2": "value or array"\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n#### Client running of commands\r\n\r\nIf the mode is not "read-only"\r\n\r\nInput message:\r\n\r\njson\r\n{\r\n\t"type_req": "command_device_cl",\r\n\t"id": "Request id",\r\n\t"device_name": "name/of/device or alias",\r\n\t"command_name": "Command name"\r\n}\r\n\r\n\r\nOutput message:\r\n\r\njson\r\n{\r\n\t"event": "read",\r\n\t"type_req": "command_device_cl",\r\n\t"id_req": "Request id",\r\n\t"data": {\r\n\t\t"command_name": "Command name",\r\n\t\t"device_name": "name/of/device or alias",\r\n\t\t"argout": "value or array"\r\n\t}\r\n}\r\n\r\n\r\n#### Client attribute writing\r\n\r\nIf the mode is not "read-only"\r\n\r\nInput JSON:\r\n\r\njson\r\n{\r\n\t"type_req": "write_attr_dev_cl",\r\n\t"attr_name": "Attribute name",\r\n\t"device_name": "Device name",\r\n\t"id": "Request id",\r\n\t"argin": "value or [array]",\r\n\t"dimX": "only for Image type",\r\n\t"dimY": "only for Image type"\r\n}\r\n\r\n\r\nOutput message (if succesfull):\r\n\r\njson\r\n{\r\n\t"event": "read", \r\n\t"type_req": "write_attr_dev_cl", \r\n\t"id_req": 0, \r\n\t"resp": "Was written to the attribute."\r\n}\r\n\r\n\r\n## Work with events\r\n\r\nSubscription to events is possible in all modes.\r\n\r\nThe following event types are currently supported: CHANGE_EVENT, PERIODIC_EVENT, ARCHIVE_EVENT, USER_EVENT\r\n\r\nTo subscribe to events in server mode, set values to property list for defining Tango device.\r\n\r\nEvent data comes in the following format:\r\n\r\njson\r\n{\r\n\t"event": "read",\r\n\t"type_req": "from_event",\r\n\t"event_type": "Event type",\r\n\t"timestamp": 1501324867,\r\n\t"attr": "attribute name",\r\n\t"data": "value or array"\r\n}\r\n\r\n\r\n\r\n#### Subscribing to events\r\n\r\nOnly for client mode!\r\n\r\nThe following event types are currently supported: CHANGE_EVENT, PERIODIC_EVENT, ARCHIVE_EVENT, USER_EVENT\r\n\r\nTo subscribe to events, you need to send a message in this format\r\n\r\njson\r\n{\r\n\t"type_req": "eventreq_add_dev",\r\n\t"id": "id",\r\n\t"change": {\r\n\t\t"name_of_device": "atrribute_name or array of names",\r\n\t\t"name_of_other_device": "atrribute_name"\r\n\t},\r\n\t"periodic": {\r\n\t\t"name_of_device": "atrribute_name or array of names",\r\n\t\t"name_of_other_device": "atrribute_name"\r\n\t},\r\n\t"user": {\r\n\t\t"name_of_device": "atrribute_name or array of names",\r\n\t\t"name_of_other_device": "atrribute_name"\r\n\t},\r\n\t"archive": {\r\n\t\t"name_of_device": "atrribute_name or array of names",\r\n\t\t"name_of_other_device": "atrribute_name"\r\n\t}\r\n}\r\n\r\n\r\nThe answer in case of success:\r\n\r\njson\r\n{\r\n\t"event":"read",\r\n\t"type_req": "eventreq_add_dev", \r\n\t"id_req": 2, \r\n\t"resp": [\r\n\t\t{\r\n\t\t\t"device": "name/of/device", \r\n\t\t\t"attribute": "attribute name", \r\n\t\t\t"event_type": "Event type", \r\n\t\t\t"event_sub_id": 2\r\n\t\t}\r\n\t]\r\n}\r\n\r\n\r\nHere "event_sub_id" is the event subscription id. It can be used to further unsubscribe from the event.\r\n\r\n\r\nEvent data comes in the following format:\r\n\r\njson\r\n{\r\n\t"event": "read",\r\n\t"type_req": "from_event",\r\n\t"event_type": "Event type",\r\n\t"timestamp": 1501324867,\r\n\t"attr": "attribute name",\r\n\t"data": "value or array"\r\n}\r\n\r\n\r\n#### Full unsubscription from events\r\n\r\nOnly for client mode!\r\n\r\nTo unsubscribe from all events subscribed to, you need to send a message:\r\n\r\njson\r\n{\r\n\t"type_req": "eventreq_off",\r\n\t"id": "id"\r\n}\r\n\r\n\r\n#### Partial unsubscription from events\r\n\r\nOnly for client mode!\r\n\r\nTo unsubscribe from individual events, you need to send:\r\n\r\njson\r\n{\r\n\t"type_req": "eventreq_rem_dev",\r\n\t"id": "id",\r\n\t"event_sub_id": 12345\r\n}\r\n\r\n\r\nHere "event_sub_id" is the event subscription id.\r\n\r\n#### Get the subscriber id\r\n\r\nOnly for client mode!\r\n\r\nIf you want to get the subscriber id, send\r\n\r\njson\r\n{\r\n\t"type_req": "eventreq_check_dev",\r\n\t"id": "id",\r\n\t"device": "name/of/device", \r\n\t"attribute": "attribute name", \r\n\t"event_type": "Event type"\r\n}\r\n\r\n\r\nThe answer in case of success:\r\n\r\njson\r\n{\r\n\t"event":"read",\r\n\t"type_req": "eventreq_check_dev", \r\n\t"id_req": 2, \r\n\t"data":\r\n\t{\r\n\t\t"device": "name/of/device", \r\n\t\t"attribute": "attribute name", \r\n\t\t"event_type": "Event type", \r\n\t\t"event_sub_id": 1234\r\n\t}\r\n}\r\n\r\n\r\n\r\nIf the subscription is not found, the value for "event_sub_id" will be -1\r\n\r\n## Authorization and authentication\r\n\r\nTo execute the command, the client must be authenticated.\r\n\r\nAuthorization and authentication are performed in the Device AuthDS.\r\n\r\n#### Method SIMPLE\r\n\r\nws(wss)://ip_or_hostname:port?login=zzz&password=zzz\r\n\r\nDevice AuthDS must contain method check_user(const Tango::DevVarStringArray (*argin) and return true or false.\r\n\r\n * \(\*argin)[0] = login\r\n * \(\*argin)[1] = password\r\n \r\nAlso the server should contain the method check_permissions(const Tango::DevVarStringArray *argin), used for authentication. return true or false.\r\n \r\n * \(\*argin)[0] \xe2\x80\x94 Device name\r\n * \(\*argin)[1] \xe2\x80\x94 Running command\r\n * \(\*argin)[2] \xe2\x80\x94 Ip\r\n * \(\*argin)[3] \xe2\x80\x94 login \r\n\r\n#### Method USERANDIDENT\r\n\r\nws(wss)://ip_or_hostname:port?login=yyy&rand_ident=yyy&rand_ident_hash=yyy\r\n\r\nTo activate this feature, you need to define tident=rndid in Property "Options"\r\n\r\nDevice AuthDS must contain method check_user_ident(const Tango::DevVarStringArray *argin) and return true or false.\r\n\r\n * \(\*argin)[0] \xe2\x80\x94 login\r\n * \(\*argin)[1] \xe2\x80\x94 rand_ident. Random number/word stored/generated by the client\r\n * \(\*argin)[2] \xe2\x80\x94 rand_ident_hash. For example MD5(rand_ident+login)\r\n \r\n#### Method USERANDIDENT2\r\n\r\n__2-step verification__\r\n\r\nTo activate this feature, you need to define tident=rndid2 in Property "Options"\r\n\r\nThe same as in Method USERANDIDENT, but authentication will be after connecting\r\n\r\nAuthentication is executed in several stages.\r\n\r\nRequests must be made sequentially\r\n\r\nFirst. To start the authorization process, the user must send a message requesting a random number.\r\n\r\n json\r\n {\r\n "type_req": "rident_req",\r\n "id": "Request id",\r\n "login": "login"\r\n }\r\n\r\n \r\nSecond. The server generates a random number, stores it. Sends the following type of response to the client:\r\n\r\n json\r\n {\r\n \t"event": "read",\r\n \t"type_req": "rident_req",\r\n \t"id_req": "Request id",\r\n \t"rident": "random number"\r\n }\r\n\r\n \r\nThird. The client calculates (depending on the requirements of the authorization module) the required response, and sends it to the server.\r\n\r\n json\r\n {\r\n \t"type_req": "rident_ans",\r\n \t"id": "Request id",\r\n \t"rident_hash": "For example MD5(random_number_from_request+login)"\r\n }\r\n\r\n \r\nFinish. The server will send a response:\r\n\r\n json\r\n {\r\n \t"event": "read",\r\n \t"type_req": "rident_ans",\r\n \t"id_req": "Request id",\r\n \t"success": "true or false"\r\n }\r\n\r\n \r\n#### Method USERANDIDENT3\r\n\r\nThe same as in Method USERANDIDENT, but authentication will be after connecting\r\n\r\nTo activate this feature, you need to define tident=rndid3 in Property "Options"\r\n\r\nTo authorize, send:\r\n\r\n json\r\n {\r\n \t"type_req": "rident",\r\n \t"id": "Request id",\r\n \t"login": "login",\r\n \t"rident": "rand_ident",\r\n \t"rident_hash": "rand_ident_hash"\r\n }\r\n\r\n \r\nThe server will send a response:\r\n \r\n json\r\n {\r\n \t"event": "read",\r\n \t"type_req": "rident",\r\n \t"id_req": "Request id",\r\n \t"success": "true or false"\r\n }\r\n \r\n\r\n## Logging\r\n\r\nTo activate this feature, you need to define uselog in Property "Options"\r\n\r\nDevice AuthDS must contain method send_log_command_ex(const Tango::DevVarStringArray *argin)\r\n\r\n - id - autoincrement\r\n - argin[0] = timestamp_string (UNIX_TIMESTAMP)\r\n - argin[1] = login\r\n - argin[2] = deviceName (or group)\r\n - argin[3] = IP\r\n - argin[4] = commandName \r\n - argin[5] = command in Json (\xd0\xb2\xd0\xb2\xd0\xbe\xd0\xb4\xd0\xb8\xd0\xbc\xd0\xb0\xd1\x8f \xd0\xba\xd0\xbe\xd0\xbc\xd0\xb0\xd0\xbd\xd0\xb4\xd0\xb0 \xd0\xb2 json \xd1\x84\xd0\xbe\xd1\x80\xd0\xbc\xd0\xb0\xd1\x82\xd0\xb5)\r\n - argin[6] = statusBool (true if successful, otherwise false)\r\n - argin[7] = isGroup (true if group, otherwise false)\r\n\r\n## Additional parameters for attributes, pipe and commands\r\n\r\nUsed in server mode\r\n\r\nTo add additional parameters, add in the postfix property\r\n\r\n\r\nCommandOrAttrName;par1=val\r\n\r\n\r\nor for several parameters\r\n\r\n\r\nCommandOrAttrName;par1=val;par2;par3=34\r\n\r\n\r\nWhere par - is parameter, val - is value if required.\r\n\r\nFor pipe from updating data (property PipeName):\r\n\r\n\r\nPipeName\r\nAttrName;par1=val;par2\r\n\r\n\r\nIn the case of pipe in command mode (when requested) , parameters for individual attributes are set to property Commands. The name of the attribute must be appended with ;pipecomm, as well as the required parameter.\r\n\r\n\r\nAttrName;pipecomm;par1=val;par2\r\n\r\n\r\nList of currently available parameters for commands and attributes:\r\n\r\n - For attributes, commands and pipe: precf, precs, prec\r\n - Only for attributes: niter\r\n - Only for command: bindata\r\n \r\n#### Changing the precision and formatting the output values of attributes, pipe, and commands\r\n\r\nBy default, setprecision(5) is used to output attribute, pipe, and command data.\r\n\r\nTo set other precision values, add a postfix ;prec=N to the attribute name. \r\n\r\nN is the required precision.\r\n\r\n\r\nAttributeOrCommandName;prec=10\r\n\r\n\r\nIt is also possible to set additional formatting flags:\r\n\r\n- precf - Setting the flag std::fixed\r\n- precs - Setting the flag std::scientific\r\n\r\nExample output for 1476379200 (type double with precision = 10)\r\n\r\n- ;prec=10 - output: 1476379200\r\n- ;precf=10 - output: 1476379200.0000000000\r\n- ;precs=10 - output: 1.4763792000e+009\r\n\r\nExample output for 1476379200 (type double with precision by default)\r\n- ;precf - output: 1476379200.000000\r\n- ;precs - output: 1.476379e+009\r\n\r\n#### Setting the periodicity of the output of values for attributes\r\n\r\nUsed in server mode or for timer\r\n\r\nFor individual attributes, you can set the frequency of the output. To set the periodicity for the attribute name in the property (or in input message for timer), add ;niter=N/M or ;niter=N\r\n\r\n - N - Output once in N iterations. (unsigned short)\r\n - M - The iteration number at which the value is displayed.\r\n \r\nM should be less than N. The default value for M is 0.\r\n\r\n## The format of the returned error messages\r\n\r\nReading attributes in server mode:\r\n\r\njson\r\n{\r\n\t"event": "error",\r\n\t"type_req": "attribute",\r\n\t"err_mess": "\xd0\xa1\xd0\xbe\xd0\xbe\xd0\xb1\xd1\x89\xd0\xb5\xd0\xbd\xd0\xb8\xd0\xb5 \xd0\xbe\xd1\x88\xd0\xb8\xd0\xb1\xd0\xba\xd0\xb8"\r\n}\r\n\r\n\r\nOther Requests:\r\n\r\njson\r\n{\r\n\t"event": "error",\r\n\t"type_req": "Request Type",\r\n\t"name_req": "Request Name (If used)",\r\n\t"id_req": "Request id",\r\n\t"err_mess": "message or [Message array]"\r\n}\r\n\r\n\r\n## Property list for defining Tango device\r\n\r\n - Mode \xe2\x80\x94 Device operating mode. Device operating mode; (string) \r\n - Port \xe2\x80\x94 Listening port at connection; (DevShort)\r\n - DeviceServer - tango id of the used device. As template parameter may serve simple name of a device or name pattern for group (e.g., domain_*/family/member_*). Used only if any server mode is selected. ; (string)\r\n - Attributes \xe2\x80\x94 \xe2\x80\x94 a list of device attributes you want to read, if reading all attributes is required, add all_attrs (not operational in group mode) Used only if any server mode is selected. ; (array of string)\r\n - Commands \xe2\x80\x94 a list of device commands you want to execute through WS. Used only if any server mode is selected. ; (array of string)\r\n - PipeName - Name of DevicePipe for reading. [0]\r\nWhen using GROUP, the DevicePipe name must be the same for all devices.\r\nIf you want to set properties for specific attributes, add them in the format NameAttr;property\r\nUsed only if any server mode is selected. ; (array of string)\r\n - AuthDS \xe2\x80\x94 Tango web authentication device server (TangoWebAuth ) name.\r\nResponsible for user authentication in case of commands execution ; (string)\r\n - Secure \xe2\x80\x94 Shall we use SSL encryption?\r\nSet true, for secure wss connection, otherwise false; (bool)\r\n - Certificate \xe2\x80\x94 Full path to the certificate in use (if Secure == true); (string)\r\n - Key - Full path to the file used with Private key (if Secure == true); (string)\r\n - MaxNumberOfConnections - maximum number of connections. If the limit is reached, further connections will be lost with 400 Bad Request error. If 0 is set, the number of connections will be unlimited. ; (DevUShort)\r\n - MaximumBufferSize - maximum buffer size for each connection, KiB. The Default value is 1000. Possible values range from1 to 10000 (if setting a value outside the range, the default value will be set). If exceeding the set maximum buffer size, the connection will be lost by the server; (DevULong)\r\n - ResetTimestampDifference - The difference in timestamps (seconds) after which a WS server is reset. The difference is counted by CheckPoll method between update timestamp in UpdateData method and current timestamp. Minimum value is 60. \r\nDefault and MinValue = 60\r\nUsed only if any server mode is selected ; (DevUShort)\r\n - Options - additional options. A list of additional options for the device. (array of string)\r\n - list_subscr_event_change - List of subscriptions to change events. Used only if any server mode is selected.; (array of string)\r\n - list_subscr_event_periodic - List of subscriptions to periodic events. Used only if any server mode is selected.; (array of string)\r\n - list_subscr_event_user - List of subscriptions to user events. Used only if any server mode is selected.; (array of string)\r\n - list_subscr_event_archive - List of subscriptions to archive events. Used only if any server mode is selected.; (array of string)\r\n \r\n## Device operating mode\r\n\r\nTango module works in one of the following modes:\r\n\r\n - SERVER - Only server control of the output of information read from the attributes and pipe. And also the execution of commands in the tango-module (or group), registered in the Property. In this mode, the module is started by default. mode: ser.\r\n - SERVNCLIENT_ALL_RO - Server and client management of the output of information read from the attributes and pipe. And also the execution of commands in the tango-module (or group), registered in the Property; mode: ser_cli_all_ro.\r\n - SERVNCLIENT_ALL - Server and client management of the output of information read from the attributes and pipe. Running the commands in the tango module (or group) specified in the Property. Also the execution of commands and reading of attributes from any tango modules; mode: ser_cli_all\r\n - SERVNCLIENT_ALIAS_RO - Server and client management of the output of information read from the attributes and pipe. Running the commands in the tango module (or group) specified in the Property. It is forbidden to run commands in the modules specified by the client. Reading attributes only from tango modules that have alias; option: ser_cli_ali_ro\r\n - SERVNCLIENT_ALIAS - Server and client management of the output of information read from the attributes and pipe. Running the commands in the tango module (or group) specified in the Property. Reading attributes and the execution of commands only from tango modules that have alias; mode: ser_cli_ali\r\n - CLIENT_ALL_RO - Client control of the output of information read from the attributes and pipe. When using this mode, only the user-defined data comes from the server. Also it is forbidden to run commands; mode: cli_all_ro\r\n - CLIENT_ALL - Client control of the output of information read from the attributes and pipe. When using this mode, only the user-defined data comes from the server. It is possible to start commands on any tango-modules; mode: cli_all\r\n - CLIENT_ALIAS_RO - Client control of the output of information read from attributes and pipe only from tango modules that have alias. When using this mode, only the user-defined data comes from the server.; mode: cli_ali_ro\r\n - CLIENT_ALIAS - Client control of the output of information read from attributes and pipe, only from tango modules that have alias. When using this mode, only the user-defined data comes from the server. It is also possible to run commands only from tango modules that have alias; mode: cli_ali'

23 Oct 2017, Vladimir Elkin
Updated:
The device class has been updated.
You are looking at this version now.



23 Oct 2017, Vladimir Elkin
Updated:
The device class has been updated.
You can see previous version here .



27 Jun 2017, Vladimir Elkin
Updated:
The device class has been updated.
You can see previous version here .



21 May 2017, Igor Khorkhriakov
Reverted:
Recent update of device classes in this device server has been verified by Igor Khorkhriakov.




21 May 2017, Vladimir Elkin
Created:
The device class has been added to catalogue.
Added by:velkin on:23 Oct 2017, 10:17 a.m.