4D systems Picaso uLCD 32PTU touch display library
Diff: Picaso_4DGL-32PTU_File.cpp
- Revision:
- 24:19c77967674e
- Parent:
- 23:dd2c28fa4dfd
- Child:
- 25:015631f9e875
--- a/Picaso_4DGL-32PTU_File.cpp Tue Sep 27 10:45:38 2016 +0000 +++ b/Picaso_4DGL-32PTU_File.cpp Tue Sep 27 11:10:20 2016 +0000 @@ -167,11 +167,12 @@ for (k = 0; k < size-1; k++) command[j++] = filename[k]; command[j] = 0; + puts("\n\rFirst file = "); writeCOMMAND(command, size); bool success = writeSectorResponse(3); free(command); #ifdef DEBUGMODE - pc.printf("\n\r DEBUG: %s count = %s\n\r", filename, success ? " true" : "false"); + pc.printf("\n\r DEBUG: %s Found = %s\n\r", filename, success ? " true" : "false"); #endif } @@ -209,5 +210,58 @@ return len; } +//************************************************************************** +// The Find Next File command returns true if more file exists that satisfies +// the file argument that was given for the “Find First File” or +// “Find First File and Report” commands. +// Wildcards must be used for the “Find First File” or “Find First File and Report” +// commands else this function will always return zero as the only occurrence +// will have already been found. +// +// Note that the filename is printed on the screen. +//************************************************************************** +void PICASO_4DGL :: file_FindNext() { + + char command[2]; + + command[0] = (FILE_NEXT >> (8*1)) & 0xff; + command[1] = (FILE_NEXT >> (8*0)) & 0xff; + + puts("\n\rNext file = "); + writeCOMMAND(command, 2); + bool success = writeSectorResponse(3); +#ifdef DEBUGMODE + pc.printf("\n\r DEBUG: next file found = %s\n\r", success ? " true" : "false"); +#endif +} + +//************************************************************************** +// Returns length of the filename and the filename if at least 1 file exists +// that matches the criteria given for the “Find First File” or +// “Find First File and Report” commands. +// Wildcards must be used for the “Find First File” or “Find First File and Report” +// commands else this function will always return zero as the only occurrence will have +// already been found. +// +// Wildcards are usually used, so if the “Find First File” or “Find First File and Report” +// commands return the stringlength and filename, further tests can be made using Find +// Next File and Report command to find all the files that match the wildcard class. +//************************************************************************** +short PICASO_4DGL :: file_FindNextRet(char *outStr) { + + char command[2]; + + command[0] = (FILE_NEXT_RET >> (8*1)) & 0xff; + command[1] = (FILE_NEXT_RET >> (8*0)) & 0xff; + + writeCOMMAND(command, 2); + short len = getFilenameResponse(outStr); + +#ifdef DEBUGMODE + pc.printf("\n\r DEBUG: Found next filename = %s\n\r", outStr); +#endif + return len; +} +