11 std::stringstream formattedBuffer;
15 formattedBuffer << s << static_cast<int>(buff[index + (length -
i)]);
19 return formattedBuffer.str();
24 std::stringstream formattedBuffer;
26 formattedBuffer << std::setfill(
'0') << std::setw(2) << std::hex << static_cast<int>(buff[index +
i]);
28 return formattedBuffer.str();
36 uint8_t* writePtr = bufferToSend;
40 memcpy(writePtr + cur_index, &preHeaderData,
sizeof(
uint16_t));
42 memcpy(writePtr + cur_index, &opCodeNumber,
sizeof(
uint32_t));
44 memcpy(writePtr + cur_index, &p1,
sizeof(
uint32_t));
46 memcpy(writePtr + cur_index, &p2,
sizeof(
uint32_t));
48 memcpy(writePtr + cur_index, &p3,
sizeof(
uint32_t));
50 memcpy(writePtr + cur_index, &p4,
sizeof(
uint32_t));
56 cur_index += dataLength;
60 uint16_t tmp_size = length - header_size;
61 memcpy(bufferToSend, &tmp_size,
sizeof(
uint16_t));
67 std::vector<uint8_t> out_vec(out, out + outSize);
73 if (
res.size() <
static_cast<int>(
sizeof(
uint32_t)))
80 if (
res.size() >
static_cast<int>(inSize))
120 std::vector< uint8_t >
124 auto opCodeXmit =
static_cast<uint32_t>(newCommand.
cmd);
151 return std::vector<uint8_t>();
160 if (opCodeAsUint32 != opCodeXmit)
167 *p_response = err_type;
168 return std::vector<uint8_t>();
181 err <<
"hwmon command 0x" << std::hex << unsigned(cmd.
cmd) <<
'(';
185 err <<
' ' << cmd.
param4 << std::dec;
186 err <<
" ) failed (response " << e <<
"= " << (
str.empty() ?
"unknown" :
str ) <<
")";
202 get_gvd(gvd.size(), gvd.data(), gvd_cmd);
void send_hw_monitor_command(hwmon_cmd_details &details) const
std::string hwmon_error2str(hwmon_response e)
uint8_t receivedOpcode[4]
size_t receivedCommandDataLength
uint8_t receivedCommandData[HW_MONITOR_BUFFER_SIZE]
size_t receivedCommandDataLength
GLsizei const GLchar *const * string
std::shared_ptr< locked_transfer > _locked_transfer
std::array< uint8_t, HW_MONITOR_BUFFER_SIZE > receivedCommandData
static void fill_usb_buffer(int opCodeNumber, int p1, int p2, int p3, int p4, uint8_t const *data, int dataLength, uint8_t *bufferToSend, int &length)
static void update_cmd_details(hwmon_cmd_details &details, size_t receivedCmdLen, unsigned char *outputBuffer)
const uint16_t IVCAM_MONITOR_MAGIC_NUMBER
void execute_usb_command(uint8_t *out, size_t outSize, uint32_t &op, uint8_t *in, size_t &inSize) const
uint8_t data[HW_MONITOR_BUFFER_SIZE]
static std::string get_firmware_version_string(const std::vector< uint8_t > &buff, size_t index, size_t length=4)
std::vector< uint8_t > send(std::vector< uint8_t > const &data) const
int sizeOfSendCommandData
static std::string get_module_serial_string(const std::vector< uint8_t > &buff, size_t index, size_t length=6)
std::string hwmon_error_string(command const &cmd, hwmon_response e)
std::array< uint8_t, 4 > receivedOpcode
void get_gvd(size_t sz, unsigned char *gvd, uint8_t gvd_cmd) const
bool is_camera_locked(uint8_t gvd_cmd, uint32_t offset) const
GLenum GLuint GLenum GLsizei length
std::array< uint8_t, HW_MONITOR_BUFFER_SIZE > sendCommandData
const uint16_t HW_MONITOR_BUFFER_SIZE
int sizeOfSendCommandData
uint32_t pack(uint8_t c0, uint8_t c1, uint8_t c2, uint8_t c3)
const uint16_t IVCAM_MONITOR_MAX_BUFFER_SIZE
void copy(void *dst, void const *src, size_t size)