From 9e06836fdc70a4045f6dd0e01c97c4610aecbd5e Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期四, 14 十月 2021 15:45:45 +0800 Subject: [PATCH] add ptzTrack toPreset fun --- hikptz.go | 52 +++++++++++++++++++++++----------------------------- 1 files changed, 23 insertions(+), 29 deletions(-) diff --git a/hikptz.go b/hikptz.go index 45d0d19..f58964a 100644 --- a/hikptz.go +++ b/hikptz.go @@ -1,45 +1,39 @@ -package hikvoice +package hikControl /* -#cgo CFLAGS: -I${SRCDIR}/include -w -g -#cgo LDFLAGS: -L${SRCDIR}/libs -#cgo LDFLAGS: -lHikVoice -lAudioRender -lHCCore -lhcnetsdk -lhpr -#cgo LDFLAGS: -ldl -lm - +#cgo CXXFLAGS: -I${SRCDIR}/include -w -g +#cgo LDFLAGS: -L${SRCDIR}/lib +#cgo LDFLAGS: -lhcnetsdk -lhpr -lHCCore #include <stdlib.h> #include "hikptz.h" */ import "C" - import ( - "unsafe" + "unsafe" ) // SendVoice Send Voice -func PtzTrack(ip,password,userName string, port, channel,xBottom,xTop,yBottom,yTop 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)) - +func PtzTrack(ip, userName, password string, port, channel, xBottom, xTop, yBottom, yTop int) { - C.PtzTrack(cip, cusrname, cpasswd, C.int(port), C.int(channel),C.int(xBottom),C.int(xTop),C.int(yBottom),C.int(yTop) ) + cIp := C.CString(ip) + cUsrname := C.CString(userName) + cPasswd := C.CString(password) + + defer C.free(unsafe.Pointer(cIp)) + defer C.free(unsafe.Pointer(cUsrname)) + defer C.free(unsafe.Pointer(cPasswd)) + + 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, userName, password string, port, 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)) - + 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) ) -} \ No newline at end of file + C.toPreset(cip, cusrname, cpasswd, C.int(port), C.int(ch)) +} -- Gitblit v1.8.0