diff --git a/api/configuration.go b/api/configuration.go index 150e3a5d..d281eb88 100644 --- a/api/configuration.go +++ b/api/configuration.go @@ -64,7 +64,8 @@ type Configuration struct { // The certificate used for the service and its connections, required certificate tls.Certificate - // The timeout to be used for sending heartbeats + // The timeout to be used for sending heartbeats and applied to all + // local entities created on setup the service heartbeatTimeout time.Duration // Optional set which mDNS providers should be used diff --git a/features/client/helper_test.go b/features/client/helper_test.go index d9d63611..0ce38aa2 100644 --- a/features/client/helper_test.go +++ b/features/client/helper_test.go @@ -102,8 +102,8 @@ func setupFeatures( dataCon shipapi.ShipConnectionDataWriterInterface, featureFunctions []featureFunctions) (spineapi.EntityLocalInterface, spineapi.EntityRemoteInterface) { localDevice := spine.NewDeviceLocal("TestBrandName", "TestDeviceModel", "TestSerialNumber", "TestDeviceCode", - "TestDeviceAddress", model.DeviceTypeTypeEnergyManagementSystem, model.NetworkManagementFeatureSetTypeSmart, time.Second*4) - localEntity := spine.NewEntityLocal(localDevice, model.EntityTypeTypeCEM, spine.NewAddressEntityType([]uint{1})) + "TestDeviceAddress", model.DeviceTypeTypeEnergyManagementSystem, model.NetworkManagementFeatureSetTypeSmart) + localEntity := spine.NewEntityLocal(localDevice, model.EntityTypeTypeCEM, spine.NewAddressEntityType([]uint{1}), time.Second*4) for i, item := range featureFunctions { f := spine.NewFeatureLocal(uint(i+1), localEntity, item.featureType, model.RoleTypeClient) diff --git a/features/internal/helper_test.go b/features/internal/helper_test.go index 442be090..68533c01 100644 --- a/features/internal/helper_test.go +++ b/features/internal/helper_test.go @@ -102,8 +102,8 @@ func setupFeatures( featureFunctions []featureFunctions, ) (spineapi.EntityLocalInterface, spineapi.EntityRemoteInterface) { localDevice := spine.NewDeviceLocal("TestBrandName", "TestDeviceModel", "TestSerialNumber", "TestDeviceCode", - "TestDeviceAddress", model.DeviceTypeTypeEnergyManagementSystem, model.NetworkManagementFeatureSetTypeSmart, time.Second*4) - localEntity := spine.NewEntityLocal(localDevice, model.EntityTypeTypeCEM, spine.NewAddressEntityType([]uint{1})) + "TestDeviceAddress", model.DeviceTypeTypeEnergyManagementSystem, model.NetworkManagementFeatureSetTypeSmart) + localEntity := spine.NewEntityLocal(localDevice, model.EntityTypeTypeCEM, spine.NewAddressEntityType([]uint{1}), time.Second*4) for i, item := range featureFunctions { f := spine.NewFeatureLocal(uint(i+1), localEntity, item.featureType, model.RoleTypeClient) diff --git a/go.mod b/go.mod index 1549e84d..21b7dd39 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21.1 require ( github.com/enbility/ship-go v0.0.0-20240909200111-0d37cebbfc21 - github.com/enbility/spine-go v0.0.0-20240911140055-b637b5392906 + github.com/enbility/spine-go v0.0.0-20240915104201-575c4bb4751a github.com/stretchr/testify v1.9.0 ) diff --git a/go.sum b/go.sum index 74efa4bf..288be9f8 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,8 @@ github.com/enbility/go-avahi v0.0.0-20240909195612-d5de6b280d7a h1:foChWb8lhzqa6 github.com/enbility/go-avahi v0.0.0-20240909195612-d5de6b280d7a/go.mod h1:H64mhYcAQUGUUnVqMdZQf93kPecH4M79xwH95Lddt3U= github.com/enbility/ship-go v0.0.0-20240909200111-0d37cebbfc21 h1:ZuOja5wms/Yujch+f1wQAw5ASY8mEFUpqf/j2LFrjzA= github.com/enbility/ship-go v0.0.0-20240909200111-0d37cebbfc21/go.mod h1:8EaCKa2WOVZ/4SpquvZStPakEarjRXQLNHhC4azvaA0= -github.com/enbility/spine-go v0.0.0-20240911140055-b637b5392906 h1:/jhq32DUM6vj/mUwy0134PP6wtP7Rm8SI5tmixZhE4I= -github.com/enbility/spine-go v0.0.0-20240911140055-b637b5392906/go.mod h1:BDvhbs+XsWDGYwd8eQOzPXc8w/avVFmWKLlSKV/gx9k= +github.com/enbility/spine-go v0.0.0-20240915104201-575c4bb4751a h1:S2oeUCg0lnlWIl/CQoB+DGGEyyhtJ5Fxxd1qnRV5pfI= +github.com/enbility/spine-go v0.0.0-20240915104201-575c4bb4751a/go.mod h1:BDvhbs+XsWDGYwd8eQOzPXc8w/avVFmWKLlSKV/gx9k= github.com/enbility/zeroconf/v2 v2.0.0-20240827101515-f3956627c450 h1:39tnpfiV5OVfYb9sOqYmoivBzTHyNLWSYIxd9Qng1eg= github.com/enbility/zeroconf/v2 v2.0.0-20240827101515-f3956627c450/go.mod h1:1sUbJ+VE7yLNyRzGoCMjoDWtdZ+bW4aYBKx2+Rw+9hs= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= diff --git a/integration_tests/emobility_measurement_test.go b/integration_tests/emobility_measurement_test.go index b30913fe..90479694 100644 --- a/integration_tests/emobility_measurement_test.go +++ b/integration_tests/emobility_measurement_test.go @@ -39,8 +39,8 @@ type EmobilityMeasurementSuite struct { func (s *EmobilityMeasurementSuite) BeforeTest(suiteName, testName string) { s.sut = spine.NewDeviceLocal("TestBrandName", "TestDeviceModel", "TestSerialNumber", "TestDeviceCode", - "TestDeviceAddress", model.DeviceTypeTypeEnergyManagementSystem, model.NetworkManagementFeatureSetTypeSmart, time.Second*4) - s.localEntity = spine.NewEntityLocal(s.sut, model.EntityTypeTypeCEM, spine.NewAddressEntityType([]uint{1})) + "TestDeviceAddress", model.DeviceTypeTypeEnergyManagementSystem, model.NetworkManagementFeatureSetTypeSmart) + s.localEntity = spine.NewEntityLocal(s.sut, model.EntityTypeTypeCEM, spine.NewAddressEntityType([]uint{1}), time.Second*4) s.sut.AddEntity(s.localEntity) f := spine.NewFeatureLocal(1, s.localEntity, model.FeatureTypeTypeElectricalConnection, model.RoleTypeClient) diff --git a/service/service.go b/service/service.go index de7b767f..cddbd368 100644 --- a/service/service.go +++ b/service/service.go @@ -117,14 +117,13 @@ func (s *Service) Setup() error { deviceAddress, sd.DeviceType(), sd.FeatureSet(), - sd.HeartbeatTimeout(), ) // Create the device entities and add it to the SPINE device for _, entityType := range sd.EntityTypes() { entityAddressId := model.AddressEntityType(len(s.spineLocalDevice.Entities())) entityAddress := []model.AddressEntityType{entityAddressId} - entity := spine.NewEntityLocal(s.spineLocalDevice, entityType, entityAddress) + entity := spine.NewEntityLocal(s.spineLocalDevice, entityType, entityAddress, sd.HeartbeatTimeout()) s.spineLocalDevice.AddEntity(entity) }