Merge pull request #40 from 0x524a/36-feature-add-more-devicemgmt-operations

docs: enhance README with comprehensive API coverage summary and deta…
This commit is contained in:
ProtoTess
2025-11-30 21:16:01 -05:00
committed by GitHub
+305 -10
View File
@@ -216,6 +216,16 @@ err = client.SetImagingSettings(ctx, videoSourceToken, settings, true)
## API Overview
### API Coverage Summary
The onvif-go library provides comprehensive ONVIF protocol support with **200+ implemented APIs** across all major ONVIF services:
- **Device Management**: 98 APIs (100% complete) ✅
- **Media Service**: 14+ APIs (profiles, streams, encoding) ✅
- **PTZ Service**: 13 APIs (movement, presets, status) ✅
- **Imaging Service**: 7 APIs (brightness, contrast, focus control) ✅
- **Discovery Service**: WS-Discovery network scanning ✅
### Client Creation
```go
@@ -227,25 +237,310 @@ client, err := onvif.NewClient(
)
```
### Device Service
### Device Service (98 APIs) - 100% Complete ✅
The Device Service provides comprehensive device management capabilities with **98 fully implemented APIs**:
#### Core Device Information
| Method | Description |
|--------|-------------|
| `GetDeviceInformation()` | Get manufacturer, model, firmware version |
| `GetCapabilities()` | Get device capabilities and service endpoints |
| `GetSystemDateAndTime()` | Get device system time |
| `GetDeviceInformation()` | Get manufacturer, model, firmware version, serial number, hardware ID |
| `GetCapabilities()` | Get device capabilities and service endpoints (device, media, imaging, PTZ, events, etc.) |
| `GetServices()` | Get list of services with optional capabilities |
| `GetServiceCapabilities()` | Get device service-specific capabilities |
| `GetEndpointReference()` | Get device's WS-Addressing endpoint reference |
| `SystemReboot()` | Reboot the device |
| `Initialize()` | Discover and cache service endpoints |
#### Hostname & Network Discovery
| Method | Description |
|--------|-------------|
| `GetHostname()` | Get device hostname configuration |
| `SetHostname()` | Set device hostname |
| `GetDNS()` | Get DNS configuration |
| `GetNTP()` | Get NTP configuration |
| `GetNetworkInterfaces()` | Get network interface configuration |
| `GetScopes()` | Get configured discovery scopes |
| `GetUsers()` | Get list of user accounts |
| `SetHostnameFromDHCP()` | Enable/disable hostname from DHCP |
| `GetScopes()` | Get configured WS-Discovery scopes |
| `SetScopes()` | Set WS-Discovery scopes |
| `AddScopes()` | Add WS-Discovery scopes |
| `RemoveScopes()` | Remove WS-Discovery scopes |
#### DNS Configuration
| Method | Description |
|--------|-------------|
| `GetDNS()` | Get DNS configuration (DHCP and manual DNS servers) |
| `SetDNS()` | Set DNS configuration (from DHCP, search domains, DNS servers) |
#### NTP Configuration
| Method | Description |
|--------|-------------|
| `GetNTP()` | Get NTP configuration (DHCP and manual NTP servers) |
| `SetNTP()` | Set NTP configuration (from DHCP, NTP servers) |
#### Dynamic DNS
| Method | Description |
|--------|-------------|
| `GetDynamicDNS()` | Get Dynamic DNS configuration |
| `SetDynamicDNS()` | Set Dynamic DNS with type and name |
#### System Date & Time
| Method | Description |
|--------|-------------|
| `GetSystemDateAndTime()` | Get device system date and time (interface{}) |
| `FixedGetSystemDateAndTime()` | Get properly typed system date and time with timezone support |
| `SetSystemDateAndTime()` | Set device system date and time with manual/NTP mode |
#### Network Configuration
| Method | Description |
|--------|-------------|
| `GetNetworkInterfaces()` | Get all network interface configurations |
| `GetNetworkProtocols()` | Get network protocol settings (HTTP, HTTPS, RTSP, RTMP, SSH, etc.) |
| `SetNetworkProtocols()` | Set network protocol settings |
| `GetNetworkDefaultGateway()` | Get default gateway configuration (IPv4 and IPv6) |
| `SetNetworkDefaultGateway()` | Set default gateway configuration |
| `GetZeroConfiguration()` | Get Zero Configuration (zeroconf/Bonjour) status |
| `SetZeroConfiguration()` | Enable/disable Zero Configuration per interface |
#### User Management
| Method | Description |
|--------|-------------|
| `GetUsers()` | Get list of user accounts and credentials |
| `CreateUsers()` | Create new user accounts |
| `DeleteUsers()` | Delete user accounts |
| `SetUser()` | Modify existing user account |
| `DeleteUsers()` | Delete user accounts |
| `GetRemoteUser()` | Get remote user connection status |
| `SetRemoteUser()` | Set remote user connection settings |
#### Security & Access Control
| Method | Description |
|--------|-------------|
| `GetIPAddressFilter()` | Get IP address filter (allow/deny lists) |
| `SetIPAddressFilter()` | Set IP address filtering rules |
| `AddIPAddressFilter()` | Add IP addresses to filter list |
| `RemoveIPAddressFilter()` | Remove IP addresses from filter list |
| `GetPasswordComplexityConfiguration()` | Get password policy settings |
| `SetPasswordComplexityConfiguration()` | Set password policy (length, uppercase, numbers, special chars) |
| `GetPasswordHistoryConfiguration()` | Get password history requirements |
| `SetPasswordHistoryConfiguration()` | Set password history and re-use prevention |
| `GetAuthFailureWarningConfiguration()` | Get failed authentication warning settings |
| `SetAuthFailureWarningConfiguration()` | Set failed authentication thresholds |
#### Discovery Modes
| Method | Description |
|--------|-------------|
| `GetDiscoveryMode()` | Get discovery mode (Discoverable/NonDiscoverable) |
| `SetDiscoveryMode()` | Set discovery mode |
| `GetRemoteDiscoveryMode()` | Get remote discovery mode |
| `SetRemoteDiscoveryMode()` | Set remote discovery mode |
#### Certificate Management
| Method | Description |
|--------|-------------|
| `GetCertificates()` | Get installed certificates |
| `GetCACertificates()` | Get Certificate Authority certificates |
| `LoadCertificates()` | Load/install certificates |
| `LoadCACertificates()` | Load/install CA certificates |
| `CreateCertificate()` | Create self-signed certificate |
| `DeleteCertificates()` | Delete certificates |
| `GetCertificateInformation()` | Get certificate details and validity |
| `GetCertificatesStatus()` | Get certificate usage status |
| `SetCertificatesStatus()` | Set certificate usage (enabled/disabled) |
| `GetPkcs10Request()` | Generate PKCS#10 certificate signing request |
| `LoadCertificateWithPrivateKey()` | Load certificate with private key |
| `GetClientCertificateMode()` | Check if client certificate authentication enabled |
| `SetClientCertificateMode()` | Enable/disable client certificate authentication |
#### WiFi/802.11 Configuration
| Method | Description |
|--------|-------------|
| `GetDot11Capabilities()` | Get WiFi capabilities (cipher suites, auth modes) |
| `GetDot11Status()` | Get WiFi status (SSID, signal strength, link quality) |
| `GetDot1XConfiguration()` | Get 802.1X EAP configuration |
| `GetDot1XConfigurations()` | Get all 802.1X configurations |
| `SetDot1XConfiguration()` | Set 802.1X configuration |
| `CreateDot1XConfiguration()` | Create new 802.1X configuration |
| `DeleteDot1XConfiguration()` | Delete 802.1X configuration |
| `ScanAvailableDot11Networks()` | Scan for available WiFi networks |
#### Storage Configuration
| Method | Description |
|--------|-------------|
| `GetStorageConfigurations()` | Get all storage configurations |
| `GetStorageConfiguration()` | Get specific storage configuration |
| `CreateStorageConfiguration()` | Create new storage configuration |
| `SetStorageConfiguration()` | Update storage configuration |
| `DeleteStorageConfiguration()` | Delete storage configuration |
| `SetHashingAlgorithm()` | Set password hashing algorithm |
#### System Maintenance & Logs
| Method | Description |
|--------|-------------|
| `GetSystemLog()` | Get system logs (boot, security, etc.) |
| `GetSystemBackup()` | Get available system backups |
| `RestoreSystem()` | Restore from backup file |
| `GetSystemUris()` | Get system log and backup URIs |
| `GetSystemSupportInformation()` | Get support information and system details |
| `SetSystemFactoryDefault()` | Reset device to factory defaults |
| `StartFirmwareUpgrade()` | Initiate firmware upgrade |
| `StartSystemRestore()` | Initiate system restore |
#### Relay & Auxiliary I/O
| Method | Description |
|--------|-------------|
| `GetRelayOutputs()` | Get relay outputs and their current state |
| `SetRelayOutputSettings()` | Configure relay output behavior |
| `SetRelayOutputState()` | Set relay output state (active/inactive) |
| `SendAuxiliaryCommand()` | Send auxiliary commands (e.g., IR control) |
#### Additional Features
| Method | Description |
|--------|-------------|
| `GetGeoLocation()` | Get device geographic location |
| `SetGeoLocation()` | Set device geographic location |
| `DeleteGeoLocation()` | Delete geographic location |
| `GetDPAddresses()` | Get WS-Discovery multicast addresses |
| `SetDPAddresses()` | Set WS-Discovery multicast addresses |
| `GetAccessPolicy()` | Get device access policy |
| `SetAccessPolicy()` | Set device access policy |
| `GetWsdlUrl()` | Get device WSDL URL (deprecated) |
## 🔧 Device Management Features
The onvif-go library provides **98 fully-implemented Device Management APIs** for complete device configuration and control. See [DEVICE_API_STATUS.md](DEVICE_API_STATUS.md) for the complete API reference.
### Common Device Management Use Cases
#### Query Device Information
```go
// Get device info (manufacturer, model, firmware)
info, err := client.GetDeviceInformation(ctx)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Camera: %s %s (FW: %s)\n", info.Manufacturer, info.Model, info.FirmwareVersion)
// Get capabilities
caps, err := client.GetCapabilities(ctx)
if err != nil {
log.Fatal(err)
}
```
#### Network Configuration
```go
// Get all network interfaces
interfaces, err := client.GetNetworkInterfaces(ctx)
if err != nil {
log.Fatal(err)
}
// Get DNS and NTP settings
dns, err := client.GetDNS(ctx)
ntp, err := client.GetNTP(ctx)
// Configure DNS
err = client.SetDNS(ctx, false, []string{"example.com"}, []onvif.IPAddress{
{Type: "IPv4", IPv4Address: "8.8.8.8"},
})
// Get/Set hostname
hostname, err := client.GetHostname(ctx)
err = client.SetHostname(ctx, "new-camera-name")
```
#### User & Security Management
```go
// Get users
users, err := client.GetUsers(ctx)
// Create new user
err = client.CreateUsers(ctx, []*onvif.User{
{Username: "operator", Password: "pass123"},
})
// Configure security
err = client.SetPasswordComplexityConfiguration(ctx, &onvif.PasswordComplexityConfiguration{
MinLen: 8,
Uppercase: 1,
Number: 1,
SpecialChars: 1,
})
// IP address filtering
filter := &onvif.IPAddressFilter{
Type: onvif.IPAddressFilterAllow,
}
err = client.SetIPAddressFilter(ctx, filter)
```
#### Certificate Management
```go
// Get installed certificates
certs, err := client.GetCertificates(ctx)
// Create self-signed certificate
cert, err := client.CreateCertificate(ctx,
"cert1",
"CN=camera.example.com",
"2024-01-01T00:00:00Z",
"2025-01-01T00:00:00Z",
)
// Check certificate status
status, err := client.GetCertificatesStatus(ctx)
// Enable client certificate authentication
err = client.SetClientCertificateMode(ctx, true)
```
#### System Maintenance
```go
// Get system logs
log, err := client.GetSystemLog(ctx, onvif.SystemLogTypeBoot)
// Get system backup
backups, err := client.GetSystemBackup(ctx)
// Reboot device
rebootToken, err := client.SystemReboot(ctx)
// Set factory defaults
err = client.SetSystemFactoryDefault(ctx, onvif.FactoryDefaultTypeSoft)
// Firmware upgrade
upgradeToken, err := client.StartFirmwareUpgrade(ctx)
```
#### WiFi Configuration (802.11/802.1X)
```go
// Get WiFi capabilities
caps, err := client.GetDot11Capabilities(ctx)
// Scan available networks
networks, err := client.ScanAvailableDot11Networks(ctx, "interface1")
// Get 802.1X configuration
config, err := client.GetDot1XConfiguration(ctx, "config1")
// Set 802.1X
err = client.SetDot1XConfiguration(ctx, config)
```
#### Relay & I/O Control
```go
// Get relay outputs
relays, err := client.GetRelayOutputs(ctx)
// Control relay state
err = client.SetRelayOutputState(ctx, "relay1", onvif.RelayLogicalStateActive)
err = client.SetRelayOutputState(ctx, "relay1", onvif.RelayLogicalStateInactive)
// Send auxiliary commands (e.g., IR control)
response, err := client.SendAuxiliaryCommand(ctx, "tt:IRLamp|On")
```
### Full API Reference
For complete documentation of all 98 Device Management APIs with detailed descriptions, parameters, and return types, see:
- **[DEVICE_API_STATUS.md](DEVICE_API_STATUS.md)** - Complete API listing with categories and examples
### Media Service