summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2018-12-28 14:22:07 +0100
committerMarcus Meissner <marcus@jet.franken.de>2018-12-28 14:22:07 +0100
commitb5e37a43e412519b9e51b028eee0007e5668b567 (patch)
treefdd4874867bb36a319d9d37a94887c2f24acfdde
parentec550341dfb8210a231af733973a77452b7ef81e (diff)
downloadlibgphoto2-b5e37a43e412519b9e51b028eee0007e5668b567.tar.gz
add more getproplist variants
-rw-r--r--camlibs/ptp2/ptp.c40
-rw-r--r--camlibs/ptp2/ptp.h2
2 files changed, 23 insertions, 19 deletions
diff --git a/camlibs/ptp2/ptp.c b/camlibs/ptp2/ptp.c
index fd3c9ac88..5ac4895db 100644
--- a/camlibs/ptp2/ptp.c
+++ b/camlibs/ptp2/ptp.c
@@ -4375,18 +4375,13 @@ ptp_mtp_setobjectreferences (PTPParams* params, uint32_t handle, uint32_t* ohArr
}
uint16_t
-ptp_mtp_getobjectproplist (PTPParams* params, uint32_t handle, MTPProperties **props, int *nrofprops)
+ptp_mtp_getobjectproplist_generic (PTPParams* params, uint32_t handle, uint32_t formats, uint32_t properties, uint32_t propertygroups, uint32_t level, MTPProperties **props, int *nrofprops)
{
PTPContainer ptp;
unsigned char *data = NULL;
unsigned int size;
- PTP_CNT_INIT(ptp, PTP_OC_MTP_GetObjPropList, handle,
- 0x00000000U, /* 0x00000000U should be "all formats" */
- 0xFFFFFFFFU, /* 0xFFFFFFFFU should be "all properties" */
- 0x00000000U,
- 0xFFFFFFFFU /* means - return full tree below the Param1 handle */
- );
+ PTP_CNT_INIT(ptp, PTP_OC_MTP_GetObjPropList, handle, formats, properties, propertygroups, level);
CHECK_PTP_RC(ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size));
*nrofprops = ptp_unpack_OPL(params, data, props, size);
free(data);
@@ -4394,22 +4389,29 @@ ptp_mtp_getobjectproplist (PTPParams* params, uint32_t handle, MTPProperties **p
}
uint16_t
-ptp_mtp_getobjectproplist_single (PTPParams* params, uint32_t handle, MTPProperties **props, int *nrofprops)
+ptp_mtp_getobjectproplist_level (PTPParams* params, uint32_t handle, uint32_t level, MTPProperties **props, int *nrofprops)
{
- PTPContainer ptp;
- unsigned char *data = NULL;
- unsigned int size;
-
- PTP_CNT_INIT(ptp, PTP_OC_MTP_GetObjPropList, handle,
+ return ptp_mtp_getobjectproplist_generic (params, handle,
0x00000000U, /* 0x00000000U should be "all formats" */
0xFFFFFFFFU, /* 0xFFFFFFFFU should be "all properties" */
- 0x00000000U,
- 0x00000000U /* means - return single tree below the Param1 handle */
+ 0,
+ level,
+ props,
+ nrofprops
);
- CHECK_PTP_RC(ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size));
- *nrofprops = ptp_unpack_OPL(params, data, props, size);
- free(data);
- return PTP_RC_OK;
+}
+
+
+uint16_t
+ptp_mtp_getobjectproplist (PTPParams* params, uint32_t handle, MTPProperties **props, int *nrofprops)
+{
+ return ptp_mtp_getobjectproplist_level(params, handle, 0xFFFFFFFFU, props, nrofprops);
+}
+
+uint16_t
+ptp_mtp_getobjectproplist_single (PTPParams* params, uint32_t handle, MTPProperties **props, int *nrofprops)
+{
+ return ptp_mtp_getobjectproplist_level(params, handle, 0, props, nrofprops);
}
uint16_t
diff --git a/camlibs/ptp2/ptp.h b/camlibs/ptp2/ptp.h
index 44fe9dbef..130ebef8c 100644
--- a/camlibs/ptp2/ptp.h
+++ b/camlibs/ptp2/ptp.h
@@ -3022,6 +3022,8 @@ uint16_t ptp_mtp_setobjectpropvalue (PTPParams* params, uint32_t oid, uint16_t o
PTPPropertyValue *value, uint16_t datatype);
uint16_t ptp_mtp_getobjectreferences (PTPParams* params, uint32_t handle, uint32_t** ohArray, uint32_t* arraylen);
uint16_t ptp_mtp_setobjectreferences (PTPParams* params, uint32_t handle, uint32_t* ohArray, uint32_t arraylen);
+uint16_t ptp_mtp_getobjectproplist_generic (PTPParams* params, uint32_t handle, uint32_t formats, uint32_t properties, uint32_t propertygroups, uint32_t level, MTPProperties **props, int *nrofprops);
+uint16_t ptp_mtp_getobjectproplist_level (PTPParams* params, uint32_t handle, uint32_t level, MTPProperties **props, int *nrofprops);
uint16_t ptp_mtp_getobjectproplist (PTPParams* params, uint32_t handle, MTPProperties **props, int *nrofprops);
uint16_t ptp_mtp_getobjectproplist_single (PTPParams* params, uint32_t handle, MTPProperties **props, int *nrofprops);
uint16_t ptp_mtp_sendobjectproplist (PTPParams* params, uint32_t* store, uint32_t* parenthandle, uint32_t* handle,