| | |
| | | return;
|
| | | }
|
| | |
|
| | |
|
| | | void ToPreset(char *ip, char *userName, char *password, int port ,int channel )
|
| | | {
|
| | | // 初始化
|
| | | NET_DVR_Init();
|
| | | //设置连接时间与重连时间
|
| | | NET_DVR_SetConnectTime(2000, 1);
|
| | | NET_DVR_SetReconnect(10000, true);
|
| | | |
| | | //---------------------------------------
|
| | | //设置异常消息回调函数
|
| | | NET_DVR_SetExceptionCallBack_V30(0, NULL,g_ExceptionCallBack, NULL);
|
| | |
|
| | | //---------------------------------------
|
| | | // 注册设备
|
| | | LONG lUserID;
|
| | | //登录参数,包括设备地址、登录用户、密码等
|
| | | NET_DVR_USER_LOGIN_INFO struLoginInfo = {0};
|
| | | struLoginInfo.bUseAsynLogin = 0; //同步登录方式
|
| | | strcpy(struLoginInfo.sDeviceAddress, ip); //设备IP地址
|
| | | struLoginInfo.wPort = port; //设备服务端口
|
| | | strcpy(struLoginInfo.sUserName, userName); //设备登录用户名
|
| | | strcpy(struLoginInfo.sPassword, password); //设备登录密码
|
| | |
|
| | | //设备信息, 输出参数
|
| | | NET_DVR_DEVICEINFO_V40 struDeviceInfoV40 = {0};
|
| | |
|
| | | lUserID = NET_DVR_Login_V40(&struLoginInfo, &struDeviceInfoV40);
|
| | | if (lUserID < 0)
|
| | | {
|
| | | printf("Login failed, error code: %d\n", NET_DVR_GetLastError());
|
| | | NET_DVR_Cleanup();
|
| | | return;
|
| | | }
|
| | | |
| | | int iChannel = channel;//设备通道号
|
| | | DWORD dwPTZCommand = GOTO_PRESET; //转到预置点
|
| | | if(!NET_DVR_PTZPreset_Other(lUserID, iChannel,GOTO_PRESET))
|
| | | {
|
| | | printf("PAN_LEFT start failed, error code: %d\n", NET_DVR_GetLastError());
|
| | | NET_DVR_Logout(lUserID);
|
| | | NET_DVR_Cleanup();
|
| | | return;
|
| | | }
|
| | | //注销用户
|
| | | NET_DVR_Logout(lUserID);
|
| | |
|
| | | //释放SDK资源
|
| | | NET_DVR_Cleanup();
|
| | |
|
| | | return;
|
| | | }
|
| | |
| | | )
|
| | |
|
| | | // SendVoice Send Voice
|
| | | func PtzTrack(ip,password,port,userName string, channel,xBottom,xTop,yBottom,yTop int) {
|
| | | func PtzTrack(ip,password,userName string, port, channel,xBottom,xTop,yBottom,yTop int) {
|
| | |
|
| | | cip := C.CString(ip)
|
| | | defer C.free(unsafe.Pointer(cip))
|
| | |
| | | defer C.free(unsafe.Pointer(cusrname))
|
| | | cpasswd := C.CString(password)
|
| | | defer C.free(unsafe.Pointer(cpasswd))
|
| | | cport := C.CString(port)
|
| | | defer C.free(unsafe.Pointer(cport))
|
| | | |
| | |
|
| | | C.PtzTrack(cip, cusrname, cpasswd, cport, C.int(channel),C.int(xBottom),C.int(xTop),C.int(yBottom),C.int(yTop) )
|
| | | C.PtzTrack(cip, cusrname, cpasswd, C.int(port), C.int(channel),C.int(xBottom),C.int(xTop),C.int(yBottom),C.int(yTop) )
|
| | | }
|
| | |
|
| | | // void ToPreset(char *ip, char *userName, char *password, char *port ,int channel )
|
| | |
|
| | | func ToPreset(ip,password,port,userName string, ch int) {
|
| | | func ToPreset(ip,userName,password string, port , ch int) {
|
| | |
|
| | | |
| | | cip := C.CString(ip)
|
| | | defer C.free(unsafe.Pointer(cip))
|
| | | cusrname := C.CString(userName)
|
| | | defer C.free(unsafe.Pointer(cusrname))
|
| | | cpasswd := C.CString(password)
|
| | | defer C.free(unsafe.Pointer(cpasswd))
|
| | | |
| | |
|
| | | C.PtzTrack(cip, cusrname, cpasswd, C.int(port), C.int(ch) )
|
| | | } |
| | |
| | | #endif
|
| | |
|
| | | void PtzTrack(char *ip, char *userName, char *password, char *port ,int channel ,int xBottom ,int xTop ,int yBottom ,int yTop )
|
| | | void ToPreset(char *ip, char *userName, char *password, int port ,int channel )
|
| | |
|
| | | #ifdef __cplusplus
|
| | | }
|