#include "AVCommon.h"
Data Structures | |
struct | st_AvStatus |
struct | AvPushFileObject |
struct | AVServStartInConfig |
struct | AVServStartOutConfig |
Typedefs | |
typedef struct st_AvStatus | st_AvStatus |
typedef enum _AV_RESET_TARGET | AV_RESET_TARGET |
typedef struct AvPushFileObject | AvPushFileObject |
typedef int32_t(__stdcall * | authFn )(const char *szViewAccount, const char *szViewPassword) |
typedef int32_t(__stdcall * | avPasswordAuthFn )(const char *account, char *password, uint32_t password_buf_size) |
typedef int32_t(__stdcall * | avTokenAuthFn )(const char *identity, char *token, uint32_t token_buf_size) |
typedef int32_t(__stdcall * | avTokenRequestFn )(int32_t av_index, const char *identity, const char *identity_description, char *token, uint32_t token_buf_size) |
typedef int32_t(__stdcall * | avTokenDeleteFn )(int32_t av_index, const char *identity) |
typedef int32_t(__stdcall * | avServSendIdentityArray )(int32_t av_index, const AvIdentity *identities, uint32_t identity_count, int32_t status_code) |
typedef void(__stdcall * | avIdentityArrayRequestFn )(int32_t av_index, avServSendIdentityArray send_identity_array) |
typedef int32_t(__stdcall * | avServSendAbility )(int32_t av_index, const uint8_t *ability, uint32_t ability_size) |
typedef void(__stdcall * | avAbilityRequestFn )(int32_t av_index, avServSendAbility send_ability) |
typedef int32_t(__stdcall * | avChangePasswordRequestFn )(int32_t av_index, const char *account, const char *old_password, const char *new_password, const char *new_iotc_authkey) |
typedef int32_t(__stdcall * | avRecvJSONCtrlRequestFn )(int32_t av_index, const char *func, const TUTKJsonObject *json_args_obj, TUTKJsonObject **json_response_obj) |
typedef int32_t(__stdcall * | avNotificationSettingChangeFn )(const char *setting_str) |
The prototype of push notification settings change handle callback function. | |
typedef struct AVServStartInConfig | AVServStartInConfig |
typedef const AVServStartInConfig * | LPCAVSERV_START_IN_CONFIG |
typedef struct AVServStartOutConfig | AVServStartOutConfig |
typedef AVServStartOutConfig * | LPAVSERV_START_OUT_CONFIG |
Enumerations | |
enum | _AV_RESET_TARGET { RESET_VIDEO = 0, RESET_AUDIO, RESET_ALL } |
enum | AvPushFileType { AV_PUSH_FILE_BY_BUFFER, AV_PUSH_FILE_BY_PATH } |
Functions | |
int32_t | avServResetBuffer (int32_t avIndex, AV_RESET_TARGET eTarget, uint32_t Timeout_ms) |
Reset the Video or Audio buffer of AV server. | |
AVAPI_API_DEPRECATED int32_t | avServStart2 (int32_t nIOTCSessionID, authFn pfxAuthFn, uint32_t nTimeout, uint32_t nServType, uint8_t nIOTCChannelID) |
Start an AV server. | |
AVAPI_API_DEPRECATED int32_t | avServStart3 (int32_t nIOTCSessionID, authFn pfxAuthFn, uint32_t nTimeout, uint32_t nServType, uint8_t nIOTCChannelID, int32_t *pnResend) |
Start an AV server. | |
void | avServExit (int32_t nIOTCSessionID, uint8_t nIOTCChannelID) |
Used by an AV server exit avServStart2() process. | |
void | avServStop (int32_t nAVChannelID) |
Stop an AV server. | |
void | avServSetResendSize (int32_t nAVChannelID, uint32_t nSize) |
Set re-send buffer size. | |
int32_t | avServGetResendSize (int32_t avIndex, uint32_t *pnSize) |
Get re-send buffer size. | |
int32_t | avServGetResendFrmCount (int32_t avIndex, uint32_t *pnCount) |
Get frame count of re-send buffer. | |
int32_t | avServSetDelayInterval (int32_t nAVChannelID, uint16_t nPacketNum, uint16_t nDelayMs) |
Set interval of sending video data in AV server. | |
float | avResendBufUsageRate (int32_t nAVChannelID) |
Used by an AV server, in order to know the usage rate of resend buffer. | |
int32_t | avServStartEx (LPCAVSERV_START_IN_CONFIG AVServerInConfig, LPAVSERV_START_OUT_CONFIG AVServerOutConfig) |
Start an AV server support re-send and DTLS. | |
int32_t | avStatusCheck (int32_t nAVChannelID, st_AvStatus *psAvStatus) |
Get status of the connected AV channel. | |
This file describes AV module APIs for server.
typedef int32_t(__stdcall * authFn)(const char *szViewAccount, const char *szViewPassword) |
The prototype of authentication function used for an AV server. The authentication function is set when an AV server starts by avServStart2(). The AV server will call back authentication function when an AV client wants to connect with szViewAccount and szViewAccount
szViewAccount | [in] The view account provided by AV clients for authentication |
szViewPassword | [in] The view password provided by AV clients for authentication |
typedef enum _AV_RESET_TARGET AV_RESET_TARGET |
typedef void(__stdcall * avAbilityRequestFn)(int32_t av_index, avServSendAbility send_ability) |
The prototype of ability request function used for an AV server. The ability request function is set when an AV server starts by avServStartEx(). The AV server will call back avAbilityRequestFn function when an AV client use avClientRequestServerAbility() to request the ability of AV server
av_index | [in] The channel ID of the AV channel who request the AV server ability |
send_ability | [in] The function pointer of avServSendAbility function, used for send server ability to AV client. |
typedef int32_t(__stdcall * avChangePasswordRequestFn)(int32_t av_index, const char *account, const char *old_password, const char *new_password, const char *new_iotc_authkey) |
The prototype of change password request function used for an AV server. The change password function is set when an AV server starts by avServStartEx(). The AV server will call back avChangePasswordRequestFn function when an AV client use avClientRequestChangeServerPassword() to request change password. This function is only supported with IOTC authkey enabled, AV server should verify the correctness of account and old password provide by AV client, once the account/password authentication succeed and the new password is applied, AV server should save the new IOTC auth key, and this new IOTC auth key must be applied in the next call of IOTC_Device_LoginEx()
av_index | [in] The channel ID of the AV channel who request change password |
account | [in] The account provide by AV client |
old_password | [in] The old password provide by AV client |
new_password | [in] The new password provide by AV client |
new_iotc_authkey | [in] The new IOTC auth key provide by AV module |
typedef void(__stdcall * avIdentityArrayRequestFn)(int32_t av_index, avServSendIdentityArray send_identity_array) |
The prototype of identity array request function used for an AV server. The identity array request function is set when an AV server starts by avServStartEx(). The AV server will call back avIdentityArrayRequestFn function when an AV client use avClientRequestIdentityArray() to request the identity array stored in AV server
av_index | [in] The channel ID of the AV channel who request the identity array |
send_identity_array | [in] The function pointer of avServSendIdentityArray function, used for send identity array to AV client. |
typedef int32_t(__stdcall * avNotificationSettingChangeFn)(const char *setting_str) |
The prototype of push notification settings change handle callback function.
This callback function is called when settings of push notification changed. AV device should have a safekeeping of this setting string and should use avServEnablePushNotification() to load the settings when AV device restart next time.
setting_str | [in] the encrypted string of push notification settings |
typedef int32_t(__stdcall * avPasswordAuthFn)(const char *account, char *password, uint32_t password_buf_size) |
The prototype of account/password authentication function used for an AV server. The authentication function is set when an AV server starts by avServStartEx(). The AV server will call back avPasswordAuthFn function when an AV client wants to connect with account and password
account | [in] The account provided by AV clients for authentication |
password | [out] The buffer that server need to fill in the password string for authentication |
password_buf_size | [in] The size of password buffer |
typedef struct AvPushFileObject AvPushFileObject |
typedef int32_t(__stdcall * avRecvJSONCtrlRequestFn)(int32_t av_index, const char *func, const TUTKJsonObject *json_args_obj, TUTKJsonObject **json_response_obj) |
The prototype of recv json control request function used for an AV server. The recv json control request function is set when an AV server starts by avServStartEx(). The AV server will call back avRecvJSONCtrlRequestFn function when an AV client use avSendJSONCtrlRequest() to send json control request.
av_index | [in] The channel ID of the AV channel who send json control request |
func | [in] The function name of the json control request |
json_args_obj | [in] The json args of the json control request |
json_response_obj | [out] The json response of the josn control request |
typedef int32_t(__stdcall * avServSendAbility)(int32_t av_index, const uint8_t *ability, uint32_t ability_size) |
The prototype of send ability function used for an AV server. The send ability function must be called in avAbilityRequestFn call back function to send ability to AV client
av_index | [in] The channel ID of the target AV channel |
ability | [in] The ability buffer to be sent |
ability_size | [in] The size of ability |
typedef int32_t(__stdcall * avServSendIdentityArray)(int32_t av_index, const AvIdentity *identities, uint32_t identity_count, int32_t status_code) |
The prototype of send identity array function used for an AV server. The send identity array function must be called in avIdentityArrayRequestFn call back function to send identity array to AV client
av_index | [in] The channel ID of the target AV channel |
identities | [in] The identity array to be sent |
identity_count | [in] The identity count to be sent |
status_code | [in] The status_code avClientRequestIdentityArray() receives. |
typedef struct AVServStartInConfig AVServStartInConfig |
The input configuration of avServStartEx
cb | [in] The check byte of this structure. |
iotc_session_id | [in] The session ID of the IOTC session to create AV server |
iotc_channel_id | [in] The channel ID of the channel to create AV server |
timeout_sec | [in] The timeout for this function in unit of second. Specify it as 0 will make AV server start process wait until an AV client connects successfully. |
server_type | [in] The user-defined service type. An AV client will get this value when it invokes avClientStart() successfully. |
resend | [in] Enabling the Resend mechanism or not |
security_mode | [in] Security mode with options |
password_auth | [in] The function pointer of password authentication function |
token_auth | [in] The function pointer of token authentication function |
token_request | [in] The function pointer will be called if avClientRequestTokenWithIdentity is called in client side to request a token |
token_delete | [in] The function pointer will be called if avClientRequestDeleteTokenWithIdentity is called in client side to delete a token |
identity_array_request | [in] The function pointer will be called if avClientRequestIdentityArray is called in client side to request the identity list |
ability_request | [in] The function pointer will be called if avClientRequestServerAbility is called in client side to request server ability |
change_password_request | [in] The function pointer will be called if avClientRequestChangeServerPassword is called in client side to request server change password |
dtls_cipher_suites | [in] Setup DTLS cipher suites. Please use the name of cipher suites from OpenSSL and ":" to separate each cipher suite. If you are using mbedtls as 3rd party library, currently, we only support setting it as "PSK-AES128-CBC-SHA256". |
typedef struct AVServStartOutConfig AVServStartOutConfig |
The output configuration of avServStartEx
cb | [in] The check byte of this structure. |
resend | [out] Resend mechanism is enable or not |
two_way_streaming | [out] two way audio/video streaming mechanism is enabling or not 1: enabled, 0: disabled |
auth_type | [out] The connection is authenticated with password or token |
account_or_identity | [out] The client identity or account name |
typedef int32_t(__stdcall * avTokenAuthFn)(const char *identity, char *token, uint32_t token_buf_size) |
The prototype of identity/token authentication function used for an AV server. The authentication function is set when an AV server starts by avServStartEx(). The AV server will call back avTokenAuthFn function when an AV client wants to connect with identity and token
identity | [in] The identity provided by AV clients for authentication |
token | [out] The buffer that AV server need to fill in the token string for authentication |
token_buf_size | [in] The size of token buffer |
typedef int32_t(__stdcall * avTokenDeleteFn)(int32_t av_index, const char *identity) |
The prototype of token delete function used for an AV server. The token delete function is set when an AV server starts by avServStartEx(). The AV server will call back avTokenDeleteFn function when an AV client use avClientRequestDeleteTokenWithIdentity() to delete a token with a specific identity
av_index | [in] The channel ID of the AV channel who request to delete token |
identity | [in] The identity provided by AV clients for delete token |
typedef int32_t(__stdcall * avTokenRequestFn)(int32_t av_index, const char *identity, const char *identity_description, char *token, uint32_t token_buf_size) |
The prototype of token request function used for an AV server. The token request function is set when an AV server starts by avServStartEx(). The AV server will call back avTokenRequestFn function when an AV client use avClientRequestTokenWithIdentity() to request a token with a specific identity
av_index | [in] The channel ID of the AV channel who request the token |
identity | [in] The identity provided by AV clients for request token |
identity_description | [in] The identity description provided by AV clients that describes the identity |
token | [out] The buffer that AV server need to fill in the token string |
token_buf_size | [in] The buffer size provided by AV client who called avClientRequestTokenWithIdentity |
typedef const AVServStartInConfig* LPCAVSERV_START_IN_CONFIG |
typedef struct st_AvStatus st_AvStatus |
AvVersion | The avapi version |
RoundTripTime | The round trip time in milliseconds |
LostRate | The packet lost rate (0 ~ 100) |
BandWidth | The estimated bandwidth (Kbyte/second) |
MinRTT | The minimum round trip time in milliseconds |
LastBw | The last estimated bandwidth (Kbyte/second) |
LastRtt | The last round trip time in milliseconds |
LastCwnd | The last congestion window in bytes |
InFlight | The total non-acked data size in bytes |
enum _AV_RESET_TARGET |
enum AvPushFileType |
float avResendBufUsageRate | ( | int32_t | nAVChannelID | ) |
Used by an AV server, in order to know the usage rate of resend buffer.
AV server calls this function to know the usage rate of resend buffer. It will return a float value between 0 and 1. 0 means that resend buffer is empty, 1 means that resend buffer is full. The others mean usage rate.
nAVChannelID | [in] The channel ID of the AV channel |
void avServExit | ( | int32_t | nIOTCSessionID, |
uint8_t | nIOTCChannelID | ||
) |
Used by an AV server exit avServStart2() process.
Since avServStart2() is block processes and that means the caller has to wait for AV start or specified timeout expires before these two functions return. In some cases, caller may want to exit AV start process immediately by this function in another thread.
nIOTCSessionID | [in] The session ID of the IOTC session to exit AV start process |
nIOTCChannelID | [in] The channel ID of the channel to exit AV start process |
int32_t avServGetResendFrmCount | ( | int32_t | avIndex, |
uint32_t * | pnCount | ||
) |
Get frame count of re-send buffer.
Use this API to get the frame count of re-send buffer if re-send mechanism is enabled.
nAVChannelID | [in] The channel ID of the AV channel to be set. |
pnCount | [out] The frame count of re-send buffer. |
int32_t avServGetResendSize | ( | int32_t | avIndex, |
uint32_t * | pnSize | ||
) |
Get re-send buffer size.
Use this API to get the re-send buffer size if re-send mechanism is enabled.
nAVChannelID | [in] The channel ID of the AV channel to be set. |
pnSize | [out] The size of re-send buffer, in unit of kilo-byte. |
int32_t avServResetBuffer | ( | int32_t | avIndex, |
AV_RESET_TARGET | eTarget, | ||
uint32_t | Timeout_ms | ||
) |
Reset the Video or Audio buffer of AV server.
This function returns AV_ER_NoERROR if no error
avIndex | [in] The target avIndex |
eTarget | [in] Reset type could be RESET_VDEIO, RESET_AUDIO, RESET_ALL |
Timeout_ms | [in] The timeout value in ms to execute this function, set value 0 to wait forever |
int32_t avServSetDelayInterval | ( | int32_t | nAVChannelID, |
uint16_t | nPacketNum, | ||
uint16_t | nDelayMs | ||
) |
Set interval of sending video data in AV server.
An AV server how to send video data to AV client. It determined the delay time at regular interval between how many packets. The default value of nPacketNum is 1 and nDelayMs is 0, so the default behavior is to send frame packets without any delay.
nAVChannelID | [in] The channel ID of the AV channel to be sent |
nPacketNum | [in] How many number of packet as a regular interval |
nDelayMs | [in] Delay time in unit of million-second |
void avServSetResendSize | ( | int32_t | nAVChannelID, |
uint32_t | nSize | ||
) |
Set re-send buffer size.
Use this API to set the re-send buffer size if re-send mechanism is enabled. Default re-send buffer size is 256KB and recommend size is 1 second data.
nAVChannelID | [in] The channel ID of the AV channel to be set. |
nSize | [in] The size of re-send buffer, in unit of kilo-byte. |
AVAPI_API_DEPRECATED int32_t avServStart2 | ( | int32_t | nIOTCSessionID, |
authFn | pfxAuthFn, | ||
uint32_t | nTimeout, | ||
uint32_t | nServType, | ||
uint8_t | nIOTCChannelID | ||
) |
Start an AV server.
Start an AV server with user defined authentication function. Any AV client wanting to connect with this AV server shall pass the authentication with view account and password.
nIOTCSessionID | [in] The session ID of the IOTC session to create AV server |
pfxAuthFn | [in] The function pointer to an authentication function |
nTimeout | [in] The timeout for this function in unit of second. Specify it as 0 will make AV server start process wait until an AV client connects successfully. |
nServType | [in] The user-defined service type. An AV client will get this value when it invokes avClientStart() successfully. |
nIOTCChannelID | [in] The channel ID of the channel to create AV server |
AVAPI_API_DEPRECATED int32_t avServStart3 | ( | int32_t | nIOTCSessionID, |
authFn | pfxAuthFn, | ||
uint32_t | nTimeout, | ||
uint32_t | nServType, | ||
uint8_t | nIOTCChannelID, | ||
int32_t * | pnResend | ||
) |
Start an AV server.
Start an AV re-send supported server with user defined authentication function. Any AV client wanting to connect with this AV server shall pass the authentication with view account and password. Whether the re-send mechanism is enabled or not depends on AV client settings and will set the result into pnResend parameter.
nIOTCSessionID | [in] The session ID of the IOTC session to create AV server |
pfxAuthFn | [in] The function pointer to an authentication function |
nTimeout | [in] The timeout for this function in unit of second. Specify it as 0 will make AV server start process wait until an AV client connects successfully. |
nServType | [in] The user-defined service type. An AV client will get this value when it invokes avClientStart() successfully. |
nIOTCChannelID | [in] The channel ID of the channel to create AV server |
pnResend | [out] Set the re-send is enabled or not. |
int32_t avServStartEx | ( | LPCAVSERV_START_IN_CONFIG | AVServerInConfig, |
LPAVSERV_START_OUT_CONFIG | AVServerOutConfig | ||
) |
Start an AV server support re-send and DTLS.
Start an AV re-send and DTLS supported server by providing input configuration and output configuration. Whether the re-send mechanism is enabled or not depends on AV client settings and will set the result into output configuration. It'll return Error if server enable DTLS but client don't.
AVServerInConfig | [in] a pointer to structure which store all input parameters |
AVServerOutConfig | [out] a pointer to structure which store all output parameters more detail see AVServStartInConfig and AVServStartOUTConfig |
void avServStop | ( | int32_t | nAVChannelID | ) |
Stop an AV server.
An AV server stop AV channel by this function if this channel is no longer required.
nAVChannelID | [in] The channel ID of the AV channel to be stopped |
int32_t avStatusCheck | ( | int32_t | nAVChannelID, |
st_AvStatus * | psAvStatus | ||
) |
Get status of the connected AV channel.
An AV server may use this function to get information of the connected AV channel
nAVChannelID | [in] The channel ID of the AV channel to be checked |
psAvStatus | [out] The connection info of specified AV channel |