|
| 1 | +// Copyright (c) Orbbec Inc. All Rights Reserved. |
| 2 | +// Licensed under the MIT License. |
| 3 | + |
| 4 | +#ifdef __cplusplus |
| 5 | +extern "C" { |
| 6 | +#endif |
| 7 | + |
| 8 | +#include "ObTypes.h" |
| 9 | + |
| 10 | +/** |
| 11 | + * @brief Get the current depth work mode. |
| 12 | + * |
| 13 | + * @param[in] device The device object. |
| 14 | + * @param[out] error Pointer to an error object that will be set if an error occurs. |
| 15 | + * |
| 16 | + * @return ob_depth_work_mode The current depth work mode. |
| 17 | + */ |
| 18 | +OB_EXPORT ob_depth_work_mode ob_device_get_current_depth_work_mode(const ob_device *device, ob_error **error); |
| 19 | + |
| 20 | +/** |
| 21 | + * @brief Get current depth mode name |
| 22 | + * @brief According the current preset name to return current depth mode name |
| 23 | + * @return const char* return the current depth mode name. |
| 24 | + */ |
| 25 | +OB_EXPORT const char *ob_device_get_current_depth_work_mode_name(const ob_device *device, ob_error **error); |
| 26 | + |
| 27 | +/** |
| 28 | + * @brief Switch the depth work mode by ob_depth_work_mode. |
| 29 | + * Prefer to use ob_device_switch_depth_work_mode_by_name to switch depth mode when the complete name of the depth work mode is known. |
| 30 | + * |
| 31 | + * @param[in] device The device object. |
| 32 | + * @param[in] work_mode The depth work mode from ob_depth_work_mode_list which is returned by ob_device_get_depth_work_mode_list. |
| 33 | + * @param[out] error Pointer to an error object that will be set if an error occurs. |
| 34 | + * |
| 35 | + * @return ob_status The switch result. OB_STATUS_OK: success, other failed. |
| 36 | + */ |
| 37 | +OB_EXPORT ob_status ob_device_switch_depth_work_mode(ob_device *device, const ob_depth_work_mode *work_mode, ob_error **error); |
| 38 | + |
| 39 | +/** |
| 40 | + * @brief Switch the depth work mode by work mode name. |
| 41 | + * |
| 42 | + * @param[in] device The device object. |
| 43 | + * @param[in] mode_name The depth work mode name which is equal to ob_depth_work_mode.name. |
| 44 | + * @param[out] error Pointer to an error object that will be set if an error occurs. |
| 45 | + * |
| 46 | + * @return ob_status The switch result. OB_STATUS_OK: success, other failed. |
| 47 | + */ |
| 48 | +OB_EXPORT ob_status ob_device_switch_depth_work_mode_by_name(ob_device *device, const char *mode_name, ob_error **error); |
| 49 | + |
| 50 | +/** |
| 51 | + * @brief Request the list of supported depth work modes. |
| 52 | + * |
| 53 | + * @param[in] device The device object. |
| 54 | + * @param[out] error Pointer to an error object that will be set if an error occurs. |
| 55 | + * |
| 56 | + * @return ob_depth_work_mode_list The list of ob_depth_work_mode. |
| 57 | + */ |
| 58 | +OB_EXPORT ob_depth_work_mode_list *ob_device_get_depth_work_mode_list(const ob_device *device, ob_error **error); |
| 59 | + |
| 60 | +/** |
| 61 | + * \if English |
| 62 | + * @brief Get the depth work mode count that ob_depth_work_mode_list hold |
| 63 | + * @param[in] work_mode_list data struct contain list of ob_depth_work_mode |
| 64 | + * @param[out] error Pointer to an error object that will be set if an error occurs. |
| 65 | + * @return The total number contained in ob_depth_work_mode_list |
| 66 | + * |
| 67 | + */ |
| 68 | +OB_EXPORT uint32_t ob_depth_work_mode_list_get_count(const ob_depth_work_mode_list *work_mode_list, ob_error **error); |
| 69 | + |
| 70 | +/** |
| 71 | + * @brief Get the index target of ob_depth_work_mode from work_mode_list |
| 72 | + * |
| 73 | + * @param[in] work_mode_list Data structure containing a list of ob_depth_work_mode |
| 74 | + * @param[in] index Index of the target ob_depth_work_mode |
| 75 | + * @param[out] error Pointer to an error object that will be set if an error occurs. |
| 76 | + * @return ob_depth_work_mode |
| 77 | + * |
| 78 | + */ |
| 79 | +OB_EXPORT ob_depth_work_mode ob_depth_work_mode_list_get_item(const ob_depth_work_mode_list *work_mode_list, uint32_t index, ob_error **error); |
| 80 | + |
| 81 | +/** |
| 82 | + * @brief Free the resources of ob_depth_work_mode_list |
| 83 | + * |
| 84 | + * @param[in] work_mode_list Data structure containing a list of ob_depth_work_mode |
| 85 | + * @param[out] error Pointer to an error object that will be set if an error occurs. |
| 86 | + * |
| 87 | + */ |
| 88 | +OB_EXPORT void ob_delete_depth_work_mode_list(ob_depth_work_mode_list *work_mode_list, ob_error **error); |
| 89 | + |
| 90 | +/** |
| 91 | + * @breif Get the current preset name. |
| 92 | + * @brief The preset mean a set of parameters or configurations that can be applied to the device to achieve a specific effect or function. |
| 93 | + * |
| 94 | + * @param device The device object. |
| 95 | + * @param error Pointer to an error object that will be set if an error occurs. |
| 96 | + * @return The current preset name, it should be one of the preset names returned by @ref ob_device_get_available_preset_list. |
| 97 | + */ |
| 98 | +OB_EXPORT const char *ob_device_get_current_preset_name(const ob_device *device, ob_error **error); |
| 99 | + |
| 100 | +/** |
| 101 | + * @brief Get the available preset list. |
| 102 | + * @attention After loading the preset, the settings in the preset will set to the device immediately. Therefore, it is recommended to re-read the device |
| 103 | + * settings to update the user program temporarily. |
| 104 | + * |
| 105 | + * @param device The device object. |
| 106 | + * @param preset_name Pointer to an error object that will be set if an error occurs. The name should be one of the preset names returned by @ref |
| 107 | + * ob_device_get_available_preset_list. |
| 108 | + * @param error Pointer to an error object that will be set if an error occurs. |
| 109 | + */ |
| 110 | +OB_EXPORT void ob_device_load_preset(ob_device *device, const char *preset_name, ob_error **error); |
| 111 | + |
| 112 | +/** |
| 113 | + * @brief Load preset from json string. |
| 114 | + * @brief After loading the custom preset, the settings in the custom preset will set to the device immediately. |
| 115 | + * @brief After loading the custom preset, the available preset list will be appended with the custom preset and named as the file name. |
| 116 | + * |
| 117 | + * @param device The device object. |
| 118 | + * @param json_file_path The json file path. |
| 119 | + * @param error Pointer to an error object that will be set if an error occurs. |
| 120 | + */ |
| 121 | +OB_EXPORT void ob_device_load_preset_from_json_file(ob_device *device, const char *json_file_path, ob_error **error); |
| 122 | + |
| 123 | +/** |
| 124 | + * @brief Load custom preset from data. |
| 125 | + * @brief After loading the custom preset, the settings in the custom preset will set to the device immediately. |
| 126 | + * @brief After loading the custom preset, the available preset list will be appended with the custom preset and named as the @ref presetName. |
| 127 | + * |
| 128 | + * @attention The user should ensure that the custom preset data is adapted to the device and the settings in the data are valid. |
| 129 | + * @attention It is recommended to re-read the device settings to update the user program temporarily after successfully loading the custom preset. |
| 130 | + * |
| 131 | + * @param data The custom preset data. |
| 132 | + * @param size The size of the custom preset data. |
| 133 | + */ |
| 134 | +OB_EXPORT void ob_device_load_preset_from_json_data(ob_device *device, const char *presetName, const uint8_t *data, uint32_t size, ob_error **error); |
| 135 | + |
| 136 | +/** |
| 137 | + * @brief Export current settings as a preset json file. |
| 138 | + * @brief After exporting the custom preset, the available preset list will be appended with the custom preset and named as the file name. |
| 139 | + * |
| 140 | + * @param device The device object. |
| 141 | + * @param json_file_path The json file path. |
| 142 | + * @param error Pointer to an error object that will be set if an error occurs. |
| 143 | + */ |
| 144 | +OB_EXPORT void ob_device_export_current_settings_as_preset_json_file(ob_device *device, const char *json_file_path, ob_error **error); |
| 145 | + |
| 146 | +/** |
| 147 | + * @brief Export current device settings as a preset json data. |
| 148 | + * @brief After exporting the preset, a new preset named as the @ref presetName will be added to the available preset list. |
| 149 | + * |
| 150 | + * @attention The memory of the data is allocated by the SDK, and will automatically be released by the SDK. |
| 151 | + * @attention The memory of the data will be reused by the SDK on the next call, so the user should copy the data to a new buffer if it needs to be |
| 152 | + * preserved. |
| 153 | + * |
| 154 | + * @param[out] data return the preset json data. |
| 155 | + * @param[out] dataSize return the size of the preset json data. |
| 156 | + */ |
| 157 | +OB_EXPORT void ob_device_export_current_settings_as_preset_json_data(ob_device *device, const char *presetName, const uint8_t **data, uint32_t *dataSize, |
| 158 | + ob_error **error); |
| 159 | + |
| 160 | +/** |
| 161 | + * @brief Get the available preset list. |
| 162 | + * |
| 163 | + * @param device The device object. |
| 164 | + * @param error Pointer to an error object that will be set if an error occurs. |
| 165 | + * @return The available preset list. |
| 166 | + */ |
| 167 | +OB_EXPORT ob_device_preset_list *ob_device_get_available_preset_list(const ob_device *device, ob_error **error); |
| 168 | + |
| 169 | +/** |
| 170 | + * @brief Delete the available preset list. |
| 171 | + * |
| 172 | + * @param preset_list The available preset list. |
| 173 | + * @param error Pointer to an error object that will be set if an error occurs. |
| 174 | + */ |
| 175 | +OB_EXPORT void ob_delete_preset_list(ob_device_preset_list *preset_list, ob_error **error); |
| 176 | + |
| 177 | +/** |
| 178 | + * @brief Get the number of preset in the preset list. |
| 179 | + * |
| 180 | + * @param preset_list The available preset list. |
| 181 | + * @param error Pointer to an error object that will be set if an error occurs. |
| 182 | + * @return The number of preset in the preset list. |
| 183 | + */ |
| 184 | +OB_EXPORT uint32_t ob_device_preset_list_get_count(const ob_device_preset_list *preset_list, ob_error **error); |
| 185 | + |
| 186 | +/** |
| 187 | + * @brief Get the name of the preset in the preset list. |
| 188 | + * |
| 189 | + * @param preset_list The available preset list. |
| 190 | + * @param index The index of the preset in the preset list. |
| 191 | + * @param error Pointer to an error object that will be set if an error occurs. |
| 192 | + * @return The name of the preset in the preset list. |
| 193 | + */ |
| 194 | +OB_EXPORT const char *ob_device_preset_list_get_name(const ob_device_preset_list *preset_list, uint32_t index, ob_error **error); |
| 195 | + |
| 196 | +/** |
| 197 | + * @brief Check if the preset list has the preset. |
| 198 | + * |
| 199 | + * @param preset_list The available preset list. |
| 200 | + * @param preset_name The name of the preset. |
| 201 | + * @param error Pointer to an error object that will be set if an error occurs. |
| 202 | + * @return Whether the preset list has the preset. If true, the preset list has the preset. If false, the preset list does not have the preset. |
| 203 | + */ |
| 204 | +OB_EXPORT bool ob_device_preset_list_has_preset(const ob_device_preset_list *preset_list, const char *preset_name, ob_error **error); |
| 205 | + |
| 206 | +// The following interfaces are deprecated and are retained here for compatibility purposes. |
| 207 | +#define ob_depth_work_mode_list_count ob_depth_work_mode_list_get_count |
| 208 | +#define ob_device_preset_list_count ob_device_preset_list_get_count |
| 209 | + |
| 210 | +#ifdef __cplusplus |
| 211 | +} |
| 212 | +#endif |
0 commit comments