You are here

ZOC Script. BGS2/EHSx/PDsx/Pxx8 FFS Access/read/create files

Tutorial, October 13, 2017 - 11:45am, 839 views

his article will drive the use  the Flash File System Access available on the BGS2 Release >2.00/EHSx >2.00/PDsx/Pxx8 >3.20 modules through the use of the AT^SFSA command. .

General Overview of Flash File System Architecture (Byte numbers and file position/offsets)

Descriptions in the provided Zoc script do make extensive reference to byte numbers and file positions/offsets. To help understand how these values are updated during FFS operations, please have a look at the simplified graphical explanation below (Note: please note that this preliminary overview does not refer directly to the demonstration script and can be considered in isolation).

Zoc Script

The BGS2 Release >2.00 module is delivered from the factory with a default directory "voiceprompt" already loaded. For the purposes of this demo, all existing directories should be removed from the module before executing the script. The script does attempt to remove this directory (as well as others called DirectoryA and DirectoryB which are created later in the script) so as to return the module to a defined state. If these directories do not exist the module will return an ERROR, but this is normal and has been included in the script so that it can be repeated in succession without having to manually delete these directories.

SAY
SAY "# Flash File System Access Demo # "||DATE("N")" at "||TIME("N")||" #"
SAY

script_location= ZocGetInfo(SCRIPTNAME)

CALL ZocLogging 0
CALL ZocSetOption "CaptTimeMarks=yes"
CALL ZocSetOption "CaptAppend=yes"
script_full_filename= ZocFilename(GETFILE,script_location)
PARSE VALUE script_full_filename WITH script_filename"."
CALL ZocLogname script_filename||"_20^3-^2-^1_^4.^5.^6.TXT"
CALL ZocLogging 1
CALL ZocTimeout 60		

CALL ZocSend 'AT^^SFSA="close",0^M'
CALL ZocDelay 2

CALL ZocSend 'AT^^SFSA="ls",a:/^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="remove",A:/DirectoryB/test.txt^M'
CALL ZocDelay 2

CALL ZocSend 'AT^^SFSA="rmdir",a:/DirectoryB^M'
CALL ZocDelay 2

CALL ZocSend 'AT^^SFSA="rmdir",a:/DirectoryA^M'
CALL ZocDelay 2

CALL ZocSend 'AT^^SFSA="rmdir",a:/voiceprompt^M'
CALL ZocDelay 2

CALL ZocSend 'ATI^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'ATI1^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT+CCLK="'||DATE('O')||','||TIME('N')||'"^M'
CALL ZocWait "OK"
CALL ZocDelay 0.1

CALL ZocSend "'AT+CCLK?^M"
CALL ZocWait "OK"
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="gstat"^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocReceiveBuf(1500)
CALL ZocSend 'AT^^SFSA="gstat",a:/^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="ls",a:/^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="mkdir",a:/DirectoryA^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="ls",a:/^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="rename","a:/DirectoryA","DirectoryB"^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="ls",a:/^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="gstat",a:/^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="stat",a:/^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="ls",a:/DirectoryB^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="open","a:/DirectoryB/test.txt",8^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="ls",a:/DirectoryB^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="stat",a:/DirectoryB/test.txt^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="gstat"^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="close",0^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="open","a:/DirectoryB/test.txt",3^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="write",0,52^M'
CALL ZocWait "CONNECT"
CALL ZocSend "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="read",0,1500^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="write",0,10^M'
CALL ZocWait "CONNECT"
CALL ZocSend "1234567890"
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="close",0^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="open","a:/DirectoryB/test.txt",2^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="read",0,1500^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="stat",a:/DirectoryB^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="stat","a:/DirectoryB/test.txt"^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="close",0^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="open","a:/DirectoryB/test.txt",7^M'
CALL ZocWait 'OK' 
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="write",0,20^M'
CALL ZocWait "CONNECT"
CALL ZocDelay 0.1
CALL ZocSend '1234567890)(*&%$#@!+'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="read",0,1500^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="seek",0,0^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="read",0,10^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="read",0,10^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="read",0,10^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="read",0,10^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="seek",0,10^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="write",0,10^M'
CALL ZocWait "CONNECT"
CALL ZocSend "KLMNOPQRST"
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="read",0,1500^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="seek",0,0^M'
cALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="read",0,1500^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="close",0^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="ls",a:/^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="ls",a:/DirectoryB^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="gstat",a:/^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="stat",a:/^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="stat",a:/DirectoryB^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="stat",a:/DirectoryB/test.txt^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="remove",a:/DirectoryB/test.txt^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="ls",a:/^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="ls",a:/DirectoryB^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="rmdir",a:/DirectoryB^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="ls",a:/^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="gstat"^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

CALL ZocSend 'AT^^SFSA="gstat",a:/^M'
CALL ZocWait 'OK'
CALL ZocDelay 0.1

  Zoc Script Output and Explanation

[10:42:22.7] AT^SFSA="close",0				--> Close file with <file handle> = 0
[10:42:22.7] ^SFSA: 9					--> Result (9 = invalid file descriptor)
[10:42:22.7] ERROR	
	
[10:42:24.7] AT^SFSA="ls",a:/				--> List contents of a directory (path = a:/)
[10:42:24.7] ^SFSA: voiceprompt				--> Directory "voiceprompt" exists"
[10:42:24.7] ^SFSA: 0					--> Result (0 = success)
	
[10:42:24.7] OK	
[10:42:24.8] AT^SFSA="remove",A:/DirectoryB/test.txt	--> Remove "test.txt" from a:/DirectoryB
[10:42:24.9] ^SFSA: 2					--> Result (2 = file not found)
[10:42:24.9] ERROR	
	
[10:42:26.9] AT^SFSA="rmdir",a:/DirectoryB		--> Remove directory (path = a:/DirectoryB)
[10:42:26.9] ^SFSA: 2					--> Result (2 = file/directory not found)
[10:42:26.9] ERROR	
	
[10:42:28.9] AT^SFSA="rmdir",a:/DirectoryA		--> Remove directory (path = a:/DirectoryB)
[10:42:28.9] ^SFSA: 2					--> Result (2 = file/directory not found)
[10:42:28.9] ERROR	
	
[10:42:30.9] AT^SFSA="rmdir",a:/voiceprompt		--> Remove directory (path = a:/voiceprompt)
[10:42:30.9] ^SFSA: 0					--> Result (0 = success)
	
[10:42:30.9] OK	
[10:42:32.9] ATI					--> Display product identification information
	
[10:42:33.0] Cinterion	
[10:42:33.0] BGS2-W	
[10:42:33.0] REVISION 02.000	
	
[10:42:33.0] OK	
[10:42:33.1] ATI1					--> Display product identification information - with application revision number
	
[10:42:33.1] Cinterion	
[10:42:33.1] BGS2-W	
[10:42:33.1] REVISION 02.000	
[10:42:33.1] A-REVISION 01.000.07	
	
[10:42:33.1] OK	
[10:42:33.3] AT+CCLK="12/12/07,10:42:33"		--> Set Time and date of module
	
[10:42:33.3] OK	
[10:42:33.4] AT+CCLK?					--> Read date and time of module
	
[10:42:33.5] +CCLK: "12/12/07,10:42:33"	
	
[10:42:33.5] OK	
[10:42:33.6] AT^SFSA="gstat"				--> Read global status of FFS
[10:42:33.6] ^SFSA: 1966080				--> Storage size
[10:42:33.6] ^SFSA: 1890940				--> Free space
[10:42:33.6] ^SFSA: 0					--> Result (0 = success)
	
[10:42:33.6] OK	
[10:42:33.8] AT^SFSA="gstat",a:/"			--> Read global status of a:/ drive on FFS
[10:42:33.8] ^SFSA: 1966080				--> Storage size
[10:42:33.8] ^SFSA: 1890940				--> Free space
[10:42:33.8] ^SFSA: 0					--> Result (0 = success)
	
[10:42:33.8] OK	
[10:42:33.9] AT^SFSA="ls",a:/				--> List contents of a directory (path = a:/)
[10:42:34.0] ^SFSA: 0					--> No directories, Result (0 = success)"
	
[10:42:34.0] OK	
[10:42:34.1] AT^SFSA="mkdir",a:/DirectoryA		--> Make a directory "DirectoryA" on a:/
[10:42:34.1] ^SFSA: 0					--> Result (0 = success)
	
[10:42:34.1] OK	
[10:42:34.3] AT^SFSA="ls",a:/				--> List contents of a directory (path = a:/)
[10:42:34.3] ^SFSA: DirectoryA				--> DirectoryA has been created
[10:42:34.3] ^SFSA: 0					--> Result (0 = success)
	
[10:42:34.3] OK	
[10:42:34.4] AT^SFSA="rename","a:/DirectoryA","DirectoryB"		--> Rename DirectoryA to DirectoryB
[10:42:34.5] ^SFSA: 0							--> Result (0 = success)
	
[10:42:34.5] OK	
[10:42:34.6] AT^SFSA="ls",a:/			--> List contents of a directory (path = a:/)
[10:42:34.7] ^SFSA: DirectoryB			--> DirectoryA renamed to DirectoryB
[10:42:34.7] ^SFSA: 0				--> Result (0 = success)
	
[10:42:34.7] OK	
[10:42:34.8] AT^SFSA="gstat",a:/		--> Read global status of a:/ drive on FFS
[10:42:34.8] ^SFSA: 1966080			--> Storage Size
[10:42:34.8] ^SFSA: 1890760			--> Free space - Has decreased because "DirectoryB" has been created
[10:42:34.8] ^SFSA: 0				--> Result (0 = success)
	
[10:42:34.8] OK	
[10:42:35.0] AT^SFSA="stat",a:/			--> Read directory status (path = a:/)
[10:42:35.0] ^SFSA: 0				--> File/Directory size = 0
[10:42:35.0] ^SFSA: 03/01/01,00:05:10		--> Date last accessed
[10:42:35.0] ^SFSA: 03/01/01,00:05:10		--> Date last modified
[10:42:35.0] ^SFSA: 03/01/01,00:05:10		--> Date last file stat change
[10:42:35.0] ^SFSA: 32784			--> stat attributes
[10:42:35.0] ^SFSA: 0				--> Result (0 = success)
	
[10:42:35.0] OK	
[10:42:35.1] AT^SFSA="ls",a:/DirectoryB		--> List contents of a:/DirectoryB on FFS
[10:42:35.2] ^SFSA: 0				--> No files in directory; Result (0 = success)
	
[10:42:35.2] OK	
[10:42:35.3] AT^SFSA="open","a:/DirectoryB/test.txt",8		--> CREATE FILE "test.txt" <flags> = 8
[10:42:35.3] ^SFSA: 0,0						--> <file handle> for "test.txt" = 0; Result (0 = success)
	
[10:42:35.3] OK	
[10:42:35.5] AT^SFSA="ls",a:/DirectoryB		--> List contents of a:/DirectoryB on FFS
[10:42:35.5] ^SFSA: test.txt			--> "test.txt" present under a:/DirectoryB
[10:42:35.5] ^SFSA: 0				--> Result (0 = success)
	
[10:42:35.5] OK	
[10:42:35.6] AT^SFSA="stat",a:/DirectoryB/test.txt		--> Read file status (of "test.txt")
[10:42:35.7] ^SFSA: 0						--> File size = 0
[10:42:35.7] ^SFSA: 12/12/07,10:42:34				--> Date last accessed
[10:42:35.7] ^SFSA: 12/12/07,10:42:34				--> Date last modified
[10:42:35.7] ^SFSA: 12/12/07,10:42:34				--> Date last file stat change
[10:42:35.7] ^SFSA: 0						--> stat attributes; 0 = regular file
[10:42:35.7] ^SFSA: 0						--> Result (0 = success)
	
[10:42:35.7] OK	
[10:42:35.8] AT^SFSA="gstat"					--> Read global status of a:/ drive on FFS
[10:42:35.9] ^SFSA: 1966080					--> Storage Size
[10:42:35.9] ^SFSA: 1890722					--> Free space - Has decreased because "test.txt" has been created
[10:42:35.9] ^SFSA: 0						--> Result (0 = success)
	
[10:42:35.9] OK	
[10:42:36.0] AT^SFSA="close",0			--> Close file with <file handle> = 0 i.e. "test.txt"
[10:42:36.0] ^SFSA: 0				--> Result (0 = success)
	
[10:42:36.0] OK	
[10:42:36.2] AT^SFSA="open","a:/DirectoryB/test.txt",3		--> Open file "test.txt" with <flag> = 3 (read, write only, read/write access)
[10:42:36.2] ^SFSA: 0,0						--> <file handle> for "test.txt" = 0; Result (0 = success); File position/offset = 0.
	
[10:42:36.2] OK	
[10:42:36.3] AT^SFSA="write",0,52			--> Write 52 bytes to file with <file handle> = 0; Bytes 1 to 52 written; File position/offest = 52
[10:42:36.4] CONNECT					--> Wait for CONNECT
							--> Data written (abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ)
[10:42:36.4] ^SFSA: 0					--> Result (0 = success)
	
[10:42:36.4] OK	
[10:42:36.6] AT^SFSA="read",0,1500		--> File position/offest = 52; Request to read next 1500 bytes (from byte = 53 to 1553) 
						--> No data returned. This is because there are no bytes present from byte 53 (file position/offset = 52)
[10:42:36.6] ^SFSA: 0,0				--> Result (0 = success);
	
[10:42:36.6] OK	
[10:42:36.7] AT^SFSA="write",0,10		--> File position/offset = 52; write 10 bytes to file with <file handle> = 0 
[10:42:36.8] CONNECT				--> Wait for CONNECT
						--> Data written (1234567890)
[10:42:36.8] ^SFSA: 0				--> Result (0 = success)
	
[10:42:36.8] OK	
[10:42:36.9] AT^SFSA="close",0			--> Close file with <file handle> = 0
[10:42:37.0] ^SFSA: 0				--> Result (0 = success)
	
[10:42:37.0] OK	
[10:42:37.1] AT^SFSA="open","a:/DirectoryB/test.txt",2		--> Open file "test.txt" with <flag> = 2 (read/write access)
[10:42:37.1] ^SFSA: 0,0						--> <file handle> for "test.txt" = 0; Result (0 = success); Files position/offset = 0
	
[10:42:37.1] OK	
[10:42:37.3] AT^SFSA="read",0,1500						--> File position/offset = 0; Request to read 1500 bytes from file with <file handle> = 0
[10:42:37.3] ^SFSA: 62,0							--> 62 bytes read from file (byte 1 to byte 62), Result (0 = success)"
[10:42:37.3] abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890	--> Binary data
	
[10:42:37.3] OK	
[10:42:37.4] AT^SFSA="stat",a:/DirectoryB		--> Read directory status (path = a:/DirectoryB) 
[10:42:37.4] ^SFSA: 0					--> File/Directory size = 0
[10:42:37.4] ^SFSA: 12/12/07,10:42:34			--> Date last accessed
[10:42:37.4] ^SFSA: 12/12/07,10:42:34			--> Date last modified
[10:42:37.4] ^SFSA: 12/12/07,10:42:34			--> Date last file stat change
[10:42:37.4] ^SFSA: 16					--> stat attributes (16 = directory)
[10:42:37.4] ^SFSA: 0					--> Result (0 = success)
	
[10:42:37.5] OK	
[10:42:37.6] AT^SFSA="stat","a:/DirectoryB/test.txt		--> Read file status (path = a:/DirectoryB/test.txt) 
[10:42:37.7] ^SFSA: 62						--> File/Directory size = 62 bytes
[10:42:37.7] ^SFSA: 12/12/07,10:42:36				--> Date last accessed
[10:42:37.7] ^SFSA: 12/12/07,10:42:36				--> Date last modified
[10:42:37.7] ^SFSA: 12/12/07,10:42:36				--> Date last file stat change
[10:42:37.7] ^SFSA: 0						--> stat attributes; 0 = regular file 
[10:42:37.7] ^SFSA: 0						--> Result (0 = success)
	
[10:42:37.7] OK	
[10:42:37.8] AT^SFSA="close",0		--> Close file with <file handle> = 0
[10:42:37.8] ^SFSA: 0			--> Result (0 = success)
	
[10:42:37.8] OK	
[10:42:37.9] AT^SFSA="open","a:/DirectoryB/test.txt",7		--> Open file "test.txt" with <flag> = 7 (append)
[10:42:38.0] ^SFSA: 0,0						--> <file handle> for "test.txt" = 0; Result (0 = success); File position/offset = 62
	
[10:42:38.0] OK	
[10:42:38.1] AT^SFSA="write",0,20	--> File position/offset = 62; write 20 bytes to file with <file handle> = 0. Data written from byte 63 to 83.
[10:42:38.1] CONNECT			--> Wait for CONNECT
					--> Data written (1234567890)(*&%$#@!+)
[10:42:38.3] ^SFSA: 0			--> Result (0 = success)
	
[10:42:38.3] OK	
[10:42:38.4] AT^SFSA="read",0,1500	--> File position/offset = 82. Request to read next 1500 bytes from file with <file handle> = 0
[10:42:38.5] ^SFSA: 0,0			--> 0 bytes read from file (No bytes present from byte 83 to 1583), Result (0 = success)
	
[10:42:38.5] OK	
[10:42:38.6] AT^SFSA="seek",0,0		--> Set file position/offset to 0
[10:42:38.6] ^SFSA: 0,0			--> New file position/offset = 0, Result (0 = success)
	
[10:42:38.6] OK	
[10:42:38.8] AT^SFSA="read",0,10	--> File position/offset = 0. Request to read 10 bytes from file with <file handle> = 0.
[10:42:38.8] ^SFSA: 10,0		--> 10 bytes read from file, Result (0 = success)
[10:42:38.8] abcdefghij			--> Binary data (byte = 1 to 10). File position/Offset = 10 at end
	
[10:42:38.8] OK	
[10:42:38.9] AT^SFSA="read",0,1		--> File position/Offset = 10. Request to read 10 bytes from file with <file handle> = 0.
[10:42:39.0] ^SFSA: 10,0		--> 10 bytes read from file, Result (0 = success)
[10:42:39.0] klmnopqrst			--> Binary data (byte 11 to 20). File position/offset = 20 at end
	
[10:42:39.0] OK	
[10:42:39.1] AT^SFSA="read",0,10	--> File position/offset = 20. Request to read 10 bytes from file with <file handle> = 0.
[10:42:39.1] ^SFSA: 10,0		--> 10 bytes read from file, Result (0 = success)
[10:42:39.1] uvwxyzABCD			--> Binary data (byte 21 to 30). File position/offset = 30 at end
	
[10:42:39.1] OK	
[10:42:39.3] AT^SFSA="read",0,10	--> File position/offset = 30. Request to read 10 bytes from file with <file handle> = 0.
[10:42:39.3] ^SFSA: 10,0		--> 10 bytes read from file, Result (0 = success)
[10:42:39.3] EFGHIJKLMN			--> Binary data (byte 31 to 40). File position/offset = 40 at end
	
[10:42:39.3] OK	
[10:42:39.5] AT^SFSA="seek",0,10	--> Set file position/offset to 10
[10:42:39.5] ^SFSA: 10,0		--> New file position/offset = 10, Result (0 = success)
	
[10:42:39.5] OK	
[10:42:39.6] AT^SFSA="write",0,10	--> File position/offset = 10; write 10 bytes to file with <file handle> = 0. Data written from byte 11 to 20.
[10:42:39.7] CONNECT			--> Wait for CONNECT
					--> Data written (KLMNOPQRST)
[10:42:39.7] ^SFSA: 0			--> Result (0 = success). File position/offset = 20 at end
	
[10:42:39.7] OK	
[10:42:39.8] AT^SFSA="read",0,1500						--> File position/offset = 20. Request to read 1500 bytes from file with <file handle> = 0
[10:42:39.9] ^SFSA: 62,0							--> 62 bytes read from file, Result (0 = success)
[10:42:39.9] uvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234567890)(*&%$#@!+	--> Binary data (byte 21 to 82), File position/offset = 82 at end
	
[10:42:39.9] OK	
[10:42:40.0] AT^SFSA="seek",0,0		--> Set file position/offset to 0
[10:42:40.0] ^SFSA: 0,0			--> New file position/offset = 0, Result (0 = success)"
	
[10:42:40.0] OK	
[10:42:40.2] AT^SFSA="read",0,1500									--> File position/offset = 0. Request to read 1500 bytes from file with
[10:42:40.2] ^SFSA: 82,0										--> 82 bytes read from file, Result (0 = success)
[10:42:40.2] abcdefghijKLMNOPQRSTuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234567890)(*&%$#@!+		--> Binary data (byte 1 to byte 82). File position/offset = 82
	
[10:42:40.2] OK	
[10:42:40.3] AT^SFSA="close",0		--> Close file with <file handle> = 0	
[10:42:40.4] ^SFSA: 0			--> Result (0 = success)
	
[10:42:40.4] OK	
[10:42:40.5] AT^SFSA="ls",a:/		--> List contents of a directory (path = a:/) 
[10:42:40.6] ^SFSA: DirectoryB		--> DirectoryB returned
[10:42:40.6] ^SFSA: 0			--> Result (0 = success)
	
[10:42:40.6] OK	
[10:42:40.7] AT^SFSA="ls",a:/DirectoryB		--> List contents of a directory (path = a:/ DirectoryB)
[10:42:40.7] ^SFSA: test.txt			--> "test.txt" present under a:/DirectoryB
[10:42:40.7] ^SFSA: 0				--> Result (0 = success)
	
[10:42:40.7] OK	
[10:42:40.9] AT^SFSA="gstat",a:/	--> Read global status of a:/ drive FFS
[10:42:40.9] ^SFSA: 1966080		--> Storage size
[10:42:40.9] ^SFSA: 1890628		--> Free space
[10:42:40.9] ^SFSA: 0			--> Result (0 = success)
	
[10:42:40.9] OK	
[10:42:41.0] AT^SFSA="stat",a:/			--> Read directory status (path = a:/) 
[10:42:41.0] ^SFSA: 0				--> File/Directory size = 0
[10:42:41.0] ^SFSA: 03/01/01,00:05:10		--> Date last accessed
[10:42:41.0] ^SFSA: 03/01/01,00:05:10		--> Date last modified
[10:42:41.0] ^SFSA: 03/01/01,00:05:10		--> Date last file stat change
[10:42:41.0] ^SFSA: 32784			--> stat attributes
[10:42:41.0] ^SFSA: 0				--> Result (0 = success)
	
[10:42:41.1] OK	
[10:42:41.2] AT^SFSA="stat",a:/DirectoryB	--> Read directory status (path = a:/DirectoryB) 
[10:42:41.2] ^SFSA: 0				--> File/Directory size = 0
[10:42:41.2] ^SFSA: 12/12/07,10:42:34		--> Date last accessed
[10:42:41.2] ^SFSA: 12/12/07,10:42:34		--> Date last modified
[10:42:41.2] ^SFSA: 12/12/07,10:42:34		--> Date last file stat change
[10:42:41.2] ^SFSA: 16				--> stat attributes (16 = directory)
[10:42:41.2] ^SFSA: 0				--> Result (0 = success)
	
[10:42:41.3] OK	
[10:42:41.4] AT^SFSA="stat",a:/DirectoryB/test.txt	--> Read file status (path = a:/DirectoryB/test.txt) 
[10:42:41.4] ^SFSA: 82					--> File/Directory size = 82 bytes
[10:42:41.4] ^SFSA: 12/12/07,10:42:40			--> Date last accessed
[10:42:41.4] ^SFSA: 12/12/07,10:42:40			--> Date last modified
[10:42:41.4] ^SFSA: 12/12/07,10:42:40			--> Date last file stat change
[10:42:41.4] ^SFSA: 0					--> stat attributes; 0 = regular file 
[10:42:41.4] ^SFSA: 0					--> Result (0 = success)
	
[10:42:41.4] OK	
[10:42:41.5] AT^SFSA="remove",a:/DirectoryB/test.txt	--> Remove "test.txt" from a:/DirectoryB
[10:42:41.6] ^SFSA: 0					--> Result (0 = success)
	
[10:42:41.6] OK	
[10:42:41.7] AT^SFSA="ls",a:/			--> List contents of a directory (path = a:/)
[10:42:41.8] ^SFSA: DirectoryB			--> DirectoryB returned
[10:42:41.8] ^SFSA: 0				--> Result (0 = success)
	
[10:42:41.8] OK	
[10:42:41.9] AT^SFSA="ls",a:/DirectoryB			--> List contents of a directory (path = a:/DirectoryB)
[10:42:41.9] ^SFSA: 0					--> DirectoryB is empty; Result (0 = success)
	
[10:42:41.9] OK	
[10:42:42.1] AT^SFSA="rmdir",a:/DirectoryB		--> Remove directory (path = a:/DirectoryB)
[10:42:42.1] ^SFSA: 0					--> Result (0 = success)
	
[10:42:42.1] OK	
[10:42:42.3] AT^SFSA="ls",a:/		--> List contents of a directory (path = a:/)
[10:42:42.3] ^SFSA: 0			--> Directory is empty; Result (0 = success)
	
[10:42:42.3] OK	
[10:42:42.4] AT^SFSA="gstat"		--> Read global status of FFS
[10:42:42.5] ^SFSA: 1966080		--> Storage Size
[10:42:42.5] ^SFSA: 1890940		--> Free space - has increased because files and directory removed/deleted
[10:42:42.5] ^SFSA: 0			--> Result (0 = success)
	
[10:42:42.5] OK	
[10:42:42.6] AT^SFSA="gstat",a:/	--> Read global status of a:/ drive on FFS
[10:42:42.6] ^SFSA: 1966080		--> Storage Size
[10:42:42.6] ^SFSA: 1890940		--> Free space - has increased because files and directory removed/deleted
[10:42:42.6] ^SFSA: 0			--> Result (0 = success)
	
[10:42:42.6] OK	

Requisites:

-BGS2/AGS2 REL >2.0/EHSx >2.00/PDsx/Pxx8 >3.20

Regards

ALopez

Download File FFS.zip (zip | 5.01 KB)
mullengers's picture
mullengers

Hi, it is great to see that the AT^SFSA flash file system stuff works across all the products - really nice work Antonio!

Alopez

Contributors

Profile Picture
mullengers
Profile Picture
esander