github.com/enbility/spine-go@v0.7.0/api/entity.go (about) 1 package api 2 3 import "github.com/enbility/spine-go/model" 4 5 /* Entity */ 6 7 // This interface defines the functions being common to local and remote entites 8 // An entity corresponds to a SPINE entity, see SPINE Introduction Chapter 2.2 9 type EntityInterface interface { 10 // Get the entity address 11 Address() *model.EntityAddressType 12 // Get the entity type 13 EntityType() model.EntityTypeType 14 // Get the entity description 15 Description() *model.DescriptionType 16 // Set the entity description 17 SetDescription(d *model.DescriptionType) 18 // Get the next incremental feature id 19 NextFeatureId() uint 20 } 21 22 // This interface defines all the required functions need to implement a local entity 23 type EntityLocalInterface interface { 24 EntityInterface 25 // Get the associated DeviceLocalInterface implementation 26 Device() DeviceLocalInterface 27 28 // Get the hearbeat manager for this entity 29 HeartbeatManager() HeartbeatManagerInterface 30 31 // Add a new feature with a given FeatureLocalInterface implementation 32 AddFeature(f FeatureLocalInterface) 33 // Get a FeatureLocalInterface implementation for a given feature type and role or create it if it does not exist yet and return it 34 GetOrAddFeature(featureType model.FeatureTypeType, role model.RoleType) FeatureLocalInterface 35 // Get a FeatureLocalInterface implementation for a given feature type and role 36 FeatureOfTypeAndRole(featureType model.FeatureTypeType, role model.RoleType) FeatureLocalInterface 37 // Get a FeatureLocalInterface implementation for a given feature address 38 FeatureOfAddress(addressFeature *model.AddressFeatureType) FeatureLocalInterface 39 // Get all FeatureLocalInterface implementations 40 Features() []FeatureLocalInterface 41 42 // Add a new usecase 43 AddUseCaseSupport( 44 actor model.UseCaseActorType, 45 useCaseName model.UseCaseNameType, 46 useCaseVersion model.SpecificationVersionType, 47 useCaseDocumemtSubRevision string, 48 useCaseAvailable bool, 49 scenarios []model.UseCaseScenarioSupportType, 50 ) 51 // Check if a use case is already added 52 HasUseCaseSupport( 53 actor model.UseCaseActorType, 54 useCaseName model.UseCaseNameType) bool 55 // Remove support for a usecase 56 RemoveUseCaseSupport( 57 actor model.UseCaseActorType, 58 useCaseName model.UseCaseNameType, 59 ) 60 // Set the availability of a usecase. This may only be used for usescases 61 // that act as a client within the usecase! 62 SetUseCaseAvailability(actor model.UseCaseActorType, useCaseName model.UseCaseNameType, available bool) 63 // Remove all usecases 64 RemoveAllUseCaseSupports() 65 66 // Remove all subscriptions 67 RemoveAllSubscriptions() 68 69 // Remove all bindings 70 RemoveAllBindings() 71 72 // Get the SPINE data structure for NodeManagementDetailDiscoveryData messages for this entity 73 Information() *model.NodeManagementDetailedDiscoveryEntityInformationType 74 } 75 76 // This interface defines all the required functions need to implement a remote entity 77 type EntityRemoteInterface interface { 78 EntityInterface 79 80 // Get the associated DeviceRemoteInterface implementation 81 Device() DeviceRemoteInterface 82 83 // Update the device address (only used for the DeviceInformation entity when receiving the DetailDiscovery reply) 84 UpdateDeviceAddress(address model.AddressDeviceType) 85 86 // Add a new feature with a given FeatureLocalInterface implementation 87 AddFeature(f FeatureRemoteInterface) 88 89 // Remove all features 90 RemoveAllFeatures() 91 92 // Get a FeatureRemoteInterface implementation for a given feature type and role 93 FeatureOfTypeAndRole(featureType model.FeatureTypeType, role model.RoleType) FeatureRemoteInterface 94 // Get a FeatureRemoteInterface implementation for a given feature address 95 FeatureOfAddress(addressFeature *model.AddressFeatureType) FeatureRemoteInterface 96 // Get all FeatureRemoteInterface implementations 97 Features() []FeatureRemoteInterface 98 }