package com.usky.sas.common.hik;

import com.sun.jna.Native;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class InitSadp {
    public static Map<String, Sadp> sadpSDKHashMap = new ConcurrentHashMap();
    public static Sadp sadp;

    public InitSadp() {
    }

    private static boolean createSadpInstance() {
        if (sadp == null) {
            Class var0 = Sadp.class;
            synchronized(Sadp.class) {
                boolean var2;
                try {
                    String libPath = "";
                    if (OsSelect.isWindows()) {
                        libPath = "D:\\文档和图片\\工作文档\\厂家协议\\海康\\HCSadpSDKV4.2.8.10_build20220517_Win64_ZH_20231201161210\\HCSadpSDKV4.2.8.10_build20220517_Win64_ZH\\libs\\Sadp.dll";
                    } else if (OsSelect.isLinux()) {
                        libPath = "/home/uskycloud_c01/conf/libsadp.so";
                        System.load(libPath);
                    }

                    sadp = (Sadp)Native.loadLibrary(libPath, Sadp.class);
                    sadpSDKHashMap.put("sadp", sadp);
                    if (OsSelect.isLinux()) {
                        sadp.SADP_SetLogToFile(3, "/www/wwwroot/fjkjagapp.fj724.com/sadp_log/", false);
                    }

                    var2 = true;
                    return var2;
                } catch (Exception var8) {
                    System.out.println("loadLibrary Error: " + var8.getMessage());
                    var2 = false;
                } finally {
                    ;
                }

                return var2;
            }
        } else {
            return true;
        }
    }

    static {
        sadp = (Sadp)sadpSDKHashMap.get("sadp");
        createSadpInstance();
    }
}

