ONVIF is an open industry forum that provides and promotes standardized interfaces for effective interoperability of IP-based physical security products. ONVIF was created to make a standard way of how IP products within CCTV and other security areas can communicate with each other.
All the Kotlin functions provided are RxJava3 Single/Completable functions.
For a simple synchronous example you can use .blockingGet() / .blockingAwait().
Straight forward solution:
val devices: List<Device> = discoverDevices().blockingGet()If you need to create and customize a a one-shot DiscoveryManager:
val devices = discoverDevices {
discoveryTimeout = 10000
}.blockingGet()If using a custom DiscoveryManager:
val myDM = DiscoveryManager().apply { discoveryTimeout = 10000 }
val devices = awaitDeviceDiscovery { myDM.discover(it) }.blockingGet()Once you obtained the device host and you know username and password, create the OnvifDevice and get its data async using:
val om = OnvifManager()
val device = OnvifDevice(host, user, pswd)
val info = device.getInformation(om).blockingGet()
val profiles = device.getMediaProfiles(om).blockingGet()
val streamUri = device.getMediaStreamUri(profiles.first(), om).blockingGet()
val snapshotUri = device.getMediaSnapshotUri(profiles.first(), om).blockingGet()Or even more easy:
val device = OnvifDevice(host, user, pswd)
val info = device.getInformation().blockingGet()
val mediaProfiles = device.getMediaProfiles().blockingGet()
val aStreamUri = device.getMediaStreamUri(mediaProfiles.first()).blockingGet()
val aSnapshotUri = device.getMediaSnapshotUri(mediaProfiles.first()).blockingGet()