summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2025-06-07 12:09:24 +0200
committerGravatar Nikias Bassen2025-06-07 12:09:24 +0200
commite3f2d6070de7125058c343ef63961c27bc991bb6 (patch)
tree2436f76213b34ba2e06db96a990a6f0e17106e6e /include
parent2e1ee28bf1d744edcf3513859a38ac5f6615b096 (diff)
downloadlibimobiledevice-e3f2d6070de7125058c343ef63961c27bc991bb6.tar.gz
libimobiledevice-e3f2d6070de7125058c343ef63961c27bc991bb6.tar.bz2
Add new idevice_get_device_version() to interface
This allows getting a numerical representation of the device's ProductVersion string for easier version range checks
Diffstat (limited to 'include')
-rw-r--r--include/libimobiledevice/libimobiledevice.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/libimobiledevice/libimobiledevice.h b/include/libimobiledevice/libimobiledevice.h
index 8df3fed..bc57778 100644
--- a/include/libimobiledevice/libimobiledevice.h
+++ b/include/libimobiledevice/libimobiledevice.h
@@ -404,6 +404,19 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_get_handle(idevice_t device, uint32
404LIBIMOBILEDEVICE_API idevice_error_t idevice_get_udid(idevice_t device, char **udid); 404LIBIMOBILEDEVICE_API idevice_error_t idevice_get_udid(idevice_t device, char **udid);
405 405
406/** 406/**
407 * Returns the device ProductVersion in numerical form, where "X.Y.Z"
408 * will be returned as (X << 16) | (Y << 8) | Z .
409 * Use IDEVICE_DEVICE_VERSION macro for easy version comparison.
410 * @see IDEVICE_DEVICE_VERSION
411 *
412 * @param client Initialized device client
413 *
414 * @return A numerical representation of the X.Y.Z ProductVersion string
415 * or 0 if the version cannot be retrieved.
416 */
417LIBIMOBILEDEVICE_API unsigned int idevice_get_device_version(idevice_t device);
418
419/**
407 * Gets a readable error string for a given idevice error code. 420 * Gets a readable error string for a given idevice error code.
408 * 421 *
409 * @param err An idevice error code 422 * @param err An idevice error code
@@ -419,6 +432,10 @@ LIBIMOBILEDEVICE_API const char* idevice_strerror(idevice_error_t err);
419 */ 432 */
420LIBIMOBILEDEVICE_API const char* libimobiledevice_version(); 433LIBIMOBILEDEVICE_API const char* libimobiledevice_version();
421 434
435/* macros */
436/** Helper macro to get a numerical representation of a product version tuple */
437#define IDEVICE_DEVICE_VERSION(maj, min, patch) ((((maj) & 0xFF) << 16) | (((min) & 0xFF) << 8) | ((patch) & 0xFF))
438
422#ifdef __cplusplus 439#ifdef __cplusplus
423} 440}
424#endif 441#endif