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

     1  package api
     2  
     3  import (
     4  	"github.com/enbility/spine-go/model"
     5  )
     6  
     7  //go:generate mockery
     8  
     9  type EventHandlerInterface interface {
    10  	HandleEvent(EventPayload)
    11  }
    12  
    13  /* Binding Manager */
    14  
    15  // implemented by BindingManagerImpl
    16  type BindingManagerInterface interface {
    17  	AddBinding(remoteDevice DeviceRemoteInterface, data model.BindingManagementRequestCallType) error
    18  	RemoveBinding(data model.BindingManagementDeleteCallType, remoteDevice DeviceRemoteInterface) error
    19  	RemoveBindingsForDevice(remoteDevice DeviceRemoteInterface)
    20  	RemoveBindingsForEntity(remoteEntity EntityRemoteInterface)
    21  	Bindings(remoteDevice DeviceRemoteInterface) []*BindingEntry
    22  	BindingsOnFeature(featureAddress model.FeatureAddressType) []*BindingEntry
    23  	HasLocalFeatureRemoteBinding(localAddress, remoteAddress *model.FeatureAddressType) bool
    24  }
    25  
    26  /* Subscription Manager */
    27  
    28  type SubscriptionManagerInterface interface {
    29  	AddSubscription(remoteDevice DeviceRemoteInterface, data model.SubscriptionManagementRequestCallType) error
    30  	RemoveSubscription(data model.SubscriptionManagementDeleteCallType, remoteDevice DeviceRemoteInterface) error
    31  	RemoveSubscriptionsForDevice(remoteDevice DeviceRemoteInterface)
    32  	RemoveSubscriptionsForEntity(remoteEntity EntityRemoteInterface)
    33  	Subscriptions(remoteDevice DeviceRemoteInterface) []*SubscriptionEntry
    34  	SubscriptionsOnFeature(featureAddress model.FeatureAddressType) []*SubscriptionEntry
    35  }
    36  
    37  /* Heartbeats */
    38  
    39  type HeartbeatManagerInterface interface {
    40  	IsHeartbeatRunning() bool
    41  	SetLocalFeature(entity EntityLocalInterface, feature FeatureLocalInterface)
    42  	StartHeartbeat() error
    43  	StopHeartbeat()
    44  }
    45  
    46  type OperationsInterface interface {
    47  	Write() bool
    48  	WritePartial() bool
    49  	Read() bool
    50  	ReadPartial() bool
    51  	String() string
    52  	Information() *model.PossibleOperationsType
    53  }