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

Move the scan logic to HandleReadCommands instead of Initialize #30

Open
cloudxxx8 opened this issue Jul 11, 2019 · 5 comments
Open

Move the scan logic to HandleReadCommands instead of Initialize #30

cloudxxx8 opened this issue Jul 11, 2019 · 5 comments

Comments

@cloudxxx8
Copy link

Currently, the scan logic of GPS Device Service is located in Initialize func, it caused this Device Service can only serve one GPS Device.
By moving to HandleReadCommands func, it can read ProtocolProperties as the suggestion in #29. The disadvantage is that it can only scan at runtime. In the next release, this logic could move to the new AddDevice callback stated in edgexfoundry/device-sdk-go#276
This issue is just a suggestion.

@alexcourouble
Copy link

We decided to implement this in the Initialize function as a go-routine to enable reading from a mock data file and to avoid the overhead associated with opening the file/device every time HandleReadCommand is invoked.

If I understand correctly, we can't access [DeviceList.Protocols.gps] from Initialize? If not, I think we should leave it hard coded on line 62 of driver/gpsdevice.go until we can use the AddDevice callback.

@cloudxxx8
Copy link
Author

Yes, Initialize can't read ProtocolProperties because ProtocolProperties is for a specific Device and Initialize is for the Device Service.
AddDevice should be available by the end of this month. Device Service working group is discussing the contract of these new callback functions.

@alexcourouble
Copy link

Ok, I will change it once AddDevice is available.

@iain-anderson
Copy link

Hi @alexcourouble AddDevice etc are now in the SDK - this patch has been merged

@shuxuecheng
Copy link

I change the dev/ttyUSB0,but not ok.it has no vaule

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants