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

Dependents:   class_project_main

Revision:
3:1fcb46ab18df
Parent:
1:71c0e9dc153d
Child:
4:9c6f5867f050
diff -r 67753d738eb8 -r 1fcb46ab18df USBHostPTP.cpp
--- a/USBHostPTP.cpp	Fri Aug 23 20:02:44 2013 +0000
+++ b/USBHostPTP.cpp	Fri Aug 23 23:34:05 2013 +0000
@@ -230,20 +230,20 @@
   if(IsCommandSupported(operationCode)==false)
        return PIMA_RETURN_CODE_OperationNotSupported;
        
-  commandContainer.len           = PIMA_CONTAINER_HEADER_LENGTH + operationFlags->opParams*4;
+  commandContainer.length        = PIMA_CONTAINER_HEADER_LENGTH + operationFlags->opParams*4;
   responseLength                 = PIMA_CONTAINER_HEADER_LENGTH + operationFlags->rsParams*4;  
-  responseContainer.len          = responseLength;
-  commandContainer.opcode        = operationCode;
-  commandContainer.TransactionID = transactionCnt++;
+  responseContainer.length          = responseLength;
+  commandContainer.code        = operationCode;
+  commandContainer.transactionID = transactionCnt++;
   for (i=0; i<operationFlags->opParams; i++)
-    commandContainer.param[i]=parameters[i];
+    commandContainer.payload[i]=parameters[i];
     
   #ifdef USDBPTPDEBUG
       printf("PTPCommandContainer:\r\n");
-      DumpBuffer((uint8_t *)&commandContainer,commandContainer.len);
+      DumpBuffer((uint8_t *)&commandContainer,commandContainer.length);
   #endif
   
-  transferResult = host->bulkWrite(pointerToDevice, bulk_out,(uint8_t *)&commandContainer, commandContainer.len);
+  transferResult = host->bulkWrite(pointerToDevice, bulk_out,(uint8_t *)&commandContainer, commandContainer.length);
   if (checkResult(transferResult, bulk_out))
        return PIMA_RETURN_CODE_IncompleteTransfer;
   #ifdef USDBPTPDEBUG
@@ -269,7 +269,7 @@
               #endif
               firstDataBlockReceived = false;
               pointerToUint8tData    = buffer + PIMA_CONTAINER_HEADER_LENGTH;
-              bytesRemaining         = dataContainer.len - PIMA_CONTAINER_HEADER_LENGTH;
+              bytesRemaining         = dataContainer.length - PIMA_CONTAINER_HEADER_LENGTH;
               this->totalDataToTransfer = bytesRemaining;
               if(dataContainer.type==PIMA_CONTAINER_DATA)
                   bytesReceived -= PIMA_CONTAINER_HEADER_LENGTH;
@@ -310,7 +310,7 @@
                       pointerToUint8tData[i]=buffer[bytesRemaining+i];
                    }
                    
-                   return responseContainer.opcode;
+                   return responseContainer.code;
                } else {
                   
                    return PIMA_RETURN_CODE_IncompleteTransfer; 
@@ -342,7 +342,7 @@
   }
   #endif
   
-  return responseContainer.opcode;
+  return responseContainer.code;
 }
 
 
@@ -413,7 +413,7 @@
     params[2] = (uint32_t)assoc;
 
     if ( (ptp_error = Transaction(PIMA_OPERATION_CODE_GetNumObjects, &flags, params)) == PIMA_RETURN_CODE_OK)
-        *retval = responseContainer.param[0];
+        *retval = responseContainer.payload[0];
 
     return ptp_error;
 }
@@ -478,7 +478,7 @@
     params[2] = parent;
 
     if ( (ptp_error = Transaction(PIMA_OPERATION_CODE_CopyObject, &flags, params)) == PIMA_RETURN_CODE_OK)
-        *new_handle = responseContainer.param[0];
+        *new_handle = responseContainer.payload[0];
 
     return ptp_error;
 }