1 package com.intel.realsense.camera;
3 import android.Manifest;
4 import android.content.Intent;
5 import android.content.pm.PackageManager;
6 import android.os.Bundle;
7 import com.google.android.material.floatingactionbutton.FloatingActionButton;
8 import androidx.core.app.ActivityCompat;
9 import androidx.core.content.ContextCompat;
10 import androidx.appcompat.app.AppCompatActivity;
11 import android.view.View;
12 import android.view.WindowManager;
19 import java.text.SimpleDateFormat;
20 import java.util.Date;
23 private static final String TAG =
"librs camera rec";
33 protected void onCreate(Bundle savedInstanceState) {
34 super.onCreate(savedInstanceState);
35 setContentView(
R.layout.activity_recording);
36 getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
38 mGLSurfaceView = findViewById(
R.id.recordingGlSurfaceView);
40 mStopRecordFab = findViewById(
R.id.stopRecordFab);
41 mStopRecordFab.setOnClickListener(
new View.OnClickListener() {
43 public void onClick(View
view) {
45 startActivity(intent);
50 if (ContextCompat.checkSelfPermission(
this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
55 mPermissionsGranted =
true;
60 if (ContextCompat.checkSelfPermission(
this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
65 mPermissionsGranted =
true;
72 if(mPermissionsGranted){
80 public void onFrameset(
FrameSet frameSet) {
81 mGLSurfaceView.
upload(frameSet);
85 mGLSurfaceView.
clear();
87 }
catch (Exception
e) {
99 if(mGLSurfaceView != null)
100 mGLSurfaceView.
clear();
104 File rsFolder =
new File(getExternalFilesDir(null).getAbsolutePath() +
105 File.separator + getString(
R.string.realsense_folder));
107 File folder =
new File(getExternalFilesDir(null).getAbsolutePath() +
108 File.separator + getString(
R.string.realsense_folder) + File.separator +
"video");
110 SimpleDateFormat sdf =
new SimpleDateFormat(
"yyyyMMdd_HHmmss");
111 String currentDateAndTime = sdf.format(
new Date());
112 File file =
new File(folder, currentDateAndTime +
".bag");
113 return file.getAbsolutePath();
GLRsSurfaceView mGLSurfaceView
boolean mPermissionsGranted
uvc_xu_option< int > super
void enableRecordToFile(String filePath)
::std_msgs::String_< std::allocator< void > > String
static final int PERMISSIONS_REQUEST_WRITE
void onCreate(Bundle savedInstanceState)
FloatingActionButton mStopRecordFab
synchronized void start()
void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults)