它在程序中的应用是这样的,我还不明白红色部分的函数原型不是上边的NET_DVR_SetDVRMessCallBack吗?为什么到用的时候变成红色部分这样写的了?
uint32_t
MessCallBack(int32_t lCommand, char *sDVRIP, char *pBuf, uint32_t dwBufLen)
{
int32_t lIndex = -1;
int i;
char timestamp[30] = {0};
char frontID[36] = {0};
//--------------------------网络异常时-------------------------------------------------------
if(lCommand < EXCEPTION_EXCHANGE) //EXCEPTION_EXCHANGE 0x8000 (探询设备时网络异常)
{
fprintf(stderr, "lCommand[%x], sDVRIP[%s], pBuf[%s], dwBufLen[%d]\n",
lCommand, sDVRIP, pBuf, dwBufLen);
#ifdef SDK_ALCATEL
if (lCommand == COMM_ALARM) { //COMM_ALARM 0x1100 报警信息
#ifdef ALCATEL_FRONTIDCFG
fprintf(stderr, "ALARM:FrontID:");
for (i=0;i<32;i++)
fprintf(stderr, "%d", *(pBuf+i));
fprintf(stderr, "\n\r");
fprintf(stderr, "ALARM:AlarmType:%d\n",
((LPNET_DVR_ALARMINFO)(pBuf+32))->dwAlarmType); //dwAlarmType 0-信号量报警,1-硬盘满,2-信号丢失,3-移动侦测,4-硬盘未格
式化,5-读写硬盘出错,6-遮挡报警
#ifdef SDK_ALCATEL_DX
if (((LPNET_DVR_ALARMINFO)(pBuf+32))->dwAlarmType == 0)
fprintf(stderr, "ALARM:AlarmStatus:%s\n",
((LPNET_DVR_ALARMINFO)(pBuf+32))->dwAlarmStatus ? //dwAlarmStatus 1-signal alarm occur 0-signal alarm stop *ONLY
significant when dwAlarmType=0*
"signal alarm occur" : "signal alarm stop");
fprintf(stderr, "ALARM:Alarm Code:");
for (i=0;i<6;i++) {
fprintf(stderr, "%d", ((LPNET_DVR_ALARMINFO)(pBuf+32))->alarmCode[i]);
}
fprintf(stderr, "\n\r");
#endif
#else
fprintf(stderr, "ALARM:AlarmType:%d\n",
((LPNET_DVR_ALARMINFO)pBuf)->dwAlarmType);
#ifdef SDK_ALCATEL_DX
if (((LPNET_DVR_ALARMINFO)pBuf)->dwAlarmType == 0)
fprintf(stderr, "ALARM:AlarmStatus:%s\n",
((LPNET_DVR_ALARMINFO)pBuf)->dwAlarmStatus ?
"signal alarm occur" : "signal alarm stop");
fprintf(stderr, "ALARM:Alarm Code:");
for (i=0;i<6;i++) {
fprintf(stderr, "%d", ((LPNET_DVR_ALARMINFO)pBuf)->alarmCode[i]);
}
fprintf(stderr, "\n\r");
#endif
#endif
}
#ifdef SDK_ALCATEL_DX
else if (lCommand == COMM_VIDEOSTATUS) { //COMM_VIDEOSTATUS 0x1600
memcpy(timestamp, ((LPNET_DVR_VIDEOSTATUS)pBuf)->TimeStamp, 20);
fprintf(stderr, "VIDEOSTATUS:FrontID:");
for (i=0; i<32; i++)
fprintf(stderr,"%d ", ((LPNET_DVR_VIDEOSTATUS)pBuf)->byFrontID[i]);
fprintf(stderr, "\n\r");
fprintf(stderr, "VIDEOSTATUS:TimeStamp:%s\n", timestamp);
for (i=0; i<MAX_CHANNUM; i++)
fprintf(stderr, "VIDEOSTATUS:Channel[%d]:status:%s\n", i+1,
((LPNET_DVR_VIDEOSTATUS)pBuf)->status[i] ? "Normal" : "Frame Lose");
}
#endif
#endif
}
//-------------------------------------------------------------------------------------------
else
{
lIndex = *((int32_t *)pBuf);
switch (lCommand)
{
case EXCEPTION_EXCHANGE: // 0x8000 探询设备时网络异常
printf("DVR[%s] network exception\n", sDVRIP);
break;
case EXCEPTION_AUDIOEXCHANGE: // 0x8001 语音对讲异常
printf("lIndex[%d] audioexchange exception\n", lIndex);
break;
case EXCEPTION_ALARM: // 0x8002 报警异常
printf("lIndex[%d] alarm exception\n", lIndex);
break;
case EXCEPTION_PREVIEW: // 0x8003 预览异常
printf("lIndex[%d] preview exception\n", lIndex);
break;
case EXCEPTION_SERIAL: // 0x8004 透明通道异常
printf("lIndex[%d] serial exception\n", lIndex);
break;
default:
break;
}
}
return 1;
}