
-25-
v4.9
File system related functions
5.7. List subdirectories/files in current directory
ls(type_of_ls)
stores in
buffer_3G
a list of the files and/or subdirectories in the current directory. The function needs
a number as input parameter that indicates the kind of the list to do. ‘0’ for list the directories and the files, ‘1’ for list only
subdirectories and ‘2’ for list only files.
Example of use:
{
// lists the files in the current directory:
_3G.ls(2);
}
This function returns:
•
‘1’ on success
•
‘0’ if error
•
‘2’ if no data
5.8. Getting files from 3G/GPRS to Waspmote
The function
getXModemFile(‘origin_file’, ‘destiny_path’)
allows to get files from the current directory of the 3G/
GPRS Board and saves it in Waspmote’s microSD card. ‘
origin_file
’ is the name of the file to get.
destiny_path
is the path
with the name to store the file in Waspmote’s microSD card.
Example of use:
{
// Gets the test1.txt from 3G/GPRS board and stores it in /dir1/t001.txt:
_3G.getXModemFile(“test.txt”, “/dir1/t001.txt”);
}
This function returns:
•
‘1’ if success
•
‘0’ if error
•
‘-2’ if error going to root directory in Waspmote’s SD
•
‘-3’ if error creating the file in Waspmote
•
‘-4’ if error if file not exist in 3G/GPRS module
•
‘-5’ if error getting the file