我正在尝试连接探戈设备并打开相机并只播放视频,我已编写代码但它给了我错误
" TangoErrorType TangoService_connect(void *,TangoConfig):启用彩色相机"
这是代码,
公共类Main_activity扩展了Activity {
private static final String TAG = Main_activity.class.getSimpleName();
private Tango mTango;
private TangoConfig mConfig;
public TangoCameraPreview camera;
private boolean mIsTangoServiceConnected;
private boolean isConnected;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_activity);
// Instantiate Tango client
mTango = new Tango(this);
//Setting up the Tango Configuration
mConfig = new TangoConfig();
mConfig = mTango.getConfig(mConfig.CONFIG_TYPE_CURRENT);
mConfig.putBoolean(TangoConfig.KEY_BOOLEAN_MOTIONTRACKING, true);
mConfig.putBoolean(TangoConfig.KEY_BOOLEAN_DEPTH, true);
mConfig.putBoolean(TangoConfig.KEY_BOOLEAN_COLORCAMERA, true);
camera = new TangoCameraPreview(this);
}
protected void onResume() {
super.onResume();
//lock the Tango Configuration and reconnect to the service each time
//when the app is brought to the foreground
super.onResume();
if(!mIsTangoServiceConnected){
startActivityForResult(
Tango.getRequestPermissionIntent(Tango.PERMISSIONTYPE_MOTION_TRACKING),
Tango.TANGO_INTENT_ACTIVITYCODE);
}
}
protected void onActivityResult(int requestCode, int resultCode, Intent data){
//check which request we're responding
if(requestCode == Tango.TANGO_INTENT_ACTIVITYCODE){
if (resultCode == RESULT_CANCELED) {
Toast.makeText(this,
"This app requires Motion Tracking permission!",
Toast.LENGTH_LONG).show();
finish();
return;
}
try{
setTangoListeners();
camera.connectToTangoCamera(mTango,0);
startcamerapreview();
}
catch(TangoErrorException e){
Toast.makeText(this, "Tango Error! Restart the app!",
Toast.LENGTH_SHORT).show();
}
try {
mTango.connect(mConfig);
mIsTangoServiceConnected = true;
} catch (TangoOutOfDateException e) {
Toast.makeText(getApplicationContext(),
"Tango Service out of date!", Toast.LENGTH_SHORT)
.show();
}
catch (TangoErrorException e) {
Toast.makeText(getApplicationContext(),
"Tango Error! Restart the app!", Toast.LENGTH_SHORT)
.show();
}
}
}
@Override
protected void onPause(){
super.onPause();
try {
mTango.disconnect();
mIsTangoServiceConnected = false;
} catch (TangoErrorException e) {
Toast.makeText(getApplicationContext(), "Tango Error!",
Toast.LENGTH_SHORT).show();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
}
private void setTangoListeners(){
Log.i(TAG,"Just the basic exmaple");
Toast.makeText(getApplicationContext(),"Running on the Tango Device, JJ branch",Toast.LENGTH_LONG).show();
}
public void startcamerapreview(){
camera.connectToTangoCamera(mTango, TangoCameraIntrinsics.TANGO_CAMERA_RGBIR);
isConnected=true;
ArrayList<TangoCoordinateFramePair> framePairs = new ArrayList<TangoCoordinateFramePair>();
mTango.connectListener(framePairs, new OnTangoUpdateListener() {
@Override
public void onPoseAvailable(TangoPoseData pose) {
// We are not using OnPoseAvailable for this app
}
@Override
public void onFrameAvailable(int cameraId) {
// Check if the frame available is for the camera we want and
// update its frame on the camera preview.
if (cameraId == TangoCameraIntrinsics.TANGO_CAMERA_RGBIR) {
camera.onFrameAvailable();
}
}
@Override
public void onXyzIjAvailable(TangoXyzIjData xyzIj) {
// We are not using OnPoseAvailable for this app
}
@Override
public void onTangoEvent(TangoEvent event) {
// We are not using OnPoseAvailable for this app
}
public void onPointCloudAvailable(TangoPointCloudData tpcd){
}
});
}// StartCameraPreview
}
我的目标是在探戈中初始化相机并打开相机应用程序。 提前致谢