ys7

package module
v0.0.0-...-43f4734 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2019 License: MIT Imports: 8 Imported by: 0

README

#ys7 萤石SDK golang版本

Documentation

Index

Constants

View Source
const (
	//[子账号]子账号接口
	ACCOUNTCREATE         = "https://open.ys7.com/api/lapp/ram/account/create"         //创建子账户
	ACCOUNTGET            = "https://open.ys7.com/api/lapp/ram/account/get"            //获取指定子账户信息
	ACCOUNTLIST           = "https://open.ys7.com/api/lapp/ram/account/list"           //分页获取应用下的子账户信息列表
	ACCOUNTUPDATEPASSWORD = "https://open.ys7.com/api/lapp/ram/account/updatePassword" //修改子账户密码
	POLICYSET             = "https://open.ys7.com/api/lapp/ram/policy/set"             //设置子账户的授权策略
	STATEMENTADD          = "https://open.ys7.com/api/lapp/ram/statement/add"          //增加子账户授权策略中的授权语句
	STATEMENTDELETE       = "https://open.ys7.com/api/lapp/ram/statement/delete"       //删除子账户授权策略中某个设备的所有授权语句
	RAMTOKENGET           = "https://open.ys7.com/api/lapp/ram/token/get"              //获取子账户AccessToken
	ACCOUNTDELETE         = "https://open.ys7.com/api/lapp/ram/account/delete"         //删除子账户
)

接口地址

View Source
const (
	//[设备]管理
	DEVICEADD     = "https://open.ys7.com/api/lapp/device/add"         //添加设备到账号下
	DEVICEDELETE  = "https://open.ys7.com/api/lapp/device/delete"      //删除账号下指定设备
	DEVICEUPDATE  = "https://open.ys7.com/api/lapp/device/name/update" //修改设备名称
	DEVICECAPTURE = "https://open.ys7.com/api/lapp/device/capture"     //抓拍设备的当前画面
	URLIPCADD     = "https://open.ys7.com/api/lapp/device/ipc/add"     //NVR设备关联IPC
	URLIPCDELETE  = "hhttps://open.ys7.com/api/lapp/device/ipc/delete" //NVR设备删除IPC
	//修改设备视频加密密码
	//生成设备扫描配网二维码二进制数据
	CAMERANAMEUPDATE = "https://open.ys7.com/api/lapp/camera/name/update" // 修改通道名称

	//[设备]查询
	DEVICELIST = "https://open.ys7.com/api/lapp/device/list" //获取用户下的设备列表
	DEVICEINFO = "https://open.ys7.com/api/lapp/device/info" //获取指定设备的信息
	CAMERALIST = "https://open.ys7.com/api/lapp/camera/list" //获取用户下的摄像头列表

	UUIDPICTURE      = "https://open.ys7.com/api/lapp/device/uuid/picture"  //设备互联互通根据UUID查询抓拍的图片
	DEVICESTATUSINFO = "https://open.ys7.com/api/lapp/device/status/get"    //根据序列号获取设备的状态信息
	DEVICECAMERALIST = "https://open.ys7.com/api/lapp/device/camera/list"   //根据序列号获取设备的通道信息
	DEVICESUPPORT    = "https://open.ys7.com/api/lapp/device/support/ezviz" //根据设备型号以及设备版本号查询设备是否支持萤石协议
	DEVICECAPACITY   = "https://open.ys7.com/api/lapp/device/capacity"      //根据设备序列号查询设备能力集

	//[设备]配置
	DEFENCESET        = "https://open.ys7.com/api/lapp/device/defence/set"         //设置设备活动检测开关状态
	OFFENCRYPT        = "https://open.ys7.com/api/lapp/device/encrypt/off"         //关闭设备视频加密开关
	ONENCRYPT         = "https://open.ys7.com/api/lapp/device/encrypt/on"          //打开设备视频加密开关
	SWITICHSTATUS     = "https://open.ys7.com/api/lapp/device/sound/switch/status" //获取wifi配置或者设备重启提示音开关状态
	SETSOUND          = "https://open.ys7.com/api/lapp/device/sound/switch/set"    //设置wifi配置或者设备重启提示音开关状态
	SCRNESWITCHSTATUS = "https://open.ys7.com/api/lapp/device/scene/switch/status" //获取镜头遮蔽开关状态
	SETSCRENSWITCH    = "https://open.ys7.com/api/lapp/device/scene/switch/set"    //设置镜头遮蔽开关

)

接口地址

View Source
const (
	//[直播管理]直播接口
	LIVEVIDEOLIST      = "https://open.ys7.com/api/lapp/live/video/list"      //获取用户下的直播地址列表
	LIVEADDRESSLIMITED = "https://open.ys7.com/api/lapp/live/address/limited" //获取指定有效期的直播地址
	LIVEVIDEOOPEN      = "https://open.ys7.com/api/lapp/live/video/open"      //批量开通直播功能
	LIVEVIDEOCLOSE     = "https://open.ys7.com/api/lapp/live/video/close"     //批量关闭直播功能
	LIVEGET            = "https://open.ys7.com/api/lapp/live/address/get"     //批量获取设备的直播地址信息

)

接口地址

View Source
const (
	// [设备]云台
	URLPTZSTAR      = "https://open.ys7.com/api/lapp/device/ptz/start"
	URLPTZSTOP      = "https://open.ys7.com/api/lapp/device/ptz/stop"
	URLPTZMIRROR    = "https://open.ys7.com/api/lapp/device/ptz/mirror"
	URLPRESETADD    = "https://open.ys7.com/api/lapp/device/preset/add"
	URLPPRESETMOVE  = "https://open.ys7.com/api/lapp/device/preset/move"
	URLPPRESETCLEAR = "https://open.ys7.com/api/lapp/device/preset/clear"
)

接口地址

View Source
const (
	//[流量管理]流量接口
	TRAFFICUSERTOTAL    = "https://open.ys7.com/api/lapp/traffic/user/total"    //该接口用于查询账号下流量消耗汇总
	TRAFFICUSERDETAIL   = "https://open.ys7.com/api/lapp/traffic/user/detail"   //查询账户下流量消耗详情
	TRAFFICDAYDETAIL    = "https://open.ys7.com/api/lapp/traffic/day/detail"    //查询账户下某天流量消耗详情
	TRAFFICDEVICEDETAIL = "https://open.ys7.com/api/lapp/traffic/device/detail" //查询指定设备在某一时间段消耗流量数据
)

接口地址

View Source
const (
	MASTERACC = 0 //主账号
	RAMACC    = 1 //子账号

	//[用户]获取accessToken
	ACCESSTOKEN = "https://open.ys7.com/api/lapp/token/get" //获取accessToken

)

URL

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	AccessToken string `json:"accessToken"`
	ExpireTime  int64  `json:"expireTime"`
}

AccessToken 萤石密钥

type Account

type Account struct {
	AccountID string `json:"accountId"`
}

Account 萤石子账号ID

type Camera

type Camera struct {
	DeviceSerial string `json:"deviceSerial"`
	IpcSerial    string `json:"ipcSerial"`
	ChannelNo    int    `json:"channelNo"`
	ChannelName  string `json:"channelName"`
	PicURL       string `json:"picUrl"`
	IsShared     string `json:"isShared"`
	VideoLevel   int    `json:"videoLevel"`
	IsEncrypt    int    `json:"isEncrypt"`
	Status       int    `json:"status"`
}

Camera 萤石摄像头数据结构

type Device

type Device struct {
	DeviceSerial  string `json:"deviceSerial"`
	DeviceName    string `json:"deviceName"`
	DeviceType    string `json:"deviceType"`
	Status        int    `json:"status"`
	Defence       int    `json:"defence"`
	DeviceVersion string `json:"deviceVersion"`
}

Device 萤石设备数据结构

type DeviceCapacity

type DeviceCapacity struct {
	Support_cloud                string `json:"support_cloud"`
	Support_intelligent_track    string `json:"support_intelligent_track"`
	Support_p2p_mode             string `json:"support_p_2_p_mode"`
	Support_resolution           string `json:"support_resolution"`
	Support_talk                 string `json:"support_talk"`
	Support_wifi_userId          string `json:"support_wifi_user_id"`
	Support_remote_auth_randcode string `json:"support_remote_auth_randcode"`
	Support_upgrade              string `json:"support_upgrade"`
	Support_smart_wifi           string `json:"support_smart_wifi"`
	Support_ssl                  string `json:"support_ssl"`
	Support_weixin               string `json:"support_weixin"`
	Ptz_close_scene              string `json:"ptz_close_scene"`
	Support_preset_alarm         string `json:"support_preset_alarm"`
	Support_related_device       string `json:"support_related_device"`
	Support_message              string `json:"support_message"`
	Ptz_preset                   string `json:"ptz_preset"`
	Support_wifi                 string `json:"support_wifi"`
	Support_cloud_version        string `json:"support_cloud_version"`
	Ptz_center_mirror            string `json:"ptz_center_mirror"`
	Support_defence              string `json:"support_defence"`
	Ptz_top_bottom               string `json:"ptz_top_bottom"`
	Support_fullscreen_ptz       string `json:"support_fullscreen_ptz"`
	Support_defenceplan          string `json:"support_defenceplan"`
	Support_disk                 string `json:"support_disk"`
	Support_alarm_voice          string `json:"support_alarm_voice"`
	Ptz_left_right               string `json:"ptz_left_right"`
	Support_modify_pwd           string `json:"support_modify_pwd"`
	Support_capture              string `json:"support_capture"`
	Support_privacy              string `json:"support_privacy"`
	Support_encrypt              string `json:"support_encrypt"`
	Support_auto_offline         string `json:"support_auto_offline"`
}

DeviceCapacity 萤石设备能力集

type DeviceInfo

type DeviceInfo struct {
	DeviceSerial   string `json:"deviceSerial"`
	DeviceName     string `json:"deviceName"`
	Model          string `json:"model"`
	Status         int    `json:"status"`
	Defence        int    `json:"defence"`
	IsEncrypt      int    `json:"isEncrypt"`
	AlarmSoundMode int    `json:"alarmSoundMode"`
	OfflineNotify  int    `json:"offlineNotify"`
}

DeviceInfo 萤石设备数据结构

type DeviceStatusInfo

type DeviceStatusInfo struct {
	PrivacyStatus  int    `json:"privacyStatus"`
	PirStatus      int    `json:"pirStatus"`
	AlarmSoundMode int    `json:"alarmSoundMode"`
	BattryStatus   int    `json:"battryStatus"`
	LockSignal     int    `json:"lockSignal"`
	DiskNum        int    `json:"diskNum"`
	DiskState      string `json:"diskState"`
	CloudType      int    `json:"cloudType"`
	CloudStatus    int    `json:"cloudStatus"`
	NvrDiskNum     int    `json:"nvrDiskNum"`
	NvrDiskState   string `json:"nvrDiskState"`
}

设备状态信息

type Live

type Live struct {
	DeviceSerial string `json:"deviceSerial"`
	ChannelNo    int    `json:"channelNo"`
	DeviceName   string `json:"deviceName"`
	LiveAddress  string `json:"liveAddress,omitempty"`
	HdAddress    string `json:"hdAddress,omitempty"`
	Hls          string `json:"hls,omitempty"`
	HlsHd        string `json:"hlsHd,omitempty"`
	Rtmp         string `json:"rtmp,omitempty"`
	RtmpHd       string `json:"rtmpHd,omitempty"`
	Status       int    `json:"status"`
	Exception    int    `json:"exception"`
	BeginTime    int64  `json:"beginTime"`
	EndTime      int64  `json:"endTime"`
}

Live 直播信息

type LiveState

type LiveState struct {
	DeviceSerial string `json:"deviceSerial"`
	ChannelNo    int    `json:"channelNo"`
	Ret          string `json:"ret"`
	Desc         string `json:"desc"`
}

LiveState 直播状态返回

type Page

type Page struct {
	Total int `json:"total"`
	Page  int `json:"page"`
	Size  int `json:"size"`
}

Page 分页数据

type Picture

type Picture struct {
	PicUrl string `json:"picUrl"`
}

图片

type Policy

type Policy struct {
	Statement []Statement `json:"Statement"`
}

Policy Policy

type RAMAccount

type RAMAccount struct {
	AccountID     string `json:"accountId"`
	AccountName   string `json:"accountName"`
	AppKey        string `json:"appKey"`
	AccountStatus int    `json:"accountStatus"`
	Policy        Policy `json:"policy"`
}

RAMAccount 萤石子账号

type Statement

type Statement struct {
	Permission string   `json:"Permission"`
	Resource   []string `json:"Resource"`
}

Statement Statement

type Status

type Status struct {
	Code string `json:"code"`
	Msg  string `json:"msg"`
	Buf  []byte `json:"-"`
}

Status 状态

type SwitchStatus

type SwitchStatus struct {
	DeviceSerial string `json:"deviceSerial"`
	ChannelNo    int    `json:"channelNo"`
	Enable       int    `json:"enable"`
}

SwitchStatus 开关状态

type TrafficTotal

type TrafficTotal struct {
	TotalFlow      int64 `json:"totalFlow"`
	UsedFlow       int64 `json:"usedFlow"`
	AverageConsume int   `json:"averageConsume"`
}

TrafficTotal 账号下流量消耗汇总

type TrafficUserDetail

type TrafficUserDetail struct {
	FlowDate     int64 `json:"flowDate"`
	DeviceCount  int   `json:"deviceCount"`
	ChannelCount int   `json:"channelCount"`
	HlsFlow      int64 `json:"hlsFlow"`
	AppFlow      int64 `json:"appFlow"`
	RtmpFlow     int64 `json:"rtmpFlow"`
	FlowCount    int64 `json:"flowCount"`
}

TrafficUserDetail 账户下流量消耗详情

type Ys7

type Ys7 struct {
	AppKey      string
	Secret      string
	AccessToken string
	ExpireTime  int64
	IsRAM       int
	AccountID   string
	Password    string
}

Ys7 萤石接口

func NewRAMYs7

func NewRAMYs7(AppKey, Secret, AccountID string) (ys *Ys7, err error)

NewRAMYs7 创建子账号对象

func NewYs7

func NewYs7(AppKey, Secret string) (ys *Ys7, err error)

NewYs7 创建Ys7对象

func (*Ys7) AddDevice

func (ys *Ys7) AddDevice(deviceSerial, validateCode string) (err error)

AddDevice 添加设备

func (*Ys7) AddDeviceIpc

func (ys *Ys7) AddDeviceIpc(deviceSerial, ipcSerial string, channelNo int, validateCode string) (err error)

AddDeviceIpc NVR设备关联IPC

func (*Ys7) AddPreset

func (ys *Ys7) AddPreset(deviceSerial string, channelNo int) (index int, err error)

AddPreset 添加预置点

func (*Ys7) ClearPreset

func (ys *Ys7) ClearPreset(deviceSerial string, channelNo, index int) (err error)

ClearPreset 清除预置点

func (*Ys7) CloseLive

func (ys *Ys7) CloseLive(source string) (states []LiveState, err error)

CloseLive 批量关闭直播功能

func (*Ys7) CreateAccount

func (ys *Ys7) CreateAccount(accountName, password string) (acc *Account, err error)

CreateAccount 创建子账号

func (*Ys7) CreateAccountAndToken

func (ys *Ys7) CreateAccountAndToken(accountName, password string) (y *Ys7, err error)

CreateAccountAndToken 创建子账号并返回子账号对象

func (*Ys7) DeleteAccount

func (ys *Ys7) DeleteAccount(accountID string) (err error)

DeleteAccount 删除子账户

func (*Ys7) DeleteDevice

func (ys *Ys7) DeleteDevice(deviceSerial string) (err error)

DeleteDevice 删除设备

func (*Ys7) DeleteDeviceIpc

func (ys *Ys7) DeleteDeviceIpc(deviceSerial, ipcSerial string, channelNo int) (err error)

DeleteDeviceIpc NVR设备删除IPC

func (*Ys7) GetAccessToken

func (ys *Ys7) GetAccessToken() (ac *AccessToken, err error)

GetAccessToken 获取token

func (*Ys7) GetAllCameraList

func (ys *Ys7) GetAllCameraList() (cameras []Camera, err error)

GetAllCameraList 获取所有摄像头列表

func (*Ys7) GetAllDeviceList

func (ys *Ys7) GetAllDeviceList() (devices []Device, err error)

GetAllDeviceList 获取所有设备列表

func (*Ys7) GetCameraList

func (ys *Ys7) GetCameraList(pageStart, pageSize int) (cameras []Camera, page Page, err error)

GetCameraList 获取摄像头列表

func (*Ys7) GetDeviceCameraList

func (ys *Ys7) GetDeviceCameraList(deviceSerial string) (cameras []Camera, err error)

GetDeviceCameraList 获取指定设备的通道信息

func (*Ys7) GetDeviceCap

func (ys *Ys7) GetDeviceCap(deviceSerial string) (deviceCap *DeviceCapacity, err error)

GetDeviceCap 根据设备序列号查询设备能力集

func (*Ys7) GetDeviceCapture

func (ys *Ys7) GetDeviceCapture(deviceSerial string, channelNo int) (picURL string, err error)

GetDeviceCapture 设备抓拍图片

func (*Ys7) GetDeviceList

func (ys *Ys7) GetDeviceList(pageStart, pageSize int) (devices []Device, page Page, err error)

GetDeviceList 获取设备列表

func (*Ys7) GetDeviceStatusInfo

func (ys *Ys7) GetDeviceStatusInfo(deviceSerial string, channel int) (devInfo *DeviceStatusInfo, err error)

GetDeviceStatusInfo 根据序列号获取设备的状态信息

func (*Ys7) GetLiveLimited

func (ys *Ys7) GetLiveLimited(deviceSerial string, channelNo, expireTime int) (live Live, err error)

GetLiveLimited 获取指定有效期直播流地址

func (*Ys7) GetPictureByUuid

func (ys *Ys7) GetPictureByUuid(uuid string, size int) (pic *Picture, err error)

GetPictureByUuid 设备互联互通根据UUID查询抓拍的图片

func (*Ys7) GetSceneSwitchStatus

func (ys *Ys7) GetSceneSwitchStatus(deviceSerial string) (switchStatus *SwitchStatus, err error)

GetSceneSwitchStatus 获取镜头遮蔽开关状态

func (*Ys7) GetSoundSwitchStatus

func (ys *Ys7) GetSoundSwitchStatus(deviceSerial string) (soundStatus *SwitchStatus, err error)

GetSoundSwitchStatus 获取wifi配置提示音开关状态

func (*Ys7) GetTrafficDayDetail

func (ys *Ys7) GetTrafficDayDetail(flowTime int64, pageStart, pageSize int) (traffic []TrafficUserDetail, err error)

GetTrafficDayDetail 查询账户下某天流量消耗详情

func (*Ys7) GetTrafficDeviceDetail

func (ys *Ys7) GetTrafficDeviceDetail(deviceSerial string, startTime, endTime int64, pageStart, pageSize int) (traffic []TrafficUserDetail, err error)

GetTrafficDeviceDetail 查询指定设备在某一时间段消耗流量数据

func (*Ys7) GetTrafficUserDetail

func (ys *Ys7) GetTrafficUserDetail(startTime, endTime int64, pageStart, pageSize int) (traffic []TrafficUserDetail, err error)

GetTrafficUserDetail 查询账户下流量消耗详情

func (*Ys7) GetTrafficUserTotal

func (ys *Ys7) GetTrafficUserTotal() (tra *TrafficTotal, err error)

GetTrafficUserTotal 该接口用于查询账号下流量消耗汇总

func (*Ys7) InfoDevice

func (ys *Ys7) InfoDevice(deviceSerial string) (deviceinfo DeviceInfo, err error)

InfoDevice 获取单个设备信息

func (*Ys7) IsSupportEzviz

func (ys *Ys7) IsSupportEzviz(model, version string) (protocol *Ys7Protocol, err error)

IsSupportEzviz 根据设备型号以及设备版本号查询设备是否支持萤石协议

func (*Ys7) ListLiveVideo

func (ys *Ys7) ListLiveVideo(pageStart, pageSize int) (live []Live, err error)

ListLiveVideo 获取直播列表

func (*Ys7) LiveGet

func (ys *Ys7) LiveGet(source string) (states []Live, err error)

LiveGet 批量获取设备的直播地址信息

func (*Ys7) MirrorPtz

func (ys *Ys7) MirrorPtz(deviceSerial string, channelNo, command int) (err error)

MirrorPtz 镜像翻转

func (*Ys7) MovePreset

func (ys *Ys7) MovePreset(deviceSerial string, channelNo, index int) (err error)

MovePreset 调用预置点

func (*Ys7) OffEncrypt

func (ys *Ys7) OffEncrypt(deviceSerial, validateCode string) (err error)

OffEncrypt 关闭设备视频加密开关

func (*Ys7) OnEncrypt

func (ys *Ys7) OnEncrypt(deviceSerial string) (err error)

OnEncrypt 开启设备视频加密开关

func (*Ys7) OpenLive

func (ys *Ys7) OpenLive(source string) (states []LiveState, err error)

OpenLive 批量开通直播功能

func (*Ys7) RAMAccountGet

func (ys *Ys7) RAMAccountGet(accountID, accountName string) (acc *RAMAccount, err error)

RAMAccountGet 获取单个子账户信息

func (*Ys7) RAMAccountList

func (ys *Ys7) RAMAccountList(pageStart, pageSize int) (acc []RAMAccount, page Page, err error)

RAMAccountList 获取子账户信息列表

func (*Ys7) RAMAddStatement

func (ys *Ys7) RAMAddStatement(accountID string, statement Statement) (err error)

RAMAddStatement 增加子账户权限

func (*Ys7) RAMDeleteStatement

func (ys *Ys7) RAMDeleteStatement(accountID, deviceSerial string) (err error)

RAMDeleteStatement 删除子账户权限

func (*Ys7) RAMGetAccessToken

func (ys *Ys7) RAMGetAccessToken(accountID string) (ac *AccessToken, err error)

RAMGetAccessToken 获取B模式子账户accessToken

func (*Ys7) RAMSetSetPolicy

func (ys *Ys7) RAMSetSetPolicy(accountID string, policy Policy) (err error)

RAMSetSetPolicy 设置子账号权限

func (*Ys7) RAMUpdatePassword

func (ys *Ys7) RAMUpdatePassword(accountID, old, new string) (err error)

RAMUpdatePassword 修改当前子账户密码

func (*Ys7) SetDefence

func (ys *Ys7) SetDefence(deviceSerial string, isDefence int) (err error)

SetDefence 设备布撤防

func (*Ys7) SetSceneSwitch

func (ys *Ys7) SetSceneSwitch(deviceSerial string, enable, channelNo int) (err error)

SetSceneSwitch 设置设备镜头遮蔽开关状态

func (*Ys7) SetSoundSwitch

func (ys *Ys7) SetSoundSwitch(deviceSerial string, enable, channelNo int) (err error)

SetSoundSwitch 设置wifi配置或设备启动提示音开关

func (*Ys7) StartPtz

func (ys *Ys7) StartPtz(deviceSerial string, channelNo, direction, speed int) (err error)

StartPtz 开始云台控制

func (*Ys7) StopPtz

func (ys *Ys7) StopPtz(deviceSerial string, channelNo, direction int) (err error)

StopPtz 停止云台转动

func (*Ys7) UpdateCameraName

func (ys *Ys7) UpdateCameraName(deviceSerial, name string, channelNo int) (err error)

UpdateCameraName 修改通道名称

func (*Ys7) UpdateDeviceName

func (ys *Ys7) UpdateDeviceName(deviceSerial, deviceName string) (err error)

UpdateDeviceName 修改通道名称

type Ys7Protocol

type Ys7Protocol struct {
	Model     string `json:"model"`
	Version   string `json:"version"`
	IsSupport string `json:"isSupport"`
}

Ys7 萤石协议

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL