import { ApiClientFactory } from '../core/api.client.factory'; import { GatewayList, CreateGateway, CreateNVR, CreateCamera, DeviceDetail, SchemesList, SchemesReq, DeviceSchemeLog, DeviceInitStatusReq, Host, VideoList, HummingbirdVersion, CameraSettingStatus, theDeviceContextDetail, TowerCraneList, TowerCraneReq, SwitchTowerCraneReq, SendTowerCraneReq, IpcToGboxReq, BimconfigReq, GboxLicenseBindingParams, SchemesVersionList, } from '../model/hummingbirdConfig.model'; import { Pageable } from '../model'; export class HummingbirdV2Service { constructor(private factory: ApiClientFactory) {} /** * 获取v1 v2盒子列表 */ fetchGatewayList(projectId: string) { return this.factory.surveillance.get(`/edge/v2/listGateway`, { projectId }); } /** * @function loadEdgeGatewayList 获取网关列表 * @param projectId 项目ID */ async loadEdgeGatewayList(projectId: string): Promise { const result = await this.factory.surveillance.get( `/edge/v2/projects/${projectId}/devices/listGateway` ); return result; } /** * @function loadEdgeVideoList 获取相关设备列表 * @param projectId 项目ID * @param type 列表类型 * type:nvr,获取视频NVR列表 * type:camera,获取摄像机列表 */ async loadEdgeVideoList(projectId: string, type: string, params?: any) { const result = await this.factory.surveillance.get( `/edge/v2/projects/${projectId}/devices?type=${type}`, params ); return result; } /** * @function createVideoGateway 新建和更新网关 * @param projectId 项目ID * @param gateway 更新的数据,具体参数查看CreateGateway * @param type 类型 gateway:视频网关,edgeGateway:蜂鸟盒子边缘网关 */ async createVideoGateway(projectId: string, gateway: CreateGateway): Promise { return await this.factory.surveillance.put(`/edge/v2/box/gateway`, gateway); } /** * @function createEdgeNVR 新建和更新NVR * @param projectId 项目ID * @param nvrData 更新的数据,具体参数查看CreateNVR */ async createEdgeNVR(projectId: string, nvr: CreateNVR): Promise { return await this.factory.surveillance.put(`/edge/v2/projects/${projectId}/devices/nvr`, nvr); } /** * @function createEdgeCamera 新建和更新camera * @param projectId 项目ID * @param camera 更新的数据,具体参数查看CreateCamera */ async createEdgeCamera(projectId: string, camera: CreateCamera): Promise { return await this.factory.surveillance.put(`/edge/v2/projects/${projectId}/devices/camera`, camera); } /** * @function deleteEdgeDevice 删除视频相关设备 * @param projectId 项目ID * @param id 数据ID */ async deleteEdgeDevice(projectId: string, id: string): Promise { return await this.factory.surveillance.delete(`/edge/v2/projects/${projectId}/devices/${id}/delete`); } /** * @function loadEdgeDeviceDetail 获取设备详情信息 * @param projectId 项目ID * @param deviceId 设备ID */ async loadEdgeDeviceDetail(projectId: string, deviceId: string): Promise { const result = await this.factory.surveillance.get( `/edge/v2/projects/${projectId}/devices/${deviceId}/detail` ); return result; } /** * @function loadCurrentVersions 获取蜂鸟部署方案当前版本 */ async loadCurrentVersions(mac: string): Promise { return await this.factory.surveillance.put(`/edge/v2/currentScheme?mac=${mac}`); } /** * @function queryMinMac 获取最小mac地址 */ async queryMinMac(mac: string): Promise { const result = await this.factory.surveillance.get('edge/v2/queryMinMac', { mac }) return result; } /** * @function loadSchemes 获取蜂鸟部署方案 */ async loadSchemes(projectId: string, labels?: string): Promise { return await this.factory.surveillance.get(`edge/v2/schemes`, { projectId, labels }); } /** * @function loadAiModel 获取部署方案对应的部署模型 */ async loadAiModel(schemeId: number): Promise { return await this.factory.surveillance.get(`edge/v2/queryAiModel`, { schemeId }); } /** * 获取方案对应的版本 * @param solutionId * @returns */ async loadSchemesVersion(solutionId: string): Promise { return await this.factory.surveillance.get(`edge/v2/schemeVersions`, { solutionId }); } /** * @function bindingSchemes 绑定并部署方案 */ bindingSchemes(schemesReq: SchemesReq): Promise { return this.factory.surveillance.put(`edge/v2/device/scheme/deploy`, schemesReq); } /** * @function loaddeviceSchemeLog 获取设备部署方案的日志 */ async loaddeviceSchemeLog(id: string): Promise { return await this.factory.surveillance.get(`edge/v2/device/states`, { id }); } /** * 获取盒子的状态 * @param id * @returns */ async loadCameraSettingStatus(id: string): Promise { return await this.factory.surveillance.get(`edge/v2/device/statusV2`, { id }); } /** * @function adddeviceinitStatus 添加初始化状态 */ async adddeviceinitStatus(deviceInitStatusReq: DeviceInitStatusReq): Promise { return await this.factory.surveillance.put(`edge/v2/device/updateInitStatus`, deviceInitStatusReq); } /** * @function loadDeviceInitConfig 查询初始化后的盒子配置信息 */ async loadDeviceInitConfig(projectId: string, mac: string): Promise { return await this.factory.surveillance.get(`edge/v2/projects/${projectId}/devices/gbox/${mac}`); } /** * @function unbindMac 解绑Mac地址 */ async unbindMac(id: string): Promise { return await this.factory.surveillance.put(`edge/v2/device/unbind/${id}`); } /** * @function loadhost 获取host */ async loadhost(projectId: string): Promise { return await this.factory.surveillance.get(`edge/v2/box/dns`, { projectId }); } /** * @function sendHumingGatewayConfig 下发配置 * @param projectId 项目ID * @param gatewayId 网关ID */ async sendHumingGatewayConfig(projectId: string, gatewayId: string): Promise { const result = await this.factory.surveillance.put(`/edge/v2/syncDeviceToBox/${projectId}/${gatewayId}`); return result; } /** * @function sendHumingGatewayConfigV2 下发配置 * @param projectId 项目ID * @param gatewayId 网关ID */ async sendHumingGatewayConfigV2(projectId: string, gatewayId: string): Promise { const result = await this.factory.surveillance.put(`/edge/v2/syncDeviceToBoxV2/${projectId}/${gatewayId}`); return result; } /** * @function addCsutomConfig 附加配置接口 */ async addCsutomConfig(deviceId: string, appId: string, configReq: any): Promise { const result = await this.factory.surveillance.put( `/edge/v2/device/${deviceId}/application/${appId}/setting`, configReq ); return result; } /** * @function deleteGateWay 删除网关 * @param type delete:删除后保留数据,deleteAll:删除后不保留历史数据 */ async deleteGateWay(projectId: string, deviceId: string, type: string): Promise { const result = await this.factory.surveillance.delete( `edge/v2/projects/${projectId}/devices/${deviceId}/${type}` ); return result; } /** * @function resetGateWay 蜂鸟盒子周转处理 * @param projectId * @param deviceId * @returns */ async resetGateWay(projectId: string, deviceId: string) { const result = await this.factory.surveillance.delete(`/edge/v2/projects/${projectId}/devices/${deviceId}/reset`); return result; } /** * 设置设备是否上云 * @param projectId 项目ID * @param deviceId 设备ID * @param status 是否上云 */ async setDeviceCloudStatus(projectId: string, deviceId: string, cloud: boolean): Promise { const result = await this.factory.surveillance.put(`edge/v2/projects/${projectId}/devices/cloud/${deviceId}`, { cloud, }); return result; } /** * 立即重启 */ async rebootNow(projectId: string, deviceId: string): Promise { const result = await this.factory.surveillance.put(`edge/v2/projects/${projectId}/devices/${deviceId}/reboot`); return result; } /** * 获取盒子版本信息 * @returns */ async loadHummingbirdVersion(): Promise { return await this.factory.surveillance.get(`/edge/v2/box/authTypes`); } /** * 网关信息 */ async loadGatewayProcessLog(id: string): Promise { return await this.factory.surveillance.get(`/edge/v2/device/shadow?id=${id}`); } /** * 网关端口号 */ async loadGatewayPort(id: string): Promise { return await this.factory.surveillance.get(`/edge/v2/device/port?id=${id}`); } /** * 解密NVR * @param id 项目ID * @returns */ async loadDecryptNvr(id: string): Promise { return await this.factory.surveillance.put(`/edge/v2/box/encryptOffYsy?projectId=${id}`); } /** * 加密NVR * @param id 项目ID * @returns */ async loadEncryptNvr(id: string): Promise { return await this.factory.surveillance.put(`/edge/v2/box/encryptOnYsy?projectId=${id}`); } /** * 关联设备 * @param id 项目ID * @returns */ async loadTheDeviceContext(params: object): Promise { return await this.factory.surveillance.post(`/device/mapping`, params); } /** * 查询关联设备 * @param id 项目ID * @returns */ async loadInquireTheDeviceContext(thirdDeviceId: string): Promise { return await this.factory.surveillance.get(`/device/mapping/gbox/${thirdDeviceId}`); } /** * 删除单个关联 * @param id 项目ID * @returns */ async loadDeleteTheDeviceContext(gboxDeviceId: string): Promise { return await this.factory.surveillance.delete(`/device/mapping/gbox/${gboxDeviceId}`); } /** * 获取塔机列表 * @param projectId * @returns */ async loadTowerCraneList(projectId: string): Promise { return await this.factory.surveillance.get(`/edge/v2/queryTowerCrane`, { projectId }); } /** * 修改塔机信息 * @param option * @returns */ async editTowerCrane(option: TowerCraneReq): Promise { return await this.factory.surveillance.post(`/edge/v2/towerCrane`, option); } /** * 开启/关闭塔机 * @param option * @returns */ async swtichTowerCrane(option: SwitchTowerCraneReq): Promise { return await this.factory.surveillance.post(`/edge/v2/operatorTowerCrane`, option); } /** * 下发塔机信息 * @param option * @returns */ async sendTowerCrane(option: SendTowerCraneReq): Promise { return await this.factory.surveillance.post(`/edge/v2/issueTowerCrane`, option); } /** * 获取5G设备列表 * @param projectId * @returns */ async loadd5GDeviceList(projectId: string): Promise { return await this.factory.surveillance.get(`/gbox/5g/devices`, { projectId }); } /** * 保存/删除,5G摄像机 * @param option * @returns */ async saveIpcToGbox(option: IpcToGboxReq): Promise { return await this.factory.surveillance.post(`/gbox/5g/addIpcToGbox`, { ...option, appVersion: 'v2', }); } /** * 保存BIM视频融合设置 * @param option * @returns */ async saveBimConfig(option: BimconfigReq): Promise { return await this.factory.surveillance.post(`/bim/video/fusion`, option); } /** * 获取BIM视频列表 * @param projectId * @param gatewayId * @returns */ async loadBimVideoList(projectId: string, gatewayId?: string): Promise { return await this.factory.surveillance.get(`/bim/video/fusion`, { projectId, gatewayId }); } /** * 获取盒子AI算法配置组件化地址 * @param mac * @returns */ async loadHummingbirdAIUrl(mac: string): Promise { return await this.factory.surveillance.get(`/edge/v2/remoteDesktop`, { mac }); } /** * 获取方案模型列表 * @returns */ async loadSchemeModelsList(): Promise { return await this.factory.surveillance.get(`/edge/v2/schemeModels`); } /** * 连接盒子 * @param mac * @returns */ async loadTestWebSocket(mac: string): Promise { return await this.factory.surveillance.get(`edge/v2/testWebSocket`, { mac }); } // 球机巡检 /** * @name 球机巡航路线-单项|列表 * @params projectId|id?|params? */ async fetchBallCameraDetectList(projectId: string, params?: any) { const url = `ballDevice/aiDetect/v2/${projectId}/gbox/list`; const result = await this.factory.surveillance.get(url, params); return result; } /** * @name 下发配置 */ async issueBallCameraConfiguration(projectId: string, id: string) { const url = `ballDevice/aiDetect/v2/${projectId}/gbox/${id}/issue`; const result = await this.factory.surveillance.post(url); return result; } /** * 查询租户授权情况 */ fetchGboxLicense(params: { pageNo: number; pageSize: number }) { return this.factory.surveillance.get>(`/tenant/gbox/license/page`, params); } /** * 查询租户空闲授权 */ fetchGboxYear(mac: string) { return this.factory.surveillance.put(`gbox/license?mac=${mac}`); } /** * 查询租户盒子授权信息 */ fetchTenantGboxAuth(mac: string) { return this.factory.surveillance.get(`gbox/license?mac=${mac}`); } /** * 绑定权限 */ gboxBindLicense(params: GboxLicenseBindingParams) { return this.factory.surveillance.put(`gbox/license/bind`, params); } /** * 获取租户授权信息 */ fetchTenantLicense(tenantId: string) { return this.factory.surveillance.get(`gbox/license/${tenantId}`); } /** * 同步授权 */ syncGboxLicense(tenantId: string) { return this.factory.surveillance.put(`gbox/license/sync/${tenantId}`); } /** * 同步租户 */ syncTenant(tenantId: string) { return this.factory.surveillance.put(`/tenant/gbox/license/syncLicense/${tenantId}`); } /** * 同步租户(所有) */ syncTenantData() { return this.factory.surveillance.put(`tenant/gbox/license/syncTenantData`); } /** * 查询蜂鸟盒子授权记录 */ fetchLicenseRecord(params: { pageNo: number; pageSize: number }, search?: any) { return this.factory.surveillance.get>(`/tenant/gbox/license/devices`, { ...params, ...search }); } /** * 获取租户列表 */ fetchTenantList() { return this.factory.surveillance.get(`/tenant/gbox/license/tenants`); } /** * 项目记录弹窗,绑定记录 */ fetchProjectRecord(mac: string) { return this.factory.surveillance.get(`/tenant/gbox/license/addedLog`, { mac }); } /** * 同步添加日志 */ syncAddedLog(tenantId: string) { return this.factory.surveillance.put(`/tenant/gbox/license/syncAddedLog/${tenantId}`); } /** * 获取优化时间去重信息 */ fetchPrivateConf() { return this.factory.surveillance.get(`/private/config`); } /** * 云端事件上报,去重设置 */ eventConfSetting(params: { gboxId: string; projectId: string; type: number; minutes: number }) { const url = `gbox/event/config`; return this.factory.surveillance.put(url, params); } /** * 查询云端事件上报,去重设置 */ getConfSetting(gboxId: string) { const url = `gbox/event/config`; return this.factory.surveillance.get(url, { gboxId }); } /** * 查询盒子模型 */ queryBoxModel(mac: string) { const url = `/edge/v2/queryBoxModel`; return this.factory.surveillance.put(url, { mac }); } /** * @function syncVideoData 同步筑联的数据 * @param projectId 项目ID */ syncZhulian(projectId: string): Promise { return this.factory.surveillance.get(`/edge/v2/syncDeviceStatus/${projectId}`); } /** * @function loadCameraDeviceInfo 获取摄像机设备信息 * @param projectId 项目ID * @param id 摄像机设备ID */ loadCameraDeviceInfo(projectId: string, id: string) { return this.factory.surveillance.get(`/edge/v2/projects/${projectId}/devices/camera/${id}`); } }