Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ArCameraServiceDemo
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
maiqh
ArCameraServiceDemo
Commits
1038e1ed
Commit
1038e1ed
authored
Aug 12, 2020
by
maiqh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化数据拷贝方式和修改陀螺仪名称
parent
e078de7f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
6 deletions
+31
-6
GDArCameraService.java
...avi/amapauto/gdarcameraservicedemo/GDArCameraService.java
+3
-2
BroadcastUtils.java
.../amapauto/gdarcameraservicedemo/utils/BroadcastUtils.java
+1
-1
LogUtils.java
...tonavi/amapauto/gdarcameraservicedemo/utils/LogUtils.java
+23
-0
SharedMemUtils.java
.../amapauto/gdarcameraservicedemo/utils/SharedMemUtils.java
+4
-3
No files found.
CameraServiceDemo/app/src/main/java/com/autonavi/amapauto/gdarcameraservicedemo/GDArCameraService.java
View file @
1038e1ed
...
@@ -16,12 +16,12 @@ import com.autonavi.amapauto.gdarcameraservice.IGDCameraStateCallBack;
...
@@ -16,12 +16,12 @@ import com.autonavi.amapauto.gdarcameraservice.IGDCameraStateCallBack;
import
com.autonavi.amapauto.gdarcameraservice.IGDSize
;
import
com.autonavi.amapauto.gdarcameraservice.IGDSize
;
import
com.autonavi.amapauto.gdarcameraservice.model.ArCameraOpenResultParam
;
import
com.autonavi.amapauto.gdarcameraservice.model.ArCameraOpenResultParam
;
import
com.autonavi.amapauto.gdarcameraservice.model.GDArCameraParam
;
import
com.autonavi.amapauto.gdarcameraservice.model.GDArCameraParam
;
import
com.autonavi.amapauto.gdarcameraservicedemo.utils.LogUtils
;
import
com.autonavi.amapauto.gdarcameraservicedemo.utils.SharedMemUtils
;
import
com.autonavi.amapauto.gdarcameraservicedemo.utils.SharedMemUtils
;
import
java.io.FileDescriptor
;
import
java.io.FileDescriptor
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.util.Arrays
;
public
class
GDArCameraService
extends
Service
{
public
class
GDArCameraService
extends
Service
{
private
final
static
String
TAG
=
"GDArCameraService"
;
private
final
static
String
TAG
=
"GDArCameraService"
;
...
@@ -32,7 +32,6 @@ public class GDArCameraService extends Service {
...
@@ -32,7 +32,6 @@ public class GDArCameraService extends Service {
public
static
final
int
HEADER_SIZE
=
20
;
public
static
final
int
HEADER_SIZE
=
20
;
/**
/**
* 图片宽度
* 图片宽度
* 注意: 车盒上支持1080宽度,但手机上不支持,手机上设置宽度位1080时,会报错导致相机打不开
*/
*/
private
int
imageWidth
=
1280
;
private
int
imageWidth
=
1280
;
...
@@ -152,6 +151,7 @@ public class GDArCameraService extends Service {
...
@@ -152,6 +151,7 @@ public class GDArCameraService extends Service {
parameters
.
setPreviewSize
(
imageWidth
,
imageHeight
);
parameters
.
setPreviewSize
(
imageWidth
,
imageHeight
);
parameters
.
setPreviewFormat
(
ImageFormat
.
NV21
);
parameters
.
setPreviewFormat
(
ImageFormat
.
NV21
);
mCamera
.
setParameters
(
parameters
);
mCamera
.
setParameters
(
parameters
);
// mCamera.setDisplayOrientation(90);
mCamera
.
setPreviewCallback
(
new
Camera
.
PreviewCallback
()
{
mCamera
.
setPreviewCallback
(
new
Camera
.
PreviewCallback
()
{
@Override
@Override
public
void
onPreviewFrame
(
byte
[]
data
,
Camera
camera
)
{
public
void
onPreviewFrame
(
byte
[]
data
,
Camera
camera
)
{
...
@@ -219,6 +219,7 @@ public class GDArCameraService extends Service {
...
@@ -219,6 +219,7 @@ public class GDArCameraService extends Service {
SharedMemUtils
.
setLength
(
buffer
,
0
);
SharedMemUtils
.
setLength
(
buffer
,
0
);
SharedMemUtils
.
setContentSize
(
buffer
,
bytes
.
length
);
SharedMemUtils
.
setContentSize
(
buffer
,
bytes
.
length
);
SharedMemUtils
.
setContent
(
buffer
,
bytes
);
SharedMemUtils
.
setContent
(
buffer
,
bytes
);
try
{
try
{
SharedMemUtils
.
setCanRead
(
buffer
);
SharedMemUtils
.
setCanRead
(
buffer
);
mMemoryFile
.
writeBytes
(
buffer
,
0
,
0
,
buffer
.
length
);
mMemoryFile
.
writeBytes
(
buffer
,
0
,
0
,
buffer
.
length
);
...
...
CameraServiceDemo/app/src/main/java/com/autonavi/amapauto/gdarcameraservicedemo/utils/BroadcastUtils.java
View file @
1038e1ed
...
@@ -17,7 +17,7 @@ public class BroadcastUtils {
...
@@ -17,7 +17,7 @@ public class BroadcastUtils {
receiverIntent
.
putExtra
(
"productModel"
,
"M2"
);
receiverIntent
.
putExtra
(
"productModel"
,
"M2"
);
receiverIntent
.
putExtra
(
"cameraDisplay"
,
"1280x720"
);
receiverIntent
.
putExtra
(
"cameraDisplay"
,
"1280x720"
);
receiverIntent
.
putExtra
(
"cameraName"
,
"C2390"
);
receiverIntent
.
putExtra
(
"cameraName"
,
"C2390"
);
receiverIntent
.
putExtra
(
"imu"
,
"
MPU-605
0"
);
receiverIntent
.
putExtra
(
"imu"
,
"
DA28
0"
);
receiverIntent
.
putExtra
(
"cameraConnect"
,
"MIPI"
);
receiverIntent
.
putExtra
(
"cameraConnect"
,
"MIPI"
);
context
.
sendBroadcast
(
receiverIntent
);
context
.
sendBroadcast
(
receiverIntent
);
}
}
...
...
CameraServiceDemo/app/src/main/java/com/autonavi/amapauto/gdarcameraservicedemo/utils/LogUtils.java
0 → 100644
View file @
1038e1ed
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
);
}
}
CameraServiceDemo/app/src/main/java/com/autonavi/amapauto/gdarcameraservicedemo/utils/SharedMemUtils.java
View file @
1038e1ed
...
@@ -204,9 +204,10 @@ public class SharedMemUtils {
...
@@ -204,9 +204,10 @@ public class SharedMemUtils {
if
(
header
==
null
||
header
.
length
<
HEADER_SIZE
)
{
if
(
header
==
null
||
header
.
length
<
HEADER_SIZE
)
{
return
false
;
return
false
;
}
}
for
(
int
i
=
0
;
i
<
tempData
.
length
;
i
++)
{
// for (int i = 0; i < tempData.length; i++) {
header
[
HEADER_SIZE
+
i
]
=
tempData
[
i
];
// header[HEADER_SIZE+i] = tempData[i];
}
// }
System
.
arraycopy
(
tempData
,
0
,
header
,
HEADER_SIZE
,
tempData
.
length
);
return
true
;
return
true
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment