• R/O
  • SSH

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

アルファ版。新版→https://osdn.jp/users/tacticsrealize/pf/ChlorophyllUploader/wiki/FrontPage


File Info

Rev. 82b375367456635f711775be0d76dcafef88ca32
Tamanho 1,405 bytes
Hora 2015-07-08 20:15:01
Autor
Mensagem de Log

新ファイル形式に対応しArduinoとの連携

Content

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));
	}

}