Translation is not finished yet
Перевод ещё не закончен Русская версия здесь
For successful compilation TANGO libraries and a c++11 compiler must be installed. libboost-system-dev libssl must also be installed. The 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 (default. Correct if necessary).
As a default, compilation runs in OPTIMIZED (-O2) mode. For compilation in DEBUG (-g -D_DEBUG) mode, start make RTYPE=debug, inputting make clean
In this type of module, the listening device and attributes are written in the properties
More about server mode
Makefile is in the directory ./server_mode/
In this type of module, the listening device and attributes are completely specified by the client. Actions require special client commands in JSON format
More about client mode
Makefile is in the directory ./client_mode/
The property Options
(array of strings) for the TANGO device has the format opt1
or opt2 = val
, where opt
is the option name, val
is the value, if required.
List of possible options:
-
group - No value. Use a Tango Group. The
DeviceServer
property must be set in a group-appropriate format -
uselog - No value. Using logging when executing commands. For more details
-
useoldjson- No value. Old type answers (Previous verions)
-
tident- With value. The type of authorization used. Two types are used ,
permission_www
(For more details), andsmpl
- SIMPLE (by default) -
command_name_for_check_user- With value. Other command name for check user. By default
check_user
. Example:command_name_for_check_user=NEW_COMMAND_NAME
-
command_name_for_check_permission- With value. Other command name for check permissions. By default
check_permissions
. Example:command_name_for_check_permission=NEW_COMMAND_NAME
-
command_name_for_log- With value. Other command name for logging. По умолчанию
send_log_command_ex
. Example:command_name_for_log=NEW_COMMAND_NAME
-
maxnconn- The maximum number of connections. If the limit is reached, subsequent connections will be aborted with a 400 Bad Request error. If set to 0, the number of connections will not be limited.
-
maxbuffsize-The maximum buffer size for each connection in KiB. By default 1000. Possible values from 1 to 10000
To execute the command, the client must be authenticated.
Authorization and authentication are performed in the Device AuthDS
.
login and password must be written to URL ws(wss)://ip_or_hostname:port?login=zzz&password=zzz
or after connection:
{
"type_req": "change_user_smpl",
"id": "Request id",
"login": "login",
"password": "password"
}
Device AuthDS
must contain method check_user(const Tango::DevVarStringArray (*argin)
and return true or false.
If you want to change the name of method, you need to define command_name_for_check_user=NEW_NAME_FOR_CHECK_USER_METHOD
in Property "Options"
- argin[0] - login
- argin[1] - password
Also the server should contain the method check_permissions(const Tango::DevVarStringArray *argin)
, used for authentication. return true or false.
If you want to change the name of method, you need to define command_name_for_check_permission=NEW_NAME_FOR_CHECK_PERMISSIONS_METHOD
in Property "Options"
- argin[0] — Device name
- argin[1] — Running command
- argin[2] — Ip
- argin[3] — login
Property Options
must contain tident=permission_www
.
When using this method, only authorization is performed. Authentication takes place automatically when sending any " login "
and " password "
Data is sent to authProxy->command_inout("check_permissions_www", argin);
5 values are passed to check_permissions_www
:
- argin[0] - login
- argin[1] - password
- argin[2] - device name
- argin[3] - command name +
"/write"
, for examplecommand_name/write
- argin[4] - IP
For activate this feature, you need to define uselog
in Property "Options"
Device AuthDS
must contain method send_log_command_ex(const Tango::DevVarStringArray *argin)
- id - autoincrement
- argin[0] = timestamp_string (UNIX_TIMESTAMP)
- argin[1] = login
- argin[2] = deviceName (or group)
- argin[3] = IP
- argin[4] = commandName
- argin[5] = command in Json (вводимая команда в json формате)
- argin[6] = statusBool (true if successful, otherwise false)
- argin[7] = isGroup (true if group, otherwise false)
Precision options are set in different ways, depending on the recipient.
For requests, setting the additional key precision
, the format of which depends on the type of request. It is either an object or a value.
To set the precision values of attributes from Property
, add ; prec = N
to the attribute name in the property, where N is the required precision. Example: AttrDevDouble; prec = 10
More details about double can be found here, about float here.
It is also possible to set additional formatting flags:
- precf - Setting the flag std::fixed
- precs - Setting the flag std::scientific
Example output for 1476379200 (type double with precision = 10)
- prec=10 - output: 1476379200
- precf=10 - output: 1476379200.0000000000
- precs=10 - output: 1.4763792000e+009
Example output for 1476379200 (type double with precision by default)
- precf - output: 1476379200.000000
- precs - output: 1.476379e+009
{
"event": "error",
"type_req": "Type of request",
"id_req": "Request id. If it was",
"err_mess": "Or string, or array of string or object",
"type_err": "type of error"
}
type_err
- type of error. Possible types of errors listed below
- init_failed - Listening device initialization error
- auth_check - Authentication error. wrong login or password
- auth_perm - Authentication error. No access
- auth_server_err - Authentication error. Server is not available
- is_not_valid - Invalid request
- not_supp - No support. For example, for a command with a given type of argument
- not_supp_in_curr - No support in the current mode
- unknown_req_type - Unknown request type
- check_request - Check the request. Invalid format or required key not found
- tango_exc - TANGO exception
- unavailable_devs - All device unavailable
- event_err - Exception from TANGO events data
- event_dev_err - Exception from listened device
- check_code - This type of error should not be reported during normal operation.
- subscr_not_found - No subscription found with the given id. May occur when unsubscribing from events
- commun_failed - Tango::CommunicationFailed
- conn_failed - Tango::ConnectionFailed
- unknown_exc - Unknown type exception
- not_subscr_yet - No subscribers yet. Occurs with commands for managing subscriptions, if there were no subscriptions yet.
- from_event_sub - An error occurred when subscribing to events in server mode
- device_not_in_group - Request to a device not from the group