github.com/enbility/spine-go@v0.7.0/api/events.go (about)

     1  package api
     2  
     3  import "github.com/enbility/spine-go/model"
     4  
     5  type EventHandlerLevel uint
     6  
     7  const (
     8  	EventHandlerLevelCore        EventHandlerLevel = iota // Shall only be used by the core stack
     9  	EventHandlerLevelApplication                          // Shall only be used by applications
    10  )
    11  
    12  type ElementChangeType uint16
    13  
    14  const (
    15  	ElementChangeAdd ElementChangeType = iota
    16  	ElementChangeUpdate
    17  	ElementChangeRemove
    18  )
    19  
    20  type EventType uint16
    21  
    22  const (
    23  	EventTypeDeviceChange       EventType = iota // Sent after successful response of NodeManagementDetailedDiscovery
    24  	EventTypeEntityChange                        // Sent after successful response of NodeManagementDetailedDiscovery
    25  	EventTypeSubscriptionChange                  // Sent after successful subscription request from remote
    26  	EventTypeBindingChange                       // Sent after successful binding request from remote
    27  	EventTypeDataChange                          // Sent after remote provided new data items for a function
    28  )
    29  
    30  type EventPayload struct {
    31  	Ski           string                // required
    32  	EventType     EventType             // required
    33  	ChangeType    ElementChangeType     // required
    34  	Device        DeviceRemoteInterface // required for DetailedDiscovery Call
    35  	Entity        EntityRemoteInterface // required for DetailedDiscovery Call and Notify
    36  	Feature       FeatureRemoteInterface
    37  	LocalFeature  FeatureLocalInterface    // required for write commands
    38  	Function      model.FunctionType       // required for write commands
    39  	CmdClassifier *model.CmdClassifierType // optional, used together with EventType EventTypeDataChange
    40  	Data          any
    41  }