本文整理汇总了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();
}
示例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." );
}
} );
}
示例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);
}
示例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;
}