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

Comments

Projects
None yet
3 participants
@ZackM-Work

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.

@ryanatball

This comment has been minimized.

Show comment
Hide comment
@ryanatball

ryanatball Mar 17, 2017

Member

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.

Member

ryanatball 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.

@ryanatball ryanatball added the feature label Mar 17, 2017

@jasonatball jasonatball self-assigned this May 10, 2017

jasonatball added a commit that referenced this issue May 10, 2017

jasonatball added a commit that referenced this issue May 10, 2017

Merge pull request #448 from BallAerospace/get_interface_targets
Add get_interface_targets scripting method #408

@ryanatball ryanatball modified the milestone: v3.9.2 May 18, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment