Commit 675ce2346dfdeb58227b8b18aa60746ea834ff76

Authored by panlinlin
2 parents 422ce8ae 224e9043

Merge remote-tracking branch 'origin/master' into wvp-28181-2.0

src/main/java/com/genersoft/iot/vmp/gb28181/auth/DigestServerAuthenticationHelper.java
@@ -235,55 +235,4 @@ public class DigestServerAuthenticationHelper { @@ -235,55 +235,4 @@ public class DigestServerAuthenticationHelper {
235 return mdString.equals(response); 235 return mdString.equals(response);
236 236
237 } 237 }
238 -  
239 -  
240 - public static void main(String[] args) throws NoSuchAlgorithmException {  
241 - MessageDigest messageDigest2 = MessageDigest.getInstance(DEFAULT_ALGORITHM);  
242 - String realm = "DS-2CD2520F";  
243 - String username = "admin";  
244 - String passwd = "12345";  
245 -  
246 - String nonce = "4d6a553452444d30525441364e6d4d304e6a68684e47553d";  
247 -  
248 - String uri = "/ISAPI/Streaming/channels/101/picture";  
249 - // qop 保护质量 包含auth(默认的)和auth-int(增加了报文完整性检测)两种策略  
250 - String qop = "auth";  
251 -  
252 - // 客户端随机数,这是一个不透明的字符串值,由客户端提供,并且客户端和服务器都会使用,以避免用明文文本。  
253 - // 这使得双方都可以查验对方的身份,并对消息的完整性提供一些保护  
254 - String cNonce = "C1A5298F939E87E8F962A5EDFC206918";  
255 -  
256 - // nonce计数器,是一个16进制的数值,表示同一nonce下客户端发送出请求的数量  
257 - int nc = 1;  
258 -  
259 - String A1 = username + ":" + realm + ":" + passwd;  
260 - System.out.println("A1: " + A1);  
261 - String A2 = "GET" + ":" + uri.toString();  
262 - System.out.println("A2: " + A2);  
263 - byte mdbytes[] = messageDigest2.digest(A1.getBytes());  
264 - String HA1 = toHexString(mdbytes);  
265 - System.out.println("HA1: " + HA1);  
266 -  
267 - mdbytes = messageDigest2.digest(A2.getBytes());  
268 - String HA2 = toHexString(mdbytes);  
269 - System.out.println("HA2: " + HA2);  
270 - String cnonce = "93d4d37df32e1a85";  
271 - String KD = HA1 + ":" + nonce;  
272 -  
273 - if (nc != -1) {  
274 - KD += ":" + "00000001";  
275 - }  
276 - if (cnonce != null) {  
277 - KD += ":" + cnonce;  
278 - }  
279 - if (qop != null) {  
280 - KD += ":" + qop;  
281 - }  
282 - KD += ":" + HA2;  
283 - System.out.println("KD: " + KD);  
284 - mdbytes = messageDigest2.digest(KD.getBytes());  
285 - String mdString = toHexString(mdbytes);  
286 - String response = "3993a815e5cdaf4470e9b4f9bd41cf4a";  
287 - System.out.println(mdString);  
288 - }  
289 } 238 }
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
@@ -232,7 +232,7 @@ public class SIPCommander implements ISIPCommander { @@ -232,7 +232,7 @@ public class SIPCommander implements ISIPCommander {
232 ptzXml.append("</Info>\r\n"); 232 ptzXml.append("</Info>\r\n");
233 ptzXml.append("</Control>\r\n"); 233 ptzXml.append("</Control>\r\n");
234 234
235 - Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "ViaPtzBranch", "FromPtzTag", "ToPtzTag"); 235 + Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "ViaPtzBranch", "FromPtzTag", null);
236 236
237 transmitRequest(device, request); 237 transmitRequest(device, request);
238 return true; 238 return true;
@@ -268,7 +268,7 @@ public class SIPCommander implements ISIPCommander { @@ -268,7 +268,7 @@ public class SIPCommander implements ISIPCommander {
268 ptzXml.append("</Info>\r\n"); 268 ptzXml.append("</Info>\r\n");
269 ptzXml.append("</Control>\r\n"); 269 ptzXml.append("</Control>\r\n");
270 270
271 - Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "ViaPtzBranch", "FromPtzTag", "ToPtzTag"); 271 + Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "ViaPtzBranch", "FromPtzTag", null);
272 transmitRequest(device, request); 272 transmitRequest(device, request);
273 return true; 273 return true;
274 } catch (SipException | ParseException | InvalidArgumentException e) { 274 } catch (SipException | ParseException | InvalidArgumentException e) {
@@ -635,7 +635,7 @@ public class SIPCommander implements ISIPCommander { @@ -635,7 +635,7 @@ public class SIPCommander implements ISIPCommander {
635 catalogXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); 635 catalogXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n");
636 catalogXml.append("</Query>\r\n"); 636 catalogXml.append("</Query>\r\n");
637 637
638 - Request request = headerProvider.createMessageRequest(device, catalogXml.toString(), "ViaDeviceInfoBranch", "FromDeviceInfoTag", "ToDeviceInfoTag"); 638 + Request request = headerProvider.createMessageRequest(device, catalogXml.toString(), "ViaDeviceInfoBranch", "FromDeviceInfoTag", null);
639 639
640 transmitRequest(device, request); 640 transmitRequest(device, request);
641 641
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
@@ -20,13 +20,42 @@ public interface DeviceChannelMapper { @@ -20,13 +20,42 @@ public interface DeviceChannelMapper {
20 "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status})") 20 "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status})")
21 int add(DeviceChannel channel); 21 int add(DeviceChannel channel);
22 22
23 - @Update("UPDATE device_channel " +  
24 - "SET name=#{name}, manufacture=#{manufacture}, model=#{model}, owner=#{owner}, civilCode=#{civilCode}, " +  
25 - "block=#{block}, address=#{address}, parental=#{parental}, parentId=#{parentId}, safetyWay=#{safetyWay}, " +  
26 - "registerWay=#{registerWay}, certNum=#{certNum}, certifiable=#{certifiable}, errCode=#{errCode}, secrecy=#{secrecy}, " +  
27 - "ipAddress=#{ipAddress}, port=#{port}, password=#{password}, PTZType=#{PTZType}, status=#{status}, streamId=#{streamId}, " +  
28 - "hasAudio=#{hasAudio}" +  
29 - "WHERE deviceId=#{deviceId} AND channelId=#{channelId}") 23 +// @Update("UPDATE device_channel " +
  24 +// "SET name=#{name}, manufacture=#{manufacture}, model=#{model}, owner=#{owner}, civilCode=#{civilCode}, " +
  25 +// "block=#{block}, address=#{address}, parental=#{parental}, parentId=#{parentId}, safetyWay=#{safetyWay}, " +
  26 +// "registerWay=#{registerWay}, certNum=#{certNum}, certifiable=#{certifiable}, errCode=#{errCode}, secrecy=#{secrecy}, " +
  27 +// "ipAddress=#{ipAddress}, port=#{port}, password=#{password}, PTZType=#{PTZType}, status=#{status}, streamId=#{streamId}, " +
  28 +// "hasAudio=#{hasAudio}" +
  29 +// "WHERE deviceId=#{deviceId} AND channelId=#{channelId}")
  30 +
  31 +
  32 + @Update(value = {" <script>" +
  33 + "UPDATE device_channel " +
  34 + "SET deviceId='${deviceId}'" +
  35 + "<if test=\"name != null\">, name='${name}'</if>" +
  36 + "<if test=\"manufacture != null\">, manufacture='${manufacture}'</if>" +
  37 + "<if test=\"model != null\">, model='${model}'</if>" +
  38 + "<if test=\"owner != null\">, owner='${owner}'</if>" +
  39 + "<if test=\"civilCode != null\">, civilCode='${civilCode}'</if>" +
  40 + "<if test=\"block != null\">, block='${block}'</if>" +
  41 + "<if test=\"address != null\">, address='${address}'</if>" +
  42 + "<if test=\"parental != null\">, parental=${parental}</if>" +
  43 + "<if test=\"parentId != null\">, parentId='${parentId}'</if>" +
  44 + "<if test=\"safetyWay != null\">, safetyWay=${safetyWay}</if>" +
  45 + "<if test=\"registerWay != null\">, registerWay=${registerWay}</if>" +
  46 + "<if test=\"certNum != null\">, certNum='${certNum}'</if>" +
  47 + "<if test=\"certifiable != null\">, certifiable=${certifiable}</if>" +
  48 + "<if test=\"errCode != null\">, errCode=${errCode}</if>" +
  49 + "<if test=\"secrecy != null\">, secrecy='${secrecy}'</if>" +
  50 + "<if test=\"ipAddress != null\">, ipAddress='${ipAddress}'</if>" +
  51 + "<if test=\"port != null\">, port=${port}</if>" +
  52 + "<if test=\"password != null\">, password='${password}'</if>" +
  53 + "<if test=\"PTZType != null\">, PTZType=${PTZType}</if>" +
  54 + "<if test=\"status != null\">, status='${status}'</if>" +
  55 + "<if test=\"streamId != null\">, streamId='${streamId}'</if>" +
  56 + "<if test=\"hasAudio != null\">, hasAudio='${hasAudio}'</if>" +
  57 + "WHERE deviceId='${deviceId}' AND channelId='${channelId}'"+
  58 + " </script>"})
30 int update(DeviceChannel channel); 59 int update(DeviceChannel channel);
31 60
32 @Select(value = {" <script>" + 61 @Select(value = {" <script>" +
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
@@ -45,18 +45,21 @@ public interface DeviceMapper { @@ -45,18 +45,21 @@ public interface DeviceMapper {
45 int add(Device device); 45 int add(Device device);
46 46
47 47
48 - @Update("UPDATE device " +  
49 - "SET name=#{name}, " +  
50 - "manufacturer=#{manufacturer}," +  
51 - "model=#{model}," +  
52 - "firmware=#{firmware}, " +  
53 - "transport=#{transport}," +  
54 - "streamMode=#{streamMode}, " +  
55 - "ip=#{ip}, " +  
56 - "port=#{port}, " +  
57 - "hostAddress=#{hostAddress}, " +  
58 - "online=#{online} " +  
59 - "WHERE deviceId=#{deviceId}") 48 + @Update(value = {" <script>" +
  49 + "UPDATE device " +
  50 + "SET deviceId='${deviceId}'" +
  51 + "<if test=\"name != null\">, name='${name}'</if>" +
  52 + "<if test=\"manufacturer != null\">, manufacturer='${manufacturer}'</if>" +
  53 + "<if test=\"model != null\">, model='${model}'</if>" +
  54 + "<if test=\"firmware != null\">, firmware='${firmware}'</if>" +
  55 + "<if test=\"transport != null\">, transport='${transport}'</if>" +
  56 + "<if test=\"streamMode != null\">, streamMode='${streamMode}'</if>" +
  57 + "<if test=\"ip != null\">, ip='${ip}'</if>" +
  58 + "<if test=\"port != null\">, port=${port}</if>" +
  59 + "<if test=\"hostAddress != null\">, hostAddress='${hostAddress}'</if>" +
  60 + "<if test=\"online != null\">, online=${online}</if>" +
  61 + "WHERE deviceId='${deviceId}'"+
  62 + " </script>"})
60 int update(Device device); 63 int update(Device device);
61 64
62 @Select("SELECT *, (SELECT count(0) FROM device_channel WHERE deviceId=de.deviceId) as channelCount FROM device de") 65 @Select("SELECT *, (SELECT count(0) FROM device_channel WHERE deviceId=de.deviceId) as channelCount FROM device de")