Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Easy way to find which targets use an interface? #408
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.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.
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):
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.