Atmel Software Framework

nav_filterlist.c File Reference
#include "conf_explorer.h"
#include "navigation.h"
#include "nav_filterlist.h"
#include "file.h"
#include <LIB_CTRLACCESS>

Functions

bool nav_filterlist_cd (void)
 This function enters in the selected directory. More...
 
bool nav_filterlist_findname (const FS_STRING sz_name, bool b_match_case)
 This function searches a file name in file list filtered. More...
 
uint16_t nav_filterlist_get (void)
 This function returns the position of selected file in filtered file list. More...
 
bool nav_filterlist_goto (uint16_t u16_newpos)
 This function goes to a position in filtered file list. More...
 
bool nav_filterlist_gotoindex (const Fs_index _MEM_TYPE_SLOW_ *index)
 This function selects a file in the navigator via a file index. More...
 
bool nav_filterlist_gotoparent (void)
 This function goes to at the parent directory. More...
 
bool nav_filterlist_mount (void)
 This function mounts the selected partition. More...
 
uint16_t nav_filterlist_nb (fl_type_t fl_type, const FS_STRING sz_filterext)
 This function computes the number of files and/or directories in filtered file list This function is blocking. More...
 
bool nav_filterlist_nb_ex (fl_type_t fl_type, const FS_STRING sz_filterext, uint16_t *p_total, uint8_t retry)
 This function computes the number of files and/or directories in filtered file list This function is not blocking. More...
 
bool nav_filterlist_next (void)
 This function goes to the next position in the filtered file list. More...
 
bool nav_filterlist_previous (void)
 This function goes to the previous position in filtered file list. More...
 
bool nav_filterlist_reset (void)
 This function resets the pointer of selection, so "no file selected" in filtered file list. More...
 
bool nav_filterlist_root (void)
 This function initializes the file filtered list on the root directory. More...
 
void nav_filterlist_setfilter (const FS_STRING sz_filterext)
 This function affiliates an extension filter at current navigator. More...
 
static bool update_counter (uint8_t *counter)
 Update and test the counter. More...
 

bool nav_filterlist_cd ( void  )

This function enters in the selected directory.

@return  false in case of error, see global value "fs_g_status" for more detail
@return  true otherwise
//! After this routine the file list changes and contains the files and directories of the new directory.
//! By default no file is selected.
//! 

References fs_g_nav, FS_NO_SEL, nav_dir_cd(), and Fs_management::u16_pos_filterlist.

bool nav_filterlist_findname ( const FS_STRING  sz_name,
bool  b_match_case 
)

This function searches a file name in file list filtered.

@param     sz_name        name to search (UNICODE or ASCII) <br>
                          The name must end with NULL or '*' value
@param     b_match_case   false to ignore the case

@return    false in case of error, see global value "fs_g_status" for more detail
@return    true otherwise
//! This function starts a search at the next position of the current in filtered file list
//! 

References FS_NAME_CHECK, nav_file_name(), and nav_filterlist_next().

uint16_t nav_filterlist_get ( void  )

This function returns the position of selected file in filtered file list.

Returns
position of selected file in directory (0 is the first position)
FS_NO_SEL, in case of no file selected

References fs_g_nav, and Fs_management::u16_pos_filterlist.

Referenced by ai_usb_ms_nav_file_pos(), ai_usb_ms_specific_nav_get_next_playlist_pos(), nav_filterflat_get(), nav_filterflat_next(), and nav_filterflat_previous().

bool nav_filterlist_goto ( uint16_t  u16_newpos)

This function goes to a position in filtered file list.

Parameters
u16_newposnew position to select (0 is the first position)
Returns
false in case of error, see global value "fs_g_status" for more detail
true otherwise

References fs_g_nav, FS_NO_SEL, nav_filterlist_next(), nav_filterlist_previous(), nav_filterlist_reset(), and Fs_management::u16_pos_filterlist.

Referenced by ai_usb_ms_nav_file_goto(), ai_usb_ms_specific_nav_get_next_playlist_pos(), and nav_filterlist_nb_ex().

bool nav_filterlist_gotoindex ( const Fs_index _MEM_TYPE_SLOW_ index)

This function selects a file in the navigator via a file index.

@param     index       structure with information about file to select (disk, partition, dir, file/dir selected )

@return    false in case of error, see global value "fs_g_status" for more detail
@return    true otherwise
//! This routine allow to reinit a navigator quickly via a file index (disk, partition, dir, file/dir selected )
//! To get a file index, you shall used the routine nav_getindex().
//! 

References fs_g_nav, fs_g_nav_fast, nav_drive_set(), nav_filterlist_next(), nav_filterlist_reset(), nav_partition_mount(), nav_partition_set(), Fs_management_fast::u16_entry_pos_sel_file, and Fs_management::u32_cluster_sel_dir.

Referenced by ai_usb_ms_nav_getplayfile(), and ai_usb_ms_specific_nav_getplaylistfile().

bool nav_filterlist_gotoparent ( void  )

This function goes to at the parent directory.

@return  false in case of error, see global value "fs_g_status" for more detail
@return  true otherwise
//! After, the filtered file list changes and contains the files and directories of the new directory.
//! By default, the file selected in filtered file list is the previous (children) directory.
//! 

References fat_check_mount_noopen(), fat_get_entry_info(), fat_read_dir(), FS_ERR_FS, FS_ERR_IS_ROOT, fs_g_nav, fs_g_nav_entry, fs_g_nav_fast, fs_g_status, nav_filterlist_next(), nav_filterlist_reset(), Fs_management_fast::u16_entry_pos_sel_file, Fs_management_entry::u32_cluster, and Fs_management::u32_cluster_sel_dir.

Referenced by ai_usb_ms_nav_dir_gotoparent(), nav_filterflat_next(), and nav_filterflat_previous().

bool nav_filterlist_mount ( void  )

This function mounts the selected partition.

@return  false in case of error, see global value "fs_g_status" for more detail
@return  true otherwise
//! If the FS_MULTI_PARTITION option is disabled
//! then the mount routine selects the first partition supported by file system. <br>
//! After mount, the file list contains files and directories of ROOT directory
//! 

References fs_g_nav, FS_NO_SEL, nav_partition_mount(), and Fs_management::u16_pos_filterlist.

Referenced by nav_filterflat_mount().

uint16_t nav_filterlist_nb ( fl_type_t  fl_type,
const FS_STRING  sz_filterext 
)

This function computes the number of files and/or directories in filtered file list This function is blocking.

It will only return when the final count is computed, which may take some time.

Parameters
fl_typeFL_ALL To check all types (files and directories).
FL_DIR To check the directory presence.
FL_FILE To check the file presence.
sz_filterextExtension filter (ASCII format, e.g.: "txt" or "txt,d*,wk" ).
If this argument in NULL, then it uses the default filter used by the filterlist.
This argument is also ignored for b_type == FS_DIR.
Returns
number of files and/or directories present in filtered file list.

References nav_filterlist_nb_ex(), and total.

bool nav_filterlist_nb_ex ( fl_type_t  fl_type,
const FS_STRING  sz_filterext,
uint16_t *  p_total,
uint8_t  retry 
)

This function computes the number of files and/or directories in filtered file list This function is not blocking.

It will return after <retry> iteration if the result is not yet computed.

Parameters
fl_typeFL_ALL To check all types (files and directories).
FL_DIR To check the directory presence.
FL_FILE To check the file presence.
sz_filterextExtension filter (ASCII format, e.g.: "txt" or "txt,d*,wk" ).
If this argument in NULL, then it uses the default filter used by the filterlist.
This argument is also ignored for b_type == FS_DIR.
p_totalPointer to the result which will be updated by the function (added). Initialization shall be done before entering into this function.
retryNumber of files seen before leaving the function. 0 means that the function is blocking until the result is known.
Returns
number of files and/or directories present in filtered file list.

References FL_DIR, FL_FILE, FS_DIR, FS_FILE, FS_FIND_NEXT, fs_g_nav, FS_NO_SEL, nav_file_checkext(), nav_file_isdir(), nav_filelist_set(), nav_filelist_single_disable(), nav_filelist_single_enable(), nav_filterlist_goto(), nav_filterlist_reset(), Fs_management::sz_filterext, Fs_management::u16_pos_filterlist, and update_counter().

Referenced by ai_usb_ms_nav_dir_nb(), ai_usb_ms_nav_file_nb(), ai_usb_ms_nav_playlist_nb(), and nav_filterlist_nb().

bool nav_filterlist_next ( void  )
bool nav_filterlist_previous ( void  )

This function goes to the previous position in filtered file list.

Returns
false in case of an error or no next file, see global value "fs_g_status" for more detail
true otherwise

References FS_FIND_PREV, fs_g_nav, nav_file_checkext(), nav_file_isdir(), nav_filelist_get(), nav_filelist_goto(), nav_filelist_set(), Fs_management::sz_filterext, and Fs_management::u16_pos_filterlist.

Referenced by ai_usb_ms_nav_file_previous(), nav_filterflat_previous(), and nav_filterlist_goto().

bool nav_filterlist_reset ( void  )

This function resets the pointer of selection, so "no file selected" in filtered file list.

Returns
false in case of an error, see global value "fs_g_status" for more detail
true otherwise

References fs_g_nav, FS_NO_SEL, nav_filelist_reset(), and Fs_management::u16_pos_filterlist.

Referenced by ai_usb_ms_nav_dir_cd(), nav_filterflat_gotoparent(), nav_filterflat_reset(), nav_filterlist_goto(), nav_filterlist_gotoindex(), nav_filterlist_gotoparent(), nav_filterlist_nb_ex(), and nav_filterlist_setfilter().

bool nav_filterlist_root ( void  )

This function initializes the file filtered list on the root directory.

Returns
false in case of error, see global value "fs_g_status" for more detail
true otherwise

References fs_g_nav, FS_NO_SEL, nav_dir_root(), and Fs_management::u16_pos_filterlist.

Referenced by nav_filterflat_root().

void nav_filterlist_setfilter ( const FS_STRING  sz_filterext)

This function affiliates an extension filter at current navigator.

Parameters
sz_filterextextension filter (ASCII format, e.g.: "txt" or "txt,d*,wk" )

References fs_g_nav, nav_filterlist_reset(), and Fs_management::sz_filterext.

Referenced by ai_usb_ms_init_drive().

static bool update_counter ( uint8_t *  counter)
static

Update and test the counter.

Parameters
counterthe counter
Returns
false if the counter reaches the end true otherwise

Referenced by nav_filterlist_nb_ex().