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

Easy way to find which targets use an interface? #408

Closed
ZackM-Work opened this issue Mar 13, 2017 · 1 comment
Closed

Easy way to find which targets use an interface? #408

ZackM-Work opened this issue Mar 13, 2017 · 1 comment
Labels
Milestone

Comments

@ZackM-Work
Copy link

ZackM-Work commented Mar 13, 2017

Is there a way to quickly determine which targets make use of a particular interface? I defined a custom interface for my target that I am writing a tool to handle subscribing and unsubscribing from messages over that interface. As this tool is specific to a specific type of interface I only want to show targets that use that interface. I tried System.targets[0].interface.name but interface is nil for all of my targets when i call it from my tool. I assume it is populated in the cmd_tlm_server when it loads its configuration data.

Is there a way to get that information either from the cmd_tlm_server or through another function call or sequence of function calls to populate the System.targets.interface fields in another tool. Since the cmd_tlm_server would have to be running for this to be meaningful I would be fine with requiring it be up and running to use my new tool.

Thanks.

@ghost
Copy link

ghost commented Mar 17, 2017

The CmdTlmServer is the only part of the system that knows which targets are mapped to which interface. Unfortunately the COSMOS API doesn't currently provide a way to look that up. http://cosmosrb.com/docs/scripting/#interfaces

I'll use this ticket to capture that feature request.

For now, you should be able to get the information by parsing the CmdTlmServer configuration files from another tool. Something like (not tested):

require 'cosmos/tools/cmd_tlm_server/cmd_tlm_server_config'

config = Cosmos::CmdTlmServerConfig.new(File.join(Cosmos::USERPATH, 'config', 'tools', 'cmd_tlm_server', 'cmd_tlm_server.txt'))

After running that, System.targets.interface fields should be filled in.

@ghost ghost added the feature label Mar 17, 2017
@ghost ghost self-assigned this May 10, 2017
ghost pushed a commit that referenced this issue May 10, 2017
ghost pushed a commit that referenced this issue May 10, 2017
Add get_interface_targets scripting method #408
@ghost ghost closed this as completed May 10, 2017
@ghost ghost modified the milestone: v3.9.2 May 18, 2017
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant