提交 | 用户 | 时间
|
ce910c
|
1 |
package com.netsdk.demo.frame.vto; |
H |
2 |
|
|
3 |
import javax.swing.JFrame; |
|
4 |
import javax.swing.SwingUtilities; |
|
5 |
|
|
6 |
import com.sun.jna.Pointer; |
|
7 |
|
|
8 |
import com.netsdk.common.Res; |
|
9 |
import com.netsdk.lib.NetSDKLib.LLong; |
|
10 |
import com.netsdk.lib.NetSDKLib.fHaveReConnect; |
|
11 |
|
|
12 |
/** |
|
13 |
* 网络连接恢复,设备重连成功回调 通过 CLIENT_SetAutoReconnect 设置该回调函数,当已断线的设备重连成功时,SDK会调用该函数 |
|
14 |
* |
|
15 |
* @author 47081 |
|
16 |
* |
|
17 |
*/ |
|
18 |
public class DefaultHaveReconnect implements fHaveReConnect { |
|
19 |
private static DefaultHaveReconnect INSTANCE; |
|
20 |
private JFrame frame; |
|
21 |
|
|
22 |
public void setFrame(JFrame frame) { |
|
23 |
this.frame = frame; |
|
24 |
} |
|
25 |
|
|
26 |
private DefaultHaveReconnect() { |
|
27 |
// TODO Auto-generated constructor stub |
|
28 |
} |
|
29 |
|
|
30 |
public static DefaultHaveReconnect getINSTANCE() { |
|
31 |
if (INSTANCE == null) { |
|
32 |
INSTANCE = new DefaultHaveReconnect(); |
|
33 |
} |
|
34 |
return INSTANCE; |
|
35 |
} |
|
36 |
|
|
37 |
@Override |
|
38 |
public void invoke(LLong lLoginID, String pchDVRIP, int nDVRPort, Pointer dwUser) { |
|
39 |
System.out.printf("ReConnect Device[%s] Port[%d]\n", pchDVRIP, nDVRPort); |
|
40 |
|
|
41 |
// 重连提示 |
|
42 |
SwingUtilities.invokeLater(new Runnable() { |
|
43 |
public void run() { |
|
44 |
if (frame != null) { |
|
45 |
frame.setTitle(Res.string().getPTZ() + " : " + Res.string().getOnline()); |
|
46 |
} |
|
47 |
} |
|
48 |
}); |
|
49 |
} |
|
50 |
} |