Page 1 of 7 1234567 LastLast
Results 1 to 10 of 63

Thread: MDX and COM big update

  1. #1
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,045

    MDX and COM big update

    Ok, MDX now has the ability to control programs through their COM interface as well as be controlled by other programs through the MDX COM interface.

    New FCC here: <EDIT> Built into MDX now </EDIT>

    <EDIT> See post #13 for more syntax details</EDIT>

    There are still some little things I need to clean up for a full update through the updater, but it should be stable.

    So changes to the com section of the xml file. There are now 2 sections like below:

    Code:
    <?xml version="1.0" encoding="utf-8" ?>
    <FusionControlCentreConfiguration ...>
       ...
      <require>
         ...
      </require>
    
      <speech ...>
         ...
      </speech>
    
      <general>
         ...
        <com status="enabled">
          <commands>
            <command id="RoadRunnerCommand" minimum_delta_vote_time="100">
              <do function="trigger output" functionTargetID="Digital Output 0" vote_opinion="on" vote_priority="medium"></do>
              <do function="trigger output" functionTargetID="Digital Output 1" vote_opinion="on" vote_priority="medium"></do>
            </command>
          </commands>
          <executable_commands>
            <external_COM_id id="RoadRunner.SDK">
              <command internal_id="RoadRunnerCommand_PLAY" external_command="Execute">
                <parameter order="0" external_command_parameter="PLAY" />
              </command>
            </external_COM_id>
          </executable_commands>
        </com>
         ...
      </general>
    
      <graphics>
         ...
      </graphics>
    
      <io>
         ...
      </io>
    
      <logic>
         ...
      </logic>
       ...
    </FusionControlCentreConfiguration>
    Notice the bold section. This is what has been added. Also I am hoping that the xml structure being fully outlined will be easier for people to see what's going on and where this code is in relation to the root.

    Every external_COM_id is a different program. You could have multiple external_COM_id pointing to the same program, but that could cause instance problems, and would take more memory and defeat the purpose.

    In the external_COM_id the id is what the external program needs to be referenced as. In the case of RoadRunner, it is "RoadRunner.SDK". I havent experimented with it enough to know if RR needs it to be case sensitive, but MDX will honour case for everything in this section.

    Child nodes of external_COM_id are the commands that MDX will send. Each command has an internal and external command name.

    Internal is what is used by MDX to find this specific command pointing to this specific program and with these specific parameters.

    The external is what is required by the external program. With RoadRunner, it is "Execute" as far as I know and it works with the build I have.

    The parameters are each child node of command labelled parameter. The order they are based off of is the number in the order attribute, NOT the order in which they appear in the file to allow for greater expandability.

    Now to call this code and have the command send to the program (in this case Execute("PLAY") being sent to RoadRunner), you need to raise a vote with the function of "external command" and the functionTargetID of "RoadRunnerCommand_PLAY". The rest of the vote options need to be filled with filler such as below where a button will call the command to run causing RR to intercept a "PLAY" command.

    Code:
          <button id="BUTTON_COM_TEST" enabled="yes" function="external command" functionTargetID="roadrunnercommand_play" vote="filler" vote_opinion="filler" vote_priority="Medium">
            <images imagePrimary="content\images\button_images\button_down.png" imageSecondary="content\images\button_images\button.png" imageDisabled="content\images\button_images\button.png" imagePushed="content\images\button_images\button_down.png"></images>
            <display size="230,70" location="37,119" page="0" z_order="0.9"></display>
            <vote_options minimum_delta_vote_time_down="20" ></vote_options>
            <text font="verdana" font_size="25"></text>
            <text colourPrimaryARGB="255,255,255,255" textPrimary="COM_Test"></text>
            <text colourSecondaryARGB="255,255,255,255" textSecondary="COM_Test"></text>
          </button>
    That should do it.

    And odd yet not unpleasant side effect of the new code is that if you have RoadRunner being the object getting commands passed to like above, RR will start with MDX if it is not already running. Sort of spiffy and unexpected.

    If you have questions, ask.
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  2. #2
    Low Bitrate bigbuffs's Avatar
    Join Date
    Nov 2007
    Posts
    109
    Like usual I'm a little confused by the new code but I'm not very good at writing and understanding this stuff. How would I get this to send my steering wheel controls to RR.

    Using the configurator, everything I send goes under the logic section, will I not be using that anymore? Also, is there a way to use the configurator for this new setup or will I have to write the code myself (with help from you guys obviously)?
    [||||||----] - 60% Complete

  3. #3
    Variable Bitrate dhantiflag's Avatar
    Join Date
    Nov 2006
    Location
    Mentor, OHIO
    Posts
    384
    Quote Originally Posted by bigbuffs View Post
    Like usual I'm a little confused by the new code but I'm not very good at writing and understanding this stuff. How would I get this to send my steering wheel controls to RR.

    Using the configurator, everything I send goes under the logic section, will I not be using that anymore? Also, is there a way to use the configurator for this new setup or will I have to write the code myself (with help from you guys obviously)?

  4. #4
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,045
    This is not in the configurator. None of the COM is. I am working on it this weekend, but I have 3 classes this semester where the professor thinks he/she teaches the only class worthwhile and therefore gives more homework than ever possible to do...


    Anyways,

    The first code segment is what "defines" the command. It you wanted to add a second command to RR (such as "STOP"), it would be:

    Code:
            <external_COM_id id="RoadRunner.SDK">
              <command internal_id="RoadRunnerCommand_PLAY" external_command="Execute">
                <parameter order="0" external_command_parameter="PLAY" />
              </command>
              <command internal_id="RoadRunnerCommand_STOP" external_command="Execute">
                <parameter order="0" external_command_parameter="STOP" />
              </command>
            </external_COM_id>
    The second code is how to call it. That displays a button that you click. You click it and it votes exactly like before. The vote however, is to do the "roadrunnercommand_play" that was defined above. So it will send "PLAY" to "RoadRunner.SDK".

    If you want to do it from a logic statement, then in the vote area it would look just like the buttons vote area.
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  5. #5
    Low Bitrate bigbuffs's Avatar
    Join Date
    Nov 2007
    Posts
    109
    first of all your doing an awesome job with MDX its come a long way in a short period of time.

    I see what you're saying but what if I don't want a button in mdx but I want a button on my SWC to send the "PLAY" command to RR. Can I do this using the new COM integration?

    The code I am trying to use know is something like this
    Code:
    <if fire_on="logic" minimum_delta_vote_time="100">
    - <boolean_operation type="and">
    - <parameter1>
    - <boolean_operation type="less than">
    - <parameter1>
    <analogue id="swc" time="0" />
    </parameter1>
    - <parameter2>
    <number>1.9</number>
    </parameter2>
    </boolean_operation>
    </parameter1>
    - <parameter2>
    - <boolean_operation type="greater than">
    - <parameter1>
    <analogue id="swc" time="0" />
    </parameter1>
    - <parameter2>
    <number>1.2</number>
    </parameter2>
    </boolean_operation>
    </parameter2>
    </boolean_operation>
    - <then>
    <do function="Send Key" functionTargetID="winamp" vote_opinion="NUM6" vote_priority="Medium" />
    </then>
    </if>
    [||||||----] - 60% Complete

  6. #6
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,045
    Like I said, if you want to send it from a logic statement like what you want to do, use the same vote options.

    so in your do code instead of "send key" it should be "external command". Instead of the targetID being "winamp" it should be "roadrunnercommand_play" if using the example uptop.
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  7. #7
    Low Bitrate bigbuffs's Avatar
    Join Date
    Nov 2007
    Posts
    109
    OK I think I'm starting to understand. I'll probably try to get it up and running in the morning and write some code and I'll post back after that doesn't work. Thanks again for the help.
    [||||||----] - 60% Complete

  8. #8
    Maximum Bitrate Woofnstuff's Avatar
    Join Date
    Oct 2007
    Location
    Auckland
    Posts
    570
    so in theory any command in that RR can accept via a button push in the skin, you can now trigger via the MDX?

    thats great... and exactly what I've been waiting for thanks

  9. #9
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,045
    Quote Originally Posted by Woofnstuff View Post
    so in theory any command in that RR can accept via a button push in the skin, you can now trigger via the MDX?

    thats great... and exactly what I've been waiting for thanks
    Not just theory, but in practice. Any command that RR can interpret, will work
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  10. #10
    Maximum Bitrate Woofnstuff's Avatar
    Join Date
    Oct 2007
    Location
    Auckland
    Posts
    570
    Sweet!!!

Page 1 of 7 1234567 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •