Skip to content

Commit

Permalink
[feat]: add get pid interface
Browse files Browse the repository at this point in the history
  • Loading branch information
daiyin committed Aug 9, 2024
1 parent 20f5737 commit 45b992f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 12 deletions.
15 changes: 15 additions & 0 deletions include/k4a/k4a.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ extern "C" {
* @{
*/

/** get device pid
*
* \remarks This API is currently mainly used to get device pid
*
* \xmlonly
* <requirements>
* <requirement name="Header">k4a.h (include k4a/k4a.h)</requirement>
* <requirement name="Library">k4a.lib</requirement>
* <requirement name="DLL">k4a.dll</requirement>
* </requirements>
* \endxmlonly
*/
K4A_EXPORT int k4a_device_get_pid(k4a_device_t device);


/** get device sync mode
*
* \remarks This API is currently mainly used to get device sync mode
Expand Down
4 changes: 4 additions & 0 deletions include/k4a/k4a.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1536,6 +1536,10 @@ class device
return k4a_device_get_wired_sync_mode(m_handle);
}

int get_pid(){
return k4a_device_get_pid(m_handle);
}

private:
k4a_device_t m_handle;
};
Expand Down
34 changes: 22 additions & 12 deletions src/orbbec/ob_k4a_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ char K4A_ENV_VAR_LOG_TO_A_FILE[] = K4A_ENABLE_LOG_TO_A_FILE;
#define UNREFERENCED_VALUE(P) ((void)P)

#define MAX_JSON_FILE_SIZE 1024 * 10
#define ORBBEC_MEGA_PID 0x0669
#define ORBBEC_BOLT_PID 0x066B
#define MAX_DELAY_TIME 33333
#define MIN_DELAY_TIME -33333

Expand Down Expand Up @@ -192,6 +190,14 @@ K4A_DECLARE_CONTEXT(k4a_depthengine_t, k4a_depthengine_instance_helper_t);
case fps: \
return #fps

int k4a_device_get_pid(k4a_device_t device_handle){
ob_error *ob_err = NULL;
k4a_device_context_t *device_ctx = k4a_device_t_get_context(device_handle);
ob_device_info *dev_info = ob_device_get_device_info(device_ctx->device, &ob_err);
int pid = ob_device_info_pid(dev_info, &ob_err);
return pid;
}

k4a_wired_sync_mode_t k4a_device_get_wired_sync_mode(k4a_device_t device_handle){
k4a_device_context_t *device_ctx = k4a_device_t_get_context(device_handle);
OB_DEVICE_SYNC_CONFIG ob_config;
Expand Down Expand Up @@ -2752,17 +2758,21 @@ k4a_result_t k4a_device_get_color_control_capabilities(k4a_device_t device_handl
}
break;
case K4A_COLOR_CONTROL_HDR:{
ob_bool_property_range colorParamRange = ob_device_get_bool_property_range(obDevice,
OB_PROP_COLOR_HDR_BOOL,
&ob_err);
CHECK_OB_ERROR_RETURN_K4A_RESULT(&ob_err);
ob_device_info *dev_info = ob_device_get_device_info(device_ctx->device, &ob_err);
int pid = ob_device_info_pid(dev_info, &ob_err);
if(pid == ORBBEC_BOLT_PID){
ob_bool_property_range colorParamRange = ob_device_get_bool_property_range(obDevice,
OB_PROP_COLOR_HDR_BOOL,
&ob_err);
CHECK_OB_ERROR_RETURN_K4A_RESULT(&ob_err);

*supports_auto = false;
*min_value = colorParamRange.min;
*max_value = colorParamRange.max;
*step_value = colorParamRange.step;
*default_value = colorParamRange.def;
*default_mode = K4A_COLOR_CONTROL_MODE_MANUAL;
*supports_auto = false;
*min_value = colorParamRange.min;
*max_value = colorParamRange.max;
*step_value = colorParamRange.step;
*default_value = colorParamRange.def;
*default_mode = K4A_COLOR_CONTROL_MODE_MANUAL;
}
result = K4A_RESULT_SUCCEEDED;
}
break;
Expand Down

0 comments on commit 45b992f

Please sign in to comment.