1. NVR Status 但对象初始化失败时返回false
This commit is contained in:
		
							
								
								
									
										14
									
								
								Nvr.go
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								Nvr.go
									
									
									
									
									
								
							| @@ -7,6 +7,7 @@ package HikSDK | |||||||
| */ | */ | ||||||
| import "C" | import "C" | ||||||
| import ( | import ( | ||||||
|  | 	"errors" | ||||||
| 	"gitea.com/kunmeng/HikNetSDKPkg/Core" | 	"gitea.com/kunmeng/HikNetSDKPkg/Core" | ||||||
| 	"time" | 	"time" | ||||||
| 	"unsafe" | 	"unsafe" | ||||||
| @@ -29,6 +30,9 @@ func NewNvr(Ip string, Port int, Username, Password string) (*Nvr, error) { | |||||||
| } | } | ||||||
|  |  | ||||||
| func (this *Nvr) GetTimeZone() (int, error) { | func (this *Nvr) GetTimeZone() (int, error) { | ||||||
|  | 	if this == nil { | ||||||
|  | 		return 0, errors.New("Nvr is nil") | ||||||
|  | 	} | ||||||
| 	var data Core.NET_DVR_NETAPPCFG | 	var data Core.NET_DVR_NETAPPCFG | ||||||
| 	var dataPtr = unsafe.Pointer(data.GetCPtr()) | 	var dataPtr = unsafe.Pointer(data.GetCPtr()) | ||||||
| 	err := Core.GetDVRConfig(this.userId, 222, 0, dataPtr, Core.DWORD(unsafe.Sizeof(data.GetC()))) | 	err := Core.GetDVRConfig(this.userId, 222, 0, dataPtr, Core.DWORD(unsafe.Sizeof(data.GetC()))) | ||||||
| @@ -41,7 +45,9 @@ func (this *Nvr) GetTimeZone() (int, error) { | |||||||
| } | } | ||||||
|  |  | ||||||
| func (this *Nvr) CheckTimeRegionWithMonth(Year, Month, Channel uint16) ([]uint8, error) { | func (this *Nvr) CheckTimeRegionWithMonth(Year, Month, Channel uint16) ([]uint8, error) { | ||||||
|  | 	if this == nil { | ||||||
|  | 		return nil, errors.New("Nvr is nil") | ||||||
|  | 	} | ||||||
| 	//	//// 查当月 | 	//	//// 查当月 | ||||||
| 	var struSearchParam Core.NET_DVR_MRD_SEARCH_PARAM | 	var struSearchParam Core.NET_DVR_MRD_SEARCH_PARAM | ||||||
| 	struSearchParam.DwSize = Core.DWORD(unsafe.Sizeof(struSearchParam.GetC())) | 	struSearchParam.DwSize = Core.DWORD(unsafe.Sizeof(struSearchParam.GetC())) | ||||||
| @@ -72,6 +78,9 @@ func (this *Nvr) CheckTimeRegionWithMonth(Year, Month, Channel uint16) ([]uint8, | |||||||
| } | } | ||||||
|  |  | ||||||
| func (this *Nvr) CheckTimeRegionWithDay(Year, Month, Day, Channel uint16) ([]TimeRange, error) { | func (this *Nvr) CheckTimeRegionWithDay(Year, Month, Day, Channel uint16) ([]TimeRange, error) { | ||||||
|  | 	if this == nil { | ||||||
|  | 		return nil, errors.New("Nvr is nil") | ||||||
|  | 	} | ||||||
| 	var Data Core.NET_DVR_FILECOND | 	var Data Core.NET_DVR_FILECOND | ||||||
| 	Data.DwFileType = 0xff | 	Data.DwFileType = 0xff | ||||||
| 	Data.DwIsLocked = 0xff | 	Data.DwIsLocked = 0xff | ||||||
| @@ -163,6 +172,9 @@ func (this *Nvr) CheckTimeRegionWithDay(Year, Month, Day, Channel uint16) ([]Tim | |||||||
| 	return res, nil | 	return res, nil | ||||||
| } | } | ||||||
| func (this *Nvr) Logout() error { | func (this *Nvr) Logout() error { | ||||||
|  | 	if this == nil { | ||||||
|  | 		return errors.New("Nvr is nil") | ||||||
|  | 	} | ||||||
| 	return Core.Logout(this.userId) | 	return Core.Logout(this.userId) | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 kunmeng
					kunmeng