l500-fw-update-device.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2019 Intel Corporation. All Rights Reserved.
3 
5 #include "l500-private.h"
6 
7 namespace librealsense
8 {
9  l500_update_device::l500_update_device(std::shared_ptr<context> ctx, bool register_device_notifications, std::shared_ptr<platform::usb_device> usb_device)
10  : update_device(ctx, register_device_notifications, usb_device), _product_line("L500")
11  {
12  auto info = usb_device->get_info();
13  _name = ivcam2::rs500_sku_names.find(info.pid) != ivcam2::rs500_sku_names.end() ? ivcam2::rs500_sku_names.at(info.pid) : "unknown";
15  }
16 
17  void l500_update_device::update(const void* fw_image, int fw_image_size, update_progress_callback_ptr callback) const
18  {
19  update_device::update(fw_image, fw_image_size, callback);
20  }
21 
22  std::string l500_update_device::parse_serial_number(const std::vector<uint8_t>& buffer) const
23  {
24  // Note that we are using a specific serial_number_data struct then the generic one.
25  // See comment in the struct definition for more details
26  if (buffer.size() != sizeof(l500_update_device::serial_number_data))
27  throw std::runtime_error("DFU - failed to parse serial number!");
28 
29  const auto serial_num_data = (l500_update_device::serial_number_data *)buffer.data();
30  std::stringstream rv;
31  for (auto i = 0; i < ivcam2::module_asic_serial_size; i++)
32  rv << std::setfill('0') << std::setw(2) << std::hex << static_cast<int>(serial_num_data->serial[i]);
33 
34  return rv.str();
35  }
36 }
static const std::map< std::uint16_t, std::string > rs500_sku_names
Definition: l500-private.h:250
GLsizei const GLchar *const * string
l500_update_device(std::shared_ptr< context > ctx, bool register_device_notifications, std::shared_ptr< platform::usb_device > usb_device)
GLenum GLfloat * buffer
std::shared_ptr< rs2_update_progress_callback > update_progress_callback_ptr
Definition: src/types.h:1077
def info(name, value, persistent=False)
Definition: test.py:301
def callback(frame)
Definition: t265_stereo.py:91
virtual void update(const void *fw_image, int fw_image_size, update_progress_callback_ptr=nullptr) const override
std::vector< uint8_t > _serial_number_buffer
int i
void update(const void *fw_image, int fw_image_size, update_progress_callback_ptr=nullptr) const override
std::string parse_serial_number(const std::vector< uint8_t > &buffer) const


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:21