亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? receiver.java

?? tinyos-2.x.rar
?? JAVA
字號:
// $Id: Receiver.java,v 1.5 2007/05/29 16:44:50 rincon Exp $

/*									tab:4
 * "Copyright (c) 2000-2003 The Regents of the University  of California.  
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 * Copyright (c) 2002-2003 Intel Corporation
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached INTEL-LICENSE     
 * file. If you do not find these files, copies can be found by writing to
 * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
 * 94704.  Attention:  Intel License Inquiry.
 */
/* Authors:  David Gay  <dgay@intel-research.net>
 *           Intel Research Berkeley Lab
 *
 */

/**
 * @author David Gay <dgay@intel-research.net>
 * @author Intel Research Berkeley Lab
 */

package net.tinyos.message;

import net.tinyos.util.*;
import net.tinyos.packet.*;
import java.util.*;

/**
 * Receiver class (receive tinyos messages).
 * 
 * A receiver class provides a simple interface built on Message for receiving
 * tinyos messages from a SerialForwarder
 * 
 * @version 1, 15 Jul 2002
 * @author David Gay
 */
public class Receiver implements PacketListenerIF {
  public static final boolean DEBUG = false;

  public static final boolean DISPLAY_ERROR_MSGS = true;

  Hashtable templateTbl; // Mapping from AM type to msgTemplate

  PhoenixSource source;

  /**
   * Inner class representing a single MessageListener and its associated
   * Message template.
   */
  class msgTemplate {
    Message template;

    MessageListener listener;

    msgTemplate(Message template, MessageListener listener) {
      this.template = template;
      this.listener = listener;
    }

    public boolean equals(Object o) {
      try {
        msgTemplate mt = (msgTemplate) o;
        if (mt.template.getClass().equals(this.template.getClass())
            && mt.listener.equals(this.listener)) {
          return true;
        }
      } catch (Exception e) {
        return false;
      }
      return false;
    }

    public int hashCode() {
      return listener.hashCode();
    }
  }

  /**
   * Create a receiver messages from forwarder of any group id and of active
   * message type m.getType() When such a message is received, a new instance of
   * m's class is created with the received data and send to
   * listener.messageReceived
   * 
   * @param forwarder
   *          packet source to listen to
   */
  public Receiver(PhoenixSource forwarder) {
    this.templateTbl = new Hashtable();
    this.source = forwarder;
    forwarder.registerPacketListener(this);
  }

  /**
   * Register a particular listener for a particular message type. More than one
   * listener can be registered for each message type.
   * 
   * @param template
   *          specify message type and template we're listening for
   * @param listener
   *          destination for received messages
   */
  public void registerListener(Message template, MessageListener listener) {
    Integer amType = new Integer(template.amType());
    Vector vec = (Vector) templateTbl.get(amType);
    if (vec == null) {
      vec = new Vector();
    }
    vec.addElement(new msgTemplate(template, listener));
    templateTbl.put(amType, vec);
  }

  /**
   * Stop listening for messages of the given type with the given listener.
   * 
   * @param template
   *          specify message type and template we're listening for
   * @param listener
   *          destination for received messages
   */
  public void deregisterListener(Message template, MessageListener listener) {
    Integer amType = new Integer(template.amType());
    Vector vec = (Vector) templateTbl.get(amType);
    if (vec == null) {
      throw new IllegalArgumentException(
          "No listeners registered for message type "
              + template.getClass().getName() + " (AM type "
              + template.amType() + ")");
    }
    msgTemplate mt = new msgTemplate(template, listener);
    // Remove all occurrences
    while (vec.removeElement(mt))
      ;
    if (vec.size() == 0)
      templateTbl.remove(amType);
  }

  private void error(msgTemplate temp, String msg) {
    System.err.println("receive error for "
        + temp.template.getClass().getName() + " (AM type "
        + temp.template.amType() + "): " + msg);
  }

  public void packetReceived(byte[] packet) {
    if (DEBUG)
      Dump.dump("Received message", packet);

    if (packet[0] != Serial.TOS_SERIAL_ACTIVE_MESSAGE_ID)
      return; // not for us.

    SerialPacket msg = new SerialPacket(packet, 1);
    Integer type = new Integer(msg.get_header_type());
    Vector vec = (Vector) templateTbl.get(type);
    if (vec == null) {
      if (DEBUG)
        Dump.dump("Received packet with type " + type
            + ", but no listeners registered", packet);
      return;
    }
    int length = msg.get_header_length();

    Enumeration en = vec.elements();
    while (en.hasMoreElements()) {
      msgTemplate temp = (msgTemplate) en.nextElement();

      Message received;

      // Erk - end up cloning the message multiple times in case
      // different templates used for different listeners
      try {
        received = temp.template.clone(length);
        received.dataSet(msg.dataGet(), SerialPacket.offset_data(0) + msg.baseOffset(),
            0, length);
        received.setSerialPacket(msg); 
        
      } catch (ArrayIndexOutOfBoundsException e) {
        error(temp, "invalid length message received (too long)");
        continue;
      } catch (Exception e) {
        error(temp, "couldn't clone message!");
        continue;
      }

      /*
       * Messages that are longer than the template might have a variable-sized
       * array at their end
       */
      if (temp.template.dataGet().length > length) {
        error(temp, "invalid length message received (too short)");
        continue;
      }
      temp.listener.messageReceived(msg.get_header_dest(), received);
    }
  }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99re成人精品视频| 在线观看视频一区二区 | 国产一区二区女| 亚洲在线视频免费观看| 尤物视频一区二区| 亚洲影视资源网| 午夜精品一区二区三区电影天堂 | 欧美精品第1页| 欧美日韩视频不卡| 欧美曰成人黄网| 欧美日韩高清一区| 欧美一级欧美三级| 精品电影一区二区| 久久久精品中文字幕麻豆发布| 国产天堂亚洲国产碰碰| 国产精品不卡一区二区三区| 亚洲人成网站精品片在线观看 | 欧美精品v日韩精品v韩国精品v| 欧美久久久久免费| 国产农村妇女毛片精品久久麻豆| 亚洲免费大片在线观看| 午夜欧美电影在线观看| 国内精品自线一区二区三区视频| 成人免费av资源| 欧美色倩网站大全免费| 亚洲精品一区二区三区福利| 亚洲欧洲另类国产综合| 日韩在线a电影| 处破女av一区二区| 欧美精品99久久久**| 国产欧美一区二区精品性色 | 国产麻豆成人精品| 色999日韩国产欧美一区二区| 777奇米成人网| 国产日产欧美一区二区视频| 亚洲电影中文字幕在线观看| 国产盗摄女厕一区二区三区| 欧美日韩一区二区三区四区 | 日韩免费一区二区三区在线播放| 国产精品理论片在线观看| 亚洲午夜精品一区二区三区他趣| 国产又黄又大久久| 欧美精品v日韩精品v韩国精品v| 国产精品丝袜一区| 美女视频黄久久| 欧美三级视频在线观看| 亚洲国产激情av| 精东粉嫩av免费一区二区三区| 一本色道久久综合狠狠躁的推荐| 久久久.com| 国内外成人在线| 8v天堂国产在线一区二区| 亚洲欧洲www| 国产精品亚洲一区二区三区在线 | 亚洲已满18点击进入久久| 国产在线国偷精品产拍免费yy| 欧美日本在线一区| 一区2区3区在线看| 成人av网站免费观看| 26uuu亚洲综合色| 丝袜美腿亚洲一区| 欧美日韩激情一区| 亚洲在线视频网站| 欧美在线观看一二区| 亚洲男帅同性gay1069| 成人手机电影网| 久久九九国产精品| 狠狠色丁香婷婷综合| 日韩免费一区二区| 精品中文字幕一区二区| 精品免费日韩av| 国产一区二区不卡| 国产午夜一区二区三区| 国产盗摄精品一区二区三区在线 | 国内成人自拍视频| 日韩欧美的一区| 乱中年女人伦av一区二区| 91精品视频网| 久久精品国产亚洲高清剧情介绍| 日韩一区二区三区电影在线观看 | 日本不卡一区二区三区 | 国产精品女同互慰在线看| 国产精品一区专区| 亚洲欧洲日韩一区二区三区| 高清国产午夜精品久久久久久| 久久精品男人的天堂| 成人综合日日夜夜| 亚洲欧美日韩国产综合在线 | 麻豆精品视频在线| 精品国内二区三区| 不卡一区二区三区四区| 亚洲精品免费在线观看| 欧美日韩免费电影| 狠狠狠色丁香婷婷综合激情 | 欧美精品在线视频| 久久se精品一区精品二区| 国产欧美一区二区三区网站| 色婷婷精品久久二区二区蜜臂av| 亚洲成人av电影| 欧美精品一区二区久久久| av亚洲精华国产精华精华| 2021国产精品久久精品| 国产精品一区2区| 综合激情网...| 欧美理论片在线| 国产一区二区调教| 一区二区三区中文字幕精品精品 | 精品久久久久久亚洲综合网 | 免费三级欧美电影| 久久精品一区蜜桃臀影院| 在线亚洲免费视频| 韩日精品视频一区| 亚洲女与黑人做爰| 久久亚洲二区三区| 欧美在线不卡视频| 福利一区福利二区| 日本亚洲最大的色成网站www| 中文久久乱码一区二区| 欧美一区二区在线视频| 91免费看片在线观看| 日韩高清国产一区在线| 亚洲色图另类专区| 久久这里只有精品视频网| 欧美日韩免费观看一区三区| 国产成人啪午夜精品网站男同| 日韩av一区二| 亚洲成人精品在线观看| 亚洲欧美国产高清| 国产日产欧美一区二区视频| 日韩欧美aaaaaa| 91麻豆精品国产| 色偷偷一区二区三区| 成人午夜av在线| 国产自产高清不卡| 日韩主播视频在线| 亚洲午夜激情网站| 亚洲影视在线观看| 亚洲精品视频免费看| 成人免费在线播放视频| 国产精品嫩草影院av蜜臀| 久久久蜜桃精品| 2023国产精品自拍| 精品成a人在线观看| 精品久久久久久无| 久久影院电视剧免费观看| 精品免费视频一区二区| 日韩欧美一区二区久久婷婷| 欧美一级一区二区| 精品国产一区二区在线观看| 欧美精品一区二区三区四区 | 91精品办公室少妇高潮对白| 国产另类ts人妖一区二区| 中文天堂在线一区| 精品1区2区在线观看| 在线观看日韩av先锋影音电影院| 国产91精品入口| 国产盗摄精品一区二区三区在线 | 欧美性videosxxxxx| 91老师片黄在线观看| 色天天综合色天天久久| 91九色02白丝porn| 777午夜精品免费视频| 日韩欧美中文一区二区| 精品久久国产97色综合| 久久精品视频一区二区三区| 中文字幕免费不卡在线| 一区二区在线看| 日韩制服丝袜先锋影音| 日本不卡高清视频| 国产成人av电影在线| 色婷婷久久久久swag精品| 欧美探花视频资源| 美女一区二区视频| 综合电影一区二区三区 | 在线观看日韩av先锋影音电影院| 色94色欧美sute亚洲线路二| 欧美三级韩国三级日本一级| 91超碰这里只有精品国产| 宅男在线国产精品| 精品三级av在线| 国产精品日日摸夜夜摸av| 亚洲免费在线播放| 奇米色777欧美一区二区| 国产精品资源在线| 欧美怡红院视频| 久久久久久久久久久黄色| 亚洲丝袜自拍清纯另类| 丝袜美腿亚洲综合| 国产999精品久久| 欧美理论在线播放| 国产精品乱人伦| 免费美女久久99| www.综合网.com| 日韩一区和二区| 国产丝袜美腿一区二区三区| 一区二区在线观看视频| 韩国三级在线一区| 91久久免费观看| 国产欧美一区二区精品性| 五月天精品一区二区三区|