ni / niveristand-communications-bus-template

Template custom device for using communications buses in VeriStand
http://www.ni.com
MIT License
0 stars 3 forks source link

Create Add/Find/Remove scripting VIs #111

Closed buckd closed 3 years ago

buckd commented 3 years ago

What does this Pull Request accomplish?

Creates scripting API entry points for adding a custom device, removing a custom device, finding a single custom device, and finding all custom devices.

Fixes #105

Why should this Pull Request be merged?

These entry points are necessities for starting from a good, known system definition.

What testing has been done?

Built locally and ran unit test.

dbendele commented 3 years ago

Thank you for adding the unit test to the template!

niveristand-diff-bot commented 3 years ago

Bleep bloop!

LabVIEW Diff Robot here with some diffs served up hot for your pull request.

Notice something funny? Help fix me on my GitHub repo.

Communication Bus Template Scripting.lvlib--Add Custom Device.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-16/16%3A13%3A42/Communication%20Bus%20Template%20Scripting.lvlib--Add%20Custom%20Device.vi.png)
Communication Bus Template Scripting.lvlib--Find All Custom Devices.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-16/16%3A13%3A42/Communication%20Bus%20Template%20Scripting.lvlib--Find%20All%20Custom%20Devices.vi.png)
Communication Bus Template Scripting.lvlib--Find Custom Device.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-16/16%3A13%3A42/Communication%20Bus%20Template%20Scripting.lvlib--Find%20Custom%20Device.vi.png)
Communication Bus Template Scripting.lvlib--Initialize Custom Device.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-16/16%3A13%3A42/Communication%20Bus%20Template%20Scripting.lvlib--Initialize%20Custom%20Device.vi.png)
Communication Bus Template Scripting.lvlib--Remove Custom Device.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-16/16%3A13%3A42/Communication%20Bus%20Template%20Scripting.lvlib--Remove%20Custom%20Device.vi.png)
Communication Bus Template System Explorer.lvlib--Implementation.lvlib--Initialize.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-16/16%3A13%3A42/Communication%20Bus%20Template%20System%20Explorer.lvlib--Implementation.lvlib--Initialize.vi.png)
Scripting.lvclass--setUp.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-16/16%3A13%3A42/Scripting.lvclass--setUp.vi.png)
Scripting.lvclass--tearDown.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-16/16%3A13%3A42/Scripting.lvclass--tearDown.vi.png)
Scripting.lvclass--test Add-Find-Remove.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-16/16%3A13%3A42/Scripting.lvclass--test%20Add-Find-Remove.vi.png)
testExample 1.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-16/16%3A13%3A42/testExample%201.vi.png)
rtzoeller commented 3 years ago

We should check the boolean return value of AddCustomDevice in Add Custom Device.vi, as it's possible this call can fail if a custom device with the specified name already exists. Otherwise the changes look great.

niveristand-diff-bot commented 3 years ago

Bleep bloop!

LabVIEW Diff Robot here with some diffs served up hot for your pull request.

Notice something funny? Help fix me on my GitHub repo.

Communication Bus Template Scripting.lvlib--Add Custom Device.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-19/09%3A56%3A34/Communication%20Bus%20Template%20Scripting.lvlib--Add%20Custom%20Device.vi.png)
Communication Bus Template Scripting.lvlib--Find All Custom Devices.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-19/09%3A56%3A34/Communication%20Bus%20Template%20Scripting.lvlib--Find%20All%20Custom%20Devices.vi.png)
Communication Bus Template Scripting.lvlib--Find Custom Device.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-19/09%3A56%3A34/Communication%20Bus%20Template%20Scripting.lvlib--Find%20Custom%20Device.vi.png)
Communication Bus Template Scripting.lvlib--Initialize Custom Device.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-19/09%3A56%3A34/Communication%20Bus%20Template%20Scripting.lvlib--Initialize%20Custom%20Device.vi.png)
Communication Bus Template Scripting.lvlib--Remove Custom Device.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-19/09%3A56%3A34/Communication%20Bus%20Template%20Scripting.lvlib--Remove%20Custom%20Device.vi.png)
Communication Bus Template System Explorer.lvlib--Implementation.lvlib--Initialize.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-19/09%3A56%3A34/Communication%20Bus%20Template%20System%20Explorer.lvlib--Implementation.lvlib--Initialize.vi.png)
Scripting.lvclass--setUp.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-19/09%3A56%3A34/Scripting.lvclass--setUp.vi.png)
Scripting.lvclass--tearDown.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-19/09%3A56%3A34/Scripting.lvclass--tearDown.vi.png)
Scripting.lvclass--test Add-Find-Remove.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-19/09%3A56%3A34/Scripting.lvclass--test%20Add-Find-Remove.vi.png)
testExample 1.vi.png ![capture](https://raw.githubusercontent.com/niveristand-diff-bot/diff-images/master/NI/niveristand-communications-bus-template/PR-111/2021-07-19/09%3A56%3A34/testExample%201.vi.png)
buckd commented 3 years ago

We should check the boolean return value of AddCustomDevice in Add Custom Device.vi, as it's possible this call can fail if a custom device with the specified name already exists. Otherwise the changes look great.

@rtzoeller Get Next Unique Label prevents us from trying to add something with the same name, so that's not a concern. Is there another reason that boolean would be false without returning an error on the error wire? image

Or should we not be trying to uniquify the name provided to us? In that case, yes we should check that.

rtzoeller commented 3 years ago

Or should we not be trying to uniquify the name provided to us? In that case, yes we should check that.

I'll leave the judgement to you. I think there are valid arguments for both approaches.

My primary concern with uniquifying the name is that someone could write code which adds the custom device, then later attempts to retrieve it by name. If they don't read the name of the node returned by Add Custom Device, they could get a node they aren't expecting. I doubt this would be an issue in practice though, so we can ignore.

buckd commented 3 years ago

My primary concern with uniquifying the name is that someone could write code which adds the custom device, then later attempts to retrieve it by name. If they don't read the name of the node returned by Add Custom Device, they could get a node they aren't expecting. I doubt this would be an issue in practice though, so we can ignore.

I agree with the sentiment that it's not likely to be a problem in practice. Also, since this is how we do it for NI-SWITCH, Engine Sim, and Ballard ARINC 429, I'm inclined to leave it like this for consistency.