Commit 1038e1ed by maiqh

优化数据拷贝方式和修改陀螺仪名称

parent e078de7f
......@@ -16,12 +16,12 @@ import com.autonavi.amapauto.gdarcameraservice.IGDCameraStateCallBack;
import com.autonavi.amapauto.gdarcameraservice.IGDSize;
import com.autonavi.amapauto.gdarcameraservice.model.ArCameraOpenResultParam;
import com.autonavi.amapauto.gdarcameraservice.model.GDArCameraParam;
import com.autonavi.amapauto.gdarcameraservicedemo.utils.LogUtils;
import com.autonavi.amapauto.gdarcameraservicedemo.utils.SharedMemUtils;
import java.io.FileDescriptor;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Arrays;
public class GDArCameraService extends Service {
private final static String TAG = "GDArCameraService";
......@@ -32,7 +32,6 @@ public class GDArCameraService extends Service {
public static final int HEADER_SIZE = 20;
/**
* 图片宽度
* 注意: 车盒上支持1080宽度,但手机上不支持,手机上设置宽度位1080时,会报错导致相机打不开
*/
private int imageWidth = 1280;
......@@ -152,6 +151,7 @@ public class GDArCameraService extends Service {
parameters.setPreviewSize(imageWidth, imageHeight);
parameters.setPreviewFormat(ImageFormat.NV21);
mCamera.setParameters(parameters);
// mCamera.setDisplayOrientation(90);
mCamera.setPreviewCallback(new Camera.PreviewCallback() {
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
......@@ -219,6 +219,7 @@ public class GDArCameraService extends Service {
SharedMemUtils.setLength(buffer, 0);
SharedMemUtils.setContentSize(buffer, bytes.length);
SharedMemUtils.setContent(buffer, bytes);
try {
SharedMemUtils.setCanRead(buffer);
mMemoryFile.writeBytes(buffer, 0, 0, buffer.length);
......
......@@ -17,7 +17,7 @@ public class BroadcastUtils {
receiverIntent.putExtra("productModel", "M2");
receiverIntent.putExtra("cameraDisplay", "1280x720");
receiverIntent.putExtra("cameraName", "C2390");
receiverIntent.putExtra("imu", "MPU-6050");
receiverIntent.putExtra("imu", "DA280");
receiverIntent.putExtra("cameraConnect", "MIPI");
context.sendBroadcast(receiverIntent);
}
......
package com.autonavi.amapauto.gdarcameraservicedemo.utils;
import android.util.Log;
public class LogUtils {
public final static String TAG = "LogUtils";
private static long mStartTime;
public static void start(String tag) {
mStartTime = System.currentTimeMillis();
Log.e(TAG, tag + " Start time : " + mStartTime);
}
public static void end(String tag) {
long endTime = System.currentTimeMillis();
Log.e(TAG, tag + " End time : " + endTime);
Log.e(TAG, " Spend time : " + (endTime - mStartTime));
}
public static void e(String tag) {
Log.e(TAG, tag);
}
}
......@@ -204,9 +204,10 @@ public class SharedMemUtils {
if (header == null || header.length < HEADER_SIZE) {
return false;
}
for (int i = 0; i < tempData.length; i++) {
header[HEADER_SIZE+i] = tempData[i];
}
// for (int i = 0; i < tempData.length; i++) {
// header[HEADER_SIZE+i] = tempData[i];
// }
System.arraycopy(tempData, 0, header, HEADER_SIZE, tempData.length);
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment