Announcement

Collapse
No announcement yet.

MonkeyBoard Dab/FM dev board scripting

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MonkeyBoard Dab/FM dev board scripting

    I have been looking for a cheap FM/Dab tuner to integrate with my Whole House Audio system.

    I have purchased one of these development boards:-

    http://www.monkeyboard.org/products/...ment-board-pro

    I am hoping to do write some simple scripts to interface with the module, it is supplied with a sample program which I am going to use to setup the FM/Dab stations. I am then planning on using scripts to select Presets display station info etc.

    The support seems pretty good they have provided me with plenty of documentation and seem to be willing to help.

    They supply a dll file for control of the module, can anyone provide an example of calling a dll file, or give a basic overview to the process?

  • #2
    not a .net DLL file, as such you can't reference it for use in a HomeSeer script (I am pretty sure of this, although if anyone else knows different). It appears that the DLL is WIN32 based (I think based on looking at it through Dependency Walker) and I have had this situation before about getting data into HS. For me it was a temperature sensor board and in that situation I had to write a plugin to get around the issue, I ended up end up battling against different data types in different languages.

    I would say you have three choices;

    1) Take apart and copy their example application, include a method to connect to HomeSeer and have it sending data to and from. Downside is that it is probably a fair amount of work and would not be that much less work than a plugin and then you end up with an additional application you need to keep in track with the rest of HS. Limits you from HS actions/triggers.

    2) Write your own .net dll - potentially quite difficult as I am not sure the serial protocol is available (?) and may be considerable effort for little real gain other than being able to make scripting easier. You could search around to see if there is a .net DLL out there for it already.

    3) Write a HS plugin, about the best solution with a good head start from the example code they give. Not a trivial task by any means but a great achievement when you get one running and working correctly. You could then implement things like the Media API and have a good interface between the device and HS. I'd keep it as single instance but guess there is nothing stopping you having a multi instance plugin.
    My Plugins:

    Pushover 3P | DoorBird 3P | Current Cost 3P | Velleman K8055 3P | LAMetric 3P | Garadget 3P | Hive 3P |
    Yeelight 3P | Nanoleaf 3P

    Comment


    • #3
      Mr Happy,

      Thanks for the comprehensive reply.

      I agree the board is pricey, I was looking for a radio board I could reliably communicate with, I have used IR with mixed results and didnt want to spend allot on a tuner with rs232 built in.

      I think I have a VB.Net dll available for the board along with the VB.NET sample code, I have been reading through the various functions built into the board and think I can make a workable interface with what I have. I will check this with support.

      I should get the board in the next few days and then I can start trying out the scripting.

      Some questions you may be able to help me with,

      1. Do I include the keystonecomm.dll in scripting references? And if so is the dll placed in the HS3 directory?

      2. When I declare the functions I want to use from the dll, do I do this everytime I use the function from within a sub or can I call all the functions on startup for example.

      3. For retrieving data from the module for example on the current program info etc, is there an easy way vs directly calling the functions to retrieve the info. I see the sample code uses threads to achieve this but I don't fully understand how to implement.

      Thanks

      Comment


      • #4
        Originally posted by cabbage View Post
        Mr Happy,

        Thanks for the comprehensive reply.

        I agree the board is pricey, I was looking for a radio board I could reliably communicate with, I have used IR with mixed results and didnt want to spend allot on a tuner with rs232 built in.

        I think I have a VB.Net dll available for the board along with the VB.NET sample code, I have been reading through the various functions built into the board and think I can make a workable interface with what I have. I will check this with support.

        I should get the board in the next few days and then I can start trying out the scripting.

        Some questions you may be able to help me with,

        1. Do I include the keystonecomm.dll in scripting references? And if so is the dll placed in the HS3 directory?

        2. When I declare the functions I want to use from the dll, do I do this everytime I use the function from within a sub or can I call all the functions on startup for example.

        3. For retrieving data from the module for example on the current program info etc, is there an easy way vs directly calling the functions to retrieve the info. I see the sample code uses threads to achieve this but I don't fully understand how to implement.

        Thanks
        The DLL with the sample app is not a .net DLL (appears to use older Win32 calls which is odd considering it's not that old) - do you have another one? It won't work in the scripting references entry in the settings.ini file I'm pretty certain of it. You can discount scripting with it from what I can work out, you would need one of those methods I posted.

        It might need threading also which is a minefield, you might be able to get away without it I don't know I didn't look through it that closely but did see it seemed to start one for some interrupt I think.

        You would reference the functions at the top in your application/plugin just once.
        My Plugins:

        Pushover 3P | DoorBird 3P | Current Cost 3P | Velleman K8055 3P | LAMetric 3P | Garadget 3P | Hive 3P |
        Yeelight 3P | Nanoleaf 3P

        Comment


        • #5
          Mr Happy,

          I have 2 dll files but from what I can see they are both Win32. The response from support is below:-

          Calling the keystonecomm.dll from HS plugin will be the best method if you are willing to write the HS plugin. In Windows, DLL can be called by any application, .net or not .net

          The DLL that we provide, has been successfully being used by C#, VB.net, Python, LabView and etc.
          ...
          .
          So I will see how it goes today,

          When you purchase the board they provide serial commands etc so I will have a backup plan if the dll doesn't work.

          Thanks again.

          Comment


          • #6
            Originally posted by cabbage View Post
            Mr Happy,

            I have 2 dll files but from what I can see they are both Win32. The response from support is below:-

            Calling the keystonecomm.dll from HS plugin will be the best method if you are willing to write the HS plugin. In Windows, DLL can be called by any application, .net or not .net

            The DLL that we provide, has been successfully being used by C#, VB.net, Python, LabView and etc.
            ...
            .
            So I will see how it goes today,

            When you purchase the board they provide serial commands etc so I will have a backup plan if the dll doesn't work.

            Thanks again.
            Ill see if I can get the dll referenced in a script and let you know, I'm not hopeful but you never know. It certainly can be called from .net but I don't think with the methods HS allow you to do that. If the serial protocol is easy enough then I think I would just avoid using it.
            My Plugins:

            Pushover 3P | DoorBird 3P | Current Cost 3P | Velleman K8055 3P | LAMetric 3P | Garadget 3P | Hive 3P |
            Yeelight 3P | Nanoleaf 3P

            Comment


            • #7
              I have just received the module.

              I have it working with the sample program, I have some simple functions setup in a script but I am unsure as to where I can put the function calls to the DLL. Any Ideas?

              Comment


              • #8
                Originally posted by cabbage View Post
                I have just received the module.

                I have it working with the sample program, I have some simple functions setup in a script but I am unsure as to where I can put the function calls to the DLL. Any Ideas?
                I think I'll have to accept I was wrong, if only I discovered this many years ago I may have saved myself considerable time writing some plugins...It appears you can use non .net DLL's, quite how easy it is going to be in practice in a HS script is anyones guess.

                Copy the declare functions from the example app to above Sub Main in your script, drop the DLL into your HS folder. Call the functions and I can get CommVersion to work and return a value, without the device I can't do anything more. I don't understand why and what it is doing with the COM port as OpenRadioPort seems to want a string passed to it but for some reason the example app references the .net IO.ports namespace, could just be to get a list of the available ports or something.
                My Plugins:

                Pushover 3P | DoorBird 3P | Current Cost 3P | Velleman K8055 3P | LAMetric 3P | Garadget 3P | Hive 3P |
                Yeelight 3P | Nanoleaf 3P

                Comment


                • #9
                  Yes you can declare dll's in scripts.

                  For example, the Maxibee IO board I used to use had the dll's declared as:

                  PHP Code:
                  Declare Function InitMbee Lib "mxb.dll" () As Boolean
                  Declare Function SetOutputs Lib "mxb.dll" (ByVal outputs As Long) As Boolean


                  Sub Main
                  (ByVal Data As String)
                  .... 
                  Jon

                  Comment


                  • #10
                    MrHappy, Jon,

                    I have got a somewhat working script now thanks for your help.

                    I can call presets and get the radio mode, signal strength etc, just a few more things to implement and I will have a useable radio interface...

                    Cabbage

                    Comment


                    • #11
                      Because a number of stations are changing from DAB to DAB+, my existing method for whole house listening of DAB transmissions is coming to an end. So I purchased a Monkeyboard DAB and wrote a plugin for it.

                      DAB & DAB+ is the equivalent of HD Radio in the USA and available in Europe, China, Australia etc. Details here: https://en.wikipedia.org/wiki/Countries_using_DAB/DMB

                      Since this is highly specialist, I don't intend to publish this, however if you discover this post and want a copy, please contact me. You will need a MonkeyBoard DAB board available from https://coolcomponents.co.uk/product...with-slideshow or http://www.cartft.com/en/catalog/il/1618 or https://www.littlebirdelectronics.com.au/monkey-board
                      Attached Files
                      Last edited by jon00; November 27th, 2017, 06:53 AM.
                      Jon

                      Comment

                      Working...
                      X