radio button sensor input

Is there a way to have radio button as our sensor input? is there any example of it?

Comments

  • Hello -

    I believe what you are asking about is a Hardware Pins simulator. In other words, you'd like your simulator BLL to provide custom controls you can use to control the sensor input.

    KinomaJS provides robust support for Hardware Pins simulators. Both Data Driven and Custom simulators are supported. Please refer to this tech note for details.

    One option could be to use a simple boolean input Data Driven simulator with a manual switch button. The data driven simulators don't require implementing any UI code.

    All our hardware pins sample apps include simulator BLLs. If you'd like to build a simulator BLL with custom UI, the i2c-touchshield app implements a custom simulator BLL and could be used for reference.

    Regards, Brian

  • Thanks! that's very helpful!

  • by the way, still on the Hardware Pins simulator question, how can I have a text box/ virtual keyboard for string input?

  • Hello -

    Using a custom simulator you have the option to display whatever you'd like. You can even display the Kinoma Create virtual keyboard and it's text field. :-)

    Using the serial-7segment-display sample app as a guide, I was able to display the virtual keyboard from my simulator BLL. The serial-7segment-display app shows how to display the keyboard. Here is what I did in my simulator BLL:

    var THEME = require ("themes/flat/theme");
    var CONTROL = require ("mobile/control");
    var KEYBOARD = require("creations/keyboard");
    var PinsSimulators = require ("PinsSimulators");
    
    // Behavior used to install the KeyboardContainer
    var KeyboardBehavior = function(column, data) {
        Behavior.call(this, column, data);
    }
    KeyboardBehavior.prototype = Object.create(Behavior.prototype, {
        onCreate: { value: function(column, data) {
            column.partContentsContainer.add(new KeyboardContainer(data)); 
        }},
    });
    
    // KeyboardContainer with the header hidden
    var KeyboardContainer = Container.template(function($) { return {
        left:0, right:0, top:0, bottom:0,
        skin: new Skin({fill: "white"}),
        contents: [
            KEYBOARD.KeyboardScreen($, {
            behavior: Object.create(KEYBOARD.KeyboardScreenBehavior.prototype, {
                onDisplaying: { value: function(container) {
                    KEYBOARD.KeyboardScreenBehavior.prototype.onDisplaying.call(this, container);
                    container.first.visible = false;                
                                }},
                onKeyboardEnter: { value: function(container, input) {
                    trace("Text: " + input + "\n");
                }}
                        })
                })
            ],
    }});
    
    exports.configure = function(configuration) {
        this.data = {
        id: '',
        behavior: KeyboardBehavior,
        header : { 
            label : "Example", 
            name : "Virtual Keyboard", 
        },
    
                // Required properties to initialize the keyboard
        title: "Keyboard",
        okLabel: "OK",
        cancelLabel: "Cancel",
        previousText: "",
        keyboard: KEYBOARD.standardKeyboard,
        hintText: "Enter text"
    };
    this.container = shell.delegate("addSimulatorPart", this.data);
    }
    

    Regards, Brian

  • Thank you so much!

  • by the way, can you also show me your code for the server, please? I do not know how to integrate it to my server side application

Sign In or Register to comment.