本文整理汇总了Java中com.MAVLink.Parser类的典型用法代码示例。如果您正苦于以下问题:Java Parser类的具体用法?Java Parser怎么用?Java Parser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Parser类属于com.MAVLink包,在下文中一共展示了Parser类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: TCPConnection
import com.MAVLink.Parser; //导入依赖的package包/类
public TCPConnection(String name,String hostname, int port)
{
this.connectionName=name;
socket = null;
this.hostname=hostname;
this.port=port;
queue = new ArrayBlockingQueue<MAVLinkPacket>(20);
parser= new Parser();
stats = new MAVLinkStats();
listeners = new ArrayList<ConnectionObserver>();
//try {
// connect();
//} catch (MyConnectException e) {
// TODO Auto-generated catch block
// e.printStackTrace();
//}
//new Thread(this).start();
}
开发者ID:AndriiDSD,项目名称:GND_Control,代码行数:21,代码来源:TCPConnection.java
示例2: receiveMessage
import com.MAVLink.Parser; //导入依赖的package包/类
@Override
public MAVLinkPacket receiveMessage() throws IOException {
if (!is_open) {
throw new IOException("Failed to receive message. The socket is closed.");
}
Parser parser = new Parser();
MAVLinkPacket packet = null;
// The maximum size of MAVLink packet is 261 bytes.
for (int i = 0; i < 263 * 2; i++) {
try {
int c = in.readUnsignedByte();
packet = parser.mavlink_parse_char(c);
} catch (java.io.EOFException ex) {
return null;
}
if (packet != null) {
MAVLinkLogger.log(Level.DEBUG, "<<", packet);
return packet;
}
}
logger.warn("Failed to parse MAVLink message.");
return null;
}
开发者ID:envirover,项目名称:SPLGroundControl,代码行数:30,代码来源:MAVLinkSocket.java
示例3: getPacket
import com.MAVLink.Parser; //导入依赖的package包/类
private MAVLinkPacket getPacket(byte[] data) throws DecoderException {
Parser parser = new Parser();
MAVLinkPacket packet = null;
for (byte b : data) {
packet = parser.mavlink_parse_char(b & 0xFF);
if (packet != null) {
return packet;
}
}
return null;
}
开发者ID:envirover,项目名称:SPLGroundControl,代码行数:14,代码来源:WSEndpoint.java
示例4: getPacket
import com.MAVLink.Parser; //导入依赖的package包/类
public MAVLinkPacket getPacket() throws DecoderException {
Parser parser = new Parser();
MAVLinkPacket packet = null;
for (byte b : Hex.decodeHex(data.toCharArray())) {
packet = parser.mavlink_parse_char(b & 0xFF);
}
return packet;
}
开发者ID:envirover,项目名称:SPLGroundControl,代码行数:11,代码来源:RockBlockHttpHandler.java
示例5: getPacket
import com.MAVLink.Parser; //导入依赖的package包/类
private MAVLinkPacket getPacket(String data) throws DecoderException {
Parser parser = new Parser();
MAVLinkPacket packet = null;
for (byte b : Hex.decodeHex(data.toCharArray())) {
packet = parser.mavlink_parse_char(b & 0xFF);
}
return packet;
}
开发者ID:envirover,项目名称:SPLGroundControl,代码行数:11,代码来源:SPLGroungControlTest.java
示例6: getPacket
import com.MAVLink.Parser; //导入依赖的package包/类
private MAVLinkPacket getPacket(String data) throws DecoderException {
if (data == null || data.isEmpty()) {
return null;
}
Parser parser = new Parser();
MAVLinkPacket packet = null;
for (byte b : Hex.decodeHex(data.toCharArray())) {
packet = parser.mavlink_parse_char(b & 0xFF);
}
return packet;
}
开发者ID:envirover,项目名称:SPLGroundControl,代码行数:16,代码来源:RockBlockService.java
示例7: UDPConnection
import com.MAVLink.Parser; //导入依赖的package包/类
public UDPConnection(String name, int port)
{
this.connectionName=name;
this.localPort = port;
//this.address = address;
connected=false;
buf = new byte[263];
this.packet = new DatagramPacket(buf,buf.length);
parser=new Parser();
queue=new ArrayBlockingQueue<MAVLinkPacket>(20);
listeners=new ArrayList<ConnectionObserver>();
//try {
// this.udpSocket.setReuseAddress(true);
//} catch (SocketException e) {
// TODO Auto-generated catch block
// e.printStackTrace();
//}
//t/ry {
// udpSocket.setSoTimeout(1000);
//} catch (SocketException e) {
// TODO Auto-generated catch block
// e.printStackTrace();
//}
//this.start();
}
开发者ID:AndriiDSD,项目名称:GND_Control,代码行数:29,代码来源:UDPConnection.java
示例8: WHOIConnection
import com.MAVLink.Parser; //导入依赖的package包/类
public WHOIConnection(String connectionName, String portName, int baudRate, int parityBits, int dataBits, int stopBits) {
// TODO Auto-generated constructor stub
this.connectionName=connectionName;
this.port=portName;
this.rate=baudRate;
this.parity=parityBits;
this.data=dataBits;
this.stop=stopBits;
this.queue=new ArrayBlockingQueue<MAVLinkPacket>(20);
this.parser=new Parser();
this.stats=new MAVLinkStats();
this.listeners=new ArrayList<ConnectionObserver>();
}
开发者ID:AndriiDSD,项目名称:GND_Control,代码行数:14,代码来源:WHOIConnection.java
示例9: SerialConnection
import com.MAVLink.Parser; //导入依赖的package包/类
public SerialConnection(String connectionName, String portName, int baudRate, int parityBits, int dataBits, int stopBits) {
// TODO Auto-generated constructor stub
this.connectionName=connectionName;
this.port=portName;
this.rate=baudRate;
this.parity=parityBits;
this.data=dataBits;
this.stop=stopBits;
this.queue=new ArrayBlockingQueue<MAVLinkPacket>(20);
this.parser=new Parser();
this.stats=new MAVLinkStats();
this.listeners=new ArrayList<ConnectionObserver>();
}
开发者ID:AndriiDSD,项目名称:GND_Control,代码行数:14,代码来源:SerialConnection.java
示例10: handleData
import com.MAVLink.Parser; //导入依赖的package包/类
private void handleData(Parser parser, int bufferSize, byte[] buffer) {
if (bufferSize < 1) {
return;
}
for (int i = 0; i < bufferSize; i++) {
MAVLinkPacket receivedPacket = parser.mavlink_parse_char(buffer[i] & 0x00ff);
if (receivedPacket != null) {
reportReceivedPacket(receivedPacket);
queueToLog(receivedPacket);
}
}
}
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:14,代码来源:MavLinkConnection.java
示例11: handleData
import com.MAVLink.Parser; //导入依赖的package包/类
private void handleData(Parser parser, int bufferSize, byte[] buffer) {
if (bufferSize < 1) {
return;
}
for (int i = 0; i < bufferSize; i++) {
MAVLinkPacket receivedPacket = parser.mavlink_parse_char(buffer[i] & 0x00ff);
if (receivedPacket != null) {
MAVLinkMessage msg = receivedPacket.unpack();
reportReceivedMessage(msg);
queueToLog(receivedPacket);
}
}
}
开发者ID:ne0fhyk,项目名称:3DRServices,代码行数:15,代码来源:MavLinkConnection.java
示例12: run
import com.MAVLink.Parser; //导入依赖的package包/类
@Override
public void run() {
Thread sendingThread = null, loggingThread = null;
// Load the connection specific preferences
loadPreferences();
try {
// Open the connection
openConnection();
mConnectionStatus.set(MAVLINK_CONNECTED);
reportConnect();
// Launch the 'Sending', and 'Logging' threads
sendingThread = new Thread(mSendingTask, "MavLinkConnection-Sending Thread");
sendingThread.start();
loggingThread = new Thread(mLoggingTask, "MavLinkConnection-Logging Thread");
loggingThread.start();
final Parser parser = new Parser();
parser.stats.mavlinkResetStats();
final byte[] readBuffer = new byte[READ_BUFFER_SIZE];
while (mConnectionStatus.get() == MAVLINK_CONNECTED) {
int bufferSize = readDataBlock(readBuffer);
handleData(parser, bufferSize, readBuffer);
}
} catch (IOException e) {
// Ignore errors while shutting down
if (mConnectionStatus.get() != MAVLINK_DISCONNECTED) {
reportComError(e.getMessage());
mLogger.logErr(TAG, e);
}
} finally {
if (loggingThread != null && loggingThread.isAlive()) {
loggingThread.interrupt();
}
if (sendingThread != null && sendingThread.isAlive()) {
sendingThread.interrupt();
}
disconnect();
}
}
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:48,代码来源:MavLinkConnection.java
示例13: run
import com.MAVLink.Parser; //导入依赖的package包/类
@Override
public void run() {
Thread sendingThread = null, loggingThread = null;
// Load the connection specific preferences
loadPreferences();
try {
//TcpLoginWin login_win = new TcpLoginWin();
// Open the connection
openConnection();
mConnectionStatus.set(MAVLINK_CONNECTED);
reportConnect();
// Launch the 'Sending', and 'Logging' threads
sendingThread = new Thread(mSendingTask, "MavLinkConnection-Sending Thread");
sendingThread.start();
loggingThread = new Thread(mLoggingTask, "MavLinkConnection-Logging Thread");
loggingThread.start();
final Parser parser = new Parser();
parser.stats.mavlinkResetStats();
final byte[] readBuffer = new byte[READ_BUFFER_SIZE];
while (mConnectionStatus.get() == MAVLINK_CONNECTED) {
int bufferSize = readDataBlock(readBuffer);
handleData(parser, bufferSize, readBuffer);
}
} catch (IOException e) {
// Ignore errors while shutting down
if (mConnectionStatus.get() != MAVLINK_DISCONNECTED) {
reportComError(e.getMessage());
mLogger.logErr(TAG, e);
}
} finally {
if (loggingThread != null && loggingThread.isAlive()) {
loggingThread.interrupt();
}
if (sendingThread != null && sendingThread.isAlive()) {
sendingThread.interrupt();
}
disconnect();
}
}
开发者ID:ufohust,项目名称:Gprs_droidplanner,代码行数:52,代码来源:MavLinkConnection.java
注:本文中的com.MAVLink.Parser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论