Monday, July 3, 2017

vCards in Ignition

I've started to more actively send code to the Ignition Module Developer Community site. If you're not aware of it, you can find it here, with my latest addition:

https://github.com/IgnitionModuleDevelopmentCommunity/vCard

The Ignition Module Developer Community site a github repository open to the community. If you'd like to upload your module as open source, it's a good place for that.

I just added the vCards module. If you have a need to use vCards in your projects, feel free to grab a copy, sign it, and start using it.

Wednesday, May 31, 2017

Including Libraries in your Ignition Modules

For those of you looking to include Java libraries, the new Maven build system makes this very easy.

If you haven't created a module yet, follow the steps in http://ignitionprogramming.blogspot.com/2017/05/module-development-quick-start-guide.html to get started.

How to include other libraries
1) Open pom.xml in the main project folder in IntelliJ IDEA
2) Add a section that looks like this:
  <dependencies>

  </dependencies>
3) Inside that <dependencies> block, copy paste the maven dependency for the library you want to include.
Example:
  <dependencies>

    <dependency>
      <groupId>com.google.zxing</groupId>
      <artifactId>core</artifactId>
      <version>3.3.0</version>
    </dependency>

  </dependencies>

And you're done! Maven makes library includes so easy that you'll forget you ever had to worry about dependency hell.


If you want to expose your newly included libraries through script functions, check out http://ignitionprogramming.blogspot.com/2011/07/adding-scripting-functions.html.

Module Development Quick Start Guide

Creating a module in Ignition is much simpler than it used to be.  Recently, Ignition module development moved over to Maven, providing easy access to Ignition archetypes and SDK includes.  Here's a quick start guide to get you going on creating your first module.

Prerequisites:

Java JDK (Version 8 or above)
IntelliJ IDEA.  The community edition works well.

Steps:

  • In IntelliJ, create new project
    • Select Maven, Add Maven Archetype
Group   : com.inductiveautomation.ignitionsdk
Artifact: client-designer-gateway-archetype
Version : 1.0.3  (Latest version as of 6/2017) 
    •  After choosing the archetype, use the following info for your module
GroupId   : Make this the moduleID  (i.e. org.ignitionmdc.barcodedecoder)
ArtifactId: Make this the last part of the GroupId  (i.e. barcodedecoder)
Version   : Make this Ignition standard with 3 numbers (i.e. 1.0.0)
  • Click to auto-import maven dependencies in the bottom right if prompted.
  • Change your moduleID
    • Open your build directory in IntelliJ IDEA's Project panel
    • Open your pom.xml
    • Find moduleId and change it to match your GroupId
  • If you'd like a nice Module Name and Description, you can update that info here:
    • Open your pom.xml from your main directory in IntelliJ IDEA's Project panel
    • Find and update <name> and <description>
  • Build your module 
    • Open View -> Tool Windows -> Maven Projects
    • Expand "Module Name (root)", "Lifecycle"
    • Right click "package", click "Run Maven Build"
  • Sign your module 

That's it!  Go to your Ignition Gateway, add your module, and you're good to go.

For more documentation on writing Ignition modules, check out these resources: