Page 1 of 8 123 ... LastLast
Results 1 to 10 of 79

Thread: DMplugin Controls

  1. #1
    Join Date
    Mar 2005
    Posts
    726

    Default DMplugin Controls

    question the example dmplugin doesn't have anything in it for controls after I create a device is there an example somewhere on how to create the controls?

  2. #2
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,553

    Default

    have a look at lua\pio1\plugins.js around line 66. There a device is created with several controls.
    Ron
    No support through PM

  3. #3
    Join Date
    Mar 2005
    Posts
    726

    Default

    cool thanks

  4. #4
    Join Date
    Mar 2005
    Posts
    726

    Default

    ok I have looked in the plugins.js file

    I found these wguch I assume are the controls but when I add them to my js file I still don't have a add controls option is there somewhere else in the plugin it has to be referenced?

    Code:
    var control = new Promixis.Control(device);
    		control.name = "IR 1";
    		control.internalId = "IR1";
    		control.dtype = Promixis.Control.CCF;

    Thanks,
    yonu

  5. #5
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,553

    Default

    aah i see.

    1. set flag for CanCreateControl
    Code:
        Plugin.prototype.flags = function ( object ) {
        
            return IGirderComponentManager.DeviceEditor |             
                IGirderComponentManager.CanCreateDevice|
                IGirderComponentManager.CanCreateControl|
                IGirderComponentManager.CanDeleteDevice | 
                IGirderComponentManager.CanDeleteComponent;
        };
    Then add a function that will do this:

    Code:
    Plugin.prototype.newControl = function ( device, parent, manager ) {
    
            parent.windowTitle = "Add Control";       
            var ui = gir.ui("pio1/newControl.ui", parent);  // you have to make this! 
    
            var control = new Promixis.Control(device);
            control.name = "IR 1";
            control.internalId = "IR1";
            control.dtype = Promixis.Control.CCF;
    
            ui.widget.cancelButton.clicked.connect( function () {
                ui.close();
            });
            
            ui.widget.okButton.clicked.connect( function () {
                manager.saveDevice(device, "UI");
                ui.close();
            });
            
            return ui;
    
    }
    I believe this should do it.
    Ron
    No support through PM

  6. #6
    Join Date
    Mar 2005
    Posts
    726

    Default

    that works to get the add button to come up but since there is no newcontrol.ui in pio1 is there an example somewhere of a control.ui?

    Thanks,
    Yonu

  7. #7
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,553

    Default

    Yeah just look at newDevice.ui and make it appropriate to your hardware.
    Ron
    No support through PM

  8. #8
    Join Date
    Mar 2005
    Posts
    726

    Default

    ok thanks I assumed the control ui stuff was different from the device stuff

  9. #9
    Join Date
    Mar 2005
    Posts
    726

    Default

    ok one more question for you and I should have this sorted out if I use control.dtype = Promixis.Control.TOGGLE where would I put my code to control the device on a state change.?

    Thanks,
    yonu

  10. #10
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,553

    Default

    There are two paths possible here.

    1. The user somehow requests and you need to update the hardware
    2. The hardware changed it self and you need to notify the device manager


    1. Look at the file device.lua in PIO1 or globalcache. The function "onControlValueChangeRequest" will be called

    2. Look at the file device.lua in globalcache. The function "handleDEVICEEvent" is called by the driver when the hardware changes "STATECHANGE" and it then sets control.ccontrol.hardwareValue = id
    Ron
    No support through PM

Page 1 of 8 123 ... LastLast

Posting Permissions

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