mac
2023-10-23 8bfe046de7987990e1bff2755c2963e14ebc54c1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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);
 
    }
 
    /**
     * 发送数据到Link网关
     *
     * @param mac      网关mac
     * @param topic    请求主题
     * @param jObject  负载数据<没有填null></>
     * @param sendPath 发送路径<类名+方法名>class->methodName</>
     */
    public void sendDataToLinkGateway(String mac,
                                      String topic, Object jObject, String sendPath, HDLLinkCallBack callBack) {
        HDLLinkLocalGateway.getInstance().sendDataToLinkGateway(mac, topic, jObject, sendPath, callBack);
 
    }
}