tencent cloud

All product documents
Operation Permission Management
Last updated: 2025-02-11 16:47:06
Operation Permission Management
Last updated: 2025-02-11 16:47:06
Note:
Operation permission management is used to manage the permissions for remote devices to send control messages to field device. When multiple remote devices have permissions to control a certain field device, operation permission can be used to ensure that only one remote device can send control messages to the field device at a time, ensuring the security of operations.

Concepts

Permission Type

1. Guest Permission
The remote device acts as a spectator, it can only view audio and video content from the field device and receive reported data from it, but cannot send control messages to the field device or speak to the field device.
2. Master Permission
The remote device acts as a controller, it can both view audio and video content from the field device, receive reported data, and send control messages to the field device.
Note:
Currently, the field device SDK restricts that only one remote device can be authorized as master permission at a time.
When the field device SDK authorizes a remote device as master permission, other connected remote devices will automatically convert to guest permission.

Basic Process

1. The remote device sends a permission request to the field device for permission. 0 is for guest permission, and 1 is for master permission.
2. The field device authorizes the remote device based on the callback of the remote device's permission request and sends an permission notification to the relevant remote devices.
3. The remote device can determine the current permission status based on the permission notification from the field device.




Authorization Mode

The remote device SDK and the field device SDK can configure whether the authorization mode is automatic mode respectively. The specific configuration JSON field is auto_permission. When set to 1, it is automatic authorization mode. When set to 0, it is application authorization mode. The default configuration is automatic authorization mode.

Automatic Authorization Mode

The application does not need to handle authorization. The SDK will automatically handle the authorization process based on the following default logic:
When the remote device sets the authorization mode to automatic, it will automatically send a master permission request to the connected field device when initiating a connect request.
When the field device sets the authorization mode to automatic, it will automatically handle the authorization for the remote device according to the requested permissions from the remote device upon receiving the permission request.

Application Authorization Mode

The SDK provides relevant authorization interfaces. The application needs to call these interfaces to handle the authorization process:
The remote device SDK will not automatically send master permission requests. The application needs to explicitly call the permission request interface to request master permission from the field device.
The field device SDK will not automatically handle permission requests. The application needs to explicitly call the set permission interface to authorize the remote device based on the permission request and the application-defined authorization rules.

Authorization Interface

Remote Device

Registers the permissions change notification

/*
* Callback Registration Function
* context Context pointer, this pointer will be returned during the callback
* callback Registered TRRO_OnOperationPermissionState Callback Function
*/

extern "C" TRRO_EXPORT void TRRO_registerOnOperationPermissionState(void* context, TRRO_OnOperationPermissionState* callback);


/*
* #name : TRRO_OnOperationPermissionState
* @brief : Callback for permissions state notification
* @input : context Callback context pointer, returned when the registration callback function is invoked
* field_devid the field device ID
* self_permission The current permissions type of this remote device, refer to TrroPermission, 0 is guest, only view permission, 1 is master, has full operation permission
* master_devid Remote device ID with master permissions
* @return : void
*/
typedef void STD_CALL TRRO_OnOperationPermissionState(void* context, const char* field_devid, int self_permission, const char* master_devid);

Request for permissions of target field device

/*
* @name : TRRO_requestPermission
* @brief : Send permission request to the field device, the field device will respond with TRRO_OnOperationPermissionState to update permissions
* @input : gwid Target field device ID
* permisson Refer to the structure TrroPermission
* @return : successful 1; failed <= 0
*/
extern "C" TRRO_EXPORT int TRRO_requestPermission(const char* gwid, int permisson);

Field Device

Register callback for remote device permission request notification

This interface is used for the field device to receive permission requests from the remote device.
/**
* @name TRRO_registerOperationPermissionRequest
* @brief Register callback for remote device control permission request notification
* @param[in] context //Application context
* @param[in] callback Callback function
* @return 1 for success, other failed
*/
extern "C" TRRO_EXPORT int TRRO_registerOperationPermissionRequest(void *context, TRRO_onOperationPermissionRequest *callback);

Parameter
Meaning
remote_devid
target remote device id
permission
TRRO_onOperationPermissionRequest Callback function
/**
* @name TRRO_onOperationPermissionRequest
* @brief Notification of remote device control permission request
* @param[in] remote_devid Remote device ID requesting permission
* @param[in] permission Requested permission, refer to TrroPermission, 0: guest (view only), 1: master (full control)
* @return void
*/
typedef void TRRO_onOperationPermissionRequest(void* context, const char* remote_devid, int permission);
Parameter
Meaning
remote_devid
target remote device id
remote_devid
Remote device ID requesting permission
permission
Requested permission, refer to TrroPermission:
0:guest (view only)
1:master (full control permission)

Set remote device operation permissions

This interface is used to set the remote device operation permissions on the field device.

/**
 * @name TRRO_setOperationPermission
 * @brief Sets the control permission for remote devices. Currently, only one remote device can have master permission at a time. If a remote device already has master permission, calling this interface to set master permission will automatically revoke the master permission from the previous device and set it for the new device;
 * @param[in] remote_devid Remote device ID to set permissions
 * @param[in] permission Refer to TrroPermission, 0: guest (view only), 1: master (full control)
 * @return 1 for success, other failed
 */
extern "C" TRRO_EXPORT int TRRO_setOperationPermission(const char* remote_devid, int permission);

Parameter
Meaning
remote_devid
target remote device id
permission
the permission to be set

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon