1// 2// Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software 3// Foundation, Inc 4// 5// This program is free software; you can redistribute it and/or modify 6// it under the terms of the GNU General Public License as published by 7// the Free Software Foundation; either version 3 of the License, or 8// (at your option) any later version. 9// 10// This program is distributed in the hope that it will be useful, 11// but WITHOUT ANY WARRANTY; without even the implied warranty of 12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13// GNU General Public License for more details. 14// 15// You should have received a copy of the GNU General Public License 16// along with this program; if not, write to the Free Software 17// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18// 19 20// Test case for lirc ActionScript class 21// compile this test case with Ming makeswf, and then 22// execute it like this gnash -1 -r 0 -v out.swf 23 24 25var remote = new Lirc(); 26 27// test the constuctor 28if (remote) { 29 trace("Lirc() constructor works"); 30} else { 31 trace("Lirc() constructor failed"); 32} 33 34if (!remote) { 35 trace("UNTESTED: extensions not built!"); 36} 37 38// var keyObj = new Key; 39 40// If the extension doesn't load, don't do anything. 41if (remote) { 42 var sock = "/tmp/lircd"; 43 if (remote.lirc_init(sock)) { 44 var str = "Connected to " + sock; 45 trace(str); 46 } else { 47 var str = "ERROR: couldn't connect to " + sock; 48 trace(str); 49 } 50 51 var button = remote.lirc_getButton(); 52 trace(button); 53 54 while (button != "QUIT" && button != "") { 55 button = remote.lirc_getButton(); 56 trace(button); 57 } 58 if (button == "QUIT") { 59 trace("Qutting due to user action"); 60 } 61 if (button == "") { 62 trace("Qutting due to socket being closed"); 63 } 64} 65 66 67