From 16abd944c4331a31e99c28564c9b8a31bfbbfefc Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Fri, 27 Aug 2021 21:14:15 +0800
Subject: [PATCH] 海康设备接口调用工具类修改
---
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/hk/util/GetCameraPreviewURL.java | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/hk/util/GetCameraPreviewURL.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/hk/util/GetCameraPreviewURL.java
index cfa4abb..3226ea1 100644
--- a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/hk/util/GetCameraPreviewURL.java
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/hk/util/GetCameraPreviewURL.java
@@ -67,6 +67,61 @@
}
+
+ /**
+ * 语音对讲
+ * @param url 语音对讲url
+ * @param cameraIndexCode 监控点唯一标识
+ * @return
+ */
+ public static String GetTalkURLs(String url,String cameraIndexCode) {
+
+ /**
+ * STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数.
+ */
+ // artemis网关服务器ip端口
+ ArtemisConfig.host = HkConstant.HOST;
+ // 秘钥appKey
+ ArtemisConfig.appKey = HkConstant.AppKey;
+ // 秘钥appSecret
+ ArtemisConfig.appSecret = HkConstant.AppSecret;
+
+
+
+ /**
+ * STEP3:设置接口的URI地址
+ */
+ final String apiUrl = ARTEMIS_PATH + url;
+ Map<String, String> path = new HashMap<String, String>(2) {
+ {
+ //根据现场环境部署确认是http还是https
+ put("https://", apiUrl);
+ }
+ };
+
+ /**
+ * STEP4:设置参数提交方式
+ */
+ String contentType = "application/json";
+
+ /**
+ * STEP5:组装请求参数
+ */
+ JSONObject jsonBody = new JSONObject();
+ jsonBody.put("cameraIndexCode", cameraIndexCode);
+ jsonBody.put("streamType", 0);
+ jsonBody.put("transmode", 1);
+ jsonBody.put("expand", "streamform=ps");
+ jsonBody.put("protocol", "ws");
+ String body = jsonBody.toJSONString();
+ /**
+ * STEP6:调用接口
+ */
+ String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , null);// post请求application/json类型参数
+ return result;
+ }
+
+
/**
* 获取监控点资源分页数据
* @param url 监控资源url
@@ -83,8 +138,6 @@
ArtemisConfig.appKey = HkConstant.AppKey;
// 秘钥appSecret
ArtemisConfig.appSecret = HkConstant.AppSecret;
-
-
/**
* STEP3:设置接口的URI地址
@@ -121,7 +174,9 @@
String result = GetCameraResourcePage(1,1,HkConstant.cameras);
String result1 = GetCameraPreviewURL(HkConstant.previewURLs,"1f792961883543c6868cc8b200291962", ProtocolConstant.HLS);
+ String result2 = GetTalkURLs(HkConstant.previewURLs,"1f792961883543c6868cc8b200291962");
System.out.println("result结果示例: " + result);
System.out.println("result1 = " + result1);
+ System.out.println("result2 = " + result2);
}
}
--
Gitblit v1.9.3