2024-04-23 11:19:24 +08:00
|
|
|
|
package com.ruoyi.iot.service;
|
2024-04-19 16:36:24 +08:00
|
|
|
|
|
2024-05-06 18:06:58 +08:00
|
|
|
|
|
2024-04-23 11:19:24 +08:00
|
|
|
|
import com.ruoyi.iot.domain.CurrentDeviceData;
|
|
|
|
|
import com.ruoyi.iot.domain.HistoryDeviceData;
|
|
|
|
|
import com.ruoyi.iot.domain.IotDeviceDetail;
|
|
|
|
|
import com.ruoyi.iot.domain.IotDeviceInfo;
|
|
|
|
|
import com.ruoyi.iot.domain.response.CommandResponse;
|
2024-07-19 17:48:58 +08:00
|
|
|
|
import com.ruoyi.ss.device.domain.Device;
|
2024-04-23 11:19:24 +08:00
|
|
|
|
import com.ruoyi.ss.device.domain.enums.DeviceOnlineStatus;
|
2024-04-19 16:36:24 +08:00
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author wjh
|
|
|
|
|
* 2024/3/20
|
|
|
|
|
*/
|
|
|
|
|
public interface IotService {
|
|
|
|
|
/**
|
|
|
|
|
* 向设备发送命令
|
2024-08-12 20:55:59 +08:00
|
|
|
|
*
|
2024-04-19 16:36:24 +08:00
|
|
|
|
* @param deviceName OneNet设备名称(即设备表的MAC号)
|
2024-08-12 20:55:59 +08:00
|
|
|
|
* @param command 命令字符串
|
|
|
|
|
* @param productId
|
2024-04-19 16:36:24 +08:00
|
|
|
|
* @return
|
|
|
|
|
*/
|
2024-08-12 20:55:59 +08:00
|
|
|
|
default CommandResponse sendCommand(String deviceName, String command, String productId) {
|
|
|
|
|
return sendCommand(deviceName, command, null, productId);
|
2024-08-08 17:54:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 向设备发送命令
|
|
|
|
|
*
|
|
|
|
|
* @param deviceName OneNet设备名称(即设备表的MAC号)
|
|
|
|
|
* @param command 命令字符串
|
|
|
|
|
* @param timeout
|
2024-08-12 20:55:59 +08:00
|
|
|
|
* @param productId
|
2024-08-08 17:54:35 +08:00
|
|
|
|
* @return
|
|
|
|
|
*/
|
2024-08-12 20:55:59 +08:00
|
|
|
|
CommandResponse sendCommand(String deviceName, String command, Integer timeout, String productId);
|
2024-04-19 16:36:24 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取设备在线状态
|
2024-08-12 20:55:59 +08:00
|
|
|
|
*
|
2024-04-19 16:36:24 +08:00
|
|
|
|
* @param deviceName OneNet设备名称(即设备表的MAC号)
|
2024-08-12 20:55:59 +08:00
|
|
|
|
* @param productId
|
2024-04-19 16:36:24 +08:00
|
|
|
|
*/
|
2024-08-12 20:55:59 +08:00
|
|
|
|
DeviceOnlineStatus getOnlineStatus(String deviceName, String productId);
|
2024-04-19 16:36:24 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 通电
|
2024-08-12 20:55:59 +08:00
|
|
|
|
*
|
2024-04-19 16:36:24 +08:00
|
|
|
|
* @param deviceName OneNet设备名称(即设备表的MAC号)
|
2024-08-12 20:55:59 +08:00
|
|
|
|
* @param productId
|
2024-04-19 16:36:24 +08:00
|
|
|
|
* @return 是否成功
|
|
|
|
|
*/
|
2024-08-12 20:55:59 +08:00
|
|
|
|
boolean open(String deviceName, String productId);
|
2024-04-19 16:36:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 断电
|
2024-08-12 20:55:59 +08:00
|
|
|
|
*
|
2024-04-19 16:36:24 +08:00
|
|
|
|
* @param deviceName OneNet设备名称(即设备表的MAC号)
|
2024-08-12 20:55:59 +08:00
|
|
|
|
* @param productId
|
2024-04-19 16:36:24 +08:00
|
|
|
|
* @return 是否成功
|
|
|
|
|
*/
|
2024-08-12 20:55:59 +08:00
|
|
|
|
boolean close(String deviceName, String productId);
|
2024-04-19 16:36:24 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取历史设备数据点信息
|
2024-08-12 20:55:59 +08:00
|
|
|
|
*
|
2024-04-19 16:36:24 +08:00
|
|
|
|
* @param deviceName OneNet设备名称(即设备表的MAC号)
|
2024-08-12 20:55:59 +08:00
|
|
|
|
* @param productId
|
2024-04-19 16:36:24 +08:00
|
|
|
|
*/
|
2024-08-12 20:55:59 +08:00
|
|
|
|
HistoryDeviceData getHistoryDataPoint(String deviceName, String productId);
|
2024-04-19 16:36:24 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 批量获取当前设备数据点信息
|
2024-08-12 20:55:59 +08:00
|
|
|
|
*
|
2024-04-19 16:36:24 +08:00
|
|
|
|
* @param deviceNames 设备名称列表
|
2024-08-12 20:55:59 +08:00
|
|
|
|
* @param productId
|
2024-04-19 16:36:24 +08:00
|
|
|
|
*/
|
2024-08-12 20:55:59 +08:00
|
|
|
|
List<CurrentDeviceData> getCurrentDataPoint(List<String> deviceNames, String productId);
|
2024-04-19 16:36:24 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取当前设备数据点信息
|
2024-08-12 20:55:59 +08:00
|
|
|
|
*
|
2024-04-19 16:36:24 +08:00
|
|
|
|
* @param deviceName 设备名称
|
2024-08-12 20:55:59 +08:00
|
|
|
|
* @param productId
|
2024-04-19 16:36:24 +08:00
|
|
|
|
*/
|
2024-08-12 20:55:59 +08:00
|
|
|
|
CurrentDeviceData getCurrentDataPoint(String deviceName, String productId);
|
2024-04-19 16:36:24 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取设备详情
|
2024-08-12 20:55:59 +08:00
|
|
|
|
*
|
2024-04-19 16:36:24 +08:00
|
|
|
|
* @param deviceName 设备名称
|
2024-08-12 20:55:59 +08:00
|
|
|
|
* @param productId
|
2024-04-19 16:36:24 +08:00
|
|
|
|
*/
|
2024-08-12 20:55:59 +08:00
|
|
|
|
IotDeviceDetail getDeviceDetail(String deviceName, String productId);
|
2024-04-19 16:36:24 +08:00
|
|
|
|
|
|
|
|
|
/**
|
2024-05-23 09:31:16 +08:00
|
|
|
|
* 设置剩余时长
|
|
|
|
|
*
|
2024-04-19 16:36:24 +08:00
|
|
|
|
* @param deviceName 设备名称
|
2024-05-23 09:31:16 +08:00
|
|
|
|
* @param seconds 时长(秒)
|
2024-08-12 20:55:59 +08:00
|
|
|
|
* @param productId
|
2024-04-19 16:36:24 +08:00
|
|
|
|
*/
|
2024-08-12 20:55:59 +08:00
|
|
|
|
CommandResponse setTime(String deviceName, long seconds, String productId);
|
2024-04-19 16:36:24 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 更新设备信息
|
2024-08-12 20:55:59 +08:00
|
|
|
|
*
|
|
|
|
|
* @param device 设备信息
|
|
|
|
|
* @param productId
|
2024-04-19 16:36:24 +08:00
|
|
|
|
*/
|
2024-08-12 20:55:59 +08:00
|
|
|
|
boolean updateDevice(Device device, String productId);
|
2024-04-19 16:36:24 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取设备信息,并转化为IotDeviceInfo
|
2024-08-12 20:55:59 +08:00
|
|
|
|
*
|
2024-04-19 16:36:24 +08:00
|
|
|
|
* @param deviceName 设备名称
|
2024-08-12 20:55:59 +08:00
|
|
|
|
* @param productId
|
2024-04-19 16:36:24 +08:00
|
|
|
|
*/
|
2024-08-12 20:55:59 +08:00
|
|
|
|
IotDeviceInfo getDeviceInfo(String deviceName, String productId);
|
2024-04-19 16:36:24 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取设备信息列表,并转换为IotDeviceInfo
|
2024-08-12 20:55:59 +08:00
|
|
|
|
*
|
2024-04-19 16:36:24 +08:00
|
|
|
|
* @param deviceNames 设备名称列表
|
2024-08-12 20:55:59 +08:00
|
|
|
|
* @param productId
|
2024-04-19 16:36:24 +08:00
|
|
|
|
*/
|
2024-08-12 20:55:59 +08:00
|
|
|
|
List<IotDeviceInfo> getDeviceInfo(List<String> deviceNames, String productId);
|
2024-04-19 16:36:24 +08:00
|
|
|
|
|
2024-07-09 11:17:20 +08:00
|
|
|
|
/**
|
|
|
|
|
* 注册设备
|
|
|
|
|
*/
|
2024-08-12 20:55:59 +08:00
|
|
|
|
int create(String mac, String productId);
|
2024-07-15 15:26:48 +08:00
|
|
|
|
|
2024-04-19 16:36:24 +08:00
|
|
|
|
}
|