Skip to content
Snippets Groups Projects
Commit 33c109c8 authored by Andrew Tridgell's avatar Andrew Tridgell
Browse files

added simple java test

parent 1da7a82d
No related branches found
No related tags found
No related merge requests found
all: build
build:
mkdir -p com/MAVLink
mavgen.py --lang Java --wire-protocol=1.0 ../../../../message_definitions/v1.0/ardupilotmega.xml -o com/MAVLink
mkdir -p build
javac -d build test.java com/MAVLink/*.java com/MAVLink/common/*.java com/MAVLink/ardupilotmega/*.java
clean:
rm -rf build com/MAVLink
import com.MAVLink.MAVLinkPacket;
import com.MAVLink.common.*;
import com.MAVLink.Parser;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class test {
public static void main(String[] args) {
Parser mavParser = new Parser();
try {
FileInputStream tlog = new FileInputStream(args[0]);
try {
while(tlog.available() > 0) {
MAVLinkPacket packet = mavParser.mavlink_parse_char(tlog.read());
if(packet != null){
System.out.println("msgid: " + packet.msgid);
}
}
System.out.println("End tlog");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment