SmartRemote door E9
Dependencies: EthernetInterface HTTPServer RemoteIR SDFileSystem mbed-rpc mbed-rtos mbed
Fork of SmartRemote by
SupportingFiles/mbedRPC.js.txt@16:2d23297857bc, 2013-12-04 (annotated)
- Committer:
- sammacjunkie
- Date:
- Wed Dec 04 17:44:29 2013 +0000
- Revision:
- 16:2d23297857bc
MY HANDS ARE TYPING WORDS!; ; -also we fixed the transmit function from database; -in SupportingFiles folder is the HTML file and its javascript library for the webserver side
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sammacjunkie | 16:2d23297857bc | 1 | // mbedRPC Javascript Interface using HTTP |
sammacjunkie | 16:2d23297857bc | 2 | // sford and M Walker |
sammacjunkie | 16:2d23297857bc | 3 | // A javascript interface for talking to mbed rpc over http |
sammacjunkie | 16:2d23297857bc | 4 | // |
sammacjunkie | 16:2d23297857bc | 5 | //Copyright (c) 2010 ARM Ltd |
sammacjunkie | 16:2d23297857bc | 6 | // |
sammacjunkie | 16:2d23297857bc | 7 | //Permission is hereby granted, free of charge, to any person obtaining a copy |
sammacjunkie | 16:2d23297857bc | 8 | //of this software and associated documentation files (the "Software"), to deal |
sammacjunkie | 16:2d23297857bc | 9 | //in the Software without restriction, including without limitation the rights |
sammacjunkie | 16:2d23297857bc | 10 | //to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
sammacjunkie | 16:2d23297857bc | 11 | //copies of the Software, and to permit persons to whom the Software is |
sammacjunkie | 16:2d23297857bc | 12 | //furnished to do so, subject to the following conditions: |
sammacjunkie | 16:2d23297857bc | 13 | // |
sammacjunkie | 16:2d23297857bc | 14 | //The above copyright notice and this permission notice shall be included in |
sammacjunkie | 16:2d23297857bc | 15 | //all copies or substantial portions of the Software. |
sammacjunkie | 16:2d23297857bc | 16 | // |
sammacjunkie | 16:2d23297857bc | 17 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
sammacjunkie | 16:2d23297857bc | 18 | //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
sammacjunkie | 16:2d23297857bc | 19 | //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
sammacjunkie | 16:2d23297857bc | 20 | //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
sammacjunkie | 16:2d23297857bc | 21 | //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
sammacjunkie | 16:2d23297857bc | 22 | //OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
sammacjunkie | 16:2d23297857bc | 23 | //THE SOFTWARE. |
sammacjunkie | 16:2d23297857bc | 24 | |
sammacjunkie | 16:2d23297857bc | 25 | |
sammacjunkie | 16:2d23297857bc | 26 | //Transport Mechanisms --------------------------------------------------------------- |
sammacjunkie | 16:2d23297857bc | 27 | |
sammacjunkie | 16:2d23297857bc | 28 | function post(url) { |
sammacjunkie | 16:2d23297857bc | 29 | http = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); |
sammacjunkie | 16:2d23297857bc | 30 | if(!http) return false; |
sammacjunkie | 16:2d23297857bc | 31 | http.open("GET", url, false); |
sammacjunkie | 16:2d23297857bc | 32 | http.send(null); |
sammacjunkie | 16:2d23297857bc | 33 | return http.responseText; |
sammacjunkie | 16:2d23297857bc | 34 | |
sammacjunkie | 16:2d23297857bc | 35 | } |
sammacjunkie | 16:2d23297857bc | 36 | |
sammacjunkie | 16:2d23297857bc | 37 | function mbed(){ |
sammacjunkie | 16:2d23297857bc | 38 | //No action needs to be taken |
sammacjunkie | 16:2d23297857bc | 39 | } |
sammacjunkie | 16:2d23297857bc | 40 | |
sammacjunkie | 16:2d23297857bc | 41 | mbed.prototype.rpc = function(object, method, arguments){ |
sammacjunkie | 16:2d23297857bc | 42 | //This should be overridden by the a transport mechanism |
sammacjunkie | 16:2d23297857bc | 43 | } |
sammacjunkie | 16:2d23297857bc | 44 | |
sammacjunkie | 16:2d23297857bc | 45 | HTTPRPC.prototype = new mbed(); |
sammacjunkie | 16:2d23297857bc | 46 | HTTPRPC.prototype.constructor = HTTPRPC |
sammacjunkie | 16:2d23297857bc | 47 | function HTTPRPC(){ |
sammacjunkie | 16:2d23297857bc | 48 | //unlike other languages this doesn't need to be passed an address as it will only be allowed to communicate with itself |
sammacjunkie | 16:2d23297857bc | 49 | } |
sammacjunkie | 16:2d23297857bc | 50 | |
sammacjunkie | 16:2d23297857bc | 51 | |
sammacjunkie | 16:2d23297857bc | 52 | HTTPRPC.prototype.rpc= function(object, method, arguments) { |
sammacjunkie | 16:2d23297857bc | 53 | return post("/rpc/" + object + "/" + method + " " + arguments.join(",")); |
sammacjunkie | 16:2d23297857bc | 54 | } |
sammacjunkie | 16:2d23297857bc | 55 | |
sammacjunkie | 16:2d23297857bc | 56 | // Pin Names to Allow pins to be reffered to as a type rather than a string or number |
sammacjunkie | 16:2d23297857bc | 57 | |
sammacjunkie | 16:2d23297857bc | 58 | function pin(name){ |
sammacjunkie | 16:2d23297857bc | 59 | this._name = name; |
sammacjunkie | 16:2d23297857bc | 60 | } |
sammacjunkie | 16:2d23297857bc | 61 | |
sammacjunkie | 16:2d23297857bc | 62 | LED1 = new pin("LED1"); |
sammacjunkie | 16:2d23297857bc | 63 | LED2 = new pin("LED2"); |
sammacjunkie | 16:2d23297857bc | 64 | LED3 = new pin("LED3"); |
sammacjunkie | 16:2d23297857bc | 65 | LED4 = new pin("LED4"); |
sammacjunkie | 16:2d23297857bc | 66 | |
sammacjunkie | 16:2d23297857bc | 67 | p5 = new pin("p5"); |
sammacjunkie | 16:2d23297857bc | 68 | p6 = new pin("p6"); |
sammacjunkie | 16:2d23297857bc | 69 | p7 = new pin("p7"); |
sammacjunkie | 16:2d23297857bc | 70 | p8 = new pin("p8"); |
sammacjunkie | 16:2d23297857bc | 71 | p9 = new pin("p9"); |
sammacjunkie | 16:2d23297857bc | 72 | p10 = new pin("p10"); |
sammacjunkie | 16:2d23297857bc | 73 | p11 = new pin("p11"); |
sammacjunkie | 16:2d23297857bc | 74 | p12 = new pin("p12"); |
sammacjunkie | 16:2d23297857bc | 75 | p13 = new pin("p13"); |
sammacjunkie | 16:2d23297857bc | 76 | p14 = new pin("p14"); |
sammacjunkie | 16:2d23297857bc | 77 | p15 = new pin("p15"); |
sammacjunkie | 16:2d23297857bc | 78 | p16 = new pin("p16"); |
sammacjunkie | 16:2d23297857bc | 79 | p17 = new pin("p17"); |
sammacjunkie | 16:2d23297857bc | 80 | p18 = new pin("p18"); |
sammacjunkie | 16:2d23297857bc | 81 | p19 = new pin("p19"); |
sammacjunkie | 16:2d23297857bc | 82 | p20 = new pin("p20"); |
sammacjunkie | 16:2d23297857bc | 83 | p21 = new pin("p21"); |
sammacjunkie | 16:2d23297857bc | 84 | p22 = new pin("p22"); |
sammacjunkie | 16:2d23297857bc | 85 | p23 = new pin("p23"); |
sammacjunkie | 16:2d23297857bc | 86 | p24 = new pin("p24"); |
sammacjunkie | 16:2d23297857bc | 87 | p25 = new pin("p25"); |
sammacjunkie | 16:2d23297857bc | 88 | p26 = new pin("p26"); |
sammacjunkie | 16:2d23297857bc | 89 | p27 = new pin("p27"); |
sammacjunkie | 16:2d23297857bc | 90 | p28 = new pin("p28"); |
sammacjunkie | 16:2d23297857bc | 91 | p29 = new pin("p29"); |
sammacjunkie | 16:2d23297857bc | 92 | p30 = new pin("p30"); |
sammacjunkie | 16:2d23297857bc | 93 | |
sammacjunkie | 16:2d23297857bc | 94 | |
sammacjunkie | 16:2d23297857bc | 95 | // interface functions ---------------------------------------------------------------- |
sammacjunkie | 16:2d23297857bc | 96 | |
sammacjunkie | 16:2d23297857bc | 97 | //*************************** DigitalOut ************************************************ |
sammacjunkie | 16:2d23297857bc | 98 | |
sammacjunkie | 16:2d23297857bc | 99 | function DigitalOut(this_mbed, mpin) { |
sammacjunkie | 16:2d23297857bc | 100 | if(typeof mpin != "string"){ |
sammacjunkie | 16:2d23297857bc | 101 | //create a new object |
sammacjunkie | 16:2d23297857bc | 102 | this._mbed = this_mbed; |
sammacjunkie | 16:2d23297857bc | 103 | this.name = this_mbed.rpc("DigitalOut", "new", [mpin._name]); |
sammacjunkie | 16:2d23297857bc | 104 | }else{ |
sammacjunkie | 16:2d23297857bc | 105 | //Tie to an existing object |
sammacjunkie | 16:2d23297857bc | 106 | this._mbed = this_mbed; |
sammacjunkie | 16:2d23297857bc | 107 | this.name = mpin; |
sammacjunkie | 16:2d23297857bc | 108 | } |
sammacjunkie | 16:2d23297857bc | 109 | } |
sammacjunkie | 16:2d23297857bc | 110 | |
sammacjunkie | 16:2d23297857bc | 111 | DigitalOut.prototype.write = function(value) { |
sammacjunkie | 16:2d23297857bc | 112 | this._mbed.rpc(this.name, "write", [value]); |
sammacjunkie | 16:2d23297857bc | 113 | } |
sammacjunkie | 16:2d23297857bc | 114 | |
sammacjunkie | 16:2d23297857bc | 115 | DigitalOut.prototype.read = function() { |
sammacjunkie | 16:2d23297857bc | 116 | return parseInt(this._mbed.rpc(this.name, "read", [""])); |
sammacjunkie | 16:2d23297857bc | 117 | } |
sammacjunkie | 16:2d23297857bc | 118 | //*************************** DigitalIn ************************************************ |
sammacjunkie | 16:2d23297857bc | 119 | |
sammacjunkie | 16:2d23297857bc | 120 | function DigitalIn(this_mbed, mpin) { |
sammacjunkie | 16:2d23297857bc | 121 | if(typeof mpin != "string"){ |
sammacjunkie | 16:2d23297857bc | 122 | //create a new object |
sammacjunkie | 16:2d23297857bc | 123 | this._mbed = this_mbed; |
sammacjunkie | 16:2d23297857bc | 124 | this.name = this._mbed.rpc("DigitalIn", "new", [mpin._name]); |
sammacjunkie | 16:2d23297857bc | 125 | }else{ |
sammacjunkie | 16:2d23297857bc | 126 | //Tie to an existing object |
sammacjunkie | 16:2d23297857bc | 127 | this._mbed = this_mbed; |
sammacjunkie | 16:2d23297857bc | 128 | this.name = mpin; |
sammacjunkie | 16:2d23297857bc | 129 | } |
sammacjunkie | 16:2d23297857bc | 130 | |
sammacjunkie | 16:2d23297857bc | 131 | } |
sammacjunkie | 16:2d23297857bc | 132 | |
sammacjunkie | 16:2d23297857bc | 133 | DigitalIn.prototype.read = function() { |
sammacjunkie | 16:2d23297857bc | 134 | return parseInt(this._mbed.rpc(this.name, "read", [""])); |
sammacjunkie | 16:2d23297857bc | 135 | } |
sammacjunkie | 16:2d23297857bc | 136 | |
sammacjunkie | 16:2d23297857bc | 137 | //*************************** AnalogOut ************************************************ |
sammacjunkie | 16:2d23297857bc | 138 | |
sammacjunkie | 16:2d23297857bc | 139 | function AnalogOut(this_mbed, mpin) { |
sammacjunkie | 16:2d23297857bc | 140 | if(typeof mpin != "string"){ |
sammacjunkie | 16:2d23297857bc | 141 | //create a new object |
sammacjunkie | 16:2d23297857bc | 142 | this._mbed = this_mbed; |
sammacjunkie | 16:2d23297857bc | 143 | this.name = this._mbed.rpc("AnalogOut", "new", [mpin._name]); |
sammacjunkie | 16:2d23297857bc | 144 | }else{ |
sammacjunkie | 16:2d23297857bc | 145 | //Tie to an existing object |
sammacjunkie | 16:2d23297857bc | 146 | this._mbed = this_mbed; |
sammacjunkie | 16:2d23297857bc | 147 | this.name = mpin; |
sammacjunkie | 16:2d23297857bc | 148 | } |
sammacjunkie | 16:2d23297857bc | 149 | } |
sammacjunkie | 16:2d23297857bc | 150 | |
sammacjunkie | 16:2d23297857bc | 151 | AnalogOut.prototype.write = function(value) { |
sammacjunkie | 16:2d23297857bc | 152 | this._mbed.rpc(this.name, "write", [value]); |
sammacjunkie | 16:2d23297857bc | 153 | } |
sammacjunkie | 16:2d23297857bc | 154 | |
sammacjunkie | 16:2d23297857bc | 155 | AnalogOut.prototype.write_u16 = function(value) { |
sammacjunkie | 16:2d23297857bc | 156 | this._mbed.rpc(this.name, "write_u16", [value]); |
sammacjunkie | 16:2d23297857bc | 157 | } |
sammacjunkie | 16:2d23297857bc | 158 | |
sammacjunkie | 16:2d23297857bc | 159 | AnalogOut.prototype.read = function() { |
sammacjunkie | 16:2d23297857bc | 160 | return parseFloat(this._mbed.rpc(this.name, "read", [""])); |
sammacjunkie | 16:2d23297857bc | 161 | } |
sammacjunkie | 16:2d23297857bc | 162 | |
sammacjunkie | 16:2d23297857bc | 163 | //*************************** AnalogIn ************************************************ |
sammacjunkie | 16:2d23297857bc | 164 | |
sammacjunkie | 16:2d23297857bc | 165 | function AnalogIn(this_mbed, mpin) { |
sammacjunkie | 16:2d23297857bc | 166 | if(typeof mpin != "string"){ |
sammacjunkie | 16:2d23297857bc | 167 | //create a new object |
sammacjunkie | 16:2d23297857bc | 168 | this._mbed = this_mbed; |
sammacjunkie | 16:2d23297857bc | 169 | this.name = this._mbed.rpc("AnalogIn", "new", [mpin._name]); |
sammacjunkie | 16:2d23297857bc | 170 | }else{ |
sammacjunkie | 16:2d23297857bc | 171 | //Tie to an existing object |
sammacjunkie | 16:2d23297857bc | 172 | this._mbed = this_mbed; |
sammacjunkie | 16:2d23297857bc | 173 | this.name = mpin; |
sammacjunkie | 16:2d23297857bc | 174 | } |
sammacjunkie | 16:2d23297857bc | 175 | } |
sammacjunkie | 16:2d23297857bc | 176 | |
sammacjunkie | 16:2d23297857bc | 177 | AnalogIn.prototype.read = function() { |
sammacjunkie | 16:2d23297857bc | 178 | return parseFloat(this._mbed.rpc(this.name, "read", [""])); |
sammacjunkie | 16:2d23297857bc | 179 | } |
sammacjunkie | 16:2d23297857bc | 180 | |
sammacjunkie | 16:2d23297857bc | 181 | AnalogIn.prototype.read_u16 = function() { |
sammacjunkie | 16:2d23297857bc | 182 | return parseInt(this._mbed.rpc(this.name, "read_u16", [""])); |
sammacjunkie | 16:2d23297857bc | 183 | } |
sammacjunkie | 16:2d23297857bc | 184 | |
sammacjunkie | 16:2d23297857bc | 185 | //*************************** PwmOut ************************************************ |
sammacjunkie | 16:2d23297857bc | 186 | |
sammacjunkie | 16:2d23297857bc | 187 | function PwmOut(this_mbed, mpin) { |
sammacjunkie | 16:2d23297857bc | 188 | if(typeof mpin != "string"){ |
sammacjunkie | 16:2d23297857bc | 189 | //create a new object |
sammacjunkie | 16:2d23297857bc | 190 | this._mbed = this_mbed; |
sammacjunkie | 16:2d23297857bc | 191 | this.name = this._mbed.rpc("PwmOut", "new", [mpin._name]); |
sammacjunkie | 16:2d23297857bc | 192 | }else{ |
sammacjunkie | 16:2d23297857bc | 193 | //Tie to an existing object |
sammacjunkie | 16:2d23297857bc | 194 | this._mbed = this_mbed; |
sammacjunkie | 16:2d23297857bc | 195 | this.name = mpin; |
sammacjunkie | 16:2d23297857bc | 196 | } |
sammacjunkie | 16:2d23297857bc | 197 | } |
sammacjunkie | 16:2d23297857bc | 198 | |
sammacjunkie | 16:2d23297857bc | 199 | PwmOut.prototype.write = function(value) { |
sammacjunkie | 16:2d23297857bc | 200 | this._mbed.rpc(this.name, "write", [value]); |
sammacjunkie | 16:2d23297857bc | 201 | } |
sammacjunkie | 16:2d23297857bc | 202 | |
sammacjunkie | 16:2d23297857bc | 203 | PwmOut.prototype.read = function() { |
sammacjunkie | 16:2d23297857bc | 204 | return parseFloat(this._mbed.rpc(this.name, "read", [""])); |
sammacjunkie | 16:2d23297857bc | 205 | } |
sammacjunkie | 16:2d23297857bc | 206 | |
sammacjunkie | 16:2d23297857bc | 207 | PwmOut.prototype.period = function(value) { |
sammacjunkie | 16:2d23297857bc | 208 | this._mbed.rpc(this.name, "period", [value]); |
sammacjunkie | 16:2d23297857bc | 209 | } |
sammacjunkie | 16:2d23297857bc | 210 | |
sammacjunkie | 16:2d23297857bc | 211 | PwmOut.prototype.period_ms = function(value) { |
sammacjunkie | 16:2d23297857bc | 212 | this._mbed.rpc(this.name, "period_ms", [value]); |
sammacjunkie | 16:2d23297857bc | 213 | } |
sammacjunkie | 16:2d23297857bc | 214 | |
sammacjunkie | 16:2d23297857bc | 215 | PwmOut.prototype.period_us = function(value) { |
sammacjunkie | 16:2d23297857bc | 216 | this._mbed.rpc(this.name, "period_us", [value]); |
sammacjunkie | 16:2d23297857bc | 217 | } |
sammacjunkie | 16:2d23297857bc | 218 | |
sammacjunkie | 16:2d23297857bc | 219 | PwmOut.prototype.pulsewidth = function(value) { |
sammacjunkie | 16:2d23297857bc | 220 | this._mbed.rpc(this.name, "pulsewidth", [value]); |
sammacjunkie | 16:2d23297857bc | 221 | } |
sammacjunkie | 16:2d23297857bc | 222 | |
sammacjunkie | 16:2d23297857bc | 223 | PwmOut.prototype.pulsewidth_ms = function(value) { |
sammacjunkie | 16:2d23297857bc | 224 | this._mbed.rpc(this.name, "pulsewidth_ms", [value]); |
sammacjunkie | 16:2d23297857bc | 225 | } |
sammacjunkie | 16:2d23297857bc | 226 | |
sammacjunkie | 16:2d23297857bc | 227 | PwmOut.prototype.pulsewidth_us = function(value) { |
sammacjunkie | 16:2d23297857bc | 228 | this._mbed.rpc(this.name, "pulsewidth_us", [value]); |
sammacjunkie | 16:2d23297857bc | 229 | } |
sammacjunkie | 16:2d23297857bc | 230 | |
sammacjunkie | 16:2d23297857bc | 231 | //*************************** serial ************************************************ |
sammacjunkie | 16:2d23297857bc | 232 | |
sammacjunkie | 16:2d23297857bc | 233 | function Serial(this_mbed, tx, rx) { |
sammacjunkie | 16:2d23297857bc | 234 | if(typeof tx != "string"){ |
sammacjunkie | 16:2d23297857bc | 235 | //create a new object |
sammacjunkie | 16:2d23297857bc | 236 | this._mbed = this_mbed; |
sammacjunkie | 16:2d23297857bc | 237 | this.name = this._mbed.rpc("Serial", "new", [tx._name, rx._name]); |
sammacjunkie | 16:2d23297857bc | 238 | }else{ |
sammacjunkie | 16:2d23297857bc | 239 | //Tie to an existing object |
sammacjunkie | 16:2d23297857bc | 240 | this._mbed = this_mbed; |
sammacjunkie | 16:2d23297857bc | 241 | this.name = tx; |
sammacjunkie | 16:2d23297857bc | 242 | } |
sammacjunkie | 16:2d23297857bc | 243 | |
sammacjunkie | 16:2d23297857bc | 244 | } |
sammacjunkie | 16:2d23297857bc | 245 | |
sammacjunkie | 16:2d23297857bc | 246 | Serial.prototype.putc = function(value) { |
sammacjunkie | 16:2d23297857bc | 247 | this._mbed.rpc(this.name, "putc", [value]); |
sammacjunkie | 16:2d23297857bc | 248 | } |
sammacjunkie | 16:2d23297857bc | 249 | |
sammacjunkie | 16:2d23297857bc | 250 | Serial.prototype.getc = function(value) { |
sammacjunkie | 16:2d23297857bc | 251 | return parseInt(this._mbed.rpc(this.name, "getc", [""])); |
sammacjunkie | 16:2d23297857bc | 252 | } |
sammacjunkie | 16:2d23297857bc | 253 | |
sammacjunkie | 16:2d23297857bc | 254 | Serial.prototype.readable = function(value) { |
sammacjunkie | 16:2d23297857bc | 255 | return parseInt(this._mbed.rpc(this.name, "readable", [""])); |
sammacjunkie | 16:2d23297857bc | 256 | } |
sammacjunkie | 16:2d23297857bc | 257 | |
sammacjunkie | 16:2d23297857bc | 258 | Serial.prototype.writeable = function(value) { |
sammacjunkie | 16:2d23297857bc | 259 | return parseInt(this._mbed.rpc(this.name, "writeable", [""])); |
sammacjunkie | 16:2d23297857bc | 260 | } |
sammacjunkie | 16:2d23297857bc | 261 | |
sammacjunkie | 16:2d23297857bc | 262 | |
sammacjunkie | 16:2d23297857bc | 263 | //*************************** RPCVariable ************************************************ |
sammacjunkie | 16:2d23297857bc | 264 | |
sammacjunkie | 16:2d23297857bc | 265 | function RPCVariable(this_mbed, name) { |
sammacjunkie | 16:2d23297857bc | 266 | this._mbed = this_mbed; |
sammacjunkie | 16:2d23297857bc | 267 | this.name = name; |
sammacjunkie | 16:2d23297857bc | 268 | } |
sammacjunkie | 16:2d23297857bc | 269 | |
sammacjunkie | 16:2d23297857bc | 270 | RPCVariable.prototype.write = function(value) { |
sammacjunkie | 16:2d23297857bc | 271 | this._mbed.rpc(this.name, "write", [value]); |
sammacjunkie | 16:2d23297857bc | 272 | } |
sammacjunkie | 16:2d23297857bc | 273 | |
sammacjunkie | 16:2d23297857bc | 274 | RPCVariable.prototype.read_int = function() { |
sammacjunkie | 16:2d23297857bc | 275 | return parseInt(this._mbed.rpc(this.name, "read", [""])); |
sammacjunkie | 16:2d23297857bc | 276 | } |
sammacjunkie | 16:2d23297857bc | 277 | |
sammacjunkie | 16:2d23297857bc | 278 | RPCVariable.prototype.read_float = function() { |
sammacjunkie | 16:2d23297857bc | 279 | return parseFloat(this._mbed.rpc(this.name, "read", [""])); |
sammacjunkie | 16:2d23297857bc | 280 | } |
sammacjunkie | 16:2d23297857bc | 281 | |
sammacjunkie | 16:2d23297857bc | 282 | RPCVariable.prototype.read = function() { |
sammacjunkie | 16:2d23297857bc | 283 | return (this._mbed.rpc(this.name, "read", [""])); |
sammacjunkie | 16:2d23297857bc | 284 | } |
sammacjunkie | 16:2d23297857bc | 285 | |
sammacjunkie | 16:2d23297857bc | 286 | //*************************** RPCFunction ************************************************ |
sammacjunkie | 16:2d23297857bc | 287 | |
sammacjunkie | 16:2d23297857bc | 288 | function RPCFunction(this_mbed, name) { |
sammacjunkie | 16:2d23297857bc | 289 | this._mbed = this_mbed; |
sammacjunkie | 16:2d23297857bc | 290 | this.name = name; |
sammacjunkie | 16:2d23297857bc | 291 | } |
sammacjunkie | 16:2d23297857bc | 292 | |
sammacjunkie | 16:2d23297857bc | 293 | RPCVariable.prototype.run = function(value) { |
sammacjunkie | 16:2d23297857bc | 294 | return (this._mbed.rpc(this.name, "run", [value])); |
sammacjunkie | 16:2d23297857bc | 295 | } |