195 lines
4.7 KiB
Java
195 lines
4.7 KiB
Java
package com.ruoyi.iot.service;
|
||
|
||
|
||
import com.ruoyi.iot.domain.HistoryDeviceData;
|
||
import com.ruoyi.iot.domain.IotDeviceInfo;
|
||
import com.ruoyi.iot.domain.response.CommandResponse;
|
||
import com.ruoyi.iot.interfaces.IotDevice;
|
||
import com.ruoyi.ss.device.domain.enums.DeviceOnlineStatus;
|
||
|
||
import java.math.BigDecimal;
|
||
import java.util.List;
|
||
|
||
/**
|
||
* @author wjh
|
||
* 2024/3/20
|
||
*/
|
||
public interface IotService {
|
||
|
||
/**
|
||
* 获取设备在线状态
|
||
*
|
||
* @param deviceName OneNet设备名称(即设备表的MAC号)
|
||
* @param productId
|
||
*/
|
||
DeviceOnlineStatus getOnlineStatus(String deviceName, String productId);
|
||
|
||
/**
|
||
* 获取设备在线状态
|
||
*/
|
||
DeviceOnlineStatus getOnlineStatus(IotDevice device);
|
||
|
||
/**
|
||
* 通电
|
||
*
|
||
* @param deviceName OneNet设备名称(即设备表的MAC号)
|
||
* @param productId
|
||
* @return 是否成功
|
||
*/
|
||
boolean open(String deviceName, String productId);
|
||
|
||
/**
|
||
* 通电
|
||
*/
|
||
boolean open(IotDevice device);
|
||
|
||
/**
|
||
* 断电
|
||
*
|
||
* @param deviceName OneNet设备名称(即设备表的MAC号)
|
||
* @param productId
|
||
* @return 是否成功
|
||
*/
|
||
boolean close(String deviceName, String productId);
|
||
|
||
/**
|
||
* 断电
|
||
*/
|
||
boolean close(IotDevice device);
|
||
|
||
/**
|
||
* 设置剩余时长
|
||
*
|
||
* @param deviceName 设备名称
|
||
* @param seconds 时长(秒)
|
||
* @param productId
|
||
*/
|
||
CommandResponse setTime(String deviceName, long seconds, String productId);
|
||
|
||
/**
|
||
* 设置剩余时长
|
||
*/
|
||
CommandResponse setTime(IotDevice device, long seconds);
|
||
|
||
/**
|
||
* 获取设备信息,并转化为IotDeviceInfo
|
||
*
|
||
* @param deviceName 设备名称
|
||
* @param productId
|
||
*/
|
||
IotDeviceInfo getDeviceInfo(String deviceName, String productId);
|
||
|
||
/**
|
||
* 获取设备信息,并转为IotDeviceInfo
|
||
*/
|
||
IotDeviceInfo getDeviceInfo(IotDevice device);
|
||
|
||
/**
|
||
* 获取设备信息列表,并转换为IotDeviceInfo
|
||
*
|
||
* @param deviceList 设备名称列表
|
||
* @param productId
|
||
*/
|
||
List<IotDeviceInfo> getDeviceInfo(List<? extends IotDevice> deviceList, String productId);
|
||
|
||
/**
|
||
* 注册设备
|
||
*/
|
||
int create(String mac, String productId);
|
||
|
||
/**
|
||
* 设备添加电量(度)
|
||
*/
|
||
CommandResponse addEle(String deviceName, BigDecimal ele, String productId);
|
||
|
||
/**
|
||
* 设备添加电量(度)
|
||
*/
|
||
CommandResponse addEle(IotDevice device, BigDecimal ele);
|
||
|
||
/**
|
||
* 直接设置设备电量(度)
|
||
*/
|
||
CommandResponse setEle(String deviceName, BigDecimal ele, String productId);
|
||
|
||
/**
|
||
* 直接设置设备电量(度)
|
||
*/
|
||
CommandResponse setEle(IotDevice device, BigDecimal ele);
|
||
|
||
/**
|
||
* 尝试设置设备剩余时长
|
||
*
|
||
* @param device MAC
|
||
* @param seconds 时长
|
||
* @param tryCount 尝试次数
|
||
*/
|
||
CommandResponse trySetTime(IotDevice device, long seconds, int tryCount);
|
||
|
||
/**
|
||
* 尝试设置设备剩余时长
|
||
*
|
||
* @param device MAC
|
||
* @param ele 电量(度)
|
||
* @param tryCount 尝试次数
|
||
*/
|
||
CommandResponse trySetEle(IotDevice device, BigDecimal ele, int tryCount);
|
||
|
||
/**
|
||
* 设置设备WIFI
|
||
* @param device 设备
|
||
* @param wifiName WIFI名称
|
||
* @param wifiPwd WIFI 密码
|
||
*/
|
||
CommandResponse setWifi(IotDevice device, String wifiName, String wifiPwd);
|
||
|
||
CommandResponse setWifi(String mac, String productId, String wifiName, String wifiPwd);
|
||
|
||
/**
|
||
* 设置倒计时提醒
|
||
*
|
||
* @param device 设备
|
||
* @param seconds 倒计时(秒)
|
||
*/
|
||
boolean setVoice(IotDevice device, long seconds);
|
||
|
||
boolean setVoice(String mac, String productId, long seconds);
|
||
|
||
/**
|
||
* 设置总用电量
|
||
* @param device 设备
|
||
* @param totalEle 总用电量(瓦时)
|
||
*/
|
||
boolean setTotalEle(IotDevice device, BigDecimal totalEle);
|
||
|
||
/**
|
||
* 设置总用电量
|
||
* @param deviceName 设备MAC
|
||
* @param productId 产品ID
|
||
* @param totalEle 总用电量(瓦时)
|
||
*/
|
||
boolean setTotalEle(String deviceName, String productId, BigDecimal totalEle);
|
||
|
||
/**
|
||
* 获取历史数据
|
||
*/
|
||
HistoryDeviceData getHistoryDataPoint(String deviceName, String productId);
|
||
|
||
/**
|
||
* 设置设备时长和电量
|
||
* @param device 设备
|
||
* @param seconds 时长(秒)
|
||
* @param ele 电量(度)
|
||
*/
|
||
int setTimeAndEle(IotDevice device, long seconds, BigDecimal ele);
|
||
|
||
/**
|
||
* 设置设备时长和电量
|
||
* @param mac mac
|
||
* @param productId 产品ID
|
||
* @param seconds 秒
|
||
* @param ele 电量(度)
|
||
*/
|
||
int setTimeAndEle(String mac, String productId, long seconds, BigDecimal ele);
|
||
}
|