Arianna autonomous DAQ firmware
Dependencies: mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW
Diff: SnCommWin.cpp
- Revision:
- 54:ea1234a44fe8
- Parent:
- 41:d6f5e2f09e07
- Child:
- 56:0bba0ef15697
--- a/SnCommWin.cpp Sun Dec 15 02:56:06 2013 +0000 +++ b/SnCommWin.cpp Sun Dec 15 05:25:40 2013 +0000 @@ -383,6 +383,10 @@ uint8_t mcode=0; uint32_t mlen=0; SnCommWin::ECommWinResult res = GetHeader(timeout, buf, bsize, mcode, mlen); +#ifdef DEBUG + printf("Got header code %x, len %u\r\n",mcode,mlen); +#endif + if ( (res>=kOkWithMsg) && (mcode==SnHeaderFrame::kMbedFileCode) ) { #ifdef DEBUG printf("Got mbed file header. File length = %u\r\n",mlen); @@ -517,10 +521,14 @@ } else { // filename mangled. either doesn't contain a '.' // or the extension is longer than 3 letters +#ifdef DEBUG + printf("filname mangled. (%s) size=%u, xdot=%u", + fname.c_str(), fname.size(), xdot); +#endif res = SnCommWin::kUnexpectedRec; } } // if header ok - + return res; } @@ -605,9 +613,10 @@ } else if (mcode==SnHeaderFrame::kMbedFilenameCode) { res = GetFilename(timeOut, confBuf, mlen); if (res>kAllFails) { - std::string fname(confBuf, mlen); // the filename + std::string fnameb(confBuf, mlen); // the filename + std::string fname(fnameb.c_str()); // mlen may include the \0 which would be counted in size() #ifdef DEBUG - printf("got filename = [%s]\r\n", fname.c_str()); + printf("got filename = [%s] (%u)\r\n", fname.c_str(), fname.size()); #endif res = GetLocalFile(fname, confBuf, bsize, timeOut); }