feat: add missing Device IO operations and fix formatting

- Add GetVideoOutputConfiguration operation
- Add GetVideoOutputConfigurationOptions operation
- Add SetVideoOutputConfiguration operation
- Add GetRelayOutputOptions operation
- Add comprehensive tests for new operations
- Add CLI support for new Device IO operations
- Fix gofmt formatting issues in all files
This commit is contained in:
0x524a
2025-12-03 01:03:11 -05:00
parent 89851baa1f
commit df3cdfb5ab
4 changed files with 42 additions and 45 deletions
+18 -18
View File
@@ -144,16 +144,16 @@ type DigitalInputConfigurationOptions struct {
// VideoOutputConfiguration represents a video output configuration.
type VideoOutputConfiguration struct {
Token string
Name string
UseCount int
OutputToken string
Token string
Name string
UseCount int
OutputToken string
ForcePersistence bool
}
// VideoOutputConfigurationOptions represents video output configuration options.
type VideoOutputConfigurationOptions struct {
Name StringRange
Name StringRange
OutputTokensAvailable []string
}
@@ -165,10 +165,10 @@ type StringRange struct {
// RelayOutputOptions represents relay output configuration options.
type RelayOutputOptions struct {
Token string
Mode []RelayMode
DelayTimes []string
Discrete bool
Token string
Mode []RelayMode
DelayTimes []string
Discrete bool
}
// getDeviceIOEndpoint returns the device IO endpoint.
@@ -818,18 +818,18 @@ func (c *Client) SetVideoOutputConfiguration(ctx context.Context, config *VideoO
endpoint := c.getDeviceIOEndpoint()
type VideoOutputConfigurationXML struct {
Token string `xml:"token,attr"`
Name string `xml:"tt:Name"`
UseCount int `xml:"tt:UseCount"`
OutputToken string `xml:"tt:OutputToken"`
Token string `xml:"token,attr"`
Name string `xml:"tt:Name"`
UseCount int `xml:"tt:UseCount"`
OutputToken string `xml:"tt:OutputToken"`
}
type SetVideoOutputConfiguration struct {
XMLName xml.Name `xml:"tmd:SetVideoOutputConfiguration"`
Xmlns string `xml:"xmlns:tmd,attr"`
XmlnsTT string `xml:"xmlns:tt,attr"`
Configuration VideoOutputConfigurationXML `xml:"tmd:Configuration"`
ForcePersistence bool `xml:"tmd:ForcePersistence"`
XMLName xml.Name `xml:"tmd:SetVideoOutputConfiguration"`
Xmlns string `xml:"xmlns:tmd,attr"`
XmlnsTT string `xml:"xmlns:tt,attr"`
Configuration VideoOutputConfigurationXML `xml:"tmd:Configuration"`
ForcePersistence bool `xml:"tmd:ForcePersistence"`
}
type SetVideoOutputConfigurationResponse struct {
+24 -25
View File
@@ -86,27 +86,27 @@ type Topic struct {
// EventBrokerConfig represents an event broker configuration.
type EventBrokerConfig struct {
Address string
TopicPrefix string
UserName string
Password string
CertificateID string
PublishFilter string
QoS int
Status string
Address string
TopicPrefix string
UserName string
Password string
CertificateID string
PublishFilter string
QoS int
Status string
CertPathValidation bool
MetadataFilter string
MetadataFilter string
}
// EventProperties represents the event properties of the device.
type EventProperties struct {
TopicNamespaceLocation []string
FixedTopicSet bool
TopicSet TopicSet
TopicExpressionDialects []string
MessageContentFilterDialects []string
TopicNamespaceLocation []string
FixedTopicSet bool
TopicSet TopicSet
TopicExpressionDialects []string
MessageContentFilterDialects []string
ProducerPropertiesFilterDialects []string
MessageContentSchemaLocation []string
MessageContentSchemaLocation []string
}
// getEventEndpoint returns the event endpoint, falling back to the default endpoint if not set.
@@ -540,13 +540,13 @@ func (c *Client) GetEventProperties(ctx context.Context) (*EventProperties, erro
}
type GetEventPropertiesResponse struct {
XMLName xml.Name `xml:"GetEventPropertiesResponse"`
TopicNamespaceLocation []string `xml:"TopicNamespaceLocation"`
FixedTopicSet bool `xml:"FixedTopicSet"`
TopicExpressionDialect []string `xml:"TopicExpressionDialect"`
MessageContentFilterDialect []string `xml:"MessageContentFilterDialect"`
ProducerPropertiesFilterDialect []string `xml:"ProducerPropertiesFilterDialect"`
MessageContentSchemaLocation []string `xml:"MessageContentSchemaLocation"`
XMLName xml.Name `xml:"GetEventPropertiesResponse"`
TopicNamespaceLocation []string `xml:"TopicNamespaceLocation"`
FixedTopicSet bool `xml:"FixedTopicSet"`
TopicExpressionDialect []string `xml:"TopicExpressionDialect"`
MessageContentFilterDialect []string `xml:"MessageContentFilterDialect"`
ProducerPropertiesFilterDialect []string `xml:"ProducerPropertiesFilterDialect"`
MessageContentSchemaLocation []string `xml:"MessageContentSchemaLocation"`
}
req := GetEventProperties{
@@ -599,8 +599,8 @@ func (c *Client) AddEventBroker(ctx context.Context, config *EventBrokerConfig)
}
type AddEventBroker struct {
XMLName xml.Name `xml:"tev:AddEventBroker"`
Xmlns string `xml:"xmlns:tev,attr"`
XMLName xml.Name `xml:"tev:AddEventBroker"`
Xmlns string `xml:"xmlns:tev,attr"`
EventBrokerConfig EventBrokerConfigXML `xml:"tev:EventBrokerConfig"`
}
@@ -776,4 +776,3 @@ func splitSpaceSeparated(s string) []string {
return result
}
-1
View File
@@ -736,4 +736,3 @@ func TestSetEventEndpoint(t *testing.T) {
t.Errorf("Expected event endpoint %s, got %s", newEndpoint, endpoint)
}
}
-1
View File
@@ -233,4 +233,3 @@ func testDeviceIOService(ctx context.Context, client *onvif.Client) {
}
}
}