| | |
| | | import com.ycl.api.DH.lib.NetSDKLib.NET_OUT_LOGIN_WITH_HIGHLEVEL_SECURITY; |
| | | import com.ycl.api.DH.lib.ToolKits; |
| | | import com.ycl.api.DH.lib.structure.*; |
| | | import com.ycl.platform.domain.result.OSDResult; |
| | | import com.ycl.utils.StringUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.io.File; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | |
| | | import static com.ycl.api.DH.lib.NetSDKLib.NET_EM_OSD_BLEND_TYPE.NET_EM_OSD_BLEND_TYPE_MAIN; |
| | | import static com.ycl.api.DH.lib.enumeration.NET_EM_CFG_OPERATE_TYPE.NET_EM_CFG_CUSTOMTITLE; |
| | |
| | | return bRet; |
| | | } |
| | | |
| | | public static String getOsdTime() { |
| | | public static OSDResult getOsd() { |
| | | OSDResult osdResult = new OSDResult(); |
| | | NetSDKLib.NET_TIME deviceTime = new NetSDKLib.NET_TIME(); |
| | | |
| | | if (!netsdk.CLIENT_QueryDeviceTime(m_hLoginHandle, deviceTime, 3000)) { |
| | | System.err.println("CLIENT_QueryDeviceTime Failed!" + ToolKits.getErrorCodePrint()); |
| | | log.error("CLIENT_QueryDeviceTime Failed!" + ToolKits.getErrorCodePrint()); |
| | | return null; |
| | | } |
| | | Date checkTime = new Date(); |
| | | osdResult.setCheckTime(checkTime); |
| | | String date = deviceTime.toStringTime(); |
| | | date = date.replace("/", "-"); |
| | | log.info("成功获取检测osd时间" + date); |
| | | |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | try { |
| | | Date time = simpleDateFormat.parse(date); |
| | | osdResult.setOsdTime(time); |
| | | } catch (ParseException e) { |
| | | log.error("时间解析失败"); |
| | | } |
| | | NET_CFG_GBMODE_INFO reserve = new NET_CFG_GBMODE_INFO(); |
| | | |
| | | NET_CFG_GBMODE_INFO osdInfo = new NET_CFG_GBMODE_INFO(); |
| | | osdInfo.write(); |
| | | boolean b = netsdk.CLIENT_GetConfig(m_hLoginHandle, NET_EM_CFG_GBMODE, 0, osdInfo.getPointer(), osdInfo.size(), 3000, reserve.getPointer()); |
| | | if (!b) { |
| | | log.info(("CLIENT_GetConfig Failed!" + ToolKits.getErrorCodePrint())); |
| | | log.error("CLIENT_GetConfig Failed!" + ToolKits.getErrorCodePrint()); |
| | | return null; |
| | | } else { |
| | | osdInfo.read(); |
| | | NET_GBMODE_CUSTOMTITLE_INFO[] stuCustomTitle = osdInfo.stuCustomTitle; |
| | | for (NET_GBMODE_CUSTOMTITLE_INFO title : stuCustomTitle) { |
| | | 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); |
| | | if (!StringUtils.isEmpty(osdStr)) { |
| | | log.info("osd二级文本" + osdStr); |
| | | 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); |
| | | if (!StringUtils.isEmpty(osdStr)) { |
| | | osdResult.setOSD4(osdStr); |
| | | } |
| | | } |
| | | }else if("RightDown".equals(position)){ |
| | | NET_TITLE_OSD_INFO[] stuOSD = title.stuOSD; |
| | | int num = 0; |
| | | for (NET_TITLE_OSD_INFO osd : stuOSD) { |
| | | String osdStr = null; |
| | | osdStr = new String(osd.szText, StandardCharsets.UTF_8); |
| | | 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); |
| | | } |
| | | } |
| | | num++; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return date; |
| | | return osdResult; |
| | | } |
| | | |
| | | } |