Added Android UWB code
This commit is contained in:
@@ -62,10 +62,8 @@ public class RTT {
|
||||
Log.d("RTT", mac.toString() + " FAILED");
|
||||
}
|
||||
|
||||
RTT.onRTTComplete(serialize(res));
|
||||
|
||||
}
|
||||
|
||||
RTT.onRTTComplete(serialize(res));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -75,28 +73,31 @@ public class RTT {
|
||||
char delim = ';';
|
||||
boolean success = res.getStatus() == RangingResult.STATUS_SUCCESS;
|
||||
|
||||
if (success) {
|
||||
baos.write(("" + res.getRangingTimestampMillis()).getBytes());
|
||||
baos.write(delim);
|
||||
} else {
|
||||
baos.write(("" + System.currentTimeMillis()).getBytes());
|
||||
baos.write(delim);
|
||||
}
|
||||
baos.write(success ? '1' : '0');
|
||||
baos.write(delim);
|
||||
|
||||
baos.write(("" + System.currentTimeMillis()).getBytes());
|
||||
baos.write(delim);
|
||||
|
||||
baos.write(res.getMacAddress().toString().getBytes());
|
||||
baos.write(delim);
|
||||
|
||||
if (success) {
|
||||
baos.write( ("" + res.getDistanceMm()).getBytes() );
|
||||
baos.write(delim);
|
||||
baos.write( ("" + res.getDistanceStdDevMm()).getBytes() );
|
||||
baos.write(delim);
|
||||
baos.write( ("" + res.getRssi()).getBytes() );
|
||||
int distValue = 0;
|
||||
int distStdDev = 0;
|
||||
int rssi = 0;
|
||||
|
||||
} else {
|
||||
baos.write( "FAILED".getBytes() );
|
||||
if (success) {
|
||||
distValue = res.getDistanceMm();
|
||||
distStdDev = res.getDistanceStdDevMm();
|
||||
rssi = res.getRssi();
|
||||
}
|
||||
|
||||
baos.write( ("" + distValue).getBytes() );
|
||||
baos.write(delim);
|
||||
baos.write( ("" + distStdDev).getBytes() );
|
||||
baos.write(delim);
|
||||
baos.write( ("" + rssi).getBytes() );
|
||||
|
||||
} catch (final Exception e) {;}
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user