import { ApiClientFactory } from '../core/api.client.factory'; import { LcyVideoList, CreateCamera, CreateLocalVideo, Docs, CreateNVR, VendorList, CategoryList, DeviceDetail, LcyAccountReq, LcyAccountRep, } from '../model/LcyConfig.model'; export class LcConfigService { constructor(private factory: ApiClientFactory) {} /** * @function loadDocs 获取文档 * @param projectId 项目ID */ async loadDocs(projectId: string): Promise { const result = await this.factory.surveillance.get( `/config/lcy/projects/${projectId}/devices/download/getUrl` ); return result; } /** * @function loadLcyVideoList 获取NVR列表 * @param projectId 项目ID * @param type */ async loadLcyVideoList(projectId: string, type: string, params?: any): Promise { const result = await this.factory.surveillance.get( `/config/lcy/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/lcy/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/lcy/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/lcy/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/lcy/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/lcy/projects/${projectId}/devices/${id}`); } /** * @function deleteDeviceLocalConfig 删除设备本地配置 * @param projectId * @param id */ async deleteDeviceLocalConfig(projectId: string, id: string): Promise { return await this.factory.surveillance.delete(`config/lcy/projects/${projectId}/devices/rtsp/${id}`); } /** * @function syncLcyData 同步筑联的数据 * @param projectId 项目ID */ async syncLcyData(projectId: string): Promise { return await this.factory.surveillance.put(`/config/lcy/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/lcy/projects/${projectId}/devices/${deviceId}` ); return result; } /** * @function 监控全部 */ async addAllMonitor(projectId: string) { return await this.factory.surveillance.put(`/config/lcy/projects/${projectId}/devices/monitor`); } /** * @function 取消监控全部 */ async cancelAllMonitor(projectId: string) { return await this.factory.surveillance.put(`/config/lcy/projects/${projectId}/devices/cancelMonitor`); } /** * @function 加入监控 */ async addMonitor(projectId: string, deviceId: string) { return await this.factory.surveillance.put(`config/lcy/projects/${projectId}/devices/${deviceId}/monitor`); } /** * @function 取消监控 */ async cancelMonitor(projectId: string, deviceId: string) { return await this.factory.surveillance.put( `config/lcy/projects/${projectId}/devices/${deviceId}/cancelMonitor` ); } /** * @function 同步摄像头 */ async syncDeviceImage(projectId: string) { return await this.factory.surveillance.put(`config/lcy/projects/${projectId}/devices/syncDeviceImage`); } /** * @function updateLcyAccount 修改乐橙云账号 */ async updateLcyAccount(projectId: string, lcyConfig: LcyAccountReq) { return await this.factory.surveillance.put(`project/video/source/config/lcy`, { projectId, lcyConfig, }); } /** * @function loadLcyAccount 修改乐橙云账号 */ async loadLcyAccount(projectId: string) { return await this.factory.surveillance.get(`project/video/source/config`, { projectId, }); } /** * 解绑乐橙云设备 * @param projectId 项目ID * @param id 设备ID */ async deleteDeviceFromLcy(projectId: string, id: string) { return await this.factory.surveillance.put(`/config/lcy/projects/${projectId}/devices/deleteDeviceFromLcy`, { id, }); } /** * 绑定乐橙云设备 */ async addDeviceToLcy(projectId: string, id: string) { return await this.factory.surveillance.put(`/config/lcy/projects/${projectId}/devices/addDeviceToLcy`, { id, }); } }