Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] indexer? hierarchy? querying problem

For my arduino eclipse plugin I would like to open a serial connection based on a click in the toolbar.
To open a connection I need a comport and a baud rate.
I know the comport because the user provided it as it is used for the upload.
So only the baud rate is missing.
The baud rate has to match the baud rate as specified in the code. So I was thinking about using the indexer to find the baud rate.
After lots of searching it is clear I miss some(?) basic understanding of the working of the indexer to get to results.

What I have in its simplest form is this as source code to be parsed
void setup()

What I need to get as result for this case is 123.

I didn't get closer than this code
String variableName = "Serial";
 IIndexBinding[] bindings = index.findBindings(variableName.toCharArray(), IndexFilter.ALL_DECLARED_OR_IMPLICIT, new NullProgressMonitor());
When variableName is "Serial" or "setup" I get a list of bindings I can inspect; but how do I get this for "Serial.begin"?

Some help is really appreciated.

Best regards

PS note that I cannot use the implementation class of Serial as that changes with board type. The only thing I really can trust to have is Serial.begin probably in setup.

Back to the top