Expose more OPC internals#2
Open
JoakimSoderberg wants to merge 5 commits into
Open
Conversation
Instead of using all parts of the library to run the OPC server there are scenarios where people only wants to use parts of the library. For example I'm writing an OPC proxy, I can't assume before starting the server how many channels there will be, so I need to be able to have my own dispatcher. Also I fixed the comment style for functions to match the go style. Made ReadOPC a standalone function and exported it so that can be used standalone.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello,
Nice implementation of OPC. However I quickly realised that I can't use it as is, since it is tailored quite specifically to one use case.
I wanted to write an OPC proxy, and that means I need raw access to the
Messagestruct and so on. But as the current design is these are not exposed.I did some changes to the library that allows me to just use some parts, and implement the connection/listening and so exactly as I want to.
This is my first attempt at a Golang project so I can't say I'm an expert. I'm totally open to modifying this PR if you want that, since I'm aware these break backwards compatability.
Some notable changes:
Serverstruct anyway. And this makes it possible to reuse in other code without being forced to useServer.I made all fields in the
Messagestruct exported. When I'm writing my proxy theDeviceconcept does not really work, I just want to get the raw messages and send them on, and be able to check the channel and such for each message.Renamed constants and changed comments to follow the "go standard" better. Examples:
(Coming from C I kind of prefer your way as a matter of taste, but keeping to a language standard if there is such a clear one trumps that my personal taste any day).
Comments in Go should be of the form:
Rather than:
This is from
go vetsuggestions.Anyway, what I ended up using of this is the changes to the exposed fields in
Messageas well as makingReadOpca function that can be used standalone. So if you want me to modify the PR to only include those changes I can do that.