Atitti  onvif 设备发现与原理

Atitti  onvif 设备发现与原理

 

1.1. ,有以下几个步骤:1

1.2. 设备搜索原理及编程技巧:2

1.3. Ws disconvert 的组播地址和端口就是37022

 

1)发现ipcam

客户端首先发起ws-discovery,查找所在网络段内的所有的ipcamIpcam在接收到ws-discovery之后可以进行响应

 

 

android下的实现方式

android下的实现方式
1DatagramPacket类,UDP的方式
2)计算广播地址(192.168.1.255
3socket send probe
4)开启一个线程去receive
5)解析收到的probematch

1.1. ,有以下几个步骤:

1、创建组播用的udp socket

2、绑定组播地址为239.255.255.250,端口为3702,因为ws-discovery的组播地址和端口就是为239.255.255.2503702

1.2. 设备搜索原理及编程技巧:

搜索发现的基本原理是:设备上服务器监听239.255.255.250的3702端口。所以,如果要实现跨网段搜索onvif设备需要路由的支持。只要组播数据包能收到,设备就能被搜到。原理是这样。参考代码:

 

1.3. Ws disconvert 的组播地址和端口就是3702

关于cxf报:Cannot create URL for this address soap.udp://239.255.255.250:3702的原因

 

 the ONVIF discovery process is based onhttp://specs.xmlsoap.org/ws/2005/04/discovery it use SOAP over UDP.

If you are using apache-cxf, this can be achieve using

org.apache.cxf.ws.discovery.WSDiscoveryClient

A simple sample code could be :

import java.util.List;

import javax.xml.ws.EndpointReference;

import org.apache.cxf.ws.discovery.WSDiscoveryClient;

 

public class Main

{

    public static void main(String[] args)

    {

        WSDiscoveryClient client = new WSDiscoveryClient();

        client.setVersion10(); // use WS-discovery 1.0

        client.setDefaultProbeTimeout(1000); // timeout 1s

 

        System.out.println("Probe:" + client.getAddress());

        List<EndpointReference> references = client.probe();

 

        System.out.println("Nb answsers:" + references.size());

        for (EndpointReference ref : references)

        {

            System.out.println(ref.toString());

        }

    }

}

 

Probe is :soap.udp://239.255.255.250:3702

Nb answsers:1

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><EndpointReference xmlns="http://www.w3.org/2005/08/addressing"><Address>http://192.168.31.144:10080/onvif/device_service</Address><ReferenceParameters/></EndpointReference>

 

1.4. 参考资料

Onvif协议及其在Android下的实现 - 青草 绿叶 百合 - 博客频道 - CSDN.NET.html

android ONVIF 组播探测在线摄像机 - 天赐良恩 - 博客园.html

 

Android Wifi获取组播 - 云上 - 博客频道 - CSDN.NET.html

android ONVIF 组播探测在线摄像机 - 天赐良恩 - 博客园.html

ONVIF 组播探测在线摄像机 - zhangkunbin的专栏 - 博客频道 - CSDN.NET.html

ONVIF客户端搜索设备获取rtsp地址开发笔记(精华篇) - 推酷.html

使用 CXF webservice 简单例子 - 烽火编程 - 博客园.html

 

 

作者:: 绰号:老哇的爪子claw of Eagle 偶像破坏者Iconoclast image-smasher

捕鸟"Bird Catcher 王中之王King of Kings 虔诚者Pious 宗教信仰捍卫者 Defender of the Faith. 卡拉卡拉红斗篷 Caracalla red cloak

简称: Emir Attilax Akbar 埃米尔 阿提拉克斯 阿克巴

全名:Emir Attilax Akbar bin Mahmud bin  attila bin Solomon Al Rapanui 

埃米尔 阿提拉克斯 阿克巴  马哈茂德  阿提拉 所罗门  阿尔 拉帕努伊   

常用名艾提拉(艾龙)   EMAIL:1466519819@qq.com

头衔:uke总部o2o负责人,全球网格化项目创始人,uke宗教与文化融合事务部部长,Uke部落首席大酋长,uke制度与重大会议委员会委员长,uke保安部首席大队长,uke制度检查委员会副会长,奶牛科技cto uke波利尼西亚区大区连锁负责人,克尔格伦群岛连锁负责人,莱恩群岛连锁负责人,uke汤加王国区域负责人。布维岛和南乔治亚和南桑威奇群岛大区连锁负责人

 

转载请注明来源:attilax的专栏   http://blog.csdn.net/attilax

--Atiend

 

 

posted @ 2016-12-14 23:13  attilaxAti  阅读(53)  评论(0编辑  收藏  举报