| | |
| | | if (!e) { |
| | | log.error("e为空"); |
| | | } |
| | | }else if(moName.startsWith("DX_RD")){ //判断设备是否是DX_RD开头 |
| | | if (serialNumber.charAt(ApiConstants.SerialNumber_Channel) == ApiConstants.SerialNumber_All) { |
| | | e = netsdk.CLIENT_GetConfig(loginId, NET_EM_CFG_CUSTOMTITLE, 0, osdInfo4.getPointer(), osdInfo4.size(), 3000, reserve4.getPointer()); |
| | | } |
| | | else if (serialNumber.charAt(ApiConstants.SerialNumber_Channel) == ApiConstants.SerialNumber_Detail) { |
| | | e = netsdk.CLIENT_GetConfig(loginId, NET_EM_CFG_CUSTOMTITLE, 1, osdInfo4.getPointer(), osdInfo4.size(), 3000, reserve4.getPointer()); |
| | | } |
| | | if (!e) { |
| | | log.error("e为空"); |
| | | } |
| | | }else { |
| | | e = netsdk.CLIENT_GetConfig(loginId, NET_EM_CFG_CUSTOMTITLE, 0, osdInfo4.getPointer(), osdInfo4.size(), 3000, reserve4.getPointer()); |
| | | if (!e) { |
| | |
| | | |
| | | import com.sun.jna.Pointer; |
| | | import com.sun.jna.ptr.IntByReference; |
| | | import com.ycl.api.DH.utils.DHApi; |
| | | import com.ycl.api.YS.lib.NetDEVSDKLib; |
| | | import com.ycl.api.YS.login.Login; |
| | | import com.ycl.platform.domain.entity.TMonitor; |
| | | import com.ycl.platform.domain.result.OSDResult; |
| | | import com.ycl.utils.StringUtils; |
| | | import enumeration.DeviceType; |
| | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.regex.Pattern; |
| | | |
| | | import static com.ycl.api.YS.lib.NetDEVSDKLib.NETDEV_LOGIN_PROTO_E.NETDEV_LOGIN_PROTO_ONVIF; |
| | | |
| | | @Slf4j |
| | | public class YSApi { |
| | | |
| | | public static OSDResult getOsd(String ip, String userName, String password) { |
| | | public static OSDResult getOsd(TMonitor monitor, String ip, String userName, String password) { |
| | | //登录 |
| | | NetDEVSDKLib.NETDEV_DEVICE_LOGIN_INFO_S stDevLoginInfo = new NetDEVSDKLib.NETDEV_DEVICE_LOGIN_INFO_S(); |
| | | NetDEVSDKLib.NETDEV_SELOG_INFO_S stSELogInfo = new NetDEVSDKLib.NETDEV_SELOG_INFO_S(); |
| | |
| | | |
| | | |
| | | String name = new String(stOSDInfo.stNameOSD.szOSDText, StandardCharsets.UTF_8).trim(); |
| | | //正则名字 如果出现特殊字符 则调用dh的接口 |
| | | log.error("YSname:{}" , name); |
| | | |
| | | // 正则表达式(匹配包含 � 字符的字符串) |
| | | String regex = ".*\\uFFFD.*"; // 核心逻辑:匹配任意位置出现 � 的字符串 |
| | | // 编译正则表达式 |
| | | Pattern pattern = Pattern.compile(regex); |
| | | boolean isMatch = pattern.matcher(name).matches(); |
| | | if(isMatch){ |
| | | log.error("出现正则名字中有特殊字符:{}" , name); |
| | | //大华 |
| | | OSDResult osd = DHApi.getOsd(monitor.getName(),monitor.getSerialNumber(),monitor.getIp(), monitor.getUsername(),monitor.getPassword()); |
| | | OSDResult osdResult2 = checkSuccess(monitor, osd); |
| | | log.error("osdResult2"); |
| | | if (osdResult2!=null) { |
| | | return osd; |
| | | }else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isNotEmpty(name) && name.contains("|")){ |
| | | String[] osdNames = name.split("\\|"); |
| | | for (int i = 0; i < osdNames.length; i++) { |
| | |
| | | } |
| | | } |
| | | |
| | | //OSDCheckThread方法 |
| | | private static OSDResult checkSuccess(TMonitor monitor, OSDResult osd) { |
| | | if (osd != null) { |
| | | osd.setSerialNumber(monitor.getSerialNumber()); |
| | | return osd; |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | public static void demo() { |
| | | Login.loginIn(); |
| | | } |
| | |
| | | } |
| | | } else if (DeviceType.YS.getType().equals(monitor.getDeviceType())) { |
| | | //宇视 |
| | | OSDResult osd = YSApi.getOsd(monitor.getIp(), monitor.getUsername(),monitor.getPassword()); |
| | | OSDResult osd = YSApi.getOsd(monitor,monitor.getIp(), monitor.getUsername(),monitor.getPassword()); |
| | | |
| | | OSDResult osdResult = checkSuccess(monitor, osd); |
| | | if (osdResult!=null) { |
| | | return osd; |
| | |
| | | return dhosd; |
| | | } |
| | | //宇视api |
| | | OSDResult ysosd = YSApi.getOsd(monitor.getIp(), monitor.getUsername(),monitor.getPassword()); |
| | | OSDResult ysosd = YSApi.getOsd(monitor,monitor.getIp(), monitor.getUsername(),monitor.getPassword()); |
| | | if (ysosd != null) { |
| | | ysosd.setSerialNumber(monitor.getSerialNumber()); |
| | | return ysosd; |