Library to allo USB PTP device to be hosted by the mbed platform

Dependents:   class_project_main

Revision:
4:9c6f5867f050
Parent:
3:1fcb46ab18df
Child:
5:728b5d58e135
--- a/USBHostPTP.cpp	Fri Aug 23 23:34:05 2013 +0000
+++ b/USBHostPTP.cpp	Wed Aug 28 03:25:53 2013 +0000
@@ -457,14 +457,14 @@
     return Transaction(PIMA_OPERATION_CODE_GetStorageIDs, &flags, NULL, parser);
 }
 
-uint16_t USBHostPTP::GetStorageInfo(uint32_t storage_id, void *parser)
+uint16_t USBHostPTP::GetStorageInfo(uint32_t storage_id)
 {
     OperFlags   flags       = { 1, 0, 0, 1, 1, 0 };
 
     uint32_t    params[1]; 
     params[0]   = storage_id;
 
-    return Transaction(PIMA_OPERATION_CODE_GetStorageInfo, &flags, params, parser);
+    return Transaction(PIMA_OPERATION_CODE_GetStorageInfo, &flags, params,  (void*)&USBHostPTP::ParseStorageInfoDataBlock);
 }
 
 uint16_t USBHostPTP::CopyObject(uint32_t handle, uint32_t storage_id, uint32_t parent, uint32_t *new_handle)
@@ -679,6 +679,19 @@
       #endif 
 }
 
+void USBHostPTP::ParseStorageInfoDataBlock(void *ptp,uint8_t *buffer,uint16_t length){
+      uint8_t *ptr,*structptr;
+      USBHostPTP *obj=(USBHostPTP *)ptp; 
+      
+      structptr=(uint8_t *) &(obj->storageInfo);
+      ptr=buffer;
+      for(int i=0;i<0x1a;i++)
+         structptr[i]=ptr[i];
+      ptr+=0x1a;
+      ptr+=obj->storageInfo.storageDescription.FillString(ptr);
+      obj->storageInfo.volumeLabel.FillString(ptr);
+}
+
 
 bool USBHostPTP::IsCommandSupported(uint16_t opcode){
    bool res=false;
@@ -790,3 +803,4 @@
 
 #endif
 
+