Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update register remote service API #147

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,17 @@ type ServiceInterface interface {
// Returns the Service detail of a remote SKI
RemoteServiceForSKI(ski string) *shipapi.ServiceDetails

// Sets the SKI as being paired
RegisterRemoteSKI(ski string)
// Pair a remote service based on the SKI
//
// Parameters:
// - ski: the SKI of the remote service (required)
// - shipID: the SHIP ID of the remote service (optional)
//
// Note: The SHIP ID is optional, but should be provided if available.
// if provided, it will be used to validate the remote service is
// providing this SHIP ID during the handshake process and will reject
// the connection if it does not match.
RegisterRemoteSKI(ski, shipID string)

// Sets the SKI as not being paired
UnregisterRemoteSKI(ski string)
Expand Down Expand Up @@ -105,7 +114,7 @@ type ServiceReaderInterface interface {

// Provides the SHIP ID the remote service reported during the handshake process
// This needs to be persisted and passed on for future remote service connections
// when using `PairRemoteService`
// when using `RegisterRemoteSKI`
ServiceShipIDUpdate(ski string, shipdID string)

// Provides the current pairing state for the remote service
Expand Down
2 changes: 1 addition & 1 deletion examples/ced/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (h *controlbox) run() {
os.Exit(0)
}

h.myService.RegisterRemoteSKI(remoteSki)
h.myService.RegisterRemoteSKI(remoteSki, "")

h.myService.Start()
// defer h.myService.Shutdown()
Expand Down
2 changes: 1 addition & 1 deletion examples/controlbox/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (h *controlbox) run() {
os.Exit(0)
}

h.myService.RegisterRemoteSKI(remoteSki)
h.myService.RegisterRemoteSKI(remoteSki, "")

h.myService.Start()
// defer h.myService.Shutdown()
Expand Down
2 changes: 1 addition & 1 deletion examples/evse/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (h *evse) run() {
os.Exit(0)
}

h.myService.RegisterRemoteSKI(remoteSki)
h.myService.RegisterRemoteSKI(remoteSki, "")

h.myService.Start()
// defer h.myService.Shutdown()
Expand Down
2 changes: 1 addition & 1 deletion examples/heatpump/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (h *heatpump) run() {
h.AddFeatures()
_ = spine.Events.Subscribe(h)

h.myService.RegisterRemoteSKI(remoteSki)
h.myService.RegisterRemoteSKI(remoteSki, "")

h.myService.Start()
// defer h.myService.Shutdown()
Expand Down
2 changes: 1 addition & 1 deletion examples/hems/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (h *hems) run() {
os.Exit(0)
}

h.myService.RegisterRemoteSKI(remoteSki)
h.myService.RegisterRemoteSKI(remoteSki, "")

h.myService.Start()
// defer h.myService.Shutdown()
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/enbility/eebus-go
go 1.22.0

require (
github.com/enbility/ship-go v0.0.0-20241118145930-d68708c5f1c0
github.com/enbility/ship-go v0.0.0-20241224121428-45edf34c56e4
github.com/enbility/spine-go v0.0.0-20241209160856-1aed917e83e7
github.com/stretchr/testify v1.9.0
golang.org/x/exp/jsonrpc2 v0.0.0-20240909161429-701f63a606c0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/enbility/go-avahi v0.0.0-20240909195612-d5de6b280d7a h1:foChWb8lhzqa6lWDRs6COYMdp649YlUirFP8GqoT0JQ=
github.com/enbility/go-avahi v0.0.0-20240909195612-d5de6b280d7a/go.mod h1:H64mhYcAQUGUUnVqMdZQf93kPecH4M79xwH95Lddt3U=
github.com/enbility/ship-go v0.0.0-20241118145930-d68708c5f1c0 h1:Z8j/N4DgUL8T8mINkHdq0bUbKcWtwDpno0bsKOGahPo=
github.com/enbility/ship-go v0.0.0-20241118145930-d68708c5f1c0/go.mod h1:JJp8EQcJhUhTpZ2LSEU4rpdaM3E2n08tswWFWtmm/wU=
github.com/enbility/ship-go v0.0.0-20241224121428-45edf34c56e4 h1:FYVDfqWdEv/ua+NGw+9Eynt6JPt1X0HPQaOI5QysaZY=
github.com/enbility/ship-go v0.0.0-20241224121428-45edf34c56e4/go.mod h1:JJp8EQcJhUhTpZ2LSEU4rpdaM3E2n08tswWFWtmm/wU=
github.com/enbility/spine-go v0.0.0-20241209160856-1aed917e83e7 h1:Pq1L3U/aoSg8qQj4CfSEUCh9fxgB3G/skUNQI32zQeg=
github.com/enbility/spine-go v0.0.0-20241209160856-1aed917e83e7/go.mod h1:ZoI9TaJO/So/677uknrli8sc6iryD7wC5iWhVIre+MI=
github.com/enbility/zeroconf/v2 v2.0.0-20240920094356-be1cae74fda6 h1:XOYvxKtT1oxT37w/5oEiRLuPbm9FuJPt3fiYhX0h8Po=
Expand Down
16 changes: 8 additions & 8 deletions mocks/DeviceConfigurationClientInterface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions mocks/DeviceConfigurationCommonInterface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions mocks/DeviceConfigurationServerInterface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions mocks/ElectricalConnectionCommonInterface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions mocks/ElectricalConnectionServerInterface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading