fuliqi
2024-11-13 6da8bd9bf08a75e3d026505f23c008f3b8188c22
ycl-server/src/main/java/com/ycl/api/DH/module/LoginModule.java
@@ -11,6 +11,8 @@
import com.ycl.api.DH.lib.structure.*;
import com.ycl.platform.domain.result.OSDResult;
import com.ycl.utils.StringUtils;
import constant.ApiConstants;
import enumeration.DeviceType;
import lombok.extern.slf4j.Slf4j;
import java.io.File;
@@ -151,7 +153,7 @@
        return bRet;
    }
    public static OSDResult getOsd(LLong loginId) {
    public static OSDResult getOsd(String serialNumber,LLong loginId) {
        OSDResult osdResult = new OSDResult();
        NetSDKLib.NET_TIME deviceTime = new NetSDKLib.NET_TIME();
        if (!netsdk.CLIENT_QueryDeviceTime(loginId, deviceTime, 3000)) {
@@ -173,7 +175,19 @@
        NET_CFG_GBMODE_INFO osdInfo = new NET_CFG_GBMODE_INFO();
        osdInfo.write();
        boolean b = netsdk.CLIENT_GetConfig(loginId, NET_EM_CFG_GBMODE, 0, osdInfo.getPointer(), osdInfo.size(), 3000, reserve.getPointer());
        boolean b = false;
        /**
         * 通过国标倒数第七位判断通道 0/全景 1/细节
         * 对于海康来说: 国标倒7: 0/全景/通道2 1/细节/通道1
         * 对于大华来说: 国标倒7: 0/全景/通道1 1/细节/通道2
         * 宇视单通道不考虑
         */
        if(serialNumber.charAt(ApiConstants.SerialNumber_Channel) == ApiConstants.SerialNumber_All ) {
            b = netsdk.CLIENT_GetConfig(loginId, NET_EM_CFG_GBMODE, 0, osdInfo.getPointer(), osdInfo.size(), 3000, reserve.getPointer());
        }else if(serialNumber.charAt(ApiConstants.SerialNumber_Channel) == ApiConstants.SerialNumber_Detail){
            b = netsdk.CLIENT_GetConfig(loginId, NET_EM_CFG_GBMODE, 1, osdInfo.getPointer(), osdInfo.size(), 3000, reserve.getPointer());
        }
        if (!b) {
//            log.error("CLIENT_GetConfig Failed!" + ToolKits.getErrorCodePrint());
            return null;
@@ -181,13 +195,13 @@
            osdInfo.read();
            NET_GBMODE_CUSTOMTITLE_INFO[] stuCustomTitle = osdInfo.stuCustomTitle;
            for (NET_GBMODE_CUSTOMTITLE_INFO title : stuCustomTitle) {
                String position = new String(title.szPositon, StandardCharsets.UTF_8);
                String position = new String(title.szPositon, StandardCharsets.UTF_8).trim();
                if("LeftDown".equals(position)) {
                    NET_TITLE_OSD_INFO[] stuOSD = title.stuOSD;
                    for (NET_TITLE_OSD_INFO osd : stuOSD) {
                        String osdStr = null;
                        osdStr = new String(osd.szText, StandardCharsets.UTF_8).trim();
                        log.info("TEXT:"+osdStr);
//                        log.info("TEXT:"+osdStr);
                        if (!StringUtils.isEmpty(osdStr)) {
                            osdResult.setOSD4(osdStr);
                        }
@@ -198,7 +212,7 @@
                    for (NET_TITLE_OSD_INFO osd : stuOSD) {
                        String osdStr = null;
                        osdStr = new String(osd.szText, StandardCharsets.UTF_8).trim();
                        log.info("TEXT:"+osdStr);
//                        log.info("TEXT:"+osdStr);
                        if (!StringUtils.isEmpty(osdStr)) {
                            if(num ==0){
                                osdResult.setOSD1(osdStr);
@@ -215,6 +229,7 @@
                }
            }
        }
        osdResult.setDeviceBrand(DeviceType.DH.getType());
        return osdResult;
    }