import { ApiClientFactory, Docs } from '..'; import { NvrParams, IpcParams, EhomeConfiguration } from '../model/SiteEnforcementRecorder.model'; export class SiteEnforcementRecorderService { constructor(private factory: ApiClientFactory) {} fetchNvrList(projectId: string) { const url = `/config/ehome/projects/${projectId}/devices?type=NVR`; return this.factory.surveillance.get(url); } fetchCameraList(projectId: string, params?: any) { const url = `/config/ehome/projects/${projectId}/devices?type=Camera`; return this.factory.surveillance.get(url, params); } updateNvr(projectId: string, params: NvrParams) { const url = `/config/ehome/projects/${projectId}/devices/nvr`; return this.factory.surveillance.put(url, params); } updateIpc(projectId: string, params: IpcParams) { const url = `/config/ehome/projects/${projectId}/devices/ipc`; return this.factory.surveillance.put(url, params); } getEhomeConfiguration(projectId: string, deviceId: string) { const url = `/config/ehome/projects/${projectId}/devices/${deviceId}/ehome`; return this.factory.surveillance.get(url); } cameraCaptrue(projectId: string, deviceId: string) { const url = `/image/capture/test`; return this.factory.surveillance.post(url, { projectId, deviceId, }); } /** * 批量截图 */ syncDeviceImage(projectId: string) { const url = `/config/ehome/projects/${projectId}/devices/syncDeviceImage`; return this.factory.surveillance.put(url); } /** * @function sync 同步设备状态 单一 */ // {{host}}/ivs/api/devices/status/613c5a23071f62001b1fd53a async sync(Id: string): Promise { const result = await this.factory.surveillance.put(`/devices/status/${Id}`); 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 delteNvrDevice 删除nvr * @param projectId * @param id */ async deleteNvrDevice(projectId: string, id: string): Promise { return await this.factory.surveillance.delete(`config/ehome/projects/${projectId}/devices/${id}`); } /** * @function 监控全部 */ async addAllMonitor(projectId: string) { return await this.factory.surveillance.put(`/config/ehome/projects/${projectId}/devices/monitor`); } /** * @function 取消监控全部 */ async cancelAllMonitor(projectId: string) { return await this.factory.surveillance.put(`/config/ehome/projects/${projectId}/devices/cancelMonitor`); } /** * @function 加入监控 */ async addMonitor(projectId: string, deviceId: string) { return await this.factory.surveillance.put(`config/ehome/projects/${projectId}/devices/${deviceId}/monitor`); } /** * @function 取消监控 */ async cancelMonitor(projectId: string, deviceId: string) { return await this.factory.surveillance.put( `config/ehome/projects/${projectId}/devices/${deviceId}/cancelMonitor` ); } /** * @function 重启设备 */ async restartDevice(deviceId: string) { return await this.factory.surveillance.post(`/ehome/device/reboot?deviceId=${deviceId}`); } /** * @function deleteVideoDevice 删除视频相关设备 * @param projectId 项目ID * @param id 数据ID */ async deleteVideoDevice(projectId: string, id: string): Promise { return await this.factory.surveillance.delete(`/config/ehome/projects/${projectId}/devices/${id}`); } /** * 详情 */ async detail(projectId: string, id: string): Promise { return await this.factory.surveillance.get(`/config/ehome/projects/${projectId}/devices/${id}`); } /** * 获取录像配置 */ async fetchRecord(id: string): Promise { return await this.factory.surveillance.get(`/config/ehome/record/${id}`, { overSize: true, }); } /** * 修改录像配置 */ async updateRecord(params: any) { return await this.factory.surveillance.put(`/config/ehome/record`, params); } /** * 下发 */ async pushRecord(projectId: string) { return await this.factory.surveillance.put(`/config/ehome/record/pushRecordConfig/${projectId}`); } /** * @function syncYsyData 同步筑联的数据 * @param projectId 项目ID */ async syncData(projectId: string): Promise { return await this.factory.surveillance.put(`/config/ehome/projects/${projectId}/devices/syncDeviceInfo`); } /** * @function loadDeviceStatus 同步设备状态 */ async loadDeviceStatus(projectId: string): Promise { const result = await this.factory.surveillance.put( `/config/ehome/projects/${projectId}/devices/syncDeviceStatus` ); return result; } /** * @function loadDocs 获取文档 * @param projectId 项目ID */ async loadDocs(projectId: string): Promise { const result = await this.factory.surveillance.get( `/config/ehome/projects/${projectId}/devices/download/getUrl` ); return result; } }