Thursday, October 16, 2014

win Remote Control - JavaScript Hello World

winRemoteControl is a JavaScript based framework to create Remote Control or Dashboard for the Internet Of Things. For now it support only iOS (It is written in C# and is portable to Android, Windows, MacOs and Linux).

Here is the Hello World program.
/*
 * winRemoteControl - Hello World
 */

// Create a button PrintHelloWorld in the remote
function PrintHelloWorld() {

    this.Type   = "Button"; // Optional Control Type
    this.Height = 75; // Optional Control Height
    this.Text   = "Print Hello World"; // Control Text
    
    this.run = function() { // Executed when the button is touched

        var msg = "Hello World!";
        this.notify( msg, new Date());
        this.getLabel1().setText(msg);
        return true;
    }
}
// Create a label in the remote
function Label1() {

    this.Type = "Label";
    this.Text = "Ready...";
}

// Remote Implementation
function Remote() {

    this.initialize = function() {
        this.Actions = {
            PrintHelloWorld : PrintHelloWorld,
            Label1         : Label1,
        }
        this.Text              = "My Hello World"; // Remote Text
        this.ControlGap        = 60;
        this.ControlYStart     = 120;
        this.RequireComputerIp = false; // This remote does not talk to any thing
    };
}


No comments:

Post a Comment