Documentation ¶
Overview ¶
Package axeventwrapper provides a Go wrapper around the axevent C library, facilitating the integration and manipulation of event systems within Axis devices.
Important:
This package relies on CGo for integration with the axevent C library and the GLib library, necessitating a running GMainLoop for proper operation.
Index ¶
- Variables
- func GoDeclarationCompleteCallback(declaration C.guint, user_data unsafe.Pointer)
- func GoSubscriptionCallback(subscription C.guint, event *C.AXEvent, user_data unsafe.Pointer)
- type AXEvent
- type AXEventErrorCode
- type AXEventHandler
- func (eh *AXEventHandler) Declare(keyValueSet *AXEventKeyValueSet, stateless bool, ...) (declaration int, err error)
- func (eh *AXEventHandler) DeclareFromTemplate(template string, keyValueSet *AXEventKeyValueSet, ...) (int, error)
- func (eh *AXEventHandler) Free()
- func (eh *AXEventHandler) OnEvent(kvs *AXEventKeyValueSet, callback func(*Event)) (subscription int, err error)
- func (ev *AXEventHandler) SendEvent(declaration int, evt *AXEvent) error
- func (eh *AXEventHandler) Subscribe(kvs *AXEventKeyValueSet, callback SubscriptionCallback, userdata any) (subscription int, err error)
- func (evt *AXEventHandler) Undeclare(declaration int) error
- func (eh *AXEventHandler) Unsubscribe(subscription int) error
- type AXEventKeyValueSet
- func AutofocusEventKvs(videoSourceConfigurationToken *int) (*AXEventKeyValueSet, error)
- func CameraApplicationPlatformVmdCamera1ProfileANYEventKvs(active *bool) (*AXEventKeyValueSet, error)
- func DayNightEventKvs(videoSourceConfigurationToken *int, day *bool) (*AXEventKeyValueSet, error)
- func DigitalInputEventKvs(inputToken *int, logicalState *bool) (*AXEventKeyValueSet, error)
- func GlobalSceneChangeEventKvs(source *string, state *bool) (*AXEventKeyValueSet, error)
- func HeaterStatusEventKvs(heater *int, running *bool) (*AXEventKeyValueSet, error)
- func LiveStreamAccessedEventKvs() (*AXEventKeyValueSet, error)
- func MotionAlarmEventKvs(source *string, state *bool) (*AXEventKeyValueSet, error)
- func NewAXEventKeyValueSet() *AXEventKeyValueSet
- func NewAXEventKeyValueSetFromEntries(entries []KeyValueEntrie) *AXEventKeyValueSet
- func NewTns1AxisEvent(topic0 string, topic1 string, topic2 *string, topic3 *string, ...) (*AXEventKeyValueSet, error)
- func NewTnsAxisEvent(topic0 string, topic1 string, topic2 *string, topic3 *string, ...) (*AXEventKeyValueSet, error)
- func StorageAlertEventKvs(wear *int, overall_health *int, temperature *int, alert *bool) (*AXEventKeyValueSet, error)
- func StorageDisruptionEventKvs(disk_id *string, disruption *bool) (*AXEventKeyValueSet, error)
- func StorageFailureEventKvs(disk_id *string, disruption *bool) (*AXEventKeyValueSet, error)
- func StorageRecordingEventKvs(recording *bool) (*AXEventKeyValueSet, error)
- func SupervisedPortEventKvs(port *int, tampered *bool) (*AXEventKeyValueSet, error)
- func SystemReadyStatusEventKvs(ready *bool) (*AXEventKeyValueSet, error)
- func TamperingEventKvs(channel *int, tampering *int) (*AXEventKeyValueSet, error)
- func TriggerRelayEventKvs(relayToken *int, logicalState *string) (*AXEventKeyValueSet, error)
- func VirtualInputEventKvs(port *int, active *bool) (*AXEventKeyValueSet, error)
- func (axEventKeyValueSet *AXEventKeyValueSet) AddKeyValue(key string, namespace *string, value interface{}, value_type AXEventValueType) error
- func (axEventKeyValueSet *AXEventKeyValueSet) AddNiceNames(key string, namespace *string, keyNiceName *string, valueNiceName *string) error
- func (axEventKeyValueSet *AXEventKeyValueSet) Free()
- func (axEventKeyValueSet *AXEventKeyValueSet) GetBoolean(key string, namespace *string) (bool, error)
- func (axEventKeyValueSet *AXEventKeyValueSet) GetDouble(key string, namespace *string) (float64, error)
- func (axEventKeyValueSet *AXEventKeyValueSet) GetInteger(key string, namespace *string) (int, error)
- func (axEventKeyValueSet *AXEventKeyValueSet) GetString(key string, namespace *string) (string, error)
- func (axEventKeyValueSet *AXEventKeyValueSet) GetValueType(key string, namespace *string) (AXEventValueType, error)
- func (axEventKeyValueSet *AXEventKeyValueSet) MarkAsData(key string, namespace *string) error
- func (axEventKeyValueSet *AXEventKeyValueSet) MarkAsSource(key string, namespace *string) error
- func (axEventKeyValueSet *AXEventKeyValueSet) MarkAsUserDefined(key string, namespace *string, userTag *string) error
- func (axEventKeyValueSet *AXEventKeyValueSet) RemoveKey(key string, namespace *string) error
- type AXEventValueType
- type AutofocusEvent
- type AxEventKeyValueSetDataMark
- type AxEventKeyValueSetNiceNames
- type AxEventKeyValueSetSourceMark
- type AxEventKeyValueSetUserDefineMark
- type CameraApplicationPlatformVmdCamera1ProfileANYEvent
- type DayNightEvent
- type DeclarationCompleteCallback
- type DigitalInputEvent
- type Event
- type EventError
- type GlobalSceneChangeEvent
- type HeaterStatusEvent
- type KeyValueEntrie
- type LiveStreamAccessedEvent
- type MotionAlarmEvent
- type StorageAlertEvent
- type StorageDisruptionEvent
- type StorageFailureEvent
- type StorageRecordingEvent
- type Subcription
- type SubscriptionCallback
- type SupervisedPortEvent
- type SystemReadyStatusEvent
- type TamperingEvent
- type TriggerRelayEvent
- type VirtualInputEvent
Constants ¶
This section is empty.
Variables ¶
var ( OnfivNameSpaceTns1 string = "tns1" OnfivNameSpaceTnsAxis string = "tnsaxis" OnfivTagOnKeyValue string = "tag-on-key-value" )
Functions ¶
Types ¶
type AXEvent ¶
func NewAxEvent ¶
func NewAxEvent(axEventKeyValueSet *AXEventKeyValueSet, datetime *time.Time) *AXEvent
Creates a new AXEvent.
func (*AXEvent) GetKeyValueSet ¶
func (axEvent *AXEvent) GetKeyValueSet() *AXEventKeyValueSet
Get the AXEventKeyValueSet associated with the AXEvent.
func (*AXEvent) GetTimestamp ¶
Get the AXEventKeyValueSet associated with the AXEvent.
type AXEventErrorCode ¶
type AXEventErrorCode int
const ( AXEventErrorGeneric AXEventErrorCode = AXEventErrorCode(C.AX_EVENT_ERROR_GENERIC) AXEventErrorInvalidArgument AXEventErrorCode = AXEventErrorCode(C.AX_EVENT_ERROR_INVALID_ARGUMENT) AXEventErrorIncompatibleValue AXEventErrorCode = AXEventErrorCode(C.AX_EVENT_ERROR_INCOMPATIBLE_VALUE) AXEventErrorDeclaration AXEventErrorCode = AXEventErrorCode(C.AX_EVENT_ERROR_DECLARATION) AXEventErrorUndeclare AXEventErrorCode = AXEventErrorCode(C.AX_EVENT_ERROR_UNDECLARE) AXEventErrorSend AXEventErrorCode = AXEventErrorCode(C.AX_EVENT_ERROR_SEND) AXEventErrorSubscription AXEventErrorCode = AXEventErrorCode(C.AX_EVENT_ERROR_SUBSCRIPTION) AXEventErrorUnsubscribe AXEventErrorCode = AXEventErrorCode(C.AX_EVENT_ERROR_UNSUBSCRIBE) AXEventErrorKeyNotFound AXEventErrorCode = AXEventErrorCode(C.AX_EVENT_ERROR_KEY_NOT_FOUND) AXEventErrorEnd AXEventErrorCode = AXEventErrorCode(C.AX_EVENT_ERROR_END) )
func (AXEventErrorCode) ErrorName ¶
func (code AXEventErrorCode) ErrorName() string
ErrorName returns the string representation of the AxOverlayErrorCode.
type AXEventHandler ¶
type AXEventHandler struct { Ptr *C.AXEventHandler // contains filtered or unexported fields }
func (*AXEventHandler) Declare ¶
func (eh *AXEventHandler) Declare(keyValueSet *AXEventKeyValueSet, stateless bool, callback DeclarationCompleteCallback, userdata any) (declaration int, err error)
Declares a new event.
func (*AXEventHandler) DeclareFromTemplate ¶
func (eh *AXEventHandler) DeclareFromTemplate(template string, keyValueSet *AXEventKeyValueSet, callback DeclarationCompleteCallback, userdata any) (int, error)
Declares a new event based upon an event template
func (*AXEventHandler) Free ¶
func (eh *AXEventHandler) Free()
Destroys an AXEventHandler an deallocates all associated declarations and subscriptions. Any pending callbacks associated with the AXEventHandler will be cancelled.
func (*AXEventHandler) OnEvent ¶
func (eh *AXEventHandler) OnEvent(kvs *AXEventKeyValueSet, callback func(*Event)) (subscription int, err error)
OnEvent creates a subscription callback for the given event key value set.
func (*AXEventHandler) SendEvent ¶
func (ev *AXEventHandler) SendEvent(declaration int, evt *AXEvent) error
Sends an event.
func (*AXEventHandler) Subscribe ¶
func (eh *AXEventHandler) Subscribe(kvs *AXEventKeyValueSet, callback SubscriptionCallback, userdata any) (subscription int, err error)
Subscribes to an event or a set of events.
func (*AXEventHandler) Undeclare ¶
func (evt *AXEventHandler) Undeclare(declaration int) error
Undeclares an event. Any pending callbacks associated with the declaration will be cancelled.
func (*AXEventHandler) Unsubscribe ¶
func (eh *AXEventHandler) Unsubscribe(subscription int) error
Unsubscribes from an event or a set of events.
type AXEventKeyValueSet ¶
type AXEventKeyValueSet struct {
Ptr *C.AXEventKeyValueSet
}
func AutofocusEventKvs ¶
func AutofocusEventKvs(videoSourceConfigurationToken *int) (*AXEventKeyValueSet, error)
func CameraApplicationPlatformVmdCamera1ProfileANYEventKvs ¶
func CameraApplicationPlatformVmdCamera1ProfileANYEventKvs(active *bool) (*AXEventKeyValueSet, error)
func DayNightEventKvs ¶
func DayNightEventKvs(videoSourceConfigurationToken *int, day *bool) (*AXEventKeyValueSet, error)
func DigitalInputEventKvs ¶
func DigitalInputEventKvs(inputToken *int, logicalState *bool) (*AXEventKeyValueSet, error)
func GlobalSceneChangeEventKvs ¶
func GlobalSceneChangeEventKvs(source *string, state *bool) (*AXEventKeyValueSet, error)
func HeaterStatusEventKvs ¶
func HeaterStatusEventKvs(heater *int, running *bool) (*AXEventKeyValueSet, error)
func LiveStreamAccessedEventKvs ¶
func LiveStreamAccessedEventKvs() (*AXEventKeyValueSet, error)
func MotionAlarmEventKvs ¶
func MotionAlarmEventKvs(source *string, state *bool) (*AXEventKeyValueSet, error)
func NewAXEventKeyValueSet ¶
func NewAXEventKeyValueSet() *AXEventKeyValueSet
Creates a new AXEventKeyValueSet
func NewAXEventKeyValueSetFromEntries ¶
func NewAXEventKeyValueSetFromEntries(entries []KeyValueEntrie) *AXEventKeyValueSet
Creates a new AXEventKeyValueSet from a list of KeyValueEntries
func NewTns1AxisEvent ¶
func NewTns1AxisEvent(topic0 string, topic1 string, topic2 *string, topic3 *string, keyvalues []*KeyValueEntrie) (*AXEventKeyValueSet, error)
NewTns1AxisEvent creates a new AXEventKeyValueSet with the given topics and key-value pairs.
func NewTnsAxisEvent ¶
func NewTnsAxisEvent(topic0 string, topic1 string, topic2 *string, topic3 *string, keyvalues []*KeyValueEntrie) (*AXEventKeyValueSet, error)
TnsAxisEvent creates a new AXEventKeyValueSet with the given topics and key-value pairs.
func StorageAlertEventKvs ¶
func StorageDisruptionEventKvs ¶
func StorageDisruptionEventKvs(disk_id *string, disruption *bool) (*AXEventKeyValueSet, error)
func StorageFailureEventKvs ¶
func StorageFailureEventKvs(disk_id *string, disruption *bool) (*AXEventKeyValueSet, error)
func StorageRecordingEventKvs ¶
func StorageRecordingEventKvs(recording *bool) (*AXEventKeyValueSet, error)
func SupervisedPortEventKvs ¶
func SupervisedPortEventKvs(port *int, tampered *bool) (*AXEventKeyValueSet, error)
func SystemReadyStatusEventKvs ¶
func SystemReadyStatusEventKvs(ready *bool) (*AXEventKeyValueSet, error)
func TamperingEventKvs ¶
func TamperingEventKvs(channel *int, tampering *int) (*AXEventKeyValueSet, error)
func TriggerRelayEventKvs ¶
func TriggerRelayEventKvs(relayToken *int, logicalState *string) (*AXEventKeyValueSet, error)
func VirtualInputEventKvs ¶
func VirtualInputEventKvs(port *int, active *bool) (*AXEventKeyValueSet, error)
func (*AXEventKeyValueSet) AddKeyValue ¶
func (axEventKeyValueSet *AXEventKeyValueSet) AddKeyValue(key string, namespace *string, value interface{}, value_type AXEventValueType) error
Adds an key value to the event set
func (*AXEventKeyValueSet) AddNiceNames ¶
func (axEventKeyValueSet *AXEventKeyValueSet) AddNiceNames(key string, namespace *string, keyNiceName *string, valueNiceName *string) error
AddNiceNames sets human-readable names for a key/value pair in an AXEventKeyValueSet.
func (*AXEventKeyValueSet) Free ¶
func (axEventKeyValueSet *AXEventKeyValueSet) Free()
Frees an AXEventKeyValueSet.
func (*AXEventKeyValueSet) GetBoolean ¶
func (axEventKeyValueSet *AXEventKeyValueSet) GetBoolean(key string, namespace *string) (bool, error)
Retrieve the boolean value associated with a key.
func (*AXEventKeyValueSet) GetDouble ¶
func (axEventKeyValueSet *AXEventKeyValueSet) GetDouble(key string, namespace *string) (float64, error)
Retrieve the double value associated with a key.
func (*AXEventKeyValueSet) GetInteger ¶
func (axEventKeyValueSet *AXEventKeyValueSet) GetInteger(key string, namespace *string) (int, error)
Retrieve the integer value associated with a key.
func (*AXEventKeyValueSet) GetString ¶
func (axEventKeyValueSet *AXEventKeyValueSet) GetString(key string, namespace *string) (string, error)
Retrieve the value type of the value associated with a key.
func (*AXEventKeyValueSet) GetValueType ¶
func (axEventKeyValueSet *AXEventKeyValueSet) GetValueType(key string, namespace *string) (AXEventValueType, error)
Retrieve the value type of the value associated with a key.
func (*AXEventKeyValueSet) MarkAsData ¶
func (axEventKeyValueSet *AXEventKeyValueSet) MarkAsData(key string, namespace *string) error
Mark a key in the AXEventKeyValueSet as data. A data key is a key that represents the state of what the event represents. E.g. an event declaration that represents an I/O port should have a key marked as data which represents the state, high or low, of the port. Please note that although it is possible to mark more than one key as data, only events with one and only one data key can be used to trigger actions.
func (*AXEventKeyValueSet) MarkAsSource ¶
func (axEventKeyValueSet *AXEventKeyValueSet) MarkAsSource(key string, namespace *string) error
Mark a key in the AXEventKeyValueSet as a source. A source key is an identifier used to distinguish between multiple instances of the same event declaration. E.g. if a device has multiple I/O ports then event declarations that represent the state of each port will have the same keys but different values. The key that represents which port the event represents should be marked as source and the key which represents the state should be marked as data. Please note that although it is possible to mark more than one key as a source, only events with zero or one source keys can be used to trigger actions.
func (*AXEventKeyValueSet) MarkAsUserDefined ¶
func (axEventKeyValueSet *AXEventKeyValueSet) MarkAsUserDefined(key string, namespace *string, userTag *string) error
Mark a key in AXEventKeyValueSet with an user defined tag.
type AXEventValueType ¶
type AXEventValueType int
const ( AXValueTypeInt AXEventValueType = AXEventValueType(C.AX_VALUE_TYPE_INT) AXValueTypeBool AXEventValueType = AXEventValueType(C.AX_VALUE_TYPE_BOOL) AXValueTypeDouble AXEventValueType = AXEventValueType(C.AX_VALUE_TYPE_DOUBLE) AXValueTypeString AXEventValueType = AXEventValueType(C.AX_VALUE_TYPE_STRING) AXValueTypeElement AXEventValueType = AXEventValueType(C.AX_VALUE_TYPE_ELEMENT) )
type AutofocusEvent ¶
type AxEventKeyValueSetDataMark ¶
Mark a key in the AXEventKeyValueSet as data. A data key is a key that represents the state of what the event represents. E.g. an event declaration that represents an I/O port should have a key marked as data which represents the state, high or low, of the port. Please note that although it is possible to mark more than one key as data, only events with one and only one data key can be used to trigger actions.
type AxEventKeyValueSetNiceNames ¶
type AxEventKeyValueSetNiceNames struct { Key string Namespace *string KeyNiceName *string ValueNiceName *string }
Set the nice names of a key/value pair in the AXEventKeyValueSet. Nice names can be used to display human-readable information about the key/value pair.
type AxEventKeyValueSetSourceMark ¶
Mark a key in the AXEventKeyValueSet as a source. A source key is an identifier used to distinguish between multiple instances of the same event declaration. E.g. if a device has multiple I/O ports then event declarations that represent the state of each port will have the same keys but different values. The key that represents which port the event represents should be marked as source and the key which represents the state should be marked as data. Please note that although it is possible to mark more than one key as a source, only events with zero or one source keys can be used to trigger actions.
type AxEventKeyValueSetUserDefineMark ¶
Mark a key in AXEventKeyValueSet with an user defined tag.
type CameraApplicationPlatformVmdCamera1ProfileANYEvent ¶
type CameraApplicationPlatformVmdCamera1ProfileANYEvent struct {
Active bool `eventKey:"active"`
}
type DayNightEvent ¶
type DeclarationCompleteCallback ¶
This is the prototype of the callback function called when a declaration has registered with the event system. https://axiscommunications.github.io/acap-documentation/docs/acap-sdk-version-3/api/src/api/axevent/html/ax__event__handler_8h.html#a16d563cbc9c8974b72f296f8dfbdff3a
type DigitalInputEvent ¶
type Event ¶
type Event struct { Kvs *AXEventKeyValueSet Timestamp time.Time }
type EventError ¶
type EventError struct { Ptr *C.GError Code AXEventErrorCode Message string Expected bool }
func (*EventError) Error ¶
func (e *EventError) Error() string
type GlobalSceneChangeEvent ¶
type HeaterStatusEvent ¶
type KeyValueEntrie ¶
type KeyValueEntrie struct { Key string Namespace *string Value interface{} ValueType AXEventValueType }
KeyValueEntrie is a key-value pair for an AXEventKeyValueSet.
type LiveStreamAccessedEvent ¶
type LiveStreamAccessedEvent struct {
Accessed bool `eventKey:"accessed"`
}
type MotionAlarmEvent ¶
type StorageAlertEvent ¶
type StorageDisruptionEvent ¶
type StorageFailureEvent ¶
type StorageRecordingEvent ¶
type StorageRecordingEvent struct {
Recording bool `eventKey:"recording"`
}
type Subcription ¶
type Subcription uint
type SubscriptionCallback ¶
This is the prototype of the callback function called whenever an event matching a subscription is received. https://axiscommunications.github.io/acap-documentation/docs/acap-sdk-version-3/api/src/api/axevent/html/ax__event__handler_8h.html#ad1bb63bc12366aefb50139ea6a8b3904
type SupervisedPortEvent ¶
type SystemReadyStatusEvent ¶
type SystemReadyStatusEvent struct {
Ready int `eventKey:"ready"`
}