Guest User

Untitled

a guest
Apr 27th, 2011
116
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void TestCustomFile(FILE* customFileHandle, int numPingsReceived)
  2. {
  3.     BVTDataBuffer sonarBuffer = BVTDataBuffer_Create();
  4.     ReadFromCustomFile(customFileHandle, sonarBuffer);
  5.  
  6.     size_t sonarBufferLength = 0;
  7.     BVTDataBuffer_GetLength(sonarBuffer, &sonarBufferLength);
  8.     unsigned char* sonarBufferData = new unsigned char[sonarBufferLength];
  9.     BVTDataBuffer_CopyTo(sonarBuffer, sonarBufferData, sonarBufferLength);
  10.  
  11.     BVTSonar sonar = BVTSonar_Create();
  12.     BVTSonar_SetFromBytes(sonar, sonarBufferData, sonarBufferLength);
  13.  
  14.     BVTHead head;
  15.     BVTSonar_GetHead(sonar, 0, &head);
  16.  
  17.     // const int pingCount = BVTHead_GetPingCount(head);
  18.     const int pingCount = numPingsReceived;
  19.  
  20.  
  21.     for(int i = 0; i < pingCount; ++i)
  22.     {
  23.         printf("Reading ping %d\n", i);
  24.         BVTDataBuffer pingBuffer = BVTDataBuffer_Create();
  25.         ReadFromCustomFile(customFileHandle, pingBuffer);
  26.  
  27.         BVTPing ping;
  28.         BVTHead_CreatePingFromBytes(head, &ping, pingBuffer);
  29.  
  30.         // needed? BVTPing_Destroy(ping);
  31.         BVTDataBuffer_Destroy(pingBuffer);
  32.     }
  33.  
  34.     BVTSonar_Destroy(sonar);
  35. }
RAW Paste Data