Skip to content

Commit 6211651

Browse files
committed
docs(readme): Bump version to v0.0.5 and modify about GetCapabilities section
1 parent 451b607 commit 6211651

2 files changed

Lines changed: 90 additions & 26 deletions

File tree

‎README.md‎

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
[![License](https://img.shields.io/badge/License-MIT-blue)](https://github.com/nirsimetri/onvif-python?tab=MIT-1-ov-file)
44
[![DeepWiki](https://img.shields.io/badge/DeepWiki-AI%20Wiki-orange)](https://deepwiki.com/nirsimetri/onvif-python)
5-
[![Release](https://img.shields.io/badge/Release-v0.0.4-red?logo=archive)](https://github.com/nirsimetri/onvif-python/releases)
5+
[![Release](https://img.shields.io/badge/Release-v0.0.5-red?logo=archive)](https://github.com/nirsimetri/onvif-python/releases)
66
<br>
7-
[![PyPI](https://img.shields.io/badge/PyPI-0.0.4-yellow?logo=archive)](https://pypi.org/project/onvif-python/)
7+
[![PyPI](https://img.shields.io/badge/PyPI-0.0.5-yellow?logo=archive)](https://pypi.org/project/onvif-python/)
88
[![Downloads](https://img.shields.io/pypi/dm/onvif-python?label=PyPI%20Downloads)](https://clickpy.clickhouse.com/dashboard/onvif-python)
99

1010
Are you having trouble finding a Python ONVIF library that supports your device?
@@ -109,32 +109,64 @@ Explore more advanced usage and service-specific operations in the [`examples/`]
109109
> [!IMPORTANT]
110110
> If you're new to ONVIF and want to learn more, we highly recommend taking the official free online course provided by ONVIF at [Introduction to ONVIF Course](https://www.onvif.org/about/introduction-to-onvif-course). Please note that we are not endorsed or sponsored by ONVIF, see [Legal Notice](#legal-notice) for details.
111111
112-
## Device Verification: Why Use GetCapabilities First?
112+
## Service Discovery: Understanding Device Capabilities
113113

114114
> [!WARNING]
115-
> Before performing any operations on an ONVIF device, it is highly recommended to verify which capabilities and services are available and supported by the device using the `GetCapabilities` method from `devicemgmt()` service instance. This step ensures that your application interacts only with features that the device actually implements, preventing errors and improving compatibility.
115+
> Before performing any operations on an ONVIF device, it is highly recommended to discover which services are available and supported by the device. This library automatically uses `GetServices` during initialization to discover service endpoints, but you can also query services manually for detailed information including capabilities.
116116
117-
**Why verify device capabilities with GetCapabilities?**
117+
**Why discover device services?**
118118

119-
- **Device Diversity:** Not all ONVIF devices support every capability or service. Capabilities may vary by manufacturer, model, firmware, or configuration.
120-
- **Error Prevention:** Attempting to use unsupported features can result in failed requests, exceptions, or undefined behavior.
121-
- **Dynamic Feature Detection:** Devices may enable or disable capabilities over time (e.g., after firmware updates or configuration changes).
122-
- **Optimized Integration:** By checking available capabilities, your application can adapt its workflow and UI to match the device's actual features.
119+
- **Device Diversity:** Not all ONVIF devices support every service. Available services may vary by manufacturer, model, firmware, or configuration.
120+
- **Error Prevention:** Attempting to use unsupported services can result in failed requests, exceptions, or undefined behavior.
121+
- **Dynamic Feature Detection:** Devices may enable or disable services over time (e.g., after firmware updates or configuration changes).
122+
- **Optimized Integration:** By checking available services, your application can adapt its workflow and UI to match the device's actual features.
123123

124-
**How to verify device capabilities:**
124+
**How service discovery works in this library:**
125125

126-
Call `GetCapabilities` on your `devicemgmt()` instance:
126+
The `ONVIFClient` automatically calls `GetServices` during initialization to build a service map. This map is used internally to resolve service endpoints:
127127

128128
```python
129129
from onvif import ONVIFClient
130130

131131
client = ONVIFClient("192.168.1.17", 8000, "admin", "admin123")
132+
133+
# Access the discovered services
134+
print(client.services)
135+
# Example output: [{'Namespace': 'http://www.onvif.org/ver10/device/wsdl', 'XAddr': '...', 'Version': {...}}, ...]
136+
137+
# Check the service map (namespace -> XAddr mapping)
138+
print(client._service_map)
139+
# Example output: {'http://www.onvif.org/ver10/media/wsdl': 'http://192.168.1.17:8000/onvif/Media', ...}
140+
```
141+
142+
**Get detailed service information with capabilities:**
143+
144+
If you need detailed capability information for each service, call `GetServices` with `IncludeCapability=True`:
145+
146+
```python
147+
device = client.devicemgmt()
148+
services = device.GetServices(IncludeCapability=True)
149+
150+
for service in services:
151+
print(f"Service: {service.Namespace}")
152+
print(f"Endpoint: {service.XAddr}")
153+
print(f"Version: {service.Version.Major}.{service.Version.Minor}")
154+
if hasattr(service, 'Capabilities') and service.Capabilities:
155+
print(f"Capabilities: {service.Capabilities}")
156+
```
157+
158+
**Alternative: Use GetCapabilities for legacy compatibility:**
159+
160+
For backward compatibility or when you need a quick overview of major service categories, you can still use `GetCapabilities`:
161+
162+
```python
132163
capabilities = client.devicemgmt().GetCapabilities()
133164
print(capabilities)
134-
# Example output: {'Media': {'XAddr': 'http://192.168.1.17:8000/onvif/media_service', ...}, 'PTZ': {...}, ...}
165+
# Example output: {'Media': {'XAddr': '...', ...}, 'PTZ': {...}, 'Events': {...}, ...}
135166
```
136167

137-
Review the returned dictionary to determine which capabilities and services (e.g., Media, PTZ, Analytics) are available before invoking further operations.
168+
> [!TIP]
169+
> The library handles service discovery automatically, so you typically don't need to call `GetServices` manually unless you need detailed capability information or want to refresh the service list after device configuration changes.
138170
139171
## Tested Devices
140172

‎README_ID.md‎

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
[![Lisensi](https://img.shields.io/badge/License-MIT-blue)](https://github.com/nirsimetri/onvif-python?tab=MIT-1-ov-file)
44
[![DeepWiki](https://img.shields.io/badge/DeepWiki-AI%20Wiki-orange)](https://deepwiki.com/nirsimetri/onvif-python)
5-
[![Rilis](https://img.shields.io/badge/Release-v0.0.4-red?logo=archive)](https://github.com/nirsimetri/onvif-python/releases)
5+
[![Rilis](https://img.shields.io/badge/Release-v0.0.5-red?logo=archive)](https://github.com/nirsimetri/onvif-python/releases)
66
<br>
7-
[![PyPI](https://img.shields.io/badge/PyPI-0.0.4-yellow?logo=archive)](https://pypi.org/project/onvif-python/)
7+
[![PyPI](https://img.shields.io/badge/PyPI-0.0.5-yellow?logo=archive)](https://pypi.org/project/onvif-python/)
88
[![Unduhan](https://img.shields.io/pypi/dm/onvif-python?label=PyPI%20Downloads)](https://clickpy.clickhouse.com/dashboard/onvif-python)
99

1010
Apakah Anda kesulitan menemukan pustaka Python ONVIF yang mendukung perangkat Anda?
@@ -109,32 +109,64 @@ Jelajahi penggunaan lanjutan dan operasi spesifik layanan di folder [`examples/`
109109
> [!IMPORTANT]
110110
> Jika Anda baru mengenal ONVIF dan ingin mempelajari lebih lanjut, kami sangat menyarankan untuk mengikuti kursus online gratis resmi yang disediakan oleh ONVIF di [Kursus Pengantar ONVIF](https://www.onvif.org/about/introduction-to-onvif-course). Harap dicatat bahwa kami tidak didukung atau disponsori oleh ONVIF, lihat [Pemberitahuan Hukum](#legal-notice) untuk detailnya.
111111
112-
## Verifikasi Perangkat: Mengapa Menggunakan GetCapabilities Terlebih Dahulu?
112+
## Penemuan Layanan: Memahami Kapabilitas Perangkat
113113

114114
> [!WARNING]
115-
> Sebelum melakukan operasi apa pun pada perangkat ONVIF, sangat disarankan untuk memverifikasi kemampuan dan layanan apa yang tersedia dan didukung oleh perangkat menggunakan metode `GetCapabilities` dari instance layanan `devicemgmt()`. Langkah ini memastikan bahwa aplikasi Anda hanya berinteraksi dengan fitur yang benar-benar diimplementasikan oleh perangkat, mencegah kesalahan, dan meningkatkan kompatibilitas.
115+
> Sebelum melakukan operasi apa pun pada perangkat ONVIF, sangat disarankan untuk menemukan layanan mana yang tersedia dan didukung oleh perangkat. Pustaka ini secara otomatis menggunakan `GetServices` selama inisialisasi untuk menemukan endpoint layanan, tetapi Anda juga dapat melakukan query layanan secara manual untuk informasi detail termasuk kapabilitas.
116116
117-
**Mengapa memverifikasi kemampuan perangkat dengan GetCapabilities?**
117+
**Mengapa menemukan layanan perangkat?**
118118

119-
- **Keanekaragaman Perangkat:** Tidak semua perangkat ONVIF mendukung setiap kemampuan atau layanan. Kemampuan dapat bervariasi berdasarkan produsen, model, firmware, atau konfigurasi.
120-
- **Pencegahan Kesalahan:** Mencoba menggunakan fitur yang tidak didukung dapat mengakibatkan permintaan gagal, pengecualian, atau perilaku yang tidak terdefinisi.
121-
- **Deteksi Fitur Dinamis:** Perangkat dapat mengaktifkan atau menonaktifkan kemampuan dari waktu ke waktu (misalnya, setelah pembaruan firmware atau perubahan konfigurasi).
122-
- **Integrasi yang Dioptimalkan:** Dengan memeriksa kemampuan yang tersedia, aplikasi Anda dapat menyesuaikan alur kerja dan UI untuk mencocokkan fitur perangkat yang sebenarnya.
119+
- **Keanekaragaman Perangkat:** Tidak semua perangkat ONVIF mendukung setiap layanan. Layanan yang tersedia dapat bervariasi berdasarkan produsen, model, firmware, atau konfigurasi.
120+
- **Pencegahan Kesalahan:** Mencoba menggunakan layanan yang tidak didukung dapat mengakibatkan permintaan gagal, pengecualian, atau perilaku yang tidak terdefinisi.
121+
- **Deteksi Fitur Dinamis:** Perangkat dapat mengaktifkan atau menonaktifkan layanan dari waktu ke waktu (misalnya, setelah pembaruan firmware atau perubahan konfigurasi).
122+
- **Integrasi yang Dioptimalkan:** Dengan memeriksa layanan yang tersedia, aplikasi Anda dapat menyesuaikan alur kerja dan UI untuk mencocokkan fitur perangkat yang sebenarnya.
123123

124-
**Cara memverifikasi kemampuan perangkat:**
124+
**Cara kerja penemuan layanan di pustaka ini:**
125125

126-
Panggil `GetCapabilities` pada instance `devicemgmt()` Anda:
126+
`ONVIFClient` secara otomatis memanggil `GetServices` selama inisialisasi untuk membangun peta layanan. Peta ini digunakan secara internal untuk menyelesaikan endpoint layanan:
127127

128128
```python
129129
from onvif import ONVIFClient
130130

131131
client = ONVIFClient("192.168.1.17", 8000, "admin", "admin123")
132+
133+
# Akses layanan yang ditemukan
134+
print(client.services)
135+
# Contoh: [{'Namespace': 'http://www.onvif.org/ver10/device/wsdl', 'XAddr': '...', 'Version': {...}}, ...]
136+
137+
# Periksa peta layanan (namespace -> pemetaan XAddr)
138+
print(client._service_map)
139+
# Contoh: {'http://www.onvif.org/ver10/media/wsdl': 'http://192.168.1.17:8000/onvif/Media', ...}
140+
```
141+
142+
**Dapatkan informasi layanan detail dengan kapabilitas:**
143+
144+
Jika Anda memerlukan informasi kapabilitas detail untuk setiap layanan, panggil `GetServices` dengan `IncludeCapability=True`:
145+
146+
```python
147+
device = client.devicemgmt()
148+
services = device.GetServices(IncludeCapability=True)
149+
150+
for service in services:
151+
print(f"Layanan: {service.Namespace}")
152+
print(f"Endpoint: {service.XAddr}")
153+
print(f"Versi: {service.Version.Major}.{service.Version.Minor}")
154+
if hasattr(service, 'Capabilities') and service.Capabilities:
155+
print(f"Kapabilitas: {service.Capabilities}")
156+
```
157+
158+
**Alternatif: Gunakan GetCapabilities untuk kompatibilitas legacy:**
159+
160+
Untuk kompatibilitas mundur atau ketika Anda memerlukan gambaran cepat tentang kategori layanan utama, Anda masih dapat menggunakan `GetCapabilities`:
161+
162+
```python
132163
capabilities = client.devicemgmt().GetCapabilities()
133164
print(capabilities)
134-
# Contoh: {'Media': {'XAddr': 'http://192.168.1.17:8000/onvif/media_service', ...}, 'PTZ': {...}, ...}
165+
# Contoh: {'Media': {'XAddr': '...', ...}, 'PTZ': {...}, 'Events': {...}, ...}
135166
```
136167

137-
Tinjau kamus yang dikembalikan untuk menentukan kemampuan dan layanan (misalnya, Media, PTZ, Analitik) yang tersedia sebelum melakukan operasi lebih lanjut.
168+
> [!TIP]
169+
> Pustaka menangani penemuan layanan secara otomatis, jadi Anda biasanya tidak perlu memanggil `GetServices` secara manual kecuali Anda memerlukan informasi kapabilitas detail atau ingin menyegarkan daftar layanan setelah perubahan konfigurasi perangkat.
138170
139171
## Perangkat yang Diuji
140172

0 commit comments

Comments
 (0)