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

Dependents:   class_project_main

Revision:
10:fc1cb68fc91e
Parent:
9:961c3357504d
Child:
11:3b072cf16df8
diff -r 961c3357504d -r fc1cb68fc91e USBHostPTP.cpp
--- a/USBHostPTP.cpp	Tue Sep 10 07:40:44 2013 +0000
+++ b/USBHostPTP.cpp	Wed Sep 18 01:48:07 2013 +0000
@@ -580,12 +580,12 @@
 {
     OperFlags   flags       = { 1, 0, 0, 1, 1, 0 };
     uint32_t    params[1];
-
+    
     params[0] = (uint32_t)pcode;
     
     if(IsPropertySupported(pcode)==false)
        return PIMA_RETURN_CODE_DevicePropertyNotSupported;
-
+       
     return Transaction(PIMA_OPERATION_CODE_GetDevicePropDesc, &flags, params, parser);
 }
 
@@ -756,6 +756,13 @@
       obj->storageInfo.volumeLabel.FillString(ptr);
 }
 
+void USBHostPTP::ParseDevicePropDescrBlock(void *ptp,uint8_t *buffer,uint16_t length){
+   PIMAPropDescr *temp;
+   
+   temp= new PIMAPropDescr;
+   temp.fill(buffer);
+   
+}
 
 bool USBHostPTP::IsCommandSupported(uint16_t opcode){
    bool res=false;
@@ -763,23 +770,17 @@
    if(opcode==PIMA_OPERATION_CODE_OpenSession || opcode==PIMA_OPERATION_CODE_GetDeviceInfo)
        res=true;
    else
-       res = CheckValueInArray(&deviceInfo.operationsSupported,opcode);
+       res = deviceInfo.operationsSupported.CheckValueInArray(opcode);
    return res;
 }
 
 bool USBHostPTP::IsPropertySupported(uint16_t code){
   
-   return CheckValueInArray(&deviceInfo.devicePropertiesSupported, code);
+   return deviceInfo.devicePropertiesSupported.CheckValueInArray(code);
    
 }
 
-bool USBHostPTP::CheckValueInArray(PIMAArray *array, uint16_t code) {
-    bool res=false;
-   for(int i=0; i<array->numberOfElements;i++)
-       if(code == array->codes[i])
-          res=true;
-   return res;
-}
+
 
 
 void USBHostPTP::DumpBuffer(uint8_t *buffer,uint32_t length){
@@ -803,23 +804,23 @@
      printf("Functional Mode:          %x\r\n",deviceInfo.functionMode);
      printf("Supported Operations: \r\n");
      for(i=0;i<deviceInfo.operationsSupported.numberOfElements;i++) {
-       printf("0x%04x\r\n",deviceInfo.operationsSupported.codes[i]);
+       printf("0x%04x\r\n",deviceInfo.operationsSupported.GetElement(i));
      }
      printf("Supported Events: \r\n");
      for(i=0;i<deviceInfo.eventsSupported.numberOfElements;i++) {
-       printf("0x%04x\r\n",deviceInfo.eventsSupported.codes[i]);
+       printf("0x%04x\r\n",deviceInfo.eventsSupported.GetElement(i));
      }
      printf("Supported Device Properties: \r\n");
      for(i=0;i<deviceInfo.devicePropertiesSupported.numberOfElements;i++) {
-       printf("0x%04x\r\n",deviceInfo.devicePropertiesSupported.codes[i]);
+       printf("0x%04x\r\n",deviceInfo.devicePropertiesSupported.GetElement(i));
      }
      printf("Supported Capture Formats: \r\n");
      for(i=0;i<deviceInfo.captureFormats.numberOfElements;i++) {
-       printf("0x%04x\r\n",deviceInfo.captureFormats.codes[i]);
+       printf("0x%04x\r\n",deviceInfo.captureFormats.GetElement(i));
      }
      printf("Supported Image Formats: \r\n");
      for(i=0;i<deviceInfo.imageFormats.numberOfElements;i++) {
-       printf("0x%04x\r\n",deviceInfo.imageFormats.codes[i]);
+       printf("0x%04x\r\n",deviceInfo.imageFormats.GetElement(i));
      }
      
      printf("Manufacturer: \r\n");