1 package com.intel.realsense.camera;
3 import android.content.Context;
4 import android.content.SharedPreferences;
5 import android.os.Handler;
6 import android.util.Log;
24 import java.util.List;
28 private static final String TAG =
"librs camera streamer";
41 private final Handler
mHandler =
new Handler();
46 public Streamer(Context context,
boolean loadConfig, Listener listener){
49 mLoadConfig = loadConfig;
57 mListener.onFrameset(
frames);
59 mHandler.post(mStreaming);
62 Log.e(TAG,
"streaming, error: " + e.getMessage());
70 if (
devices.getDeviceCount() == 0) {
86 Map<Integer, List<StreamProfile>> profilesMap;
88 if (
devices.getDeviceCount() == 0) {
93 Log.e(TAG,
"failed to create device");
99 SharedPreferences sharedPref = mContext.getSharedPreferences(mContext.getString(
R.string.app_settings), Context.MODE_PRIVATE);
101 for(Map.Entry
e : profilesMap.entrySet()){
102 List<StreamProfile>
profiles = (List<StreamProfile>)
e.getValue();
107 if(index == -1 || index >= profiles.size())
108 throw new IllegalArgumentException(
"Failed to resolve config");
123 void configAndStart()
throws Exception {
127 if(mListener != null)
134 public synchronized void start() throws Exception {
139 Log.d(TAG,
"try start streaming");
144 mHandler.post(mStreaming);
145 Log.d(TAG,
"streaming started successfully");
146 }
catch (Exception
e) {
147 Log.e(TAG,
"failed to start streaming: " + e.getMessage());
153 public synchronized void stop() {
157 Log.d(TAG,
"try stop streaming");
158 mIsStreaming =
false;
159 mHandler.removeCallbacks(mStreaming);
162 Log.d(TAG,
"streaming stopped successfully");
163 }
catch (Exception
e) {
164 Log.w(TAG,
"failed to stop streaming");
::rosgraph_msgs::Log_< std::allocator< void > > Log
static String getIndexdDeviceConfigString(String pid, StreamType streamType, int streamIndex)
static Map< Integer, List< StreamProfile > > createProfilesMap(Device device)
::std_msgs::String_< std::allocator< void > > String
Streamer(Context context, boolean loadConfig, Listener listener)
static final int L500_TIMEOUT
def run(include_folder_path, addon_folder_path)
int getFirstFrameTimeout()
static final int DEFAULT_TIMEOUT
void enableStream(StreamType type)
boolean is(Extension extension)
final boolean mLoadConfig
static String getEnabledDeviceConfigString(String pid, StreamType streamType, int streamIndex)
synchronized void start()
DeviceList queryDevices()
void configStream(Config config)