package com.hdl.photovoltaic.internet;
|
|
|
import com.hdl.photovoltaic.other.HdlAccountLogic;
|
import com.hdl.sdk.link.core.callback.HDLLinkCallBack;
|
import com.hdl.sdk.link.gateway.HDLLinkLocalGateway;
|
|
/**
|
* 客户端操作逻辑
|
*/
|
public class TcpClient {
|
|
private static volatile TcpClient sTcpClient;
|
|
/**
|
* 获取当前对象
|
*
|
* @return HdlAccountLogic
|
*/
|
public static synchronized TcpClient getInstance() {
|
if (sTcpClient == null) {
|
synchronized (TcpClient.class) {
|
if (sTcpClient == null) {
|
sTcpClient = new TcpClient();
|
}
|
}
|
|
}
|
return sTcpClient;
|
}
|
|
/**
|
* 发送数据到Link网关
|
*
|
* @param mac 网关mac
|
* @param isEncrypt 是否加密
|
* @param topic 请求主题
|
* @param jObject 负载数据<没有填null></>
|
* @param sendPath 发送路径<类名+方法名>class->methodName</>
|
*/
|
public void sendDataToLinkGateway(String mac, boolean isEncrypt,
|
String topic, Object jObject, String sendPath, HDLLinkCallBack callBack) {
|
HDLLinkLocalGateway.getInstance().sendDataToLinkGateway(mac, isEncrypt, topic, jObject, sendPath, callBack);
|
|
}
|
}
|