zhangzengfei
2021-10-14 9e06836fdc70a4045f6dd0e01c97c4610aecbd5e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package hikControl
 
/*
#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"
)
 
// SendVoice Send Voice
func PtzTrack(ip, userName, password string, port, channel, xBottom, xTop, yBottom, yTop int) {
 
    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))
}
 
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.toPreset(cip, cusrname, cpasswd, C.int(port), C.int(ch))
}