import { ApiClientFactory } from '../core/api.client.factory'; import { DroneModel, HelpDoc, DroneRequestParam } from '../model/Drone.model'; export class MobileDeviceService { constructor(private factory: ApiClientFactory) {} async loadDeviceList(projectId: string): Promise { const url = `/api/mobileDevice/projects/${projectId}/devices`; const result = await this.factory.entity.get(url); return result; } async getDeviceInfo(projectId: string, id: string): Promise { const url = `/api/mobileDevice/projects/${projectId}/devices/${id}`; const result = await this.factory.entity.get(url); return result; } async addDevice(projectId: string, param: DroneModel) { const url = `/api/mobileDevice/projects/${projectId}/devices`; const result = await this.factory.entity.put(url, param); return result; } async deleteDevice(projectId: string, id: string) { const url = `/api/mobileDevice/projects/${projectId}/devices/${id}`; const result = await this.factory.entity.delete(url); return result; } async pushRtmp(projectId: string, id: string): Promise { const url = `/api/mobileDevice/projects/${projectId}/devices/${id}/pushRtmp`; const result = await this.factory.entity.put(url); return result; } async getHelpDoc(projectId: string): Promise { const url = `/api/mobileDevice/projects/${projectId}/devices/download/getUrl`; const result = await this.factory.entity.get(url); return result; } /** * @function 监控全部 */ async addAllMonitor(projectId: string) { return await this.factory.surveillance.put(`/mobileDevice/projects/${projectId}/devices/monitor`); } /** * @function 取消监控全部 */ async cancelAllMonitor(projectId: string) { return await this.factory.surveillance.put(`/mobileDevice/projects/${projectId}/devices/cancelMonitor`); } /** * @function 加入监控 */ async addMonitor(projectId: string, deviceId: string) { return await this.factory.surveillance.put(`/mobileDevice/projects/${projectId}/devices/${deviceId}/monitor`); } /** * @function 取消监控 */ async cancelMonitor(projectId: string, deviceId: string) { return await this.factory.surveillance.put( `/mobileDevice/projects/${projectId}/devices/${deviceId}/cancelMonitor` ); } }