Page 1 of 2

TunerStudio Plugin Support

Posted: Thu Apr 05, 2012 11:21 pm
by LT401Vette
As of TunerStudio 1.34 Plugin support is activated.
This is a component of TunerStudio that has been largely underlying for several years, finally turned on and ready for initial use. (Thank gslendar for the nagging ) :)

For anyone interesting in making plugins that can access settings, runtime data, UI widgets or expression evaluation, check it out.

This can be extended much further in upcoming betas, but I will take a pause here for people to try the API and see what more is needed for what ever ideas you may have.

I have posted Java Doc, API Jar file and a basic Example plugin to demonstrate API usage at:
http://tunerstudio.com/index.php/manual ... io-plugins

Re: TunerStudio Plugin Support

Posted: Fri Apr 06, 2012 1:39 am
by Greg G
Woohoo! Off we go :)

Re: TunerStudio Plugin Support

Posted: Fri Apr 06, 2012 1:55 am
by gslender
Phil,

Awesome news. Thanks so much.

I'm getting a Error loading Plugin: ApplicationPlugin not defined in Manifest for Jar when loading the TunerStudioPluginAPI.jar file ???

G

Re: TunerStudio Plugin Support

Posted: Fri Apr 06, 2012 1:59 am
by gslender
ahhh, loaded the ExampleTunerStudioPlugin.jar and all is well.... cool.

Re: TunerStudio Plugin Support

Posted: Fri Apr 06, 2012 5:10 am
by LT401Vette
Yep, that jar is the API jar, not a plugin.

It looks like I forgot to put out the source for the examout last night.
I'll get that out and put more documentation on getring started.

You primaily just need to have a class in you jar that implements ApplicationPlugin then add that entry to the manifest.

Re: TunerStudio Plugin Support

Posted: Fri Apr 06, 2012 6:21 am
by LT401Vette
Ok, a bit more documentation and the source code is out now at:
http://tunerstudio.com/index.php/manual ... io-plugins

Re: TunerStudio Plugin Support

Posted: Fri Apr 06, 2012 6:25 am
by gslender
LT401Vette wrote:Ok, a bit more documentation and the source code is out now at:
http://tunerstudio.com/index.php/manual ... io-plugins
Ok, source is great!

Also, if you can outline how you'd expect this to be used with Eclipse that would be great.... (or do you need Netbeans?) ie how do I test and load a plugin - is there any cmd script or fast method to launch TS with new plugin loaded and launched? or would it be a case of creating the jar each time and putting in the right location for TS to reload after restarting? Oh boy I hope not :shock:

G

Re: TunerStudio Plugin Support

Posted: Fri Apr 06, 2012 6:49 am
by LT401Vette
I think added stuff to cover that a bit better now..

I use Eclipse for Android, but prefer Netbeans and use it for most other development. I have included just the source or the whole Netbeans project on that link..

When you install the plugin the first time, you need to restart TunerStudio for it to show up on the menu, but after that they are hot swapable. If you use the menus for "Add or Update a Plugin", it will reload the classes and the new plug will be displayed when you re open the plugin dialog.

Step through debugging would be challenging... You really need to have your plugin run without TunerStudio and abstract the Plugin calls.
For this what would work well is a set of stubbed out service providers to emulate a Plugin container... That would probably help great deal.

Re: TunerStudio Plugin Support

Posted: Fri Apr 06, 2012 7:00 am
by gslender
LT401Vette wrote: Step through debugging would be challenging... You really need to have your plugin run without TunerStudio and abstract the Plugin calls.
For this what would work well is a set of stubbed out service providers to emulate a Plugin container... That would probably help great deal.
If you can explain how to launch TS without using the TunerStudio.exe then I can just use the Debug run mode and step through the PluginCode at a break point. As I don't need to (and can't) see into TS source that will be fine. I just need to know how to launch a TS session from the jar and I'm good to then build and play in the plugin world - as you state, if I can compile new code and TS will reload the reflected class files when using the "Add or Update a Plugin" menu then I'm set.

Does that sound right?

G

Re: TunerStudio Plugin Support

Posted: Fri Apr 06, 2012 7:00 am
by Zaphod
What kind of plugins are we going to see in the next time with this new functionality?

Re: TunerStudio Plugin Support

Posted: Fri Apr 06, 2012 7:03 am
by LT401Vette
Yep...

It takes nothing special to launch TS directly from the jar.

Just make sure the working directory is set to the TunerStudioMS.jar folder, and launch it...

java -jar TunerStudioMS.jar

Re: TunerStudio Plugin Support

Posted: Fri Apr 06, 2012 7:14 am
by LT401Vette
What kind of plugins are we going to see in the next time with this new functionality?
That is up to any ones imagination..

Grant might be able to tell some of the things he has been itching to try.

I am thinking I will start writing more functionality as plugins myself when it suits. They keep the code encapsulated and contained. You can add new features without rolling out a new version of TunerStudio, so if there is a problem with it, you can just fix the plugin or back it out without needing to change the whole TunerStudio.

There are 3 types of plugins from a display point:
PERSISTENT_DIALOG - A Dialog Container launches a plugin and gives it access to to the controllers in the open project.
DIALOG_WIDGET = This is a widget that can be placed in a dialog or panel in the ini file.
TAB_PANEL - A plugin that adds a new Tab on the main window.

In this release only the Dialog based plugin container PERSISTENT_DIALOG type is supported. That is mostly because it will take code changes through some other core parts of TS to support the other models, I do not want to make those changes this late in the beta cycle. After this beta is rolled to stable, then those will be added in the next beta cycle.

But where the primary point is to be able to read runtime values or read/update settings, I could envision using a TAB_PANEL plugin to do something like have an MP3 Player built into TunerStudio :)

Re: TunerStudio Plugin Support

Posted: Fri Apr 06, 2012 7:27 am
by jsmcortina
What would it take to make a plugin that runs the OS-specific firmware loader binary?

James

Re: TunerStudio Plugin Support

Posted: Fri Apr 06, 2012 7:37 am
by racingmini_mtl
That's also something I'd like to know.

Jean

Re: TunerStudio Plugin Support

Posted: Fri Apr 06, 2012 7:45 am
by LT401Vette
I don't think a plugin is the ideal way to go for a firmware loader.
You could do it, because once you are writing a plugin you can do anything you can do in Java including launching native apps, but I suppose it could be better than launching them from the command line until a firmware loader is implemented in TunerStudio.

If the firmware loaders were bundled with the TunerStudio install, detecting what OS it is running on and launching the correct one isn't much trouble.

Re: TunerStudio Plugin Support

Posted: Fri Apr 06, 2012 8:39 am
by 93white3400z
Phil, since you're the one that know the limitation of the current plugins implementation, and you also know what you have on your todo list, would you mind giving us a few hints on what plugin could be interesting / feasible right now ? Thanks :D

Re: TunerStudio Plugin Support

Posted: Fri Apr 06, 2012 6:08 pm
by gslender
Created my first plugin! :yeah!:

Nothing worthy of sharing but I can confirm the compile, jar build and TS reload process works. I've still not worked out how to debug, so that may prove a problem in the future, but for now I can create an Eclipse project that produces a Jar in TS directory that I can update the plugin and the changes are immediate - so that's a start! 8)

Phil, would love to work on a way to enable self-standing debug, as without it, it will limit how far folks can take the plugin concept. The issue for me is that there is no simple way to launch TS from within the Plugin classpath so that environments like Eclipse can step through at correct break points. I need to figure out how to add TS as an Eclipse project that can be launched from the Run dialog - not impossible, just haven't been able to make it work yet :RTFM:

Re: TunerStudio Plugin Support

Posted: Fri Apr 06, 2012 6:19 pm
by gslender
LT401Vette wrote:Yep...

It takes nothing special to launch TS directly from the jar.

Just make sure the working directory is set to the TunerStudioMS.jar folder, and launch it...

java -jar TunerStudioMS.jar
It doesn't work.
The serial drivers didn't load, but it continues past that.

I'm unsure why, but it hangs after that... and doesn't proceed past loading the project.

My thoughts would be to have a -developer switch whereby it's behaviour is more controlled and allows you to specify the project and so forth.

Re: TunerStudio Plugin Support

Posted: Fri Apr 06, 2012 6:55 pm
by LT401Vette
It might work if you install the rxtx drivers to the jre.

That is the normal way, but I package them with the app dir.

The working dir will still need to be set to the install dir though as there are so many reference files needed to load a project.

Re: TunerStudio Plugin Support

Posted: Fri Apr 06, 2012 7:53 pm
by gslender
LT401Vette wrote:It might work if you install the rxtx drivers to the jre.

That is the normal way, but I package them with the app dir.

The working dir will still need to be set to the install dir though as there are so many reference files needed to load a project.
Could you perhaps just confirm that launching the jar independently works... as I can't seem to make it work - ie double-click launching the JAR doesn't work, and based on your suggested "java -jar TunerStudioMS.jar" you can't launch 1.34 of TS that way at least on Windows 7.

G