import { ApiClientFactory } from '../core/api.client.factory'; import { HikVideoList, CreateCamera, CreateLocalVideo, Docs, CreateNVR, VendorList, CategoryList, DeviceDetail, HikAccountRep, HikAccountReq, EventConfigs, } from '../model/HikConfig.model'; export class HikConfigService { constructor(private factory: ApiClientFactory) {} /** * @function loadDocs 获取文档 * @param projectId 项目ID */ async loadDocs(projectId: string): Promise { const result = await this.factory.surveillance.get( `/config/hik/projects/${projectId}/devices/download/getUrl` ); return result; } /** * @function sync 同步设备状态 单一 */ async sync(Id: string): Promise { const result = await this.factory.surveillance.put(`/devices/status/${Id}`); return result; } /** * @function loadHikVideoList 获取云眸NVR列表 * @param projectId 项目ID * @param type */ async loadHikVideoList(projectId: string, type: string, params?: any): Promise { const result = await this.factory.surveillance.get( `/config/hik/projects/${projectId}/devices?type=${type}`, params ); return result; } /** * @function createVideoNVR 新建和更新NVR * @param projectId 项目ID * @param nvrData 更新的数据,具体参数查看CreateNVR */ async createVideoNVR(projectId: string, nvr: CreateNVR): Promise { return await this.factory.surveillance.put(`/config/hik/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/hik/projects/${projectId}/devices/ipc`, camera); } /** * @function createLocalVideo 新建和更新本地camera或nvr * @param projectId 项目ID */ async createLocalVideo(projectId: string, req: CreateLocalVideo): Promise { return await this.factory.surveillance.put(`/config/hik/projects/${projectId}/devices/rtsp`, req); } /** * @function delteNvrDevice 删除nvr * @param projectId * @param id */ async deleteNvrDevice(projectId: string, id: string): Promise { return await this.factory.surveillance.delete(`config/hik/projects/${projectId}/devices/${id}`); } /** * @function deleteVideoDevice 删除视频相关设备 * @param projectId 项目ID * @param id 数据ID */ async deleteVideoDevice(projectId: string, id: string): Promise { return await this.factory.surveillance.delete(`/config/hik/projects/${projectId}/devices/${id}`); } /** * @function deleteDeviceLocalConfig 删除设备本地配置 * @param projectId * @param id */ async deleteDeviceLocalConfig(projectId: string, id: string): Promise { return await this.factory.surveillance.delete(`config/hik/projects/${projectId}/devices/rtsp/${id}`); } /** * @function syncHikData 同步筑联的数据 * @param projectId 项目ID */ async syncHikData(projectId: string): Promise { return await this.factory.surveillance.put(`/config/hik/projects/${projectId}/devices/syncDeviceInfo`); } /** * @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/hik/projects/${projectId}/devices/${deviceId}` ); return result; } /** * @function 监控全部 */ async addAllMonitor(projectId: string) { return await this.factory.surveillance.put(`/config/hik/projects/${projectId}/devices/monitor`); } /** * @function 取消监控全部 */ async cancelAllMonitor(projectId: string) { return await this.factory.surveillance.put(`/config/hik/projects/${projectId}/devices/cancelMonitor`); } /** * @function 加入监控 */ async addMonitor(projectId: string, deviceId: string) { return await this.factory.surveillance.put(`config/hik/projects/${projectId}/devices/${deviceId}/monitor`); } /** * @function 取消监控 */ async cancelMonitor(projectId: string, deviceId: string) { return await this.factory.surveillance.put( `config/hik/projects/${projectId}/devices/${deviceId}/cancelMonitor` ); } /** * @function 同步摄像头 */ async syncDeviceImage(projectId: string) { return await this.factory.surveillance.put(`config/hik/projects/${projectId}/devices/syncDeviceImage`); } /** * @function updateHikAccount 修改云眸账号 */ async updateHikAccount(projectId: string, hikConfig: HikAccountReq) { return await this.factory.surveillance.put(`project/video/source/config/hik`, { projectId, hikConfig, }); } /** * @function loadHikAccount 修改云眸账号 */ async loadHikAccount(projectId: string) { return await this.factory.surveillance.get(`project/video/source/config`, { projectId, }); } /** * @function loadHikEvent 云眸事件列表 */ async loadHikEvent() { return await this.factory.surveillance.get(`eventConfig/eventTypes/hik`); } /** * @function updateHikEvent 更新云眸事件配置 */ async updateHikEvent(param: EventConfigs) { return await this.factory.surveillance.put(`eventConfig/device/eventConfig`, param); } /** * @function deleteDeviceFromHik 解绑云眸设备 */ async deleteDeviceFromHik(projectId: string, id: string) { return await this.factory.surveillance.put(`/config/hik/projects/${projectId}/devices/deleteDeviceFromHik`, { id, }); } /** * 绑定云眸设备 */ async addDeviceToHik(projectId: string, id: string) { return await this.factory.surveillance.put(`/config/hik/projects/${projectId}/devices/addDeviceToHik`, { id, }); } /** * @function 云眸租户配置信息 */ async fetchAccountConfigInfo(tenantId: string): Promise { const result = await this.factory.surveillance.get(`/tenant/video/source/config`, { tenantId, }); return result; } /** * 租户下云眸账号设置 * @param tenantId * @param hikConfig * @returns */ async setAccountConfigInfo(tenantId: string, hikConfig: HikAccountReq): Promise { const result = await this.factory.surveillance.put(`/tenant/video/source/config/hik`, { tenantId, hikConfig, }); return result; } /** * 连锁项目列表 */ async chainProjectList(projectId: string) { return this.factory.surveillance.get(`/hik/chain/project/stores`, { projectId, }); } }