Author Topic: Custom Plugin Design  (Read 12436 times)

0 Members and 1 Guest are viewing this topic.

MrAJP

  • Jr. Member
  • **
  • Posts: 5
  • Karma: 2
    • View Profile
Custom Plugin Design
« on: October 23, 2012, 03:01:49 PM »
I've been very happy with the VoxCommando application and can see some potential applications. I have an IR transmitter that I would like to integrate into VC using a custom plugin, but can't find any documentation or reference on how to create a plugin. Can you direct me to where I can find this info?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Custom Plugin Design
« Reply #1 on: October 23, 2012, 10:07:15 PM »
Hi MRAJP.  Welcome. :D

I will try to prepare something for you tomorrow.  If you want to develop a plugin for VC you will need to use visual studio and c# ( at least that is how I have been doing it) but you can also communicate with VC quite easily by sending udp messages from another program.  Please let me know what you prefer.

I have an ir transceiver and I use it in combination with eventghost and VC.  It would be great though to have the option of accessing the remote directly in VC by means of a plugin.

MrAJP

  • Jr. Member
  • **
  • Posts: 5
  • Karma: 2
    • View Profile
Re: Custom Plugin Design
« Reply #2 on: October 23, 2012, 10:45:14 PM »
Thanks jitterjames. I have a PhidgetIR sensor that I've used in the past with LabVIEW to control my cable box. At the time when I did the integration, EventGhost didn't have support with that module. I haven't checked if that has changed. I was going to write a program in VB.net to handle the sending of commands from your program. A plugin seems like the best place to start. A c# example would be great. I can convert it over to vb.net for my needs.

I've learned a hard lesson about the TV though. VC can't hear me when it's on!  :)

Here is a link to the IR module:
http://www.phidgets.com/products.php?category=0&product_id=1055_0

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Custom Plugin Design
« Reply #3 on: October 24, 2012, 01:54:38 AM »
Quote
Here is a link to the IR module:
http://www.phidgets.com/products.php?category=0&product_id=1055_0
Wow, this device is expensive and has no external emitter output jack.
You can use a USB-UIRT http://www.usbuirt.com/overview.htm in conjunction with EventGhost and VC (for this device is a driver in eventghost available).

A other good solution to control IR and RF (315MHz US/433MHz EU) with VC is the HALi controller, you can found more info here: http://lifetek.co.uk/forum/showthread.php?tid=13&pid=15#pid15
***********  get excited and make things  **********

MrAJP

  • Jr. Member
  • **
  • Posts: 5
  • Karma: 2
    • View Profile
Re: Custom Plugin Design
« Reply #4 on: October 24, 2012, 09:33:30 AM »
Thanks Kalle. It's something to keep in mind if I need to get another controller. For now, I plan on utilizing my existing hardware as it's currently sitting in a box.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Custom Plugin Design
« Reply #5 on: October 24, 2012, 04:06:25 PM »
already have = free = cheaper than the usb uirt!

I also like the SDK they provide for this little puppy.  It is too bad it is not a little bit cheaper though... it costs twice as much as a Raspberry Pi!

OK, anyway...

Here's a sample plugin to take a look at.

If you have any questions, I am happy to help.  You can skype me if you want.  My username is as you would expect!

MrAJP

  • Jr. Member
  • **
  • Posts: 5
  • Karma: 2
    • View Profile
Re: Custom Plugin Design
« Reply #6 on: October 24, 2012, 09:45:17 PM »
Agreed! I too wish their modules were a bit cheaper.

Thanks for the SDK! I was able to convert it over to VB.net without issue, as I can never seem to get used to C# (I know, I'm in the minority).

Now to get to work! I'll post here once I've made some headway.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Custom Plugin Design
« Reply #7 on: October 24, 2012, 10:03:51 PM »
Great.  If the VB version works, please post a copy here in case someone else wants to start from that point.

TIA

MrAJP

  • Jr. Member
  • **
  • Posts: 5
  • Karma: 2
    • View Profile
Re: Custom Plugin Design
« Reply #8 on: October 24, 2012, 11:11:39 PM »
Attached is the project in VB.net.

I utilized the free SharpDevelop to make the change:
http://www.icsharpcode.net/opensource/sd/

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Custom Plugin Design
« Reply #9 on: October 25, 2012, 12:21:24 PM »
Nice.  Thanks.  ;D

paulbeauvais

  • Jr. Member
  • **
  • Posts: 22
  • Karma: 2
    • View Profile
Re: Custom Plugin Design
« Reply #10 on: February 12, 2016, 01:05:09 PM »
Hello All,

I have a plug in question.  I am using the sample plugin template you have provided above.  For a first test, I just complied it and added it to the plugins directory (inside a sub directory called SamplePlugin).  I added an icon from a different plugin just for testing.

VoxCommando can see the new plugin called SamplePluging, and let's me enable it (it is enabled by default), however when loading the plugin I get an error.  "Error Loading Plugin:" {path to plugin}

From the Log:

2/12/2016 11:49:11 AM   131   found dll: C:\VoxCommndo\Plugins\SamplePlugin\PluginInterface.dll
2/12/2016 11:49:11 AM   133   Plugin not selected in options: PluginInterface
2/12/2016 11:49:11 AM   133   found dll: C:\VoxCommndo\Plugins\SamplePlugin\SamplePlugin.dll
2/12/2016 11:49:11 AM   135   Loading: SamplePlugin
2/12/2016 11:49:11 AM   141   Error loading plugin: C:\VoxCommndo\Plugins\SamplePlugin\SamplePlugin.dll
System.InvalidCastException: Unable to cast object of type 'vcPlugin.Plugin' to type 'PluginInterface.IPlugin'.
   at VoxCommando.PluginServices.AddPlugin(String FileName)
2/12/2016 11:49:11 AM   141   [error] Error loading plugin: C:\VoxCommndo\Plugins\SamplePlugin\SamplePlugin.dll


This should be a fairly easy error to trace, but I cannot see where the cast is taking place.  I tried this in framework 3.5 and 4.0

the other files in the plugins\SamplePlugin folder are:
icon.png
pluginInterface.dll
SamplePlugin.dll
SamplePlugin.pdb
test

Any ideas or help would be appreciated.


nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Custom Plugin Design
« Reply #11 on: February 12, 2016, 01:37:23 PM »
This should be a fairly easy error to trace, but I cannot see where the cast is taking place.  I tried this in framework 3.5 and 4.0

In his post the other day, among other things James wrote:
Quote
I also recommend you reference the new PluginInterface.dll (which you can find in the main VC folder after installing) and update your plugin project to use .Net 4.5.1 or later

Have you tried that advice yet?


TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

paulbeauvais

  • Jr. Member
  • **
  • Posts: 22
  • Karma: 2
    • View Profile
Re: Custom Plugin Design
« Reply #12 on: February 12, 2016, 02:05:34 PM »
I did, but for some reason it did not work...I redid it, but also and more importantly I removed the plugininterface.dll from the plugin directory.  I am not sure why that was mucking it up, but once I removed it all is well.

thanks.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Custom Plugin Design
« Reply #13 on: February 12, 2016, 02:24:18 PM »
You generally want to avoid having multiple copies of the same .dll in your VC folders, especially if they are different versions of the same dll.

I don't know if this is what happened but if your plugin referenced the new version of the plugininterface.dll and built your plugin dll but had the old version of the plugininterface.dll in your plugin folder then it would fail because your plugin dll was expecting a newer version of the plugininterface dll.

paulbeauvais

  • Jr. Member
  • **
  • Posts: 22
  • Karma: 2
    • View Profile
Re: Custom Plugin Design
« Reply #14 on: February 12, 2016, 04:07:47 PM »
OK.  I was able to successfully modify the SamplePlugin (I even switch over to the vb.net version, that is easier for me).

Thank you for all the help.  Now I just need to create a simple Plugin for a full test.  Is there anything simple anyone needs.  If not I will probably just do some date or text manipulations.  Then I am back to full home automation stuff.

Thanks again everyone.  You guys have been great answering questions.  VoxCommando is probably the only application I have paid for in a few years (that means I really like it, so thanks for that too).

Paul