| | |
| | | for (NET_TITLE_OSD_INFO osd : stuOSD) { |
| | | String osdStr = null; |
| | | osdStr = new String(osd.szText, StandardCharsets.UTF_8).trim(); |
| | | // log.info("TEXT:"+osdStr); |
| | | log.error("TEXT:"+osdStr); |
| | | if (!StringUtils.isEmpty(osdStr)) { |
| | | if (num == 0) { |
| | | osdResult.setOSD1(osdStr); |
| | | } else if (num == 1) { |
| | | osdResult.setOSD2(osdStr); |
| | | } else if (num == 2) { |
| | | osdResult.setOSD3(osdStr); |
| | | } else if (num == 3) { |
| | | osdResult.setName(osdStr); |
| | | if (osdStr.contains("|")) { |
| | | String[] osdNames = osdStr.split("\\|"); |
| | | osdResult.setOSD1(osdNames[0]); |
| | | osdResult.setOSD2(osdNames[1]); |
| | | osdResult.setOSD3(osdNames[2]); |
| | | osdResult.setName(osdNames[3]); |
| | | } else { |
| | | if (num == 0) { |
| | | osdResult.setOSD1(osdStr); |
| | | } else if (num == 1) { |
| | | osdResult.setOSD2(osdStr); |
| | | } else if (num == 2) { |
| | | osdResult.setOSD3(osdStr); |
| | | } else if (num == 3) { |
| | | osdResult.setName(osdStr); |
| | | } |
| | | } |
| | | } |
| | | num++; |
| | |
| | | |
| | | /** |
| | | * 针对利旧设备获取OSD的方法 |
| | | * |
| | | * @param serialNumber |
| | | * @param loginId |
| | | * @return |
| | |
| | | log.error("e为空,尝试另一个通道"); |
| | | e = netsdk.CLIENT_GetConfig(loginId, NET_EM_CFG_CUSTOMTITLE, 1, osdInfo4.getPointer(), osdInfo4.size(), 3000, reserve4.getPointer()); |
| | | } |
| | | if(e) { |
| | | if (e) { |
| | | osdInfo4.read(); |
| | | NetSDKLib.NET_CUSTOM_TITLE_INFO[] stuCustomTitle = osdInfo4.stuCustomTitle; |
| | | for (NetSDKLib.NET_CUSTOM_TITLE_INFO net_custom_title_info : stuCustomTitle) { |
| | | String name = new String(net_custom_title_info.szText, StandardCharsets.UTF_8).trim(); |
| | | log.info("name:{}",name); |
| | | if(StringUtils.isNotEmpty(name) && name.contains("|")){ |
| | | log.error("name:{}", name); |
| | | if (StringUtils.isNotEmpty(name) && name.contains("|")) { |
| | | String[] osdNames = name.split("\\|"); |
| | | //剔除掉空串 |
| | | // List<String> nonEmptyList = new ArrayList<>(); |
| | |
| | | result.setName(osdNames[3]); |
| | | } |
| | | } |
| | | }else { |
| | | log.error(serialNumber,"利旧osd为空"); |
| | | } else { |
| | | log.error(serialNumber, "利旧osd为空"); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 获取单个配置 |
| | | * |
| | | * @param hLoginHandle 登陆句柄 |
| | | * @param nChn 通道号,-1 表示全通道 |
| | | * @param strCmd 配置名称 |
| | | * @param cmdObject 配置对应的结构体对象 |
| | | * @param nChn 通道号,-1 表示全通道 |
| | | * @param strCmd 配置名称 |
| | | * @param cmdObject 配置对应的结构体对象 |
| | | * @return 成功返回 true |
| | | */ |
| | | public static boolean GetDevConfig(LLong hLoginHandle, int nChn, String strCmd, Structure cmdObject) { |
| | | boolean result = false; |
| | | IntByReference error = new IntByReference(0); |
| | | int nBufferLen = 2*1024*1024; |
| | | int nBufferLen = 2 * 1024 * 1024; |
| | | byte[] strBuffer = new byte[nBufferLen]; |
| | | |
| | | if(netsdk.CLIENT_GetNewDevConfig( hLoginHandle, strCmd , nChn, strBuffer, nBufferLen,error,3000,null)) { |
| | | if (netsdk.CLIENT_GetNewDevConfig(hLoginHandle, strCmd, nChn, strBuffer, nBufferLen, error, 3000, null)) { |
| | | cmdObject.write(); |
| | | if (netsdk.CLIENT_ParseData(strCmd, strBuffer, cmdObject.getPointer(), |
| | | cmdObject.size(), null)) { |