com.github.chengtengfei:onvif-sample

Implement part of the Onvif Profile-S specification

License

License

GroupId

GroupId

com.github.chengtengfei
ArtifactId

ArtifactId

onvif-sample
Last Version

Last Version

0.0.5
Release Date

Release Date

Type

Type

jar
Description

Description

com.github.chengtengfei:onvif-sample
Implement part of the Onvif Profile-S specification
Project URL

Project URL

https://github.com/chengtengfei/onvif-simple
Source Code Management

Source Code Management

https://github.com/chengtengfei/onvif-simple/tree/master

Download onvif-sample

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.chengtengfei/onvif-sample/ -->
<dependency>
    <groupId>com.github.chengtengfei</groupId>
    <artifactId>onvif-sample</artifactId>
    <version>0.0.5</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.chengtengfei/onvif-sample/
implementation 'com.github.chengtengfei:onvif-sample:0.0.5'
// https://jarcasting.com/artifacts/com.github.chengtengfei/onvif-sample/
implementation ("com.github.chengtengfei:onvif-sample:0.0.5")
'com.github.chengtengfei:onvif-sample:jar:0.0.5'
<dependency org="com.github.chengtengfei" name="onvif-sample" rev="0.0.5">
  <artifact name="onvif-sample" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.chengtengfei', module='onvif-sample', version='0.0.5')
)
libraryDependencies += "com.github.chengtengfei" % "onvif-sample" % "0.0.5"
[com.github.chengtengfei/onvif-sample "0.0.5"]

Dependencies

compile (6)

Group / Artifact Type Version
dom4j : dom4j jar 1.6.1
org.apache.commons : commons-lang3 jar 3.8.1
commons-net : commons-net jar 3.6
commons-codec : commons-codec jar 1.13
com.squareup.okhttp3 : okhttp jar 3.14.0
org.slf4j : slf4j-api jar 1.7.29

Project Modules

There are no modules declared in this project.

English

onvif-simple

实现了部分Onvif Profile S 标准。

Getting Started

这是一个用Java写的maven jar包,你可以方便的在使用maven构建的项目中使用它。

<dependency>
    <groupId>com.github.chengtengfei</groupId>
    <artifactId>onvif-sample</artifactId>
    <version>0.0.4</version>
</dependency>

How to use it

需要引入的包

import com.github.chengtengfei.onvif.discovery.IPCDiscovery;
import com.github.chengtengfei.onvif.discovery.SingleIPCDiscovery;
import com.github.chengtengfei.onvif.model.OnvifDeviceInfo;
import com.github.chengtengfei.onvif.model.ProfileInfo;
import com.github.chengtengfei.onvif.service.OnvifService;

使用你计算机的默认IP自动发现设备(会发现和你计算机IP所在同一局域网的设备)。

try {
    List<OnvifDeviceInfo> onvifDeviceInfoList = IPCDiscovery.discovery();
    System.out.println(onvifDeviceInfoList.toString());
} catch (Exception e) {
    e.printStackTrace();
}

使用指定的IP自动发现设备(适合多网卡计算机,指定其中一个网卡IP来发现同一局域网下的设备)。

try {
    List<OnvifDeviceInfo> onvifDeviceInfoList = IPCDiscovery.discovery("192.168.101.1");
    System.out.println(onvifDeviceInfoList.toString());
} catch (Exception e) {
    e.printStackTrace();
}

获取Onvif服务地址.

try {
    OnvifDeviceInfo onvifDeviceInfo = new OnvifDeviceInfo();
    onvifDeviceInfo.setIp("192.168.101.234");
    onvifDeviceInfo.setUsername("admin");
    onvifDeviceInfo.setPassword("admin");
    SingleIPCDiscovery.fillOnvifAddress(onvifDeviceInfo);
    System.out.println(onvifDeviceInfo);
} catch (Exception e) {
    e.printStackTrace();
}

// Output : OnvifDeviceInfo{ip='192.168.101.234', onvifAddress='http://192.168.101.234:2000/onvif/device_service', username='admin', password='admin'}

获取设备媒体信息。

try {
    OnvifDeviceInfo onvifDeviceInfo = new OnvifDeviceInfo();
    onvifDeviceInfo.setIp("192.168.101.234");
    onvifDeviceInfo.setUsername("admin");
    onvifDeviceInfo.setPassword("admin");
    SingleIPCDiscovery.fillOnvifAddress(onvifDeviceInfo);
    List<ProfileInfo> profileInfoList = OnvifService.getVideoInfo(onvifDeviceInfo);
    System.out.println(profileInfoList);
} catch (Exception e) {
    e.printStackTrace();
}

// Output : [ProfileInfo{name='profile0', token='profile0', videoInfo=VideoInfo{videoEncoding='H264', videoWidth=1920, videoHeight=1080, frameRateLimit=25, bitrateLimit=4096, streamUri='rtsp://admin:[email protected]:554/av0_0'}}, ProfileInfo{name='profile1', token='profile1', videoInfo=VideoInfo{videoEncoding='H264', videoWidth=704, videoHeight=576, frameRateLimit=25, bitrateLimit=1024, streamUri='rtsp://admin:[email protected]:554/av0_1'}}]

Authors

License

This project is licensed under the Apache 2.0 License.

Acknowledgments

Versions

Version
0.0.5
0.0.4
0.0.2