import { ApiClientFactory } from '../core/api.client.factory'; import { GatewayList, CameraList, CreateGateway, Docs, CreateCamera } from '../model/tiejiaConfig.model'; export class TiejiaConfigService { constructor(private factory: ApiClientFactory) {} /** * @function syncDeviceInfo 同步设备 * @param projectId 项目ID */ async syncDeviceInfo(projectId: string): Promise { const result = await this.factory.surveillance.put(`/config/tm/projects/${projectId}/devices/syncDeviceInfo`); return result; } /** * @function syncDeviceStatus 同步设备状态 */ async syncDeviceStatus(projectId: string): Promise { const result = await this.factory.surveillance.put( `/config/tm/projects/${projectId}/devices/syncDeviceStatus` ); return result; } /** * @function loadDocs 获取文档 * @param projectId 项目ID */ async loadDocs(projectId: string): Promise { const result = await this.factory.surveillance.get( `/config/tm/projects/${projectId}/devices/download/getUrl` ); return result; } /** * 获取盒子列表 * @param projectId 项目ID */ async loadGatewayList(projectId: string): Promise { const result = await this.factory.surveillance.get( `/config/tm/projects/${projectId}/devices/list?type=gateway` ); return result; } /** * 获取摄像机列表 * @param projectId 项目ID */ async loadCameraList(projectId: string, params?: object): Promise { const result = await this.factory.surveillance.get( `/config/tm/projects/${projectId}/devices/list?type=Camera`, params ); return result; } /** * @function createVideoGateway 新建和更新网关 * @param projectId 项目ID * @param gateway 更新的数据,具体参数查看CreateGateway */ async createVideoGateway(projectId: string, gateway: CreateGateway): Promise { return await this.factory.surveillance.post(`/config/tm/projects/${projectId}/devices/bind`, gateway); } /** * @function createCamera 新建和更新视频相关设备 * @param projectId 项目ID */ async createCamera(projectId: string, req: CreateCamera): Promise { return await this.factory.surveillance.post(`/config/tm/projects/${projectId}/devices/update`, req); } /** * @function deleteVideoDevice 删除视频相关设备 * @param projectId 项目ID * @param id 数据ID */ async deleteVideoDevice(projectId: string, id: string): Promise { return await this.factory.surveillance.delete(`/config/tm/projects/${projectId}/devices/${id}`); } /** * 设备解绑 * @param projectId * @param id */ async deviceUnbind(projectId: string, id: string): Promise { return await this.factory.surveillance.get(`/config/tm/projects/${projectId}/devices/${id}/unBind`); } // /** // * @function loadGroupList 获取群组列表 // * @param projectId 项目ID // */ // async loadGroupList(projectId: string): Promise { // const result = await this.factory.surveillance.get(`/projects/${projectId}/groups`); // return result; // } // /** // * @function createGroup 添加修改群组信息 // * @param projectId 项目ID // * @param group 更新的数据,具体参数查看CreateGroup // */ // async createGroup(projectId: string, group: CreateGroup): Promise { // const result = await this.factory.surveillance.put(`/projects/${projectId}/groups`, group); // return result; // } // /** // * @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/tm/projects/${projectId}/devices/${deviceId}`); return result; } // /** // * @function deleteGroup 删除摄像机分组 // * @param projectId 项目ID // * @param id 数据ID // */ // async deleteGroup(projectId: string, id: string): Promise { // return await this.factory.surveillance.delete(`/projects/${projectId}/groups/${id}`); // } // /** // * @function sendGatewayConfig 下发网关配置 // */ // async sendGatewayConfig(projectId: string, id: string): Promise { // const result = await this.factory.surveillance.get(`/config/atlas/projects/${projectId}/devices/config/${id}`); // return result; // } }