Interfaces | Description |
TRRO_initJsonPath | Initialize the SDK using a JSON configuration file path |
TRRO_initJson | Initialize the SDK using a JSON string |
TRRO_destroy | Destroy the SDK. |
Interfaces | Description |
TRRO_getGwList | Retrieves a list of online field devices with session permissions. |
TRRO_getGwInfo | Retrieves detailed information about a specific field device, requiring session permissions for that device. |
Interfaces | Description |
TRRO_setWindows | associate the video receiver handle with the video rendering window handle |
TRRO_connectField | pull the video streams from field devices using specified video receiveres |
TRRO_disconnect | disconnect specified video receivers |
TRRO_disconnectAll | disconnect all the video receivers |
TRRO_SetRenderConfig | updates the video rendering options, e.g. super-resolution, low light enhancement, rotation, and mirroring. |
TRRO_fieldDeviceEncodeConfig | updates the encoding parameters for the specifie video stream of the field device. |
TRRO_startMediaPush | bypass push the received video to the target rtmp url |
TRRO_stopMediaPush | stop the bypass video push |
Interfaces | Description |
TRRO_registerRemoteFrameCallback | register the decoded raw video image callback, default YUVI420 format. |
TRRO_registerRemoteEncodedFrameCallback | register the received encoded video frame callback |
TRRO_useExternalDecoder | indicate the external video decoder to SDK, which will disable internal decoder and do not callback the raw video image |
TRRO_externAudioData | externally input the audio data (PCM data) for audio transmission |
TRRO_audioMute | mute / unmute the specified field device audio |
Interfaces | Description |
TRRO_sendControlData | send the binary message to the specified field device |
TRRO_registerReportDataCallback | register the callback function for receiving the binary message from field devices |
Interfaces | Description |
TRRO_requestPermission | send the operation permission request to the specified field device, e.g. master permission or guest permission (watch only) |
TRRO_registerOnOperationPermissionState | register the callback function for receiving the permission state update notification from field device |
Interfaces | Description |
TRRO_registerAllLatencyCallback | register the callback function for various latency monitoring, e.g. video tranmission or control latency |
TRRO_registerSignalStateCallback | register the callback function for monitoring the server access state of remote device |
TRRO_registerOnState | register the callback function for monitoring the video link state of remote device |
TRRO_registerOnMediaStateInfo | register the callback function for monitoring video transmission and network status of remote device |
TRRO_registerOnAudioMediaStateInfo | register the callback function for monitoring video transmission and network status of remote device |
TRRO_registerFieldSideNetworkState | register the callback function for retrieving the network status of field device |
Interfaces | Description |
TRRO_registerLogCallback | register the callback function for retrieving the sdk log data |
TRRO_diagRequest | start the end-to-end diagnosis for checking the video transmission problem of the connected field device |
TRRO_registerOnDiagReport | register the callback function for retrieving the diagnosis report, which is helpful for problem positioning |
Interfaces | Description |
TRRO_I4202ARGB | transform image data from the I420 color format to ARGB color format |
Interfaces | Description |
TRRO_getVersion | get the SDK version |
/*SDK Init will be blocked until the server is connected*/int TRRO_initJsonPath(const char* jsonPath);
parameters | description |
jsonPath | the file path of the config json file |
return | 1 success, <=0 failed |
/*SDK Init will be blocked until the server is connected*/int TRRO_initJson(const char* json);
parameters | description |
json | the json string of configuration |
return | 1 success, <=0 failed |
void TRRO_destroy();
//block until the list is retrived from cloud, it should copy the returned strings as soon as possible.const char* TRRO_getGwList();
parameters | description |
return | online field devices list in format of JSON string { "ret":0, "msg":"suc", "gateways":[ {"deviceID":"xx","name":"xx","type":"gateway","status":"connected","streams":4,"timestamp":1682231838673,"version":"xx"} ], "count":1 } |
//block until the info is retrived from cloud, it should copy the returned strings as soon as possible.const char* TRRO_getGwInfo(const char* gwid);
parameters | description |
gwid | field device Id, with projectId prefix for public cloud, e.g. - public cloud: in format of projectId/deviceId - private cloud: in format of deviceId |
return | field device info in format of JSON string {"ret":0, "msg": "suc", "deviceID":"xx", "name":"xx", "type":"gateway", "status":"connected","streams":4,"timestamp":1682231838673,"version":"xx","sdk_mode":"server2","ability":0,"licenseExpire":1745666980} |
// async mode to connect the video, the video connection status is notified by onState callback// can be called with multiple times to connect different field devicesint TRRO_connectField(const char* gwid, int streams_num, int* streams_id, int* conn_fds, int compatible = 0, const char* record_config = NULL);
parameters | description |
gwid | field device Id, with projectId prefix for public cloud, e.g. projectId/deviceId |
streams_num | size of streams_id array |
streams_id | the array of the target stream id of video streams which is coresponding to the element index of streams_config array of field device |
conn_fds | the array of the video receiver handle id for receiving video streams, same size as streams_id, starts from 0. one video receiver can only receive one video stream at same time, and the old video stream will be disconnected if using the same video receiver to connect new video stream. |
compatible | 1 for compatible mode, which can connect video stream with different sdk mode, but costing more time 0 for fast connection with configured sdk mode, the sdk mode should be same as the field device |
record_config | Specifiy the record config for connected video strreams in format of json string {"file_names": [ {"file":"test1_file", "duration":15}, {"file":"test2_file", "duration":15} ]} where file is the path and name of record file, duration is the slice duration in unit of minutes. If not need recording, set it as NULL |
return | 1 success, <=0 failed |
void TRRO_setWindows(int* conn_fds, WindowIdType * windows, int num);
parameters | description |
conn_fds | the array of the video receiver handle Id |
WindowIdType | the array of the video windows handle, for windows platform, HWND is the WindowIdType |
num | size of the array |
int TRRO_disconnect(int* conn_fds, int fd_num);
parameters | description |
conn_fds | the array of the video receiver handle Id |
fd_num | size of the array |
return | 1 success, <=0 failed |
int TRRO_disconnectAll();
parameters | description |
return | 1 success, <=0 failed |
int TRRO_SetRenderConfig(int *conn_fds, int *rotation, int *scale, int *config, int num);
parameters | description |
conn_fds | the array of the video receiver handle Id for updating render config |
rotation | the array of the rotation degree, (-360, +360), default 0 |
scale | the array of the draw mode, default 0 0 full window stretch 1 keep origin ratio |
config | the array of render effect config, the render effect config element is defined in format of 0x00000XYZ X low light enhance level, 0 for disable, 1-3 for different enhance level, 2 is recommend, default 0 Y super resolution option, 0 for disable, 1 for enable, default 0 Z mirror option, 0 for disable, 1 for enable, default 0 |
num | size of the array |
return | 1 success, <=0 failed |
int TRRO_fieldDeviceEncodeConfig(const char* gwid, int streams_id, const char* encode_config);
parameters | description |
gwid | the field device id, with projectId prefix for public cloud, e.g. projectId/deviceId |
streams_id | the stream id that needs to update encoder config |
encode_config | encode config to be updated, in the format of the json string. The encode parameter not involved in the json string will keep the same. { "fps": 30, "encode_width": 1920, "encode_height": 1080, "bps": 3000, "min_fps": 30, "min_bps": 1800, "force_min": 0, "min_width": 1920 } |
return | 1 success, <=0 failed |
int TRRO_startMediaPush(int conn_fd, const char* path);
parameters | description |
conn_fd | the video receiver handle ID |
path | the RTMP URL for bypass push, e.g. rtmp://xxxx |
return | 1 success, <=0 failed |
int TRRO_stopMediaPush(int conn_fd);
parameters | description |
conn_fd | the video receiver handle ID |
return | 1 success, <=0 failed |
void TRRO_registerRemoteFrameCallback(void* context, TRRO_onRemoteFrameData * callback, int frame_type = 0);typedef void STD_CALL TRRO_onRemoteFrameData(void* context, const char* gwid, int stream_id, int conn_fd, const char* data, int width, int height, long long videotime);
parameters | description |
context | context pointer for callback, can set as NULL if not used |
gwid | the field device id, with projectId prefix for public cloud, e.g. projectId/deviceIds |
stream_id | the video stream id |
conn_fd | id of the video receiver handle receiving the video stream |
data | decoded video image |
width | image width |
height | image height |
videotime | timestamp for the video image received by the field device SDK, with the steady_clock of the field device |
void TRRO_registerRemoteEncodedFrameCallback(void* context, TRRO_onRemoteEncodedFrameData* callback);typedef void STD_CALL TRRO_onRemoteEncodedFrameData(void* context, const char* gwid, int stream_id, int conn_fd,const char* data, int len, TrroCodec trro_codec, bool is_key_frame,long long videotime);
parameters | description |
context | context pointer for callback, can set as NULL if not used |
gwid | the field device id, with projectId prefix for public cloud, e.g. projectId/deviceIds |
stream_id | the video stream id |
conn_fd | id of the video receiver handle receiving the video stream |
data | encoded frame data buffer pointer |
len | length of data buffer |
trro_codec | codec of the encoded frame, Trro_H264, Trro_H265, Trro_AV1 |
is_key_frame | whether the video frame is IDR frame, true for IDR frame |
videotime | timestamp for the video image received by the field device SDK, with the steady_clock of the field device |
int TRRO_useExternalDecoder(bool external);
parameters | description |
external | true disable internal decoder and video image callback, default false |
return | 1 success, <=0 failed |
int TRRO_externAudioData(const char* gwid, const char* data, int data_size, int channel, int sample_rate);
parameters | description |
gwid | ID of the target field device receiving the audio, with projectId prefix for public cloud, e.g. projectId/deviceIds |
data | pointer to audio data buffer, pcm format with 16bit sampling |
data_size | size of audio data buffer |
channel | number of audio channel, 1 or 2 |
sample_rate | the audio sample rate, e.g. 16000 for 16khz sampling, support 8k/16k/24k/32k/44.1k/48kHz |
int TRRO_audioMute(const char* gwid, bool mute);
parameters | description |
gwid | ID of the target field device, with projectId prefix for public cloud, e.g. projectId/deviceIds |
mute | true for mute, false for unmute |
int TRRO_sendControlData(const char* gwid, const char* msg, int len, int qos = 0);
parameters | description |
gwid | ID of the target field device, with projectId prefix for public cloud, e.g. projectId/deviceIds |
msg | pointer to the data buffer of the msg |
len | size of the data buffer |
qos | qos mode for delivery 0 utrla low latency mode, with message loss possibility if network is poor 1 reliable mode, with larger latency if network is poor |
void TRRO_registerReportDataCallback(void* context, TRRO_onReportData * callback);/** @name : TRRO_onReportData* @brief : Callback for receiving information from field devices* @input : context The context pointer for the callback, which returns the context passed when the callback function is registered* gwid The ID of the field device from which the message originates* msg Message, binary passthrough* len Message length* qos Message transmission QoS source, 0: unreliable transmission, 1: reliable transmission* @return : void*/typedef void STD_CALL TRRO_onReportData(void* context, const char* gwid, const char* msg, int len, int qos);
parameters | description |
context | callback context pointer |
gwid | the ID of the field device sending the message |
msg | size of the data buffe |
msg | pointer to the data buffer of the msg |
len | size of the data buffer |
qos | message qos mode 0 utrla low latency mode 1 reliable mode |
int TRRO_requestPermission(const char* gwid, int permisson);
parameters | description |
gwid | the target field device id |
permission | 0 guest permission, only can watch 1 master permission, can watch, control and shout |
void TRRO_registerOnOperationPermissionState(void* context, TRRO_OnOperationPermissionState* callback);typedef void STD_CALL TRRO_OnOperationPermissionState(void* context, const char* field_devid, int self_permission, const char* master_devid);
parameters | description |
context | callback context pointer |
field_devid | the ID of the field device notifying the permission update |
self_permission | current permission of the remote device itself 0 guest permission, only can watch 1 master permission, can watch, control and shout |
master_devid | the remote device id which has the master permission of the field device. It will be empty if no device having the master permission |
void TRRO_registerAllLatencyCallback(void* context, TRRO_onAllLatencyReport * callback);typedef void STD_CALL TRRO_onAllLatencyReport(void* context, const char* gwid, int conn_fd, long long latency1, long long latency2, long long videotime, int rcct);
parameters | description |
context | callback context pointer |
gwid | the field device id |
conn_fd | the video receiver handle id |
latency1 | video transmission latency, in unit of ms, the precision depends on the difference of network up and down direction latency |
latency2 | video transmission latency (from field to remote) + control message latency (from remote to field), in unit of ms |
videotime | the timestamp of the latest received video frame, in the system clock of field device |
rcct | the round-trip control channel time (from remote to field then back to remote), in unit of ms |
int TRRO_registerSignalStateCallback(void *context, TRRO_onSignalState *callback);enum SignalState {kTrroReady = 0, /**< first connection is setup successfully */kTrroLost = 1, /**< connection is lost, but the sdk will try to reconnect */kTrroReup = 2, /**< reconnect successfully */kTrroKickout = 3, /**< the connection is kicked out due to same id login */kTrroAuthFailed = 4, /**< deviceid or password error */};typedef void TRRO_onSignalState(void *context, SignalState state);
parameters | description |
context | callback context pointer |
state | status of signal connection between remote device and server, refer to SignalState |
void TRRO_registerOnState(void* context, TRRO_OnState * callback);enum TrroState {kDisconnect = 0, /**< video connection is disconnected */kConnecting = 1, /**< begin to setup the video connection */kConnected = 2, /**< video connection is connected successfully */kDisconnecting = 3, /**< begin to disconnect the video connection */};typedef void STD_CALL TRRO_OnState(void* context, const char* gwid, int stream_id, int conn_fd, int state);
parameters | description |
context | callback context pointer |
gwid | id of the field device of the video stream |
stream_id | id of the video stream for the video connection |
conn_fd | id of the video receiver handle for the video stream connection |
state | status of video connection, refer to TrroState |
void TRRO_registerOnMediaStateInfo(void* context, TRRO_OnMediaStateInfo * callback);struct TrroMediaState {int fps; // video fpsint bps; // video bitrate, in unit of bpsint rtt; // network rtt between remote device and server for video transmissionlong long decd; //video decode time, in unit of msint jitter; // network rtt jitter, in unit of mslong long packets_lost; // packets loss rate (0-255), loss percent = packets_lost / 255 * 100%long long packets_received; // num of received packetsint stun; // stun mode of the video connection, 0: host, 1: srflx, 2: prflx, 3: relaydouble lag_k100; // 100ms video lag rate, equals sum(max(video_frame_interval - 100, 0)) / video_durationdouble lag_k150; // 150ms video lag rate, equals sum(max(video_frame_interval - 150, 0)) / video_durationlong long duration; // duration of video stream, in unit of ms};typedef void STD_CALL TRRO_OnMediaStateInfo(void* context, int conn_fd, TrroMediaState mediastate);
parameters | description |
context | callback context pointer |
conn_fd | id of the video receiver handle for the video stream connection |
mediastate | media status of video connection, refer to TrroMediaState |
void TRRO_registerFieldSideNetworkState(void* context, TRRO_onFieldSideMediaState * callback);typedef void TRRO_onFieldSideMediaState(void* context, const char* gwid, int stream_id, int fps, int bps, int rtt, int jitter, int lost);
parameters | description |
context | callback context pointer |
gwid | the field device id |
stream_id | the video stream id |
fps | number of frames per second of the field device video stream |
bps | bitrate of the field device video stream, in unit of bps |
rtt | network rtt between field device and server, in unit of ms |
jitter | network rtt jitter, in unit of ms |
lost | packets loss rate (0-255) of the field device video stream, loss percent = lost/255*100% |