33 DBG <<
"Destroying ip_device";
44 for (
int remote_sensor_index = 0; remote_sensor_index <
NUM_OF_SENSORS; remote_sensor_index++)
50 catch (
const std::exception &
e)
54 DBG <<
"Destroying ip_device completed";
71 int colon = ip_address.find(
":");
72 this->ip_address = ip_address.substr(0, colon);
89 DBG <<
"query_streams";
90 std::vector<rs2_video_stream>
streams;
104 DBG <<
"get_controls";
105 std::vector<IpDeviceControlData>
controls;
113 std::vector<rs2::stream_profile> device_streams;
133 for(
auto& control : controls)
138 INF <<
"Init sensor " << control.sensorId <<
", option '" << control.option <<
"', value " << control.range.def;
140 if(control.range.min == control.range.max)
146 remote_sensors[control.sensorId]->
sw_sensor->add_option(control.option, {control.range.min, control.range.max, control.range.def, control.range.step});
152 if(val != control.range.def && val >= control.range.min && val <= control.range.max)
157 catch(
const std::exception&
e)
166 DBG <<
"Init got " <<
streams.size() <<
" streams per sensor " << sensor_id;
168 for(
int stream_index = 0; stream_index <
streams.size(); stream_index++)
170 bool is_default=
false;
187 device_streams.push_back(stream_profile);
191 DBG <<
"Init done adding streams for sensor ID: " << sensor_id;
194 for(
auto stream_profile_from : device_streams)
196 for(
auto stream_profile_to : device_streams)
203 ERR <<
"Extrinsics data is missing.";
207 stream_profile_from.register_extrinsics_to(stream_profile_to, extrinisics);
228 enabled = (sw_sensor->get_active_streams().size() > 0);
238 catch(
const std::exception&
e)
246 notification.serialized_data = e.what();
251 auto sensor_supported_option = sw_sensor->get_supported_options();
254 if(
remote_sensors[
i]->sensors_option[opt] != (
float)sw_sensor->get_option(opt))
264 catch(
const std::exception&
e)
274 float updated_value = 0;
277 if(val != updated_value)
281 ERR <<
"Cannot update option value.";
317 if(updated_streams.size() == 0)
329 for(
size_t i = 0;
i < updated_streams.size();
i++)
337 throw std::runtime_error(
"[update_sensor_state] stream key: " +
std::to_string(requested_stream_key) +
" is not found. closing device.");
347 INF <<
"Stream started for sensor " << sensor_index;
361 rtp_stream.get()->is_enabled =
true;
363 rtp_stream.get()->frame_data_buff.frame_number = 0;
365 rtp_stream->frame_data_buff.bpp =
getStreamProfileBpp(rtp_stream.get()->get_stream_profile().format());
366 rtp_stream->frame_data_buff.stride = rtp_stream->frame_data_buff.bpp * rtp_stream->m_rs_stream.width;
368 int uid = rtp_stream.get()->m_rs_stream.uid;
372 while(rtp_stream.get()->is_enabled ==
true)
374 if(rtp_stream.get()->queue_size() != 0)
376 Raw_Frame* frame = rtp_stream.get()->extract_frame();
377 rtp_stream.get()->frame_data_buff.pixels = frame->
m_buffer;
381 rtp_stream.get()->frame_data_buff.frame_number++;
394 rtp_stream.get()->reset_queue();
395 DBG <<
"Polling data at stream " << rtp_stream.get()->m_rs_stream.uid <<
" completed";
397 catch(
const std::exception& ex)
417 DeviceData data = ip_dev->remote_sensors[0]->rtsp_client->getDeviceData();
423 return sw_dev.
get().get();
static int getPhysicalSensorUniqueKey(rs2_stream stream_type, int sensors_index)
#define DEFAULT_PROFILE_HIGHT
std::map< rs2_option, float > sensors_option
void get_option_value(int sensor_index, rs2_option opt, float &val)
const std::shared_ptr< rs2_device > & get() const
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls...
rs2_video_stream convert_stream_object(rs2::video_stream_profile sp)
void register_info(rs2_camera_info info, const std::string &val)
std::map< std::pair< int, int >, rs2_extrinsics > minimal_extrinsics_map
std::map< long long int, std::shared_ptr< rs_rtp_stream > > streams_collection
static long long int getStreamProfileUniqueKey(rs2_video_stream t_profile)
const std::string RGB_SENSOR_NAME("RGB Camera")
RsMetadataHeader * m_metadata
All the parameters required to define a video stream.
std::thread sw_device_status_check
void update_option_value(int sensor_index, rs2_option opt, float val)
void verify_version_compatibility(int api_version)
int stream_type_to_sensor_id(rs2_stream type)
GLsizei const GLchar *const * string
software_sensor add_sensor(std::string name)
void update_sensor_state(int sensor_index, std::vector< rs2::stream_profile > updated_streams, bool recover)
#define HANDLE_EXCEPTIONS_AND_RETURN(R,...)
std::string sensors_str[]
void polling_state_loop()
const std::string STEREO_SENSOR_NAME("Stereo Module")
#define DEFAULT_PROFILE_COLOR_FORMAT
GLenum GLenum GLsizei const GLuint GLboolean enabled
virtual std::vector< rs2_video_stream > getStreams()=0
virtual int getOption(const std::string &t_sensorName, rs2_option t_option, float &t_value)=0
std::vector< IpDeviceControlData > get_controls(int sensor_id)
void update_info(rs2_camera_info info, const std::string &val)
std::vector< IpDeviceControlData > controls
static MemoryPool & get_memory_pool()
#define POLLING_SW_DEVICE_STATE_INTERVAL
rs2_stream
Streams are different types of data provided by RealSense devices.
virtual std::vector< IpDeviceControlData > getControls()=0
virtual int setOption(const std::string &t_sensorName, rs2_option t_option, float t_value)=0
void set_destruction_callback(T callback) const
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented...
std::map< long long int, rs_rtp_callback * > rtp_callbacks
bool init_device_data(rs2::software_device sw_device)
void inject_frames_loop(std::shared_ptr< rs_rtp_stream > rtp_stream)
std::vector< rs2_video_stream > query_streams(int sensor_id)
ip_device(rs2::software_device sw_device, std::string ip_address)
rs2_format format() const
void set_option_value(int sensor_index, rs2_option opt, float val)
#define DEFAULT_PROFILE_FPS
rs2_device * rs2_create_net_device(int api_version, const char *address, rs2_error **error) BEGIN_API_CALL
All the parameters required to define a sensor notification.
void recover_rtsp_client(int sensor_index)
static IRsRtsp * createNew(char const *t_rtspURL, char const *t_applicationName, portNumBits t_tunnelOverHTTPPortNum, int idx)
int getStreamProfileBpp(rs2_format t_format)
std::list< long long int > active_streams_keys
std::map< long long int, std::thread > inject_frames_thread
std::map< std::pair< rs2_stream, int >, int > default_streams
#define DEFAULT_PROFILE_WIDTH
GLuint GLuint64EXT address
int stoi(const std::string &value)
std::shared_ptr< rs2::software_sensor > sw_sensor
void stop_sensor_streams(int sensor_id)
virtual int addStream(rs2_video_stream t_stream, rtp_callback *t_frameCallBack)=0
rs2_stream stream_type() const
ip_sensor * remote_sensors[NUM_OF_SENSORS]
#define VALIDATE_NOT_NULL(ARG)
std::string to_string(T value)