中文简体    English


1 Introduction

Ivy_Cloud_Dev_Sdk is a set of solutions designed by IVY-IoT to facilitate third-party equipment manufacturers to quickly access the IVY-IoT cloud platform and use cloud storage functions. It runs on the embedded Linux platform, which shields the differences of the underlying hardware and provides The unified interface is for users to call. IVY-IoT will provide SDK for the corresponding platform according to different customer hardware solutions.

2 Interface Description

2.1 SDK Init

Definition IvyCloudContext IvyCloudContextCreate(IvyCloudEnv cloudEnv)
Description Initialize the cloud storage and create a context pointer.
Parameter IvyCloudEnv cloudEnv: Cloud storage environment initialization structure variable
int8_t channel: IPC channel identification, used on base station or NVR
int8_t configPath[128]: Configure partition path, readable and writable, save when power off
STATUS_NOTIFY_CB status_notify_cb: Cloud service connection status information callback, used to receive cloud service connection status information and synchronize cloud storage time
Return Value IvyCloudContext–Cloud storage context pointer
Notes Just initialize once

2.2 SDK Deinit

Definition void IvyCloudContextDestory(IvyCloudContext context)
Description Destroy context
Parameter context: Cloud storage context pointer
Return Value None
Notes Optional

2.3 Query SDK information

Definition IVY_CODE IvyGetSdkInfo(IvySdkInfo_t *sdkInfo)
Description Get sdk version and other information
Parameter sdkInfo: sdk version information
Return Value 0: succes; other: failure
Notes Optional

2.4 Set cloud storage configuration information

Definition IVY_CODE IvyCloudSetRtmpConfig(IvyCloudContext context,IvyRtmpCfg_t *pConfig)
Description Set cloud storage configuration information, which is obtained by the app from the cloud and written to the device
Parameter IvyCloudContext context:Cloud storage context pointer
IvyRtmpCfg_t *pConfig: Cloud storage configuration structure pointer,The main parameters are as follows:
int isEnable: Cloud storage enable switch, enable when writing configuration, reset by default
char szStreamId[64]: Cloud storage push ID
char szDevId[32]: The mac address of the device needs to be issued from the app. When the cloud configuration is written, it is compared with the local mac.
char szAccessToken[128]: Corresponding storeTag obtained by the app from the cloud
char szPortal[128]:api URL
Return Value 0:success; other: failure
Notes None

2.5 Get cloud storage configuration information

Definition IVY_CODE IvyCloudGetRtmpConfig(IvyCloudContext context, IvyRtmpCfg_t *pConfig)
Description Get SDK current cloud storage configuration information
Parameter IvyCloudContext context:Cloud storage context pointer
IvyRtmpCfg_t *pConfig: Cloud storage configuration structure pointer
Return Value 0: success; other: failure
Notes None

2.6 Reset cloud storage configuration

Definition IVY_CODE IvyCloudResetRtmpConfig(IvyCloudContext context)
Description Restore the cloud storage configuration to the default, used when the device is reset
Parameter IvyCloudContext context:Cloud storage context pointer
Return Value 0: success; other: failure
Notes None

2.7 Start cloud recording

Definition IVY_CODE IvyCloudAlarmStart(IvyCloudContext context,IvyRtmpAlarmMsg_t alarmMsg)
Description Inform SDK that an alarm is triggered and start cloud recording
Parameter IvyCloudContext context: Cloud storage context pointer
IvyRtmpAlarmMsg_t alarmMsg: Alarm message structure
Return Value 0: success; other: failure
Notes Can only be used after connecting to the cloud server

2.8 Stop cloud recording

Definition IVY_CODE IvyCloudAlarmStop(IvyCloudContext context, IvyRtmpAlarmMsg_t alarmMsg)
Description Tell SDK to stop cloud recording
Parameter IvyCloudContext context: Cloud storage context
IvyRtmpAlarmMsg_t alarmMsg: Alarm message structure
Return Value 0: success; other: failure
Notes After connecting to the cloud server and starting cloud storage, it can be used

2.9 Send audio/video data

Definition IVY_CODE IvyCloudSendAV(IvyCloudContext context, IvyFrame_t* frame)
Description Send AV data to sdk
Parameter IvyCloudContext context: Cloud storage context
IvyFrame_t* frame: Audio and video frame information structure pointer, specific parameters are as follows:
IvyFrameType_e frameType: frame type
IvyStreamType_e streamType: stream type
IvyCodecType_e encodeType: encode type
int32_t frameNo: frame number
int8_t channel: Channel identification for base station or NVR
int32_t dataLen: frame data len
long long pts: Timestamp
int8_t data[0]: Address for storing frame data
Return Value 0: success; other: failure
Notes None

3 Demo use guide

3.1 Unzip the sdk

tar -xvf Ivy_Cloud_Dev_Usr_Sdk_Ingenic_V1.0.9.20190808_143845.tar.xz

sdk directory file introduction:

├── demo———->Test case
├── doc ————>sdk document
├── include———>sdk header file
├── lib—————>sdk library
└── thirdLib
│ ├── include—–>Third-party library header files
│ └── lib———–>Third-party libraries
└── Makefile
└── test.h264———->Test file

3.2 Compile demo

Demo can be tested on the linux pc side or on the board side. Modify MakeFile to select the corresponding platform to compile

3.3 Analog push stream

Run the demo:
./Ivy_demo

Simulation starts cloud storage:
kill -10 PID PID is the process ID of the demo

Simulation to stop cloud storage:
kill -12 PID

文档更新时间: 2020-06-30 18:55   作者:admin