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

Refactor service interface for SHIP data #126

Open
randomdudebunchofnumbers opened this issue Oct 17, 2024 · 2 comments
Open

Refactor service interface for SHIP data #126

randomdudebunchofnumbers opened this issue Oct 17, 2024 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@randomdudebunchofnumbers
Copy link

randomdudebunchofnumbers commented Oct 17, 2024

Some of the methods in ServiceInterface return structures or pointer to structures which encapsulate the corresponding data. This is because the implementation just passes the various interfaces of ship-go to the service interface and the corresponding ship-go implementations are designed to be thread-safe. This current implementation violates the idea of having an interface specifically designed to separate the user level from the technical (EEBus) level. Furthermore, the encapsulation prohibits the data from being convertible into JSON or any other format in a generic manner.

I'd like to propose a data struct called ServiceItem with the following items:

type ServiceItem struct {
	Name                   string                       // shipapi.MdnsEntry
	Ski                    string                       // shipapi.MdnsEntry
	ShipIdPerMdns          string                       // field Identifier of shipapi.MdnsEntry
	Brand                  string                       // shipapi.MdnsEntry
	Type                   string                       // shipapi.MdnsEntry
	Model                  string                       // shipapi.MdnsEntry
	Serial                 string                       // shipapi.MdnsEntry
	Categories             []shipapi.DeviceCategoryType // shipapi.MdnsEntry
	Trusted                bool                         // shipapi.ServiceDetails
	ConnectionState        shipapi.ConnectionState
	ConnectionErrorMessage string
	RemoteDevice           bool // because the local device will also be listed
}

ServiceItem should be available via an API method and there should also be a corresponding callback in ServiceReaderInterface.

@DerAndereAndi DerAndereAndi added good first issue Good for newcomers enhancement New feature or request labels Oct 17, 2024
@DerAndereAndi
Copy link
Member

Thanks for the suggestion!

As discussed: Another aspect is also how to register a remote device and have the stack verify that the SHIP ID is properly submitted in the SHIP handshake, instead of having the app to do it.

@randomdudebunchofnumbers
Copy link
Author

randomdudebunchofnumbers commented Oct 18, 2024

See this post in Discussions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants