当前位置: 首页>>代码示例>>Java>>正文


Java BuildSource类代码示例

本文整理汇总了Java中net.tinyos.packet.BuildSource的典型用法代码示例。如果您正苦于以下问题:Java BuildSource类的具体用法?Java BuildSource怎么用?Java BuildSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BuildSource类属于net.tinyos.packet包,在下文中一共展示了BuildSource类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import net.tinyos.packet.BuildSource; //导入依赖的package包/类
public static void main(java.lang.String[] args) {
    System.out.println(args[0]);
    String source = args[0];
    reader = BuildSource.makePacketSource(source);

    if (reader == null) {
        logger.warn("Invalid packet source: " + source);
    }

    boolean to_return = true;

    try {
        reader.open(PrintStreamMessenger.err);
    }
    catch (IOException e) {
        logger.warn("Error on " + reader.getName() + ": " + e);
        to_return = false;
    }
    run();
}
 
开发者ID:LSIR,项目名称:gsn,代码行数:21,代码来源:SenscorscopeTest.java

示例2: main

import net.tinyos.packet.BuildSource; //导入依赖的package包/类
/**
 * A Test class to check if the wrapper works.
 * @param args
 * @throws Exception
 */
public static void main ( String [ ] args ) throws Exception {
   PhoenixSource reader = BuildSource.makePhoenix( BuildSource.makeSF( "eflumpc24.epfl.ch" , 2020 ), null );
   reader.start( );
   MoteIF moteif = new MoteIF( reader );
   moteif.registerListener( new SensorScopeDataMsg( ) , new MessageListener( ) {
      public void messageReceived ( int dest , Message rawMsg ) {
         System.out.println( "Received." );
      }
   } );
}
 
开发者ID:LSIR,项目名称:gsn,代码行数:16,代码来源:TinyOS2XTemplate.java

示例3: SerialCommunicator

import net.tinyos.packet.BuildSource; //导入依赖的package包/类
public SerialCommunicator() {
	phoenix = BuildSource.makePhoenix("[email protected]/dev/ttyUSB0:telos", PrintStreamMessenger.err);
	mote = new MoteIF(phoenix);
	mote.registerListener(new HarvestAnswerSerialMsg(), this);
}
 
开发者ID:JSFernandes,项目名称:SolarHarvestPrediction,代码行数:6,代码来源:SerialCommunicator.java

示例4: initialize

import net.tinyos.packet.BuildSource; //导入依赖的package包/类
public boolean initialize() {
    AddressBean addressBean = getActiveAddressBean();

    // source
    if (addressBean.getPredicateValue(INITPARAM_SOURCE) != null) {
        source = addressBean.getPredicateValue(INITPARAM_SOURCE);
        logger.warn("Sensorscope source: " + source);
    } else {
        logger.warn("The specified parameter >" + INITPARAM_SOURCE + "< for >SensorScopeWrapper< is missing.");
        logger.warn("Initialization failed.");
        return false;
    }

    // station_id
    String station_id_str;
    if (addressBean.getPredicateValue(INITPARAM_STATION_ID) != null) {
        station_id_str = addressBean.getPredicateValue(INITPARAM_STATION_ID);
        logger.warn("Selected station-id: " + station_id_str);
    } else {
        logger.warn("The specified parameter >" + INITPARAM_STATION_ID + "< for >SensorScopeWrapper< is missing.");
        logger.warn("Initialization failed.");
        return false;
    }


    selected_station_id = Integer.parseInt(station_id_str);

    reader = BuildSource.makePacketSource(source);

    if (reader == null) {
        logger.warn("Invalid packet source: " + source);
        return false;
    }

    boolean to_return = true;

    try {
        reader.open(PrintStreamMessenger.err);
    }
    catch (IOException e) {
        logger.warn("Error on " + reader.getName() + ": " + e);
        to_return = false;
    }

    //reset buffers
    for (int i = 0; i < OUTPUT_STRUCTURE_SIZE; i++) {
        buf[i] = 0.0;
        count[i] = 0;
    }

    return to_return;
}
 
开发者ID:LSIR,项目名称:gsn,代码行数:53,代码来源:SensorScope2ExtendedWrapper.java


注:本文中的net.tinyos.packet.BuildSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。