import { ApiClientFactory } from '../core/api.client.factory'; import { VideoList, Docs, CreateGateway, CreateNVR, CreateCamera, NVRInfo, CameraInfo, GroupList, CreateGroup, VendorList, CategoryList, DeviceDetail } 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 loadVideoList 获取相关设备列表 * @param projectId 项目ID * @param type 列表类型 * type:gateway,获取视频网关列表 * type:nvr,获取视频NVR列表 * type:camera,获取摄像机列表 */ async loadVideoList(projectId: string, type: string): Promise { const result = await this.factory.surveillance.get( `/config/projects/${projectId}/devices?type=${type}` ); return result; } /** * @function createVideoGateway 新建和更新网关 * @param projectId 项目ID * @param gateway 更新的数据,具体参数查看CreateGateway */ async createVideoGateway(projectId: string, gateway: CreateGateway): Promise { return await this.factory.surveillance.put(`/config/projects/${projectId}/devices/gateway`, 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}`); } /** * @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}`); } }