zhanghua
2024-10-09 b11443475114cacb529130a04d45c7c9981ff375
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
package com.dahua.netsdk.lib.callback.impl;
 
import com.dahua.netsdk.lib.NetSDKLib;
import com.dahua.netsdk.module.BaseModule;
import com.sun.jna.Pointer;
 
/**
 * @author 47081
 * @version 1.0
 * @description 主动注册回调函数,回调函数请使用单例模式
 * @date 2021/3/13
 */
public class DefaultServiceCallBack implements NetSDKLib.fServiceCallBack {
  private static volatile DefaultServiceCallBack instance;
 
  private DefaultServiceCallBack() {
    this.baseModule = new BaseModule();
  }
 
  public static DefaultServiceCallBack getInstance() {
    if (instance == null) {
      synchronized (DefaultServiceCallBack.class) {
        if (instance == null) {
          instance = new DefaultServiceCallBack();
        }
      }
    }
    return instance;
  }
 
  private BaseModule baseModule;
 
  @Override
  public int invoke(
      NetSDKLib.LLong lHandle,
      String pIp,
      int wPort,
      int lCommand,
      Pointer pParam,
      int dwParamLen,
      Pointer dwUserData) {
    System.out.println("receive device[ip: " + pIp + ",port: " + wPort + "] auto register.");
    return 0;
  }
}