Announcement

Collapse
No announcement yet.

Creating/Porting plug-ins for Linux

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating/Porting plug-ins for Linux

    Plugin development notes for developing or converting a plugin for use on Linux.

    The plugins for Linux are EXE plugins, just like Windows. You should be able to supply one plugin that works for both. For example, our HSTouch plugin and X10 plugin are the same for both. The biggest change for Linux is that all filepaths are "/" rather than "\". There is an hs. call you make to HS to find out if you are running on Windows or Linux. We have a function called "FixPath(path)" that simply swaps the slashes.

    We do have 2 Z-Wave plugins, but that is because the plugin supports HID devices which is Windows specific, so in the Z-Wave version that is removed.

    Also, there is no windows forms, or least we don't depend on them, so you need to wrap any "Application." calls in a class that handles each OS.

    There is no "Err" and "Erl" object so you need to wrap those. (mainly used to display line numbers)

    To see how close your plugin is, run it through the MOMA app (runs on Windows) and it will point out any .net calls that are not in MONO. Get the app here:

    http://www.mono-project.com/MoMA

    When you build for Linux, you can build for "Any CPU", although building for X86 seems to work anyway.

    When using COM ports, note that there is a bug in the MONO serialport class where if you try to open a non-existent com port, the finalizer on the serialport class throws an exception. The finalizer is run in it's own thread so there is no way to catch this. The fix is to make sure the file exists. In Linux, COM ports are files like "/dev/ttyUSB0". Do this check only if you are on Linux. Here is an example:

    Code:
    If hs.GetOSType = eOSType.linux Then
                        If Not System.IO.File.Exists(port) Then
                            hs.WriteLog(IFACE_NAME, "Cannot open com port, port does not exist: " & port)
                            gInterfaceStatus.intStatus = IPlugInAPI.enumInterfaceStatus.WARNING
                            gInterfaceStatus.sStatus = "Cannot Open Port."
                            Return "Cannot open com port"
                        End If
                    End If
                    ' now its ok to open the port
    website | buy now | support | youtube

  • #2
    Mono profile?

    Which profile should we be testing against? The two choices as of today are:
    • Mono 2.8 (4.0 profile)
    • Mono 2.8 (2.0 profile)


    When I run my new plug-in through the 2.0 profile, it gets all green checks. When I run it through the 4.0 profile, there are 339 missing methods, but many of them appear to be pretty basic (like ToString on some objects).

    Comment


    • #3
      We use .NET 4 with HS3, but if you are compatible with 2.0 is should work ok.

      Originally posted by shill View Post
      Which profile should we be testing against? The two choices as of today are:
      • Mono 2.8 (4.0 profile)
      • Mono 2.8 (2.0 profile)


      When I run my new plug-in through the 2.0 profile, it gets all green checks. When I run it through the 4.0 profile, there are 339 missing methods, but many of them appear to be pretty basic (like ToString on some objects).
      website | buy now | support | youtube

      Comment


      • #4
        Originally posted by rjh View Post
        We use .NET 4 with HS3, but if you are compatible with 2.0 is should work ok.
        As an interesting note, using MOMA's "4.0 profile", the X10 plugin throws up 1219 missing methods, so the right answer must be "2.0"

        Comment


        • #5
          C# ASP "plugin" on Linux

          I'm trying to use a few ASP pages written by others on my HS3 installation on Ubuntu. I drop them in the html directory and the VB ones seem to work but I get a compiler error whenever I try a C# page. As an example, the Rest API script won't compile.

          Is there some type of configuration I need to make to enable C# support?

          Thanks!

          Comment

          Working...
          X