提交 | 用户 | 时间
|
149dd0
|
1 |
package com.iailab.netsdk.lib.callback; |
H |
2 |
|
|
3 |
import com.iailab.netsdk.lib.NetSDKLib; |
|
4 |
import com.iailab.netsdk.lib.ToolKits; |
|
5 |
import com.iailab.netsdk.lib.structure.NET_CB_REDIRECT_SERVER_CALLBACK_INFO; |
|
6 |
import com.iailab.netsdk.lib.structure.NET_IN_START_REDIRECT_SERVICE; |
|
7 |
import com.sun.jna.Callback; |
|
8 |
import com.sun.jna.Pointer; |
|
9 |
|
|
10 |
/** |
|
11 |
* @author 47081 |
|
12 |
* @version 1.0 |
|
13 |
* @description 重定向服务器回调函数原形扩展 |
|
14 |
* @date 2021/3/13 |
|
15 |
*/ |
|
16 |
public interface fRedirectServerCallBackEx extends Callback { |
|
17 |
/** |
|
18 |
* @param lDevHandle 设备句柄 |
|
19 |
* @param pInParam 设备信息,对应结构体{@link NET_CB_REDIRECT_SERVER_CALLBACK_INFO} |
|
20 |
* @param dwUserData 自定义数据,该自定义数据为{@link |
|
21 |
* NET_IN_START_REDIRECT_SERVICE#dwUserData}传入的数据,注意保证dwUser不会被jvm回收, |
|
22 |
* 否则回调中接收到的dwUser可能乱码,甚至导致程序崩溃 |
|
23 |
* @return |
|
24 |
*/ |
|
25 |
default int callback(NetSDKLib.LLong lDevHandle, Pointer pInParam, Pointer dwUserData) { |
|
26 |
NET_CB_REDIRECT_SERVER_CALLBACK_INFO info = new NET_CB_REDIRECT_SERVER_CALLBACK_INFO(); |
|
27 |
ToolKits.GetPointerDataToStruct(pInParam, 0, info); |
|
28 |
dealWithData(lDevHandle.longValue(), info, dwUserData); |
|
29 |
return 0; |
|
30 |
} |
|
31 |
|
|
32 |
/** |
|
33 |
* 数据处理 |
|
34 |
* |
|
35 |
* @param devHandler 设备句柄 |
|
36 |
* @param info 主动注册重定向设备信息 |
|
37 |
* @param userData 用户数据 |
|
38 |
*/ |
|
39 |
void dealWithData(long devHandler, NET_CB_REDIRECT_SERVER_CALLBACK_INFO info, Pointer userData); |
|
40 |
} |