Announcement

Collapse
No announcement yet.

HS3 Plugin Samples

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

    Got plugin somewhat working. It's crashing so I'm commenting lines until the crashes stop.
    Mind numbing. I was surprised when the plugin created so many files, some of which can't be erased until I reboot.

    Anyone know why these files are generated with the exe file?

    HSPI_DENON.exe
    HSPI_DENON.exe.congig
    HSPI_DENON.pdb
    HSPI_DENON.vshost.exe (can't delete this file, runs even after HS3 closes)
    HSPI_DENON.vshost.exe.config
    HSPI_DENON.vshost.exe.manifest
    HSPI_DENON.xml

    Thanks....
    Don

    Comment


      All the. vSHost files are Visual Studio files that are created for debugging and stepping through your code in VS. They won't be there in your 'release' version

      The .config file contains important information about the EXE file and will need to be shipped with your final plugin EXE

      The PDB file also contains debug info and project state info and won't be needed or present in your release version.

      Essentially when you compile the release version in VS you will only need to ship the EXE and .config files (maybe not even the .config - but that's a longer story)

      As for the crashing, rather than commenting out lines, put more try/catch constructs in place to try and catch the exception and report on it in more detail.
      Author of Highpeak Plugins | SMS-Gateway Plugin | Blue Iris Plugin | Paradox (Beta) Plugin | Modbus Plugin | Yamaha Plugin

      Comment


        Excellent advice. Thanks.
        Don

        Comment


          Thanks to all the help, my plugin is getting closer to actually working. Next question. I have made a function public and would like to know the syntax to call it from a script.
          In hs2 the call was something like hs.plugin("Denon").Send("MZ?") How is this done in hs3?
          I am using the IFACE_NAME as "Denon".

          Thanks for the help.
          Don

          Comment


            Code:
            hs.PluginFunction("Denon", "", "Send", New Object(){"MZ?"})
            Cheers,
            Bob
            Web site | Help Desk | Feature Requests | Message Board

            Comment


              Ahhh,,, Thanks Bob.
              Don

              Comment


                OK, yet another question.
                Using MS Visual Studio 2010 on my dev machine, and my prototype works well on this machine. XP 32bit. When I move the files to my production computer AMD 64 bit w/ WIN7 the plugin crashes with no entries in the log.

                Is there some magic to compile for a 64 bit machine, or is there something else going on here?

                Thanks
                Don

                Comment


                  When you go into the project properties click compile and then look at the box titled platform, try messing with the options to compile for any CPU rather than x86. There could be other errors as well depending on if you are relying on any external DLL's that might not be 64 bit compatible.

                  Comment


                    OK, see what you mean. Will give it a try.

                    Thanks.
                    Don

                    Comment


                      Still not successful. I have tried to tweak 'any CPU' '(active) any CPU'... I tried referencing both local HomeseerAPI.dll,Scheduler.dll and HSCF.dll on the target machine to no avail. Ironically, I have a 64 bit laptop with HS3 on it that I can successfully load my plugin.

                      No errors, appear in the log.

                      I can't be the only one having this problem. (Well, I hope not)
                      Don

                      Comment


                        Post some of the errors your compiler is throwing up. That might make it easier to spot what is going wrong.
                        Nicolai L

                        Comment


                          Unfortunately, I'm not getting any error messages, aside from HS3, and that isn't helpful.

                          Here are my VB Express settings and the only error message.

                          Thanks for taking the time to respond.
                          Attached Files
                          Don

                          Comment


                            When you enable developer mode and the console window pops up does it say how far it has got before erroring? You might have to put a load of debug statements in to try and find where the error is coming from as I think that Fatal error is a bit vague and people have seen it in different circumstances.

                            Comment


                              Great idea Adam. Went by too fast to read, so I went into cmd mode and got an error message. Tried using the PIPE command (hspi_Denon.exe > don.txt) but wouldn't output to a file, so this is roughly what I got.

                              Unhandled Exception: System.TypeInitaializationException: The type initializer for 'HSPI_DENON.Main' threw an exception. -->SystemBadImageFormatException: Could not load file ao assemply 'Scheduler, Version=3.0.0.0 Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
                              atHSPI_DENON.plugin..ctor()
                              at HSPI_DENON.Main..cctor() in C\HS3 Development\HSPI_DENON\main.vb:line 13

                              --End of inner exception stack trace ---
                              at SHPI_DENON.Main.Main()

                              Seems like it doesn't like something about the Schedluler.dll...

                              Any ideas?

                              Thanks;
                              Don

                              Comment


                                Are you compiling for a 64-bit CPU? Scheduler.dll is 32-bit. Also, in your project references, do you have 'copy locall' set to true?
                                Author of Highpeak Plugins | SMS-Gateway Plugin | Blue Iris Plugin | Paradox (Beta) Plugin | Modbus Plugin | Yamaha Plugin

                                Comment

                                Working...
                                X