From beaadf6542921ea13153e8a90706955b7800e9c9 Mon Sep 17 00:00:00 2001
From: chenshijun <csj_sky@126.com>
Date: 星期三, 24 七月 2019 14:07:21 +0800
Subject: [PATCH] 增加行政区域的接口
---
视频监控平台vss对外协议.doc | 0
gb28181Api.go | 111 +++++++++++--
测试rest.txt | 109 ++++++++----
视频监控平台vss对外协议.txt | 96 +++++++++++
entites.go | 18 ++
api_test.go | 129 ++++++++++------
6 files changed, 353 insertions(+), 110 deletions(-)
diff --git a/api_test.go b/api_test.go
index ccd45f4..550ca13 100644
--- a/api_test.go
+++ b/api_test.go
@@ -1,68 +1,101 @@
package gb28181api
import (
- "fmt"
+ "log"
"testing"
)
-func TestSetPlatformServerInfo(t *testing.T) {
- var api Gb28181Api
- var gbserverinfo = GbServerInfo{
- Name: "娴嬭瘯鍥芥爣骞冲彴",
- PublicID: "44120000002000000011",
- GbServerPort: 7060,
- RtspServrPort: 7554,
- HTTPClientIP: "",
- HTTPClientPort: 0,
- }
- Init("192.168.1.203", 8060)
- flag := api.SetPlatformServerInfo(gbserverinfo)
- fmt.Println(flag)
-}
+//func TestSetPlatformServerInfo(t *testing.T) {
+// var api Gb28181Api
+// var gbserverinfo = GbServerInfo{
+// Name: "娴嬭瘯鍥芥爣骞冲彴aa",
+// PublicID: "44120000002000000011",
+// GbServerPort: 7060,
+// RtspServrPort: 7554,
+// HTTPClientIP: "",
+// HTTPClientPort: 0,
+// }
+//
+// log.SetFlags(log.Lshortfile | log.LstdFlags)
+// Init("192.168.1.203", 8060)
+// flag := api.SetPlatformServerInfo(gbserverinfo)
+// log.Println(flag)
+//}
-func TestGetPlatformServerInfo(t *testing.T) {
- var api Gb28181Api
- Init("192.168.1.203", 8060)
- gbserverinfo, flag := api.GetPlatformServerInfo()
- fmt.Println("flag:", flag)
- fmt.Println("gbserverinfo:", SmartPrintStruct(gbserverinfo))
-}
+//func TestGetPlatformServerInfo(t *testing.T) {
+// var api Gb28181Api
+// Init("192.168.1.203", 8060)
+// gbserverinfo, flag := api.GetPlatformServerInfo()
+// log.Println("flag:", flag)
+// log.Println("gbserverinfo:", SmartPrintStruct(gbserverinfo))
+//}
-func TestGetDevicesByPageNO(t *testing.T) {
- var api Gb28181Api
- Init("192.168.1.203", 8060)
- devsinfo, flag := api.GetDevicesByPageNO(1)
- fmt.Println("flag:", flag)
- fmt.Println("devsinfo:", SmartPrintStruct(devsinfo))
-}
+//func TestGetDevicesByPageNO(t *testing.T) {
+// var api Gb28181Api
+// Init("192.168.1.203", 8060)
+// devsinfo, flag := api.GetDevicesByPageNO(1)
+// fmt.Println("flag:", flag)
+// fmt.Println("devsinfo:", SmartPrintStruct(devsinfo))
+//}
-func TestGetAllDevices(t *testing.T) {
- var api Gb28181Api
- Init("192.168.1.203", 8060)
- alldevsinfo, flag := api.GetAllDevices()
- fmt.Println("flag:", flag)
- fmt.Println("alldevsinfo:", SmartPrintStruct(alldevsinfo))
-}
+//func TestGetAllDevices(t *testing.T) {
+// var api Gb28181Api
+// Init("192.168.1.203", 8060)
+// alldevsinfo, flag := api.GetAllDevices()
+// log.Println("flag:", flag)
+// log.Println("alldevsinfo:", SmartPrintStruct(alldevsinfo))
+//}
-func TestGetCamsByDevAndPage(t *testing.T) {
- var api Gb28181Api
- Init("192.168.1.203", 8060)
- camsinfo, flag := api.GetCamsByDevAndPage("44122500042001000123", "all", 1)
- fmt.Println("flag:", flag)
- fmt.Println("camsinfo:", SmartPrintStruct(camsinfo))
-}
+// func TestGetCamsByDevAndPage(t *testing.T) {
+// var api Gb28181Api
+// Init("192.168.1.203", 8060)
+// camsinfo, flag := api.GetCamsByDevAndPage("44122500042001000123", "all", 1)
+// log.Println("flag:", flag)
+// log.Println("camsinfo:", SmartPrintStruct(camsinfo))
+// }
func TestGetAllCamerasByDevID(t *testing.T) {
var api Gb28181Api
Init("192.168.1.203", 8060)
allcamsinfo, flag := api.GetAllCamerasByDevID("44122500042001000123")
- fmt.Println("flag:", flag)
- fmt.Println("allcamsinfo:", SmartPrintStruct(allcamsinfo))
+ log.Println("flag:", flag)
+ log.Println("allcamsinfo:", SmartPrintStruct(allcamsinfo))
}
-func TestSetCameraPtz(t *testing.T) {
+func TestGetAllDomainUnit(t *testing.T) {
var api Gb28181Api
Init("192.168.1.203", 8060)
- flag := api.SetCameraPtz("11010202081314000004", "focusnear", 150)
- fmt.Println("flag:", flag)
+ domainunits, flag := api.GetAllDomainUnit()
+ log.Println("flag:", flag)
+ log.Println("allcamsinfo:", SmartPrintStruct(domainunits))
}
+
+//func TestGetAllCamerasByDomainUnitAndPage(t *testing.T) {
+// var api Gb28181Api
+// Init("192.168.1.203", 8060)
+// allcamsinfo, flag := api.GetAllCamerasByDomainUnitAndPage("1101", 1)
+// log.Println("flag:", flag)
+// log.Println("allcamsinfo:", SmartPrintStruct(allcamsinfo))
+//}
+
+//func TestGetAllCamerasByDomainUnit(t *testing.T) {
+// var api Gb28181Api
+// Init("192.168.1.203", 8060)
+// allcamsinfo, flag := api.GetAllCamerasByDomainUnit("44122500042001000123")
+// log.Println("flag:", flag)
+// log.Println("allcamsinfo:", SmartPrintStruct(allcamsinfo))
+//}
+
+// func TestSetCameraPtz(t *testing.T) {
+// var api Gb28181Api
+// Init("192.168.1.203", 8060)
+// flag := api.SetCameraPtz("11010202081314000004", "up", 1)
+// log.Println("flag:", flag)
+// }
+
+//func TestGetAndWriteCameras(t *testing.T) {
+// // var api Gb28181Api
+// Init("192.168.1.203", 8060)
+// GetAndWriteCameras()
+// // fmt.Println("flag:", flag)
+//}
diff --git a/entites.go b/entites.go
index daf3d57..5406f40 100644
--- a/entites.go
+++ b/entites.go
@@ -73,3 +73,21 @@
Count int `json:"count"` //(鏁板瓧) 褰撳墠鏈夊嚑鏉℃暟鎹紙涓嬪悓锛�
Data []CameraInfo `json:"data"` //璁惧淇℃伅锛屽弬鐓р��1.璁惧绠$悊鈥濆畾涔�
}
+
+//DomainUnit 璁惧鐨勮鏀垮尯鍩� (璁惧鏄钩鍙版墠浼氬幓鑾峰彇琛屾斂鍖哄煙-涓棿涓変綅缂栫爜涓�200)
+type DomainUnit struct {
+ DevPubID string `json:"devpubid"` //(瀛楃涓�) 閫氶亾鐨勮澶噄d
+ ResType int `json:"restype"` //(鏁板瓧) 1-閫氶亾璧勬簮 2-璧勬簮缁�
+ PublicID string `json:"publicid"` //(瀛楃涓�) 鍥芥爣璧勬簮閫氶亾20浣峣d 锛堢敤浜庤姹傝棰戙�佹帶鍒剁瓑鎿嶄綔锛�
+ Name string `json:"name"` //(瀛楃涓�) 璧勬簮鍚嶇О
+ ParentID string `json:"parentid"` //(瀛楃涓�) 鐖惰妭鐐筰d
+ TotalNum int `json:"totalnum"` //(鏁板瓧) 璧勬簮缁勪笅鎬荤殑鏁伴噺
+ OnlineNum int `json:"onlinenum"` //(鏁板瓧) 璧勬簮缁勪笅鎬荤殑鍦ㄧ嚎鏁伴噺
+}
+
+//DomainUnit 璁惧鐨勮鏀垮尯鍩� (璁惧鏄钩鍙版墠浼氬幓鑾峰彇琛屾斂鍖哄煙-涓棿涓変綅缂栫爜涓�200)
+type DomainUnitInfo struct {
+ GbResult
+ Count int `json:"count"` //(鏁板瓧) 褰撳墠鏈夊嚑鏉℃暟鎹�
+ Data []DomainUnit `json:"data"` //鍖哄煙淇℃伅
+}
diff --git a/gb28181Api.go b/gb28181Api.go
index 4093c7b..7b0ad94 100644
--- a/gb28181Api.go
+++ b/gb28181Api.go
@@ -4,6 +4,7 @@
"bytes"
"encoding/json"
"fmt"
+ "log"
"strconv"
)
@@ -42,12 +43,12 @@
var res GbResult
// fmt.Println("body", string(body))
if err = json.Unmarshal(body, &res); err != nil {
- fmt.Println("jsonErr:", err)
+ log.Println("jsonErr:", err)
return false
}
if res.ErrCode != 0 {
- fmt.Println("errcode: ", res.ErrCode, " errdesc: ", res.ErrDesc)
+ log.Println("errcode: ", res.ErrCode, " errdesc: ", res.ErrDesc)
return false
}
@@ -67,18 +68,18 @@
var info GbServerInfo
body, err := client.DoGetRequest(url, nil, nil)
if err != nil {
- fmt.Println("err:", err)
+ log.Println("err:", err)
return info, false
}
//瑙f瀽retGbServerInfo
var res retGbServerInfo
if err = json.Unmarshal(body, &res); err != nil {
- fmt.Println("jsonErr:", err)
+ log.Println("jsonErr:", err)
return info, false
}
if res.ErrCode != 0 {
- fmt.Println("errcode: ", res.ErrCode, " errdesc: ", res.ErrDesc)
+ log.Println("errcode: ", res.ErrCode, " errdesc: ", res.ErrDesc)
return info, false
}
@@ -94,17 +95,17 @@
var devicesPerPage DevicesInOnePage
body, err := client.DoGetRequest(url, nil, nil)
if err != nil {
- fmt.Println("err:", err)
+ log.Println("err:", err)
return devicesPerPage, false
}
//瑙f瀽 DevicesInOnePage
if err = json.Unmarshal(body, &devicesPerPage); err != nil {
- fmt.Println("jsonErr:", err)
+ log.Println("jsonErr:", err)
return devicesPerPage, false
}
if devicesPerPage.ErrCode != 0 {
- fmt.Println("errcode: ", devicesPerPage.ErrCode, " errdesc: ", devicesPerPage.ErrDesc)
+ log.Println("errcode: ", devicesPerPage.ErrCode, " errdesc: ", devicesPerPage.ErrDesc)
return devicesPerPage, false
}
@@ -116,7 +117,7 @@
var deviceSlice []DeviceInfo
devicesPerPage, flag := api.GetDevicesByPageNO(1)
if !flag {
- fmt.Println("GetDevicesByPageNO Error, deviceSlice is nil")
+ log.Println("GetDevicesByPageNO Error, deviceSlice is nil")
return deviceSlice, false
}
deviceSlice = devicesPerPage.Data
@@ -124,7 +125,7 @@
for i := 1; i < devicesPerPage.TotalPage; i++ {
devicesPerPage, flag := api.GetDevicesByPageNO(i + 1)
if !flag {
- fmt.Println("GetDevicesByPageNO Error,pageno:" + strconv.Itoa(i+1) + " ,deviceSlice is not completed")
+ log.Println("GetDevicesByPageNO Error,pageno:" + strconv.Itoa(i+1) + " ,deviceSlice is not completed")
return deviceSlice, false
}
deviceSlice = append(deviceSlice, devicesPerPage.Data...)
@@ -145,24 +146,24 @@
var camerasPerPage CamerasInOnePage
body, err := client.DoGetRequest(url, nil, nil)
if err != nil {
- fmt.Println("err:", err)
+ log.Println("err:", err)
return camerasPerPage, false
}
//瑙f瀽 CamerasInOnePage
if err = json.Unmarshal(body, &camerasPerPage); err != nil {
- fmt.Println("jsonErr:", err)
+ log.Println("jsonErr:", err)
return camerasPerPage, false
}
if camerasPerPage.ErrCode != 0 {
- fmt.Println("errcode: ", camerasPerPage.ErrCode, " errdesc: ", camerasPerPage.ErrDesc)
+ log.Println("errcode: ", camerasPerPage.ErrCode, " errdesc: ", camerasPerPage.ErrDesc)
return camerasPerPage, false
}
if len(camerasPerPage.Data) > 0 {
for i, v := range camerasPerPage.Data {
if v.ResType == 2 {
- fmt.Println("v.restype == 2")
+ log.Println("v.restype == 2")
camerasPerPage.Data = append(camerasPerPage.Data[:i], camerasPerPage.Data[i+1:]...)
}
}
@@ -177,7 +178,7 @@
var cameraSlice []CameraInfo
camerasPerPage, flag := api.GetCamsByDevAndPage(devID, "all", 1)
if !flag {
- fmt.Println("GetCamsByDevAndPage Error, deviceSlice is nil")
+ log.Println("GetCamsByDevAndPage Error, deviceSlice is nil")
return cameraSlice, false
}
cameraSlice = camerasPerPage.Data
@@ -185,7 +186,79 @@
for i := 1; i < camerasPerPage.TotalPage; i++ {
camerasPerPage, flag := api.GetCamsByDevAndPage(devID, "all", i+1)
if !flag {
- fmt.Println("GetCamsByDevAndPage Error! devID:" + devID + ",type:all,pageno:" + strconv.Itoa(i+1) + " ,cameraSlice is not completed")
+ log.Println("GetCamsByDevAndPage Error! devID:" + devID + ",type:all,pageno:" + strconv.Itoa(i+1) + " ,cameraSlice is not completed")
+ return cameraSlice, false
+ }
+ cameraSlice = append(cameraSlice, camerasPerPage.Data...)
+ }
+
+ return cameraSlice, true
+}
+
+//GetAllDomainUnit get all domainunit 鑾峰彇鎵�鏈夎鏀垮尯鍩�
+func (api Gb28181Api) GetAllDomainUnit() ([]DomainUnit, bool) {
+ url := BASIC_URL + DATA_URL_PREFIX + "/get_all_domainunit"
+ client := NewClient()
+
+ var dmUnit DomainUnitInfo
+ body, err := client.DoGetRequest(url, nil, nil)
+ if err != nil {
+ log.Println("err:", err)
+ return dmUnit.Data, false
+ }
+
+ //瑙f瀽 dmUnit
+ if err = json.Unmarshal(body, &dmUnit); err != nil {
+ log.Println("jsonErr:", err)
+ return dmUnit.Data, false
+ }
+ if dmUnit.ErrCode != 0 {
+ log.Println("errcode: ", dmUnit.ErrCode, " errdesc: ", dmUnit.ErrDesc)
+ return dmUnit.Data, false
+ }
+
+ return dmUnit.Data, true
+}
+
+//GetAllCamerasByDomainUnit get all cameras by domainunit 鑾峰彇鎵�鏈夎鏀垮尯鍩熶笅鐨勮澶�
+func (api Gb28181Api) GetAllCamerasByDomainUnitAndPage(domainpubid string, pageNo int) (CamerasInOnePage, bool) {
+ url := BASIC_URL + DATA_URL_PREFIX + "/get_domainunit_channel/" + domainpubid + "/" + strconv.Itoa(pageNo)
+ client := NewClient()
+
+ var camerasPerPage CamerasInOnePage
+ body, err := client.DoGetRequest(url, nil, nil)
+ if err != nil {
+ log.Println("err:", err)
+ return camerasPerPage, false
+ }
+
+ //瑙f瀽 CamerasInOnePage
+ if err = json.Unmarshal(body, &camerasPerPage); err != nil {
+ log.Println("jsonErr:", err)
+ return camerasPerPage, false
+ }
+ if camerasPerPage.ErrCode != 0 {
+ log.Println("errcode: ", camerasPerPage.ErrCode, " errdesc: ", camerasPerPage.ErrDesc)
+ return camerasPerPage, false
+ }
+
+ return camerasPerPage, true
+}
+
+//GetAllCamerasByDevID 鑾峰彇鎸囧畾琛屾斂鍖哄煙鐨勬憚鍍忔満鍒楄〃
+func (api Gb28181Api) GetAllCamerasByDomainUnit(domainpubid string) ([]CameraInfo, bool) {
+ var cameraSlice []CameraInfo
+ camerasPerPage, flag := api.GetAllCamerasByDomainUnitAndPage(domainpubid, 1)
+ if !flag {
+ log.Println("GetCamsByDevAndPage Error, deviceSlice is nil")
+ return cameraSlice, false
+ }
+ cameraSlice = camerasPerPage.Data
+
+ for i := 1; i < camerasPerPage.TotalPage; i++ {
+ camerasPerPage, flag := api.GetAllCamerasByDomainUnitAndPage(domainpubid, i+1)
+ if !flag {
+ log.Println("GetCamsByDevAndPage Error! devID:" + domainpubid + ",type:all,pageno:" + strconv.Itoa(i+1) + " ,cameraSlice is not completed")
return cameraSlice, false
}
cameraSlice = append(cameraSlice, camerasPerPage.Data...)
@@ -205,18 +278,18 @@
body, err := client.DoGetRequest(url, nil, nil)
if err != nil {
- fmt.Println("err:", err)
+ log.Println("err:", err)
return false
}
//瑙f瀽 CamerasInOnePage
var res GbResult
if err = json.Unmarshal(body, &res); err != nil {
- fmt.Println("jsonErr:", err)
+ log.Println("jsonErr:", err)
return false
}
if res.ErrCode != 0 {
- fmt.Println("errcode: ", res.ErrCode, " errdesc: ", res.ErrDesc)
+ log.Println("errcode: ", res.ErrCode, " errdesc: ", res.ErrDesc)
return false
}
diff --git "a/\346\265\213\350\257\225rest.txt" "b/\346\265\213\350\257\225rest.txt"
index 50ec16e..e4a9c1b 100644
--- "a/\346\265\213\350\257\225rest.txt"
+++ "b/\346\265\213\350\257\225rest.txt"
@@ -6,7 +6,7 @@
一、数据配置管理协议:
1、设置服务器信息:POST
- http://192.168.12.112:8060/vssconfig/set_platform_server?gbsvrid=32000000002000000001&gbsvrport=7060&gbsvrname=国标服务&rtspsvrport=7554
+ http://192.168.3.23:8060/vssconfig/set_platform_server?gbsvrid=32000000002000000001&gbsvrport=7060&gbsvrname=国标服务&rtspsvrport=7554
HTTP Method: GET
返回结果:
@@ -16,13 +16,13 @@
}
2、获取服务器信息:GET
- http://192.168.12.112:8060/vssconfig/get_platform_server
+ http://192.168.3.23:8060/vssconfig/get_platform_server
返回结果:
{
"errcode":0,
"errdesc":"OK",
"name":"本级国标平台",
- "ipaddr":"192.168.12.112",
+ "ipaddr":"192.168.3.23",
"httpserverport":8060,
"publicid":"11000000002000000001",
"gbserverport":7060,
@@ -33,7 +33,7 @@
3.设置上级平台信息:POST
更新或则增加上级平台信息
- http://192.168.12.112:8060/vssconfig/set_upper_platform_server/update
+ http://192.168.3.23:8060/vssconfig/set_upper_platform_server/update
HTTP Method: POST
Body:
@@ -45,7 +45,7 @@
}
删除上级平台信息
- http://192.168.12.112:8060/vssconfig/set_upper_platform_server/delete
+ http://192.168.3.23:8060/vssconfig/set_upper_platform_server/delete
HTTP Method: POST
Body:
@@ -57,7 +57,7 @@
}
4.获取上级平台信息:GET
- http://192.168.12.112:8060/vssconfig/get_upper_platform_server/1
+ http://192.168.3.23:8060/vssconfig/get_upper_platform_server/1
返回结果:
{
@@ -69,7 +69,7 @@
}
5.获取所有设备信息:GET
- http://192.168.12.112:8060/vssconfig/get_all_device/1
+ http://192.168.3.23:8060/vssconfig/get_all_device/1
返回结果:
{
@@ -83,7 +83,7 @@
6.设备管理(一般用于删除设备):POST
删除设备:
- http://192.168.12.112:8060/vssconfig/set_device/delete
+ http://192.168.3.23:8060/vssconfig/set_device/delete
HTTP Method: POST
@@ -108,7 +108,7 @@
}
7.获取设备的所有通道资源信息:GET
- http://192.168.12.112:8060/vssconfig/get_all_channel/11010000002000000001/all/1
+ http://192.168.3.23:8060/vssconfig/get_all_channel/11010000002000000001/all/1
返回结果:
{
@@ -116,14 +116,14 @@
[
{"restype":2,"publicid":"11010000002150000004","name":"28181推送角色","alive":1,"corp":"","model":"","owner":"","civilcode":"","address":"","devpubid":"11010000002000000001","parentid":"11010000002000000001","ip":"","port":0,"longitude":0.0,"latitude":0.0,"ptztype":0,"streamtype":0,"realrtspurl":""},
{"restype":2,"publicid":"11010000002160000009","name":"网关接入摄像机组","alive":1,"corp":"","model":"","owner":"","civilcode":"","address":"","devpubid":"11010000002000000001","parentid":"11010000002150000004","ip":"","port":0,"longitude":0.0,"latitude":0.0,"ptztype":0,"streamtype":0,"realrtspurl":""},
- {"restype":1,"publicid":"11010000001310000004","name":"rtsp_69_1","alive":1,"corp":"51","model":"rtsplib_ipc","owner":"11010000002000000001","civilcode":"1101","address":"","devpubid":"11010000002000000001","parentid":"11010000002160000009","ip":"","port":0,"longitude":104.08116,"latitude":30.68946,"ptztype":3,"streamtype":0,"realrtspurl":"rtsp://192.168.12.112:7554/DevAor=11010000001310000004"},
- {"restype":1,"publicid":"11010000001310000029","name":"成都分公司","alive":1,"corp":"8","model":"hikes_ipc","owner":"11010000002000000001","civilcode":"1101","address":"","devpubid":"11010000002000000001","parentid":"11010000002160000009","ip":"","port":0,"longitude":0.0,"latitude":0.0,"ptztype":1,"streamtype":0,"realrtspurl":"rtsp://192.168.12.112:7554/DevAor=11010000001310000029"},
- {"restype":1,"publicid":"11010000001310000030","name":"大华测试摄像机179-1","alive":1,"corp":"1","model":"dahua_IPC","owner":"11010000002000000001","civilcode":"1101","address":"","devpubid":"11010000002000000001","parentid":"11010000002160000009","ip":"","port":0,"longitude":0.0,"latitude":0.0,"ptztype":1,"streamtype":0,"realrtspurl":"rtsp://192.168.12.112:7554/DevAor=11010000001310000030"}
+ {"restype":1,"publicid":"11010000001310000004","name":"rtsp_69_1","alive":1,"corp":"51","model":"rtsplib_ipc","owner":"11010000002000000001","civilcode":"1101","address":"","devpubid":"11010000002000000001","parentid":"11010000002160000009","ip":"","port":0,"longitude":104.08116,"latitude":30.68946,"ptztype":3,"streamtype":0,"realrtspurl":"rtsp://192.168.3.23:7554/DevAor=11010000001310000004"},
+ {"restype":1,"publicid":"11010000001310000029","name":"成都分公司","alive":1,"corp":"8","model":"hikes_ipc","owner":"11010000002000000001","civilcode":"1101","address":"","devpubid":"11010000002000000001","parentid":"11010000002160000009","ip":"","port":0,"longitude":0.0,"latitude":0.0,"ptztype":1,"streamtype":0,"realrtspurl":"rtsp://192.168.3.23:7554/DevAor=11010000001310000029"},
+ {"restype":1,"publicid":"11010000001310000030","name":"大华测试摄像机179-1","alive":1,"corp":"1","model":"dahua_IPC","owner":"11010000002000000001","civilcode":"1101","address":"","devpubid":"11010000002000000001","parentid":"11010000002160000009","ip":"","port":0,"longitude":0.0,"latitude":0.0,"ptztype":1,"streamtype":0,"realrtspurl":"rtsp://192.168.3.23:7554/DevAor=11010000001310000030"}
]
}
8.获取设备下的一级资源信息:GET (根据父节点查找)
- http://192.168.12.112:8060/vssconfig/get_all_channel/11010000002000000001/node/1
+ http://192.168.3.23:8060/vssconfig/get_all_channel/11010000002000000001/node/1
返回结果:
{
@@ -135,51 +135,82 @@
9.获取平台的所有通道资源信息 (不包含资源组) ----> 如果只接入IPC设备, 建议采用该接口获取资源信息
- http://192.168.12.112:8060/vssconfig/get_platform_all_channel/1
+ http://192.168.3.23:8060/vssconfig/get_platform_all_channel/1
返回结果:
{
"errcode": 0 ,"errdesc": "OK" ,"totalsize": 3 ,"onepagesize": 100 ,"totalpage": 1 ,"pageno": 1, "count":3,"data":
[
- {"restype":1,"publicid":"11010000001310000004","name":"rtsp_69_1","alive":1,"corp":"51","model":"rtsplib_ipc","owner":"11010000002000000001","civilcode":"1101","address":"","devpubid":"11010000002000000001","parentid":"11010000002160000009","ip":"","port":0,"longitude":104.08116,"latitude":30.68946,"ptztype":3,"streamtype":0,"realrtspurl":"rtsp://192.168.12.112:7554/DevAor=11010000001310000004"},
- {"restype":1,"publicid":"11010000001310000029","name":"成都分公司","alive":1,"corp":"8","model":"hikes_ipc","owner":"11010000002000000001","civilcode":"1101","address":"","devpubid":"11010000002000000001","parentid":"11010000002160000009","ip":"","port":0,"longitude":0.0,"latitude":0.0,"ptztype":1,"streamtype":0,"realrtspurl":"rtsp://192.168.12.112:7554/DevAor=11010000001310000029"},
- {"restype":1,"publicid":"11010000001310000030","name":"大华测试摄像机179-1","alive":1,"corp":"1","model":"dahua_IPC","owner":"11010000002000000001","civilcode":"1101","address":"","devpubid":"11010000002000000001","parentid":"11010000002160000009","ip":"","port":0,"longitude":0.0,"latitude":0.0,"ptztype":1,"streamtype":0,"realrtspurl":"rtsp://192.168.12.112:7554/DevAor=11010000001310000030"}
+ {"restype":1,"publicid":"11010000001310000004","name":"rtsp_69_1","alive":1,"corp":"51","model":"rtsplib_ipc","owner":"11010000002000000001","civilcode":"1101","address":"","devpubid":"11010000002000000001","parentid":"11010000002160000009","ip":"","port":0,"longitude":104.08116,"latitude":30.68946,"ptztype":3,"streamtype":0,"realrtspurl":"rtsp://192.168.3.23:7554/DevAor=11010000001310000004"},
+ {"restype":1,"publicid":"11010000001310000029","name":"成都分公司","alive":1,"corp":"8","model":"hikes_ipc","owner":"11010000002000000001","civilcode":"1101","address":"","devpubid":"11010000002000000001","parentid":"11010000002160000009","ip":"","port":0,"longitude":0.0,"latitude":0.0,"ptztype":1,"streamtype":0,"realrtspurl":"rtsp://192.168.3.23:7554/DevAor=11010000001310000029"},
+ {"restype":1,"publicid":"11010000001310000030","name":"大华测试摄像机179-1","alive":1,"corp":"1","model":"dahua_IPC","owner":"11010000002000000001","civilcode":"1101","address":"","devpubid":"11010000002000000001","parentid":"11010000002160000009","ip":"","port":0,"longitude":0.0,"latitude":0.0,"ptztype":1,"streamtype":0,"realrtspurl":"rtsp://192.168.3.23:7554/DevAor=11010000001310000030"}
]
}
+
+10.获取设备的行政区域 (设备是平台才会去获取行政区域-中间三位编码为200)
+ http://192.168.3.23:8060/vssconfig/get_all_domainunit
+ 返回结果:
+ {
+ "errcode":0,"errdesc":"OK","count":10,"data":
+ [
+ {"restype":2,"publicid":"11","name":"北京","devpubid":"11010000002000000001","parentid":"11000000002000000001","totalnum":16,"onlinenum":7},
+ {"restype":2,"publicid":"1101","name":"市区","devpubid":"11010000002000000001","parentid":"11","totalnum":15,"onlinenum":6},
+ {"restype":2,"publicid":"110101","name":"朝阳","devpubid":"11010000002000000001","parentid":"1101","totalnum":0,"onlinenum":0},
+ {"restype":2,"publicid":"11010109","name":"派出所09","devpubid":"11010000002000000001","parentid":"110101","totalnum":0,"onlinenum":0},
+ {"restype":2,"publicid":"110105","name":"东城","devpubid":"11010000002000000001","parentid":"1101","totalnum":0,"onlinenum":0},
+ {"restype":2,"publicid":"110112","name":"通州","devpubid":"11010000002000000001","parentid":"1101","totalnum":9,"onlinenum":4},
+ {"restype":2,"publicid":"11011201","name":"派出所1","devpubid":"11010000002000000001","parentid":"110112","totalnum":0,"onlinenum":0},
+ {"restype":2,"publicid":"1102","name":"11","devpubid":"11010000002000000001","parentid":"11","totalnum":0,"onlinenum":0},
+ {"restype":2,"publicid":"110233","name":"33","devpubid":"11010000002000000001","parentid":"1102","totalnum":0,"onlinenum":0},
+ {"restype":2,"publicid":"110255","name":"33","devpubid":"11010000002000000001","parentid":"1102","totalnum":0,"onlinenum":0}
+ ]
+ }
+
+11. 获取行政区域的通道信息
+ http://192.168.3.23:8060/vssconfig/get_domainunit_channel/1101/1
+ 返回结果:
+ {
+ "errcode": 0 ,"errdesc": "OK" ,"totalsize": 3 ,"onepagesize": 100 ,"totalpage": 1 ,"pageno": 1, "count":3,"data":
+ [
+ {"restype":1,"publicid":"11010000001310000004","name":"rtsp_69_1","alive":0,"corp":"51","model":"rtsplib_ipc","owner":"11010000002000000001","civilcode":"1101","address":"","devpubid":"11010000002000000001","parentid":"11010000002160000009","ip":"","port":0,"longitude":104.08116,"latitude":30.68946,"ptztype":3,"streamtype":0,"realrtspurl":"rtsp://192.168.3.23:7554/DevAor=11010000001310000004"},
+ {"restype":1,"publicid":"11010000001310000029","name":"成都分公司-","alive":1,"corp":"8","model":"hikes_ipc","owner":"11010000002000000001","civilcode":"1101","address":"","devpubid":"11010000002000000001","parentid":"11010000002160000009","ip":"","port":0,"longitude":0.0,"latitude":0.0,"ptztype":1,"streamtype":0,"realrtspurl":"rtsp://192.168.3.23:7554/DevAor=11010000001310000029"},
+ {"restype":1,"publicid":"11010000001310000030","name":"大华测试摄像机79-1","alive":1,"corp":"1","model":"dahua_IPC","owner":"11010000002000000001","civilcode":"1101","address":"","devpubid":"11010000002000000001","parentid":"11010000002160000009","ip":"","port":0,"longitude":0.0,"latitude":0.0,"ptztype":1,"streamtype":0,"realrtspurl":"rtsp://192.168.3.23:7554/DevAor=11010000001310000030"}
+ ]
+ }
操作相关接口:
1.PTZ控制
- 向上: http://192.168.12.112:8060/vss/ptz/up/100/11000000001325000001
+ 向上: http://192.168.3.23:8060/vss/ptz/up/100/11000000001325000001
- 向下: http://192.168.12.112:8060/vss/ptz/down/100/11000000001325000001
+ 向下: http://192.168.3.23:8060/vss/ptz/down/100/11000000001325000001
- 向左: http://192.168.12.112:8060/vss/ptz/left/100/11000000001325000001
+ 向左: http://192.168.3.23:8060/vss/ptz/left/100/11000000001325000001
- 向右: http://192.168.12.112:8060/vss/ptz/right/100/11000000001325000001
+ 向右: http://192.168.3.23:8060/vss/ptz/right/100/11000000001325000001
- 左上: http://192.168.12.112:8060/vss/ptz/leftup/100/11000000001325000001
+ 左上: http://192.168.3.23:8060/vss/ptz/leftup/100/11000000001325000001
- 左下: http://192.168.12.112:8060/vss/ptz/leftdown/100/11000000001325000001
+ 左下: http://192.168.3.23:8060/vss/ptz/leftdown/100/11000000001325000001
- 右上: http://192.168.12.112:8060/vss/ptz/rightup/100/11000000001325000001
+ 右上: http://192.168.3.23:8060/vss/ptz/rightup/100/11000000001325000001
- 右下: http://192.168.12.112:8060/vss/ptz/rightdown/100/11000000001325000001
+ 右下: http://192.168.3.23:8060/vss/ptz/rightdown/100/11000000001325000001
- 镜头近: http://192.168.12.112:8060/vss/ptz/zoomin/100/11000000001325000001
- 镜头远: http://192.168.12.112:8060/vss/ptz/zoomout/100/11000000001325000001
+ 镜头近: http://192.168.3.23:8060/vss/ptz/zoomin/100/11000000001325000001
+ 镜头远: http://192.168.3.23:8060/vss/ptz/zoomout/100/11000000001325000001
- 焦距远: http://192.168.12.112:8060/vss/ptz/focusfar/100/11000000001325000001
- 焦距近: http://192.168.12.112:8060/vss/ptz/focusnear/100/11000000001325000001
+ 焦距远: http://192.168.3.23:8060/vss/ptz/focusfar/100/11000000001325000001
+ 焦距近: http://192.168.3.23:8060/vss/ptz/focusnear/100/11000000001325000001
- 设置预置位:http://192.168.12.112:8060/vss/ptz/setpos/100/11000000001325000001
- 调预置位: http://192.168.12.112:8060/vss/ptz/callpos/100/11000000001325000001
+ 设置预置位:http://192.168.3.23:8060/vss/ptz/setpos/100/11000000001325000001
+ 调预置位: http://192.168.3.23:8060/vss/ptz/callpos/100/11000000001325000001
- 停止: http://192.168.12.112:8060/vss/ptz/stop/0/11000000001325000001
+ 停止: http://192.168.3.23:8060/vss/ptz/stop/0/11000000001325000001
2.录像查询
- http://192.168.12.112:8060/vss/history_search/2018-08-30T00:00:00/2018-08-30T02:00:00/11000000001325000001
+ http://192.168.3.23:8060/vss/history_search/2018-08-30T00:00:00/2018-08-30T02:00:00/11000000001325000001
返回结果:
{
@@ -207,8 +238,8 @@
3.设备控制
- 手动录像开启:http://192.168.12.112:8060/vss/device_ctrl/record/11000000001325000001/start
- 手动录像停止: http://192.168.12.112:8060/vss/device_ctrl/record/11000000001325000001/stop
+ 手动录像开启:http://192.168.3.23:8060/vss/device_ctrl/record/11000000001325000001/start
+ 手动录像停止: http://192.168.3.23:8060/vss/device_ctrl/record/11000000001325000001/stop
返回结果:
{
@@ -225,7 +256,7 @@
"errcode": (数字) 返回值,0表示成功,其他见错误码
"imageurl": (字符串) 图片的url地址
请求:
- URL: http://192.168.12.112:8060/vss/get_image/11000000001320020001/1
+ URL: http://192.168.3.23:8060/vss/get_image/11000000001320020001/1
HTTP Method: GET
@@ -235,7 +266,7 @@
"errcode":0,
"errdesc":"OK",
"imagetime":"2019-03-04T11:44:16",
- "imageurl":"http://192.168.12.112:8088/image/11000000001320020001.jpg"
+ "imageurl":"http://192.168.3.23:8088/image/11000000001320020001.jpg"
}
5. 重新获取资源目录
@@ -243,7 +274,7 @@
"devpubid": (字符串) 设备20位编号
请求:
- URL: http://192.168.12.112:8060/vss/get_catalog/11010000002000000001
+ URL: http://192.168.3.23:8060/vss/get_catalog/11010000002000000001
HTTP Method: GET
@@ -256,7 +287,7 @@
二、报警通知
视频服务器作为httpclient
- URL: http://192.168.12.112:8060/vssalarm
+ URL: http://192.168.3.23:8060/vssalarm
HTTP Method: POST
diff --git "a/\350\247\206\351\242\221\347\233\221\346\216\247\345\271\263\345\217\260vss\345\257\271\345\244\226\345\215\217\350\256\256.doc" "b/\350\247\206\351\242\221\347\233\221\346\216\247\345\271\263\345\217\260vss\345\257\271\345\244\226\345\215\217\350\256\256.doc"
index 6857b9e..2e486f4 100644
--- "a/\350\247\206\351\242\221\347\233\221\346\216\247\345\271\263\345\217\260vss\345\257\271\345\244\226\345\215\217\350\256\256.doc"
+++ "b/\350\247\206\351\242\221\347\233\221\346\216\247\345\271\263\345\217\260vss\345\257\271\345\244\226\345\215\217\350\256\256.doc"
Binary files differ
diff --git "a/\350\247\206\351\242\221\347\233\221\346\216\247\345\271\263\345\217\260vss\345\257\271\345\244\226\345\215\217\350\256\256.txt" "b/\350\247\206\351\242\221\347\233\221\346\216\247\345\271\263\345\217\260vss\345\257\271\345\244\226\345\215\217\350\256\256.txt"
index efa1f55..449ca86 100644
--- "a/\350\247\206\351\242\221\347\233\221\346\216\247\345\271\263\345\217\260vss\345\257\271\345\244\226\345\215\217\350\256\256.txt"
+++ "b/\350\247\206\351\242\221\347\233\221\346\216\247\345\271\263\345\217\260vss\345\257\271\345\244\226\345\215\217\350\256\256.txt"
@@ -246,7 +246,6 @@
{"publicid":'11000000001320020001',"errcode":-502,"errdesc":"error 501"}
]
}
-
7.获取设备的所有通道资源信息
@@ -420,7 +419,96 @@
"realrtspurl":"rtsp://192.168.0.10:7554/DevAor=11010000001310000004"
}
+10.获取设备的行政区域 (设备是平台才会去获取行政区域-中间三位编码为200)
+ 字段说明:
+ "devpubid": (字符串) 注册的设备id
+ "errcode: (数字) 返回状态值,0表示正常状态,其他见错误码(下同)
+ "errdesc": (字符串) 错误码描述(下同)
+
+ "restype": (数字) 1-通道资源 2-资源组
+ "publicid": (字符串) 国标资源通道20位id (用于请求视频、控制等操作)
+ "name": (字符串) 资源名称
+ "alive": (数字) 状态 0:不在线 1:在线
+ "totalnum": (数字) 资源组下总的数量
+ "onlinenum" (数字) 资源组下总的在线数量
+
+请求:
+ URL: http://192.168.0.10:8060/vssconfig/get_all_domainunit
+
+ HTTP Method: GET
+
+返回:
+ 其中errcode为必填项,errcode小于0表示错误,无数据; 如果errcode等于0,那么数据里面的每项都是必填项
+ {
+ "errcode": 0 ,"errdesc": "OK" ,"count":2,"data":
+ [
+ {"restype":2,"publicid":"1101","name":"北京市","devpubid":"11010000002000000001","parentid":"11010000002000000001","totalnum":100,"onlinenum":80},
+ {"restype":2,"publicid":"110101","name":"北京市东城区","devpubid":"11010000002000000001","parentid":"1101","totalnum":100,"onlinenum":80}
+ ]
+ }
+
+11.获取行政区域的通道信息
+ 字段说明:
+ "pageno": (数字) 指定获取第几页,第一次为1,返回总页数,总条数
+ "devpubid": (字符串) 注册的设备id
+ "domainpubid" (字符串) 行政区域的id
+
+ "errcode: (数字) 返回状态值,0表示正常状态,其他见错误码(下同)
+ "errdesc": (字符串) 错误码描述(下同)
+ "totalsize": (数字) 设备总数 (下同)
+ "onepagesize": (数字) 每页大小 (下同)
+ "totalpage": (数字) 总分页数 (下同)
+ "pageno": (数字) 当前第几页(下同)
+ "count": (数字) 当前有几条数据(下同)
+ "data": 设备信息,参照“1.设备管理”定义
+
+ "restype": (数字) 1-通道资源 2-资源组
+ "publicid": (字符串) 国标资源通道20位id (用于请求视频、控制等操作)
+ "name": (字符串) 资源名称
+ "alive": (数字) 状态 0:不在线 1:在线
+ "corp": (字符串) 厂商
+ "owner": (字符串) 设备归属
+ "civilcode": (字符串) 行政区域 (可以按照行政区域进行划分资源组)
+ "address": (字符串) 地址
+ "devpubid": (字符串) 通道的设备id
+ "parentid": (字符串) 父节点id
+ "ip": (字符串) ip地址
+ "port": (数字) 端口
+ "longitude": (数字) 经度
+ "latitude": (数字) 纬度
+ "ptztype": (数字) 控制类型 1-球机;2-半球;3-固定枪机;4-遥控枪机;
+ "streamtype": (数字) 码流类型 0-H264;1-MPEG2;2-MPEG4;3-SVAC;4-3GP;5-H265;
+ "realrtspurl":(字符串) 实时视频的rtsp地址
+
+ 请求:
+ URL: http://192.168.0.10:8060/vssconfig/get_domainunit_channel/{domainpubid}/{pageno}
+
+ HTTP Method: GET
+
+ 返回:
+ 其中errcode为必填项,errcode小于0表示错误,无数据; 如果errcode等于0,那么数据里面的每项都是必填项
+ {
+ "errcode": 0 ,"errdesc": "OK" ,"totalsize": 3 ,"onepagesize": 100 ,"totalpage": 1 ,"pageno": 1, "count":3,"data":
+ [
+ {"restype":1,"publicid":"11010000001310000004","name":"rtsp_69_1","alive":1,"corp":"51","model":"rtsplib_ipc","owner":"11010000002000000001","civilcode":"1101","address":"","devpubid":"11010000002000000001","parentid":"11010000002160000009","ip":"","port":0,"longitude":104.08116,"latitude":30.68946,"ptztype":3,"streamtype":0,"realrtspurl":"rtsp://192.168.1.230:7554/DevAor=11010000001310000004"},
+ {"restype":1,"publicid":"11010000001310000029","name":"成都分公司","alive":1,"corp":"8","model":"hikes_ipc","owner":"11010000002000000001","civilcode":"1101","address":"","devpubid":"11010000002000000001","parentid":"11010000002160000009","ip":"","port":0,"longitude":0.0,"latitude":0.0,"ptztype":1,"streamtype":0,"realrtspurl":"rtsp://192.168.1.230:7554/DevAor=11010000001310000029"},
+ {"restype":1,"publicid":"11010000001310000030","name":"大华测试摄像机179-1","alive":1,"corp":"1","model":"dahua_IPC","owner":"11010000002000000001","civilcode":"1101","address":"","devpubid":"11010000002000000001","parentid":"11010000002160000009","ip":"","port":0,"longitude":0.0,"latitude":0.0,"ptztype":1,"streamtype":0,"realrtspurl":"rtsp://192.168.1.230:7554/DevAor=11010000001310000030"}
+ ]
+ }
+
+行政区域资源组展现方式:(完全采用下级注册资源展现方式)
+ 本级平台的(Svrtbl)
+ --注册设备下的资源组1 VSSDomainUnitTbl
+ --通道资源 (VSSChannelTbl)
+ --注册设备下的资源组2 VSSDomainUnitTbl
+ --通道资源 (VSSChannelTbl)
+
+行政区域资源树展现:
+ 一级资源组(国标服务名称:http://192.168.1.230:8060/vssconfig/get_platform_server)
+ --二级级资源组 (restype=2 通道资源:http://192.168.1.230:8060/vssconfig/get_all_domainunit)
+ --通道资源 (restype=1 通道资源:http://192.168.1.230:8060/vssconfig/get_domainunit_channel/{domainpubid}/{pageno})
+
二、通信接口:
视频服务器作为httpserver。
@@ -433,7 +521,7 @@
"ptzparam": (数字) 参数,速度范围为1-255
请求:
- URL: http://192.168.0.10:8088/vss/ptz/{ptztype}/{ptzparam}/{channelid}
+ URL: http://192.168.0.10:8060/vss/ptz/{ptztype}/{ptzparam}/{channelid}
HTTP Method: GET
@@ -456,7 +544,7 @@
"type": (字符串)录像类型 all,time,alarm,manual
请求:
- URL: http://192.168.0.10:8088/vss/history_search/{begintime}/{endtime}/{channelid}
+ URL: http://192.168.0.10:8060/vss/history_search/{begintime}/{endtime}/{channelid}
HTTP Method: GET
@@ -514,7 +602,7 @@
"latitude": (字符串) 纬度
请求:
- URL: http://192.168.0.10:8088/vssalarm
+ URL: http://192.168.0.10:8060/vssalarm
HTTP Method: POST
--
Gitblit v1.8.0