アルファ版。新版→https://osdn.jp/users/tacticsrealize/pf/ChlorophyllUploader/wiki/FrontPage
修訂. | 82b375367456635f711775be0d76dcafef88ca32 |
---|---|
大小 | 1,405 bytes |
時間 | 2015-07-08 20:15:01 |
作者 | |
Log Message | 新ファイル形式に対応しArduinoとの連携 |
package ants;
import java.io.File;
import java.time.format.DateTimeFormatter;
import mirrg.file.watcherspawning.FileWatcherSpawning;
import ants.chlorofilsender.BuilderMessage;
import ants.chlorofilsender.PacketChlorofilSender;
public class SampleFileWatcherSpawning
{
/**
* ファイル名
*/
public final static DateTimeFormatter formatterIn =
DateTimeFormatter.ofPattern("uuuuMMddHHmmss");
/**
* 保存・Arduino送信形式
*/
public final static DateTimeFormatter formatterOut =
DateTimeFormatter.ofPattern("uuuu/MM/dd HH:mm:ss");
public static void main(String[] args)
{
FileWatcherSpawning fileWatcherSpawning = new FileWatcherSpawning(
new File("./csvs"),
new File("./config.txt"),
formatterIn,
formatterOut,
(file, localDateTime) -> {
try {
PacketChlorofilSender.parse(localDateTime, file)
.forEach(SampleFileWatcherSpawning::onData);
} catch (Exception e) {
e.printStackTrace();
}
});
// initialized!!
System.out.println(BuilderMessage.setPrefix(
"http://j.kisarazu.ac.jp/Arduino/ANTS/0301/"));
fileWatcherSpawning.start();
}
protected static void onData(PacketChlorofilSender packet)
{
System.out.println(String.format(
"Processed!!: '%s'",
packet.time.format(formatterOut)));
System.out.println(BuilderMessage.build(packet));
}
}