Commit 46da0d13 by Your Name

Initial commit

parents
File added
#ifndef AVGLOBAL_H
#define AVGLOBAL_H
typedef int AV_int32;
typedef unsigned int AV_uint32;
#ifndef __OBJC__
typedef int AV_BOOL;
#else
typedef BOOL AV_BOOL;
#endif
typedef void* AV_HANDLE;
typedef unsigned char AV_BYTE;
typedef float AV_float;
#ifdef WIN32
typedef __int64 AV_int64;
typedef unsigned __int64 AV_uint64;
#else
typedef long long AV_int64;
typedef unsigned long long AV_uint64;
#endif
#endif
arm-linux-g++ main.cpp -I ./ -L ./ -ldhnetsdk
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
File added
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
//#include "avglobal.h"
//#include "dhconfigsdk.h"
#include "dhnetsdk.h"
LLONG g_lLoginId = -1;
BOOL CALLBACK MessCallBack(LONG lCommand, LLONG lLoginID, char *pBuf, DWORD dwBufLen, char *pchDVRIP, LONG nDVRPort, LDWORD dwUser)
{
printf("lCommand %08x pBuf[%d] %s\n", lCommand, dwBufLen, pBuf);
//if(0 == dwUser)
//{
// return false;
// }
if (DH_ALARM_PARKING_LOT_STATUS_DETECTION == lCommand)
{
ALARM_PARKING_LOT_STATUS_DETECTION *pInfo = (ALARM_PARKING_LOT_STATUS_DETECTION*)pBuf;
printf("\n\npInfo->nChannelID %d\n", pInfo->nChannelID);
printf("pInfo->nAction %d\n", pInfo->nAction);
printf("pInfo->szName %s\n", pInfo->szName);
printf("pInfo->emClassType %d\n", pInfo->emClassType);
printf("pInfo->nEventID %08x\n", pInfo->nEventID);
printf("pInfo->nParkingStatusNum %d\n", pInfo->nParkingStatusNum);
for (int i = 0; i < pInfo->nParkingStatusNum; i ++) {
printf("Index %d\n", i);
printf("pInfo->stuParkingStatus.szName %s\n", pInfo->stuParkingStatus[i].szName);
printf("pInfo->stuParkingStatus.nID %d\n", pInfo->stuParkingStatus[i].nID);
printf("pInfo->stuParkingStatus.nParkedNumber %d\n", pInfo->stuParkingStatus[i].nParkedNumber);
printf("pInfo->stuParkingStatus.emChangeStatus %d\n", pInfo->stuParkingStatus[i].emChangeStatus);
}
}
else
{
}
switch(lCommand)
{
case DH_ALARM_ALARM_EX: // 0x2101 // 外部报警
case DH_MOTION_ALARM_EX: // 0x2102 // 动态检测
case DH_VIDEOLOST_ALARM_EX: // 0x2103 // 视频丢失
case DH_SHELTER_ALARM_EX: // 0x2104 // 视频遮挡
case DH_DISKFULL_ALARM_EX: // 0x2106 // 硬盘满
case DH_DISKERROR_ALARM_EX: // 0x2107 // 硬盘坏
{
//pDialog->SetAlarmMessage(lCommand, pBuf, dwBufLen);
}
}
return true;
}
int CALLBACK AnalyzerDataCallBack(LLONG lAnalyzerHandle, DWORD dwAlarmType, void* pAlarmInfo, BYTE *pBuffer, DWORD dwBufSize, LDWORD dwUser, int nSequence, void *reserved)
{
switch(dwAlarmType) {
case EVENT_IVS_TRAFFIC_MANUALSNAP: {
DEV_EVENT_TRAFFIC_MANUALSNAP_INFO* pInfo = (DEV_EVENT_TRAFFIC_MANUALSNAP_INFO*)pAlarmInfo;
printf("ManualSnapNo: %s", (char*)pInfo-> szManualSnapNo);
break;
}
case EVENT_IVS_TRAFFIC_PARKINGSPACEPARKING: {
printf("Park have car event:\n");
DEV_EVENT_TRAFFIC_PARKINGSPACEPARKING_INFO *pInfo = (DEV_EVENT_TRAFFIC_PARKINGSPACEPARKING_INFO*)pAlarmInfo;
printf("\t pInfo->nChannelID %d\n", pInfo->nChannelID);
printf("\t pInfo->szName %s\n", pInfo->szName);
printf("\t pInfo->nLane %d\n", pInfo->nLane);
printf("\t pInfo-> szPlateNumber %s\n", pInfo->stTrafficCar.szPlateNumber);
printf("\t pInfo-> szPlateType %s\n", pInfo->stTrafficCar.szPlateType);
printf("\t pInfo-> szPlateColor %s\n", pInfo->stTrafficCar.szPlateColor);
//DEV_EVENT_TRAFFIC_PARKINGSPACEPARKING_INFO;
break;
}
case EVENT_IVS_TRAFFIC_PARKINGSPACENOPARKING: {
printf("Park no car event:\n");
//DEV_EVENT_TRAFFIC_PARKINGSPACENOPARKING_INFO
DEV_EVENT_TRAFFIC_PARKINGSPACENOPARKING_INFO* pInfo = (DEV_EVENT_TRAFFIC_PARKINGSPACENOPARKING_INFO*)pAlarmInfo;
printf("\t pInfo->nChannelID %d\n", pInfo->nChannelID);
printf("\t pInfo->szName %s\n", pInfo->szName);
printf("\t pInfo->nLane %d\n", pInfo->nLane);
printf("\t pInfo-> szPlateNumber %s\n", pInfo->stTrafficCar.szPlateNumber);
printf("\t pInfo-> szPlateType %s\n", pInfo->stTrafficCar.szPlateType);
printf("\t pInfo-> szPlateColor %s\n", pInfo->stTrafficCar.szPlateColor);
break;
}
default:
// printf("dwAlarmType %08x\n", dwAlarmType);
break;
}
return 0;
}
int main()
{
bool bRet = CLIENT_Init(NULL, NULL);
if (!bRet)
{
printf("Init error\n");
}
else
{
printf("Init Success\n");
}
/* Set reconnect */
CLIENT_SetAutoReconnect(NULL, NULL);
// 设置报警回调函数
CLIENT_SetDVRMessCallBack(MessCallBack, 0);
NET_IN_LOGIN_WITH_HIGHLEVEL_SECURITY stInparam;
memset(&stInparam, 0, sizeof(stInparam));
stInparam.dwSize = sizeof(stInparam);
strncpy(stInparam.szIP, "192.168.1.108", sizeof("192.168.1.108") - 1);
strncpy(stInparam.szPassword, "s12345678", sizeof("s12345678") - 1);
strncpy(stInparam.szUserName, "admin", sizeof("admin") - 1);
stInparam.nPort = 37777;
stInparam.emSpecCap = EM_LOGIN_SPEC_CAP_TCP;
NET_OUT_LOGIN_WITH_HIGHLEVEL_SECURITY stOutparam;
memset(&stOutparam, 0, sizeof(stOutparam));
stOutparam.dwSize = sizeof(stOutparam);
g_lLoginId = CLIENT_LoginWithHighLevelSecurity(&stInparam, &stOutparam);
if (0 == g_lLoginId) {
fprintf(stderr, "login error stOutparam.nError %d\n", stOutparam.nError);
} else {
fprintf(stderr, "login Success fd %d\n", g_lLoginId);
}
LLONG lAnalyerHandle = CLIENT_RealLoadPictureEx(g_lLoginId, 0, (DWORD)EVENT_IVS_ALL, TRUE, AnalyzerDataCallBack, NULL, NULL);
if(0 == lAnalyerHandle)
{
printf("CLIENT_RealLoadPictureEx: failed! Error code %x.\n", CLIENT_GetLastError());
return -1;
}
//if(CLIENT_StartListenEx(g_lLoginId)) {
if (CLIENT_StartListenEx(g_lLoginId)) {
printf("CLIENT_StartListen success\n");
} else {
printf("CLIENT_StartListen failed\n");
}
while(1) {
sleep(10);
}
CLIENT_Cleanup();
return 1;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment