import { ApiClientFactory } from '../core/api.client.factory'; import { VideoList, CreateVideo, CreateLocalVideo, Docs, VendorList, CategoryList, DeviceDetail, YsvmsAccountReq, YsvmsAccountRes, } from '../model/ysvmsConfig.model'; export class YsvmsConfigService { constructor(private factory: ApiClientFactory) {} /** * @function loadYsvmsAccount 获取宇视账号信息 */ async loadYsvmsAccount(projectId: string) { return await this.factory.surveillance.get(`project/video/source/config`, { projectId, }); } /** * @function createYsvmsAccount 修改宇视账号 */ async createYsvmsAccount(projectId: string, ezcloudConfig: YsvmsAccountReq) { return await this.factory.surveillance.put(`project/video/source/config/ezcloud`, { projectId, ezcloudConfig, }); } /** * @function loadDocs 获取文档 * @param projectId 项目ID */ async loadDocs(projectId: string): Promise { const result = await this.factory.surveillance.get( `/config/vms/projects/${projectId}/devices/download/getUrl` ); return result; } /** * @function syncVmsData 同步筑联的数据 * @param projectId 项目ID */ async syncYsyData(projectId: string): Promise { return await this.factory.surveillance.put(`/config/vms/projects/${projectId}/devices/syncDeviceInfo`); } /** * @function syncDeviceStatus 同步设备状态 */ async syncDeviceStatus(projectId: string): Promise { const result = await this.factory.surveillance.get( `/config/vms/projects/${projectId}/devices/syncDeviceStatus` ); return result; } /** * @function loadVideoList 获取宇视相关列表 * @param projectId 项目ID * @param type */ async loadVideoList(projectId: string, type: string, params?: object): Promise { const result = await this.factory.surveillance.get( `/config/vms/projects/${projectId}/devices?type=${type}`, params ); return result; } /** * @function createVideo 新建和更新视频相关设备 * @param projectId 项目ID * @param type 类型 NVR,Camera */ async createVideo(projectId: string, req: CreateVideo, type: string): Promise { return await this.factory.surveillance.put(`/config/vms/projects/${projectId}/devices/save`, { ...req, type, }); } /** * @function createLocalVideo 新建和更新本地camera或nvr * @param projectId 项目ID */ async createLocalVideo(projectId: string, req: CreateLocalVideo): Promise { return await this.factory.surveillance.put(`/config/vms/projects/${projectId}/devices/rtsp`, req); } /** * @function deleteVideoDevice 删除视频相关设备 * @param projectId * @param id */ async deleteVideoDevice(projectId: string, id: string): Promise { return await this.factory.surveillance.delete(`config/vms/projects/${projectId}/devices/${id}`); } /** * @function deleteDeviceLocalConfig 删除设备本地配置 * @param projectId * @param id */ async deleteDeviceLocalConfig(projectId: string, id: string): Promise { return await this.factory.surveillance.delete(`config/vms/projects/${projectId}/devices/rtsp/${id}`); } /** * @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/vms/projects/${projectId}/devices/${deviceId}` ); return result; } /** * @function 监控全部 */ async addAllMonitor(projectId: string) { return await this.factory.surveillance.put(`/config/vms/projects/${projectId}/devices/monitor`); } /** * @function 取消监控全部 */ async cancelAllMonitor(projectId: string) { return await this.factory.surveillance.put(`/config/vms/projects/${projectId}/devices/cancelMonitor`); } /** * @function 加入监控 */ async addMonitor(projectId: string, deviceId: string) { return await this.factory.surveillance.put(`config/vms/projects/${projectId}/devices/${deviceId}/monitor`); } /** * @function 取消监控 */ async cancelMonitor(projectId: string, deviceId: string) { return await this.factory.surveillance.put( `config/vms/projects/${projectId}/devices/${deviceId}/cancelMonitor` ); } /** * 宇视截图 * @param projectId * @returns */ async vmsSyncDeviceImage(projectId: string) { return await this.factory.surveillance.put(`config/vms/projects/${projectId}/devices/syncDeviceImage`); } }