import { ApiClientFactory } from '../core/api.client.factory'; import { VideoList, GatewayList, Docs, CreateGateway, CreateNVR, CreateCamera, NVRInfo, CameraInfo, GroupList, CreateGroup, VendorList, CategoryList, DeviceDetail, CameraModel, HummingbirdDocs, PageList, DeviceLocations, DeviceLocationsReq, } from '../model/videoConfig.model'; export class VideoConfigService { constructor(private factory: ApiClientFactory) {} /** * @function sendGatewayConfig 下发配置 * @param projectId 项目ID * @param gatewayId 网关ID */ async sendGatewayConfig(projectId: string, gatewayId: string): Promise { const result = await this.factory.surveillance.put( `/config/projects/${projectId}/devices/gateway/${gatewayId}/syncConfig` ); return result; } /** * @function loadDocs 获取文档 * @param projectId 项目ID */ async loadDocs(projectId: string): Promise { const result = await this.factory.surveillance.get(`/config/projects/${projectId}/devices/download/getUrl`); return result; } /** * @function loadHummingbirdDocs 下载蜂鸟盒子帮助文档 */ async loadHummingbirdDocs(): Promise { const result = await this.factory.surveillance.get(`/config/lai/download/getUrl`); return result; } /** * @function loadGatewayList 获取网关列表 * @param projectId 项目ID */ async loadGatewayList(projectId: string): Promise { const result = await this.factory.surveillance.get( `/config/projects/${projectId}/devices/listGateway` ); return result; } /** * @function loadVideoList 获取相关设备列表 * @param projectId 项目ID * @param type 列表类型 * type:gateway,获取视频网关列表 * type:nvr,获取视频NVR列表 * type:camera,获取摄像机列表 */ async loadVideoList(projectId: string, type: string, params?: any): Promise { const result = await this.factory.surveillance.get( `/config/projects/${projectId}/devices?type=${type}`, params ); return result; } /** * @function createVideoGateway 新建和更新网关 * @param projectId 项目ID * @param gateway 更新的数据,具体参数查看CreateGateway * @param type 类型 gateway:视频网关,edgeGateway:蜂鸟盒子边缘网关 */ async createVideoGateway(projectId: string, gateway: CreateGateway, type: string): Promise { return await this.factory.surveillance.put(`/config/projects/${projectId}/devices/${type}`, gateway); } /** * @function createVideoNVR 新建和更新NVR * @param projectId 项目ID * @param nvrData 更新的数据,具体参数查看CreateNVR */ async createVideoNVR(projectId: string, nvr: CreateNVR): Promise { return await this.factory.surveillance.put(`/config/projects/${projectId}/devices/nvr`, nvr); } /** * @function createVideoCamera 新建和更新camera * @param projectId 项目ID * @param camera 更新的数据,具体参数查看CreateCamera */ async createVideoCamera(projectId: string, camera: CreateCamera): Promise { return await this.factory.surveillance.put(`/config/projects/${projectId}/devices/camera`, camera); } /** * @function deleteVideoDevice 删除视频相关设备 * @param projectId 项目ID * @param id 数据ID */ async deleteVideoDevice(projectId: string, id: string): Promise { return await this.factory.surveillance.delete(`/config/projects/${projectId}/devices/${id}/delete`); } /** * @function syncVideoData 同步筑联的数据 * @param projectId 项目ID */ async syncVideoData(projectId: string): Promise { return await this.factory.surveillance.put(`/org/syncProjectDevice?projectId=${projectId}`); } /** * @function loadNVRDeviceInfo 获取NVR设备信息 * @param projectId 项目ID * @param id NVR设备ID */ async loadNVRDeviceInfo(projectId: string, id: string): Promise { const result = await this.factory.surveillance.get(`/config/projects/${projectId}/devices/nvr/${id}`); return result; } /** * @function loadCameraDeviceInfo 获取摄像机设备信息 * @param projectId 项目ID * @param id 摄像机设备ID */ async loadCameraDeviceInfo(projectId: string, id: string): Promise { const result = await this.factory.surveillance.get( `/config/projects/${projectId}/devices/camera/${id}` ); return result; } /** * @function loadGroupList 获取群组列表 * @param projectId 项目ID */ async loadGroupList(projectId: string): Promise { const result = await this.factory.surveillance.get(`/projects/${projectId}/groups`); return result; } /** * @function createGroup 添加修改群组信息 * @param projectId 项目ID * @param group 更新的数据,具体参数查看CreateGroup */ async createGroup(projectId: string, group: CreateGroup): Promise { const result = await this.factory.surveillance.put(`/projects/${projectId}/groups`, group); return result; } /** * @function loadVendorList 获取vendor厂家信息列表 */ async loadVendorList(): Promise { const result = await this.factory.surveillance.get(`/system/dict/vendors`); return result; } /** * @function loadCategoryList 获取Category信息列表 */ async loadCategoryList(): Promise { const result = await this.factory.surveillance.get(`/system/dict/cameraTypes`); return result; } /** * @function loadDeviceDetail 获取设备详情信息 * @param projectId 项目ID * @param deviceId 设备ID */ async loadDeviceDetail(projectId: string, deviceId: string): Promise { const result = await this.factory.surveillance.get( `/config/projects/${projectId}/devices/${deviceId}/detail` ); return result; } /** * @function deleteGroup 删除摄像机分组 * @param projectId 项目ID * @param id 数据ID */ async deleteGroup(projectId: string, id: string): Promise { return await this.factory.surveillance.delete(`/projects/${projectId}/groups/${id}`); } /** * @function loadCameraList 获取摄像机列表 */ async loadCameraList(projectId: string, type: string, sourceType: string): Promise { const result = await this.factory.surveillance.get(`/projects/${projectId}/devices/list`, { type, sourceType, }); return result; } /** * @function loadDeviceStatus 同步设备状态 */ async loadDeviceStatus(projectId: string, type: string): Promise { const result = await this.factory.surveillance.put( `/config/${type}/projects/${projectId}/devices/syncDeviceStatus` ); return result; } /** * 设备截图测试 * @param projectId * @param deviceId * @returns */ async loadDeviceSnapShot(projectId: string, deviceId: string): Promise { const result = await this.factory.surveillance.post(`/image/capture/test`, { projectId, deviceId }); return result; } /** * @function promotionVedioing 前台宣传视频展示 * @param projectId 项目ID */ async promotionVedioing(projectId: string): Promise { const result = await this.factory.surveillance.get(`static/page/list?projectId=${projectId}`); return result; } /** * 获取摄像机位置分组列表 * @param projectId * @returns */ async loadDeviceLocationsList(projectId: string): Promise { const result = await this.factory.surveillance.get(`projects/${projectId}/deviceLocations`); return result; } /** * 获取摄像机位置分组树形列表 * @param projectId * @returns */ async loadDeviceLocationsListTree(projectId: string) { const result = await this.factory.surveillance.get(`projects/${projectId}/deviceLocations/tree`); return result; } /** * 保存摄像机位置分组 * @param projectId * @param options * @returns */ async saveDeviceLocations(projectId: string, options: DeviceLocationsReq): Promise { const result = await this.factory.surveillance.put(`projects/${projectId}/deviceLocations`, options); return result; } /** * 删除摄像机位置分组 * @param projectId * @param id * @returns */ async deleteDeviceLocations(projectId: string, id: string): Promise { const result = await this.factory.surveillance.delete(`projects/${projectId}/deviceLocations/${id}`); return result; } /** * 同步PBS树 * @param projectId * @returns */ async syncDeviceLocation(projectId: string) { const result = await this.factory.surveillance.get(`/projects/${projectId}/deviceLocations/syncSpaceStructure`); return result; } /** * 批量删除位置 * @param projectId */ async batchDelLocation(projectId: string, locationIds: string[]) { const result = await this.factory.surveillance.delete(`/projects/${projectId}/deviceLocations/batchDel`, locationIds); return result; } }