refactor: 重命名 connection -> session
This commit is contained in:
@ -5,16 +5,16 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Connection struct {
|
||||
type Session struct {
|
||||
Device *onvif.Device `json:"device"`
|
||||
}
|
||||
|
||||
func New(xaddr string, username string, password string) (*Connection, error) {
|
||||
func NewSession(xaddr string, username string, password string) (*Session, error) {
|
||||
// 规范化连接地址
|
||||
if !strings.Contains(xaddr, ":") {
|
||||
xaddr += ":80"
|
||||
}
|
||||
|
||||
|
||||
dev, err := onvif.NewDevice(onvif.DeviceParams{
|
||||
Xaddr: xaddr,
|
||||
Username: username,
|
||||
@ -25,5 +25,5 @@ func New(xaddr string, username string, password string) (*Connection, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Connection{Device: dev}, nil
|
||||
return &Session{Device: dev}, nil
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package onvif
|
||||
|
||||
import "github.com/IOTechSystems/onvif/device"
|
||||
|
||||
func (c *Connection) GetDeviceInfo() (*device.GetDeviceInformationResponse, error) {
|
||||
func (c *Session) GetDeviceInfo() (*device.GetDeviceInformationResponse, error) {
|
||||
resp, err := c.Device.CallMethod(device.GetDeviceInformation{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"github.com/IOTechSystems/onvif/xsd"
|
||||
)
|
||||
|
||||
func (c *Connection) SubscribeEvents(
|
||||
func (c *Session) SubscribeEvents(
|
||||
consumerAddress event.AttributedURIType,
|
||||
terminationTime xsd.String, // PT60S
|
||||
) (*event.SubscribeResponse, error) {
|
||||
|
Reference in New Issue
Block a user