OpenSDK  V4.2.0
Typedefs | Functions
Message notification

Typedefs

typedef void(CALLBACK * OpenSDK_Push_MessageHandler) (const char *szDesc, const char *szContent, const char *szDetail, void *pUser)
 Alarm notification callback function. More...
 

Functions

OPENSDK_API OPENSDK_RESULT CALLBACK OpenSDK_Push_SetAlarmCallBack (OpenSDK_Push_MessageHandler pHandle, void *pUser)
 Set alarm notification callback. More...
 
OPENSDK_API OPENSDK_RESULT CALLBACK OpenSDK_Push_SetDeviceStatusCallBack (OpenSDK_Push_MessageHandler pHandle, void *pUser)
 Set device online/ offline notification. More...
 
OPENSDK_API OPENSDK_RESULT CALLBACK OpenSDK_Push_SetTransparentChannelCallBack (OpenSDK_Push_MessageHandler pHandle, void *pUser)
 Set device online/ offline notification. More...
 
OPENSDK_API OPENSDK_RESULT CALLBACK OpenSDK_Push_StartRecvEx (const char *szPushSecret)
 Start receiving alarm. More...
 
OPENSDK_API OPENSDK_RESULT CALLBACK OpenSDK_Push_StopRecv ()
 Stop receiving alarm. More...
 

Detailed Description

Typedef Documentation

typedef void(CALLBACK * OpenSDK_Push_MessageHandler) (const char *szDesc, const char *szContent, const char *szDetail, void *pUser)

Alarm notification callback function.

Parameters
szDescDescription
szContentContent
szDetailWhole message
pUserUser-defined data
See also
OpenSDK_Push_SetAlarmCallBack()
OpenSDK_Push_SetDeviceStatusCallBack()
OpenSDK_Push_SetTransparentChannelCallBack()
Note
See the JSON format of alarm message below:
1 {
2  "msgType": "1", // Message type
3  "alarmTime": "2012-12-25 15:25:42", // Alarm time
4  "deviceSeril": "421877673", // Device serial No.
5  "channelID": "1", // Channel ID:
6  "alarmType": "11", // Alarm type
7  "picUrl": "http://www.hikvision.com/", // Picture URL
8  "videoUrl": "http://www.hikvision.com/",// Video URL
9  "custominfo":"sn=507669173^cn=30", // Custom content, including zone.
10  "custominfoType":"CS-A1-32W_01" // Type of custom content
11 }
See the JSON format of alarm content below:
1 {
2  "msgType": "3", // message type, 3-device status triggering
3  "devMsgType": "1", // Notification type No., 1-offline
4  "msgTime": "2016-01-27 16:09:39", // Message time
5  "deviceSeril": "421877673", // Device serial No.
6  "channelID": "1" // Channel ID
7 }
See the JSON format of transparent channel notification below:
1 {
2  "msgType": "com,hikvision.open.transparent", // Message type, transparent data type
3  "msgSeq": "123456789", // Message serial No.
4  "createDate": 1456070400000.0, // Message time,time stamp (date)
5  "data": "hello", // Message content, i.e., transparently transmited data
6  "sn": "421877673", // Device serial No.
7 }

Function Documentation

OPENSDK_API OPENSDK_RESULT CALLBACK OpenSDK_Push_SetAlarmCallBack ( OpenSDK_Push_MessageHandler  pHandle,
void *  pUser 
)

Set alarm notification callback.

Parameters
[in]pHandleAlarm notification founction
[in]pUserUser-defined data, callback function will be thrown out.
Returns
Return 0 on success, -1 on failure
See also
OpenSDK_Push_AlarmHandler
OPENSDK_API OPENSDK_RESULT CALLBACK OpenSDK_Push_SetDeviceStatusCallBack ( OpenSDK_Push_MessageHandler  pHandle,
void *  pUser 
)

Set device online/ offline notification.

Parameters
[in]pHandleDevice status notification function
[in]pUserUser-defined data, callback function will be thrown out.
Returns
Return 0 on success, -1 on failure
See also
OpenSDK_Push_MessageHandler
OPENSDK_API OPENSDK_RESULT CALLBACK OpenSDK_Push_SetTransparentChannelCallBack ( OpenSDK_Push_MessageHandler  pHandle,
void *  pUser 
)

Set device online/ offline notification.

Parameters
[in]handleAlarm notification function
[in]publishHandleNotification function
[in]pUserUser-defined data, callback function will be thrown out.
Returns
Return 0 on success, -1 on failure
See also
OpenSDK_Push_MessageHandler
OPENSDK_API OPENSDK_RESULT CALLBACK OpenSDK_Push_StartRecvEx ( const char *  szPushSecret)

Start receiving alarm.

Parameters
[in]szAccessTokenVerification Token
[in]szPushSecretAccess the key used by Push, system will generate when creating application.
Returns
Return 0 on success, -1 on failure. If returning failed, call GetLastErrorCode() to get the error code.
See also
OpenSDK_Push_StopRecv()
OPENSDK_API OPENSDK_RESULT CALLBACK OpenSDK_Push_StopRecv ( )

Stop receiving alarm.

Returns
Return 0 on success, -1 on failure
See also
OpenSDK_Push_StartRecv()