快速业务通道

使用Sun SPOT作为构建监视器 - 编程入门网

作者 佚名技术 来源 NET编程 浏览 发布时间 2012-06-17
{            // Can''t do much now.            ex1.printStackTrace();          }        }      }    }.start(); }

使用Sun SPOT作为构建监视器(7)

时间:2011-05-25 IBM Craig W. Caulfield

updateBuildStatus() 方法处理 MIDlet 的主要工作,如清单 5 所示:

清单 5. 侦听 CanaryHandler 发送的消息的方法

/**   * Reflect the status of the continuous build process  taking place on the   * host PC by setting the colours of the SPOT''s LEDs  appropriately.   */ private void updateBuildStatus() throws IOException {    setColour(LEDColor.WHITE, "");    String baseStationAddress = getAppProperty ("BaseStationAddress");    String portNumber = getAppProperty("PortNumber");    String connectionString = "radiostream://" +  baseStationAddress + '':'' +        portNumber;    // Open a connection to the base station.    connection = (RadiostreamConnection) Connector.open (connectionString);    dis = connection.openDataInputStream();    dos = connection.openDataOutputStream();    while (true) {      // dis will block here forever until it has  something from the host      // to read.      String buildStatus = dis.readUTF();      if (buildStatus.equals("RUN")) {        setColour(LEDColor.BLUE, buildStatus);      } else if (buildStatus.equals("SUCCESS")) {        setColour(LEDColor.GREEN, buildStatus);      } else if (buildStatus.equals("FAIL")) {        setColour(LEDColor.RED, buildStatus);      } else {        throw new IllegalArgumentException("The build status  of " +            buildStatus + " isn''t recognised.");      }      dos.writeUTF("Build status updated to " +  buildStatus);      dos.flush();    } }

聞喘Sun SPOT恬葎更秀酌篇匂(8)

扮寂:2011-05-25 IBM Craig W. Caulfield

乎圭隈遍枠繍侭嗤 LED 延撹易弼?燕幣 SPOT 祥偖。隼朔?嚥 CanaryHandler 窃貌?万嬉蝕匯倖 radiostream 銭俊參式方象補秘才補竃送。徽 頁?壓宸戦?万遍枠晦編貫補秘送響匯訳?連?旺怦毘岷欺辺欺?連。

泌賠汽 6 侭幣?輝辺欺匯訳?連扮?setColour() 圭隈恢伏総匯倖?殻?參 厚仟 SPOT 貧議 LED 議冲弼。隼朔?BuildCanary 指欺 while 儉桟議競極?吉 棋和匯訳?連。

賠汽 6. 恢伏匯倖譜崔冲弼議仟?殻

/**   * Set a colour for the LEDs to display.   *   * @param colour an LEDColor value.   * @param buildStatus the current status if the build.   */ private void setColour(final LEDColor colour, final String  buildStatus) {    if (colourThread != null) {      colourThread.interrupt();    }    setColour = new SetColour(colour, buildStatus);    colourThread = new Thread(setColour);    colourThread.start(); }

嚥緩揖扮?寔屎荷恬 LED 頁壓 SetColour 窃嶄?泌賠汽 7 侭幣?

賠汽 7. 荷恬 LED 議坪何窃

/**   * An

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号