| | |
| | | |
| | | #include <stdlib.h> |
| | | #include "Voice.h" |
| | | |
| | | */ |
| | | import "C" |
| | | import ( |
| | | "unsafe" |
| | | ) |
| | | |
| | | // SendVoice Send Voice |
| | | func SendVoice(ip,usrname,passwd,voiceFilePath string) int { |
| | | return int(C.SendVoice(C.CString(ip), C.CString(usrname), C.CString(passwd), C.CString(voiceFilePath))) |
| | | |
| | | cip := C.CString(ip) |
| | | defer C.free(unsafe.Pointer(cip)) |
| | | cusrname := C.CString(usrname) |
| | | defer C.free(unsafe.Pointer(cusrname)) |
| | | cpasswd := C.CString(passwd) |
| | | defer C.free(unsafe.Pointer(cpasswd)) |
| | | cvoiceFilePath := C.CString(voiceFilePath) |
| | | defer C.free(unsafe.Pointer(cvoiceFilePath)) |
| | | |
| | | cRet := C.SendVoice(cip, cusrname, cpasswd, cvoiceFilePath) |
| | | return int(cRet) |
| | | } |
| | |
| | | |
| | | func TestMain(m *testing.M) { |
| | | fmt.Println("begin") |
| | | r := SendVoice("192.168.5.35", "admin", "a1234567", "/media/basic/cdbfb548-3100-4738-b9c1-0a7e1e002170/workspace/goproject/src/hicvoice/8k_1_16.g711a") |
| | | var ip,usrname,passwd,filepath string |
| | | ip = "192.168.5.35" |
| | | usrname = "admin" |
| | | passwd = "a1234567" |
| | | filepath = "/media/basic/cdbfb548-3100-4738-b9c1-0a7e1e002170/workspace/goproject/src/hicvoice/8k_1_16.g711a" |
| | | r := SendVoice(ip, usrname, passwd, filepath) |
| | | fmt.Println("end ", r) |
| | | } |