import { Pageable } from '../'; import { ApiClientFactory } from '../core/api.client.factory'; import { GIPClogModel, GIPClogParam, GIPCmodel, GIPCParamModel } from '../model/gipc.model'; import { Docs } from '../model/videoConfig.model'; import { DeviceDetail, EventConfigs, YsyOnlineLogParam, YsyOnlineLogModel } from '../model/ysConfig.model'; import { CreateLocalVideo } from '../model/ysvmsConfig.model'; export class GIPCService { constructor(private factory: ApiClientFactory) {} /** * @function loadDeviceList 获取GIPC列表 * @param projectId 项目ID * @param type */ async loadDeviceList(projectId: string, type: string, params?: any): Promise { const result = await this.factory.surveillance.get( `/config/gipc/projects/${projectId}/devices?type=${type}`, params ); return result; } async loadDocs(projectId: string): Promise { const result = await this.factory.surveillance.get( `/config/gipc/projects/${projectId}/devices/download/getUrl` ); return result; } /** * @function deleteVideoDevice 删除视频相关设备 * @param projectId 项目ID * @param id 数据ID */ async deleteGIPC(projectId: string, id: string, unbind: boolean): Promise { return await this.factory.surveillance.delete( `/config/gipc/projects/${projectId}/devices/${id}?unbind=${unbind}` ); } /** * @function 方案列表 */ async fetchSchemeList() { return await this.factory.surveillance.get(`/config/gipc/schemes/listShared`); } /** * @function loadAlgoList 策略列表 */ async loadAlgoList(projectId: string) { return await this.factory.surveillance.get(`/config/gipc/projects/${projectId}/devices/eventTypes`); } /** * @function putVideoCamera 新建和更新camera * @param projectId 项目ID * @param camera 更新的数据,具体参数查看CreateCamera */ async updateGIPC(projectId: string, camera: GIPCParamModel): Promise { return await this.factory.surveillance.put(`/config/gipc/projects/${projectId}/devices/ipc`, camera); } /** * @function 新下发接口 2023/1/11 */ issueConfiguration(projectId: string, camera: GIPCParamModel): Promise { return this.factory.surveillance.put( `/config/gipc/projects/${projectId}/devices/${camera.id}/queryEventConfig`, camera ); } /** * 添加/修改SDC(华为)摄像机 * @param projectId * @param camera * @returns */ async saveSDC(projectId: string, camera: GIPCParamModel): Promise { return await this.factory.surveillance.put(`/holo/gipc/projects/${projectId}/devices/ipc`, camera); } /** * @function 同步摄像头 */ async syncDeviceImage(projectId: string) { return await this.factory.surveillance.put(`config/gipc/projects/${projectId}/devices/syncDeviceImage`); } /** * @function 监控全部 */ async addAllMonitor(projectId: string) { return await this.factory.surveillance.put(`/config/gipc/projects/${projectId}/devices/monitor`); } /** * @function 取消监控全部 */ async cancelAllMonitor(projectId: string) { return await this.factory.surveillance.put(`/config/gipc/projects/${projectId}/devices/cancelMonitor`); } /** * @function 加入监控 */ async addMonitor(projectId: string, deviceId: string) { return await this.factory.surveillance.put(`config/gipc/projects/${projectId}/devices/${deviceId}/monitor`); } /** * @function 取消监控 */ async cancelMonitor(projectId: string, deviceId: string) { return await this.factory.surveillance.put( `config/gipc/projects/${projectId}/devices/${deviceId}/cancelMonitor` ); } /** * @function createLocalVideo 新建和更新本地camera或nvr * @param projectId 项目ID */ async createLocalVideo(projectId: string, req: CreateLocalVideo): Promise { return await this.factory.surveillance.put(`/config/gipc/projects/${projectId}/devices/rtsp`, req); } /** * @function deleteDeviceLocalConfig 删除设备本地配置 * @param projectId * @param id */ async deleteDeviceLocalConfig(projectId: string, id: string): Promise { return await this.factory.surveillance.delete(`config/gipc/projects/${projectId}/devices/rtsp/${id}`); } /** * @function loadDeviceDetail 获取设备详情信息 * @param projectId 项目ID * @param deviceId 设备ID */ async loadDeviceDetail(projectId: string, deviceId: string): Promise { const result = await this.factory.surveillance.get( `/config/gipc/projects/${projectId}/devices/${deviceId}` ); return result; } /** * @function 下发配置 * @param projectId */ async setConfig(projectId: string, deviceId: string): Promise { const result = await this.factory.surveillance.put(`/config/gipc/edge/syncConfig`, { projectId, deviceId, }); return result; } /** * @function 部署 * @param projectId */ async deployDevice(projectId: string, deviceId: string, schemeId: string): Promise { const result = await this.factory.surveillance.put(`/config/gipc/edge/deploy`, { projectId, deviceId, schemeId, }); return result; } /** * @function loadGIPCOnlineLog 萤石云在线日志 */ async loadGIPCOnlineLog(param: GIPClogParam) { return await this.factory.surveillance.get>(`/gipc/log/online/query`, param); } /** * @function 解绑设备 */ async unbindingDevice(projectId: string, id: string) { return await this.factory.surveillance.put(`/config/gipc/projects/${projectId}/devices/deleteDeviceFromYsy`, { id, }); } }