Microchip® Advanced Software Framework

ai_usb_ms.h File Reference
#include "fs_com.h"
#include "fat.h"
#include "navigation.h"
#include "play_list.h"
#include "nav_filterlist.h"
#include "nav_automatic.h"
#include "audio_interface.h"
#include "conf_audio_interface.h"

Data Structures

struct  St_audio_ctx
 

Macros

#define CMD_AI_USB_MS_AUDIO_NAV_GET_FOLDER_NAME   (CMD_AI_SPECIFIC_ID_START + 4)
 
#define CMD_AI_USB_MS_AUDIO_NAV_PLAYLIST_PLAY_LINK   (CMD_AI_SPECIFIC_ID_START + 3)
 
#define CMD_AI_USB_MS_AUDIO_NAV_RESTORE   (CMD_AI_SPECIFIC_ID_START + 9)
 
#define CMD_AI_USB_MS_AUDIO_NAV_SAVE   (CMD_AI_SPECIFIC_ID_START + 8)
 
#define CMD_AI_USB_MS_NAV_GET_NEXT_PLAYLIST_POS   (CMD_AI_SPECIFIC_ID_START + 0)
 
#define CMD_AI_USB_MS_NAV_GET_PLAYLIST_FILE   (CMD_AI_SPECIFIC_ID_START + 5)
 
#define CMD_AI_USB_MS_NAV_PLAYLIST_LINK_NAME   (CMD_AI_SPECIFIC_ID_START + 2)
 
#define CMD_AI_USB_MS_NAV_PLAYLIST_LINK_NB   (CMD_AI_SPECIFIC_ID_START + 1)
 
#define CMD_AI_USB_MS_NAV_RESTORE   (CMD_AI_SPECIFIC_ID_START + 7)
 
#define CMD_AI_USB_MS_NAV_SAVE   (CMD_AI_SPECIFIC_ID_START + 6)
 
#define CMD_AI_USB_MS_PLAYLIST_NAV_RESTORE   (CMD_AI_SPECIFIC_ID_START + 11)
 
#define CMD_AI_USB_MS_PLAYLIST_NAV_SAVE   (CMD_AI_SPECIFIC_ID_START + 10)
 

Functions

static __always_inline bool ai_async_usb_ms_specific_audio_nav_get_folder_name (uint8_t u8_size_max)
 Returns the folder name of the current file selected in the navigation navigator. More...
 
static __always_inline bool ai_async_usb_ms_specific_audio_nav_playlist_play_link (uint16_t u16_link_pos)
 Play the link inside the currently selected playlist. More...
 
static __always_inline bool ai_async_usb_ms_specific_audio_nav_restore (void **context)
 Restore the context of the audio navigator. More...
 
static __always_inline bool ai_async_usb_ms_specific_audio_nav_save (void **context)
 Save the context of the audio navigator. More...
 
static __always_inline bool ai_async_usb_ms_specific_nav_get_next_playlist_pos (uint16_t u16_start_file_pos)
 Return the next playlist on the current directory. More...
 
static __always_inline bool ai_async_usb_ms_specific_nav_getplaylistfile (void)
 Position the File system navigation on the playlist file. More...
 
static __always_inline bool ai_async_usb_ms_specific_nav_playlist_link_name (uint16_t u16_link_pos)
 Returns the name of the link inside the currently selected playlist. More...
 
static __always_inline bool ai_async_usb_ms_specific_nav_playlist_link_nb (void)
 Returns the number of links inside the currently selected playlist. More...
 
static __always_inline bool ai_async_usb_ms_specific_nav_restore (void **context)
 Restore the context of the filesystem navigator. More...
 
static __always_inline bool ai_async_usb_ms_specific_nav_save (void **context)
 Save the context of the filesystem navigator. More...
 
static __always_inline bool ai_async_usb_ms_specific_playlist_nav_restore (void **context)
 Restore the context of the playlist navigator. More...
 
static __always_inline bool ai_async_usb_ms_specific_playlist_nav_save (void **context)
 Save the context of the playlist navigator. More...
 
bool ai_usb_ms_audio_context_restore (void *ctx, ai_async_status_t *cmd_ai_status)
 Restore a audio context (eventualy restart play). More...
 
void * ai_usb_ms_audio_context_save (uint8_t *status, uint16_t *size, ai_async_status_t *cmd_ai_status)
 Give complete audio context (player state, play time, repeat, shuffle, file played, explorer mode ) More...
 
bool ai_usb_ms_audio_ctrl_ffw (uint32_t u32_duration, ai_async_status_t *cmd_ai_status)
 Fast Forward. More...
 
bool ai_usb_ms_audio_ctrl_frw (uint32_t u32_duration, ai_async_status_t *cmd_ai_status)
 Fast Rewind. More...
 
bool ai_usb_ms_audio_ctrl_pause (ai_async_status_t *cmd_ai_status)
 Pause the current audio file. More...
 
bool ai_usb_ms_audio_ctrl_resume (ai_async_status_t *cmd_ai_status)
 Resume the play of the current audio file. More...
 
bool ai_usb_ms_audio_ctrl_start_ffw (ai_async_status_t *cmd_ai_status)
 Start Fast Forward. More...
 
bool ai_usb_ms_audio_ctrl_start_frw (ai_async_status_t *cmd_ai_status)
 Start Fast Rewind. More...
 
Ai_player_flag_t ai_usb_ms_audio_ctrl_status (ai_async_status_t *cmd_ai_status)
 Return the current status of player. More...
 
bool ai_usb_ms_audio_ctrl_stop (ai_async_status_t *cmd_ai_status)
 Stop the player. More...
 
bool ai_usb_ms_audio_ctrl_stop_ffw_frw (ai_async_status_t *cmd_ai_status)
 Stop FastForward/FastRewind. More...
 
uint32_t ai_usb_ms_audio_ctrl_time (ai_async_status_t *cmd_ai_status)
 Return current time played (ms) More...
 
bool ai_usb_ms_audio_nav_eof_occur (ai_async_status_t *cmd_ai_status)
 Start next file. More...
 
Ai_explorer_mode ai_usb_ms_audio_nav_expmode_get (ai_async_status_t *cmd_ai_status)
 This function returns the mode used. More...
 
void ai_usb_ms_audio_nav_expmode_set (Ai_explorer_mode exp_mode, ai_async_status_t *cmd_ai_status)
 This function selects the loop mode. More...
 
uint16_t ai_usb_ms_audio_nav_file_info_album (char **sz_album, ai_async_status_t *cmd_ai_status)
 Return album of current song file selected. More...
 
uint16_t ai_usb_ms_audio_nav_file_info_artist (char **sz_artist, ai_async_status_t *cmd_ai_status)
 Return artist of current song file selected. More...
 
uint32_t ai_usb_ms_audio_nav_file_info_duration (ai_async_status_t *cmd_ai_status)
 Return duration of current song file selected. More...
 
uint16_t ai_usb_ms_audio_nav_file_info_genre (char **sz_genre, ai_async_status_t *cmd_ai_status)
 Return genre of current song file selected. More...
 
void * ai_usb_ms_audio_nav_file_info_image (ai_image_size_t *size, ai_async_status_t *cmd_ai_status)
 Returns a pointer and image information of the embedded image of the selected track. More...
 
uint16_t ai_usb_ms_audio_nav_file_info_title (char **sz_title, ai_async_status_t *cmd_ai_status)
 Return title of current song file selected. More...
 
uint32_t ai_usb_ms_audio_nav_file_info_track (ai_async_status_t *cmd_ai_status)
 Return track of current song file selected. More...
 
uint32_t ai_usb_ms_audio_nav_file_info_type (ai_async_status_t *cmd_ai_status)
 Return the type of the song for the selected file. More...
 
St_ai_info_version ai_usb_ms_audio_nav_file_info_version (ai_async_status_t *cmd_ai_status)
 Return the version of the metadata storage method used for the selected file. More...
 
uint16_t ai_usb_ms_audio_nav_file_info_year (ai_async_status_t *cmd_ai_status)
 Return year of current song file selected. More...
 
uint16_t ai_usb_ms_audio_nav_getname (char **string, ai_async_status_t *cmd_ai_status)
 Get name of current file played. More...
 
uint16_t ai_usb_ms_audio_nav_getpos (ai_async_status_t *cmd_ai_status)
 Give the position of play file. More...
 
uint16_t ai_usb_ms_audio_nav_nb (ai_async_status_t *cmd_ai_status)
 Number of song file present in current directory played or the number of file present in playlist played. More...
 
bool ai_usb_ms_audio_nav_next (ai_async_status_t *cmd_ai_status)
 Go to next file to play. More...
 
bool ai_usb_ms_audio_nav_playfile (ai_async_status_t *cmd_ai_status)
 Start the play of current file selected in File System navigation. More...
 
bool ai_usb_ms_audio_nav_previous (ai_async_status_t *cmd_ai_status)
 Go to previous file to play. More...
 
Ai_repeat_mode ai_usb_ms_audio_nav_repeat_get (ai_async_status_t *cmd_ai_status)
 Get repeat mode. More...
 
void ai_usb_ms_audio_nav_repeat_set (Ai_repeat_mode repeat_mode, ai_async_status_t *cmd_ai_status)
 Set repeat mode. More...
 
bool ai_usb_ms_audio_nav_setpos (uint16_t, ai_async_status_t *cmd_ai_status)
 Set audio navigation at a position. More...
 
Ai_shuffle_mode ai_usb_ms_audio_nav_shuffle_get (ai_async_status_t *cmd_ai_status)
 This function return the shuffle mode used. More...
 
void ai_usb_ms_audio_nav_shuffle_set (Ai_shuffle_mode shuffle, ai_async_status_t *cmd_ai_status)
 This function selects the shuffle mode. More...
 
ai_device_status_t ai_usb_ms_get_device_status (ai_async_status_t *cmd_ai_status)
 Tells if a device is connected or not. More...
 
uint16_t ai_usb_ms_get_product_id (ai_async_status_t *cmd_ai_status)
 Here is the list of the SYNCHRONOUS functions. More...
 
uint16_t ai_usb_ms_get_serial_number (char **sz_sn, ai_async_status_t *cmd_ai_status)
 Return the serial number of the connected USB mass storage device. More...
 
uint16_t ai_usb_ms_get_vendor_id (ai_async_status_t *cmd_ai_status)
 Return the vendor ID of the connected USB mass storage device. More...
 
void ai_usb_ms_init (void)
 Initialize the Mass Storage Audio Interface. More...
 
bool ai_usb_ms_nav_dir_cd (ai_async_status_t *cmd_ai_status)
 Enters in the current directory selected in file list filtered. More...
 
bool ai_usb_ms_nav_dir_gotoparent (ai_async_status_t *cmd_ai_status)
 Goes to the parent directory of current directory corresponding at file list filtered. More...
 
uint16_t ai_usb_ms_nav_dir_name (char **string, ai_async_status_t *cmd_ai_status)
 Return the file name of current parent directory. More...
 
uint16_t ai_usb_ms_nav_dir_nb (ai_async_status_t *cmd_ai_status)
 Computes the number of directories in the filtered list. More...
 
bool ai_usb_ms_nav_dir_root (ai_async_status_t *cmd_ai_status)
 Initializes the file list filtered on the root directory. More...
 
uint64_t ai_usb_ms_nav_drive_free_space (ai_async_status_t *cmd_ai_status)
 Get the free space in bytes available on the device. More...
 
uint8_t ai_usb_ms_nav_drive_get (ai_async_status_t *cmd_ai_status)
 Returns the number of the selected drive. More...
 
bool ai_usb_ms_nav_drive_mount (ai_async_status_t *cmd_ai_status)
 Mounts the current drive selected. More...
 
uint8_t ai_usb_ms_nav_drive_nb (ai_async_status_t *cmd_ai_status)
 Return the number of drives. More...
 
bool ai_usb_ms_nav_drive_set (uint8_t u8_number, ai_async_status_t *cmd_ai_status)
 Selects the drive in current navigator but do not mount it. More...
 
uint64_t ai_usb_ms_nav_drive_total_space (ai_async_status_t *cmd_ai_status)
 Get the total space in bytes available on the device. More...
 
bool ai_usb_ms_nav_file_goto (uint32_t u32_newpos, ai_async_status_t *cmd_ai_status)
 Goes to a position in the filtered list. More...
 
uint16_t ai_usb_ms_nav_file_info_album (char **sz_album, ai_async_status_t *cmd_ai_status)
 Return album of current file selected. More...
 
uint16_t ai_usb_ms_nav_file_info_artist (char **sz_artist, ai_async_status_t *cmd_ai_status)
 Return artist of current file selected. More...
 
uint32_t ai_usb_ms_nav_file_info_duration (ai_async_status_t *cmd_ai_status)
 Return duration of current file selected. More...
 
uint16_t ai_usb_ms_nav_file_info_genre (char **sz_genre, ai_async_status_t *cmd_ai_status)
 Return genre of current file selected. More...
 
void * ai_usb_ms_nav_file_info_image (ai_image_size_t *size, ai_async_status_t *cmd_ai_status)
 Returns a pointer and image information of the embedded image of the selected track. More...
 
uint16_t ai_usb_ms_nav_file_info_title (char **sz_title, ai_async_status_t *cmd_ai_status)
 Return title of current file selected. More...
 
uint32_t ai_usb_ms_nav_file_info_track (ai_async_status_t *cmd_ai_status)
 Return track of current file selected. More...
 
uint32_t ai_usb_ms_nav_file_info_type (ai_async_status_t *cmd_ai_status)
 Return the type of the song for the selected file. More...
 
St_ai_info_version ai_usb_ms_nav_file_info_version (ai_async_status_t *cmd_ai_status)
 Return the version of the metadata storage method used for the selected file. More...
 
uint16_t ai_usb_ms_nav_file_info_year (ai_async_status_t *cmd_ai_status)
 Return year of current file selected. More...
 
bool ai_usb_ms_nav_file_isdir (ai_async_status_t *cmd_ai_status)
 Returns the type of the selected file. More...
 
uint16_t ai_usb_ms_nav_file_name (char **string, ai_async_status_t *cmd_ai_status)
 Return the file name of current file selected. More...
 
uint16_t ai_usb_ms_nav_file_nb (ai_async_status_t *cmd_ai_status)
 Computes the number of files in the filtered list. More...
 
bool ai_usb_ms_nav_file_next (ai_async_status_t *cmd_ai_status)
 Goes to the next file of the filtered list. More...
 
uint32_t ai_usb_ms_nav_file_pos (ai_async_status_t *cmd_ai_status)
 Returns the position of selected file in list filtered. More...
 
bool ai_usb_ms_nav_file_previous (ai_async_status_t *cmd_ai_status)
 Goes to the previous file of the filtered list. More...
 
bool ai_usb_ms_nav_getplayfile (ai_async_status_t *cmd_ai_status)
 Position the File system navigation on the file play. More...
 
uint16_t ai_usb_ms_nav_playlist_nb (ai_async_status_t *cmd_ai_status)
 Computes the number of playlists in the filtered list. More...
 
void ai_usb_ms_new_connection (void)
 Routine to notify the Audio Interface of a new device connection. More...
 

#define CMD_AI_USB_MS_AUDIO_NAV_GET_FOLDER_NAME   (CMD_AI_SPECIFIC_ID_START + 4)
#define CMD_AI_USB_MS_AUDIO_NAV_PLAYLIST_PLAY_LINK   (CMD_AI_SPECIFIC_ID_START + 3)
#define CMD_AI_USB_MS_AUDIO_NAV_RESTORE   (CMD_AI_SPECIFIC_ID_START + 9)
#define CMD_AI_USB_MS_AUDIO_NAV_SAVE   (CMD_AI_SPECIFIC_ID_START + 8)
#define CMD_AI_USB_MS_NAV_GET_NEXT_PLAYLIST_POS   (CMD_AI_SPECIFIC_ID_START + 0)
#define CMD_AI_USB_MS_NAV_GET_PLAYLIST_FILE   (CMD_AI_SPECIFIC_ID_START + 5)
#define CMD_AI_USB_MS_NAV_PLAYLIST_LINK_NAME   (CMD_AI_SPECIFIC_ID_START + 2)
#define CMD_AI_USB_MS_NAV_PLAYLIST_LINK_NB   (CMD_AI_SPECIFIC_ID_START + 1)
#define CMD_AI_USB_MS_NAV_RESTORE   (CMD_AI_SPECIFIC_ID_START + 7)
#define CMD_AI_USB_MS_NAV_SAVE   (CMD_AI_SPECIFIC_ID_START + 6)
#define CMD_AI_USB_MS_PLAYLIST_NAV_RESTORE   (CMD_AI_SPECIFIC_ID_START + 11)
#define CMD_AI_USB_MS_PLAYLIST_NAV_SAVE   (CMD_AI_SPECIFIC_ID_START + 10)

static __always_inline bool ai_async_usb_ms_specific_audio_nav_get_folder_name ( uint8_t  u8_size_max)
static

Returns the folder name of the current file selected in the navigation navigator.

Parameters
u8_size_maxThe maximal size of the buffer
Returns
cmd_out_status - false in case of error, true is success

References ai_async_cmd_put(), and CMD_AI_USB_MS_AUDIO_NAV_GET_FOLDER_NAME.

static __always_inline bool ai_async_usb_ms_specific_audio_nav_playlist_play_link ( uint16_t  u16_link_pos)
static

Play the link inside the currently selected playlist.

Parameters
u16_link_posThe position in the playlist of the link to select
Returns
cmd_out_status - false in case of error, true is success

References ai_async_cmd_put(), and CMD_AI_USB_MS_AUDIO_NAV_PLAYLIST_PLAY_LINK.

static __always_inline bool ai_async_usb_ms_specific_audio_nav_restore ( void **  context)
static

Restore the context of the audio navigator.

Returns
false in case of error

References ai_async_cmd_put(), and CMD_AI_USB_MS_AUDIO_NAV_RESTORE.

static __always_inline bool ai_async_usb_ms_specific_audio_nav_save ( void **  context)
static

Save the context of the audio navigator.

Returns
false in case of error

References ai_async_cmd_put(), and CMD_AI_USB_MS_AUDIO_NAV_SAVE.

static __always_inline bool ai_async_usb_ms_specific_nav_get_next_playlist_pos ( uint16_t  u16_start_file_pos)
static

Return the next playlist on the current directory.

Parameters
u16_start_file_posThe starting file position where to start searching for the next playlist. This value has to be set to ((uint16_t) -1) at the beginning of the list.
Returns
cmd_out_status - false in case of error, true is success

References ai_async_cmd_put(), and CMD_AI_USB_MS_NAV_GET_NEXT_PLAYLIST_POS.

static __always_inline bool ai_async_usb_ms_specific_nav_getplaylistfile ( void  )
static

Position the File system navigation on the playlist file.

Returns
false in case of error

References ai_async_cmd_put(), and CMD_AI_USB_MS_NAV_GET_PLAYLIST_FILE.

static __always_inline bool ai_async_usb_ms_specific_nav_playlist_link_name ( uint16_t  u16_link_pos)
static

Returns the name of the link inside the currently selected playlist.

Parameters
u16_link_posThe position in the playlist of the link to select
Returns
cmd_out_status - false in case of error, true is success

References ai_async_cmd_put(), and CMD_AI_USB_MS_NAV_PLAYLIST_LINK_NAME.

static __always_inline bool ai_async_usb_ms_specific_nav_playlist_link_nb ( void  )
static

Returns the number of links inside the currently selected playlist.

Returns
cmd_out_status - false in case of error, true is success

References ai_async_cmd_put(), and CMD_AI_USB_MS_NAV_PLAYLIST_LINK_NB.

static __always_inline bool ai_async_usb_ms_specific_nav_restore ( void **  context)
static

Restore the context of the filesystem navigator.

Returns
false in case of error

References ai_async_cmd_put(), and CMD_AI_USB_MS_NAV_RESTORE.

static __always_inline bool ai_async_usb_ms_specific_nav_save ( void **  context)
static

Save the context of the filesystem navigator.

Returns
false in case of error

References ai_async_cmd_put(), and CMD_AI_USB_MS_NAV_SAVE.

static __always_inline bool ai_async_usb_ms_specific_playlist_nav_restore ( void **  context)
static

Restore the context of the playlist navigator.

Returns
false in case of error

References ai_async_cmd_put(), and CMD_AI_USB_MS_PLAYLIST_NAV_RESTORE.

static __always_inline bool ai_async_usb_ms_specific_playlist_nav_save ( void **  context)
static

Save the context of the playlist navigator.

Returns
false in case of error

References ai_async_cmd_put(), and CMD_AI_USB_MS_PLAYLIST_NAV_SAVE.

bool ai_usb_ms_audio_ctrl_ffw ( uint32_t  u32_duration,
ai_async_status_t cmd_ai_status 
)

Fast Forward.

Parameters
u32_durationduration of FFW in seconds
Returns
false in case of error

References CMD_DONE, CMD_ERROR, file_format_supported, is_file_playing, PLAYER_FLAG_FFW, and Ai_player_flag_t::status_fast.

Referenced by ai_usb_ms_audio_context_restore(), and ai_usb_ms_audio_ctrl_start_ffw().

bool ai_usb_ms_audio_ctrl_frw ( uint32_t  u32_duration,
ai_async_status_t cmd_ai_status 
)
bool ai_usb_ms_audio_ctrl_start_ffw ( ai_async_status_t cmd_ai_status)

Start Fast Forward.

Returns
false in case of error

References ai_usb_ms_audio_ctrl_ffw().

bool ai_usb_ms_audio_ctrl_start_frw ( ai_async_status_t cmd_ai_status)

Start Fast Rewind.

Returns
false in case of error

References ai_usb_ms_audio_ctrl_frw().

Ai_player_flag_t ai_usb_ms_audio_ctrl_status ( ai_async_status_t cmd_ai_status)

Return the current status of player.

Returns
field of bits (PLAYER_STATUS_PLAY)

References CMD_DONE, CMD_ERROR, fat_check_device(), FS_NAV_ID_FILESYSTEM, nav_select(), Ai_player_flag_t::new_directory, and Ai_player_flag_t::new_file_played.

Referenced by ai_usb_ms_audio_context_save().

bool ai_usb_ms_audio_ctrl_stop_ffw_frw ( ai_async_status_t cmd_ai_status)

Stop FastForward/FastRewind.

Returns
false in case of error

References CMD_ERROR.

uint32_t ai_usb_ms_audio_ctrl_time ( ai_async_status_t cmd_ai_status)

Return current time played (ms)

Returns
current time

References CMD_DONE.

Referenced by ai_usb_ms_audio_context_save(), and ai_usb_ms_audio_ctrl_frw().

Ai_explorer_mode ai_usb_ms_audio_nav_expmode_get ( ai_async_status_t cmd_ai_status)

This function returns the mode used.

Returns
mode used (NAVAUTO_MODE_DISKS, NAVAUTO_MODE_DIRONLY, NAVAUTO_MODE_DIRSUB)

References AUDIO_EXPLORER_MODE_DIRONLY, AUDIO_EXPLORER_MODE_DIRSUB, AUDIO_EXPLORER_MODE_DISK, AUDIO_EXPLORER_MODE_DISKS, CMD_DONE, FS_NAV_ID_AUDIO, nav_select(), navauto_getmode(), NAVAUTO_MODE_DIRONLY, NAVAUTO_MODE_DIRSUB, NAVAUTO_MODE_DISK, and NAVAUTO_MODE_DISKS.

void ai_usb_ms_audio_nav_expmode_set ( Ai_explorer_mode  exp_mode,
ai_async_status_t cmd_ai_status 
)

This function selects the loop mode.

Note
It reinit the folder level at the current position
Parameters
exp_modemode to select (NAVAUTO_MODE_DISKS, NAVAUTO_MODE_DIRONLY, NAVAUTO_MODE_DIRSUB)

References ai_usb_ms_audio_ctrl_resume(), ai_usb_ms_audio_ctrl_stop(), AUDIO_EXPLORER_MODE_DIRONLY, AUDIO_EXPLORER_MODE_DIRSUB, AUDIO_EXPLORER_MODE_DISK, AUDIO_EXPLORER_MODE_DISKS, CMD_DONE, CMD_EXECUTING, FS_NAV_ID_AUDIO, nav_select(), NAVAUTO_MODE_DIRONLY, NAVAUTO_MODE_DIRSUB, NAVAUTO_MODE_DISK, NAVAUTO_MODE_DISKS, navauto_setmode(), PLAYER_FLAG_PAUSE, PLAYER_FLAG_STOP, and Ai_player_flag_t::status.

uint16_t ai_usb_ms_audio_nav_file_info_album ( char **  sz_album,
ai_async_status_t cmd_ai_status 
)

Return album of current song file selected.

Parameters
stringpointer to store the string allocated by the routine
Returns
number of character (unit 2B for UNICODE) allocated

References ai_usb_ms_nav_file_info_album(), and ai_usb_ms_song_read_info().

uint16_t ai_usb_ms_audio_nav_file_info_artist ( char **  sz_artist,
ai_async_status_t cmd_ai_status 
)

Return artist of current song file selected.

Parameters
stringpointer to store the string allocated by the routine
Returns
number of character (unit 2B for UNICODE) allocated

References ai_usb_ms_nav_file_info_artist(), and ai_usb_ms_song_read_info().

uint32_t ai_usb_ms_audio_nav_file_info_duration ( ai_async_status_t cmd_ai_status)

Return duration of current song file selected.

Returns
duration (ms)

References ai_usb_ms_nav_file_info_duration(), CMD_DONE, CMD_ERROR, FS_NAV_ID_AUDIO, FS_NAV_ID_FILESYSTEM, nav_getindex(), nav_gotoindex(), and nav_select().

uint16_t ai_usb_ms_audio_nav_file_info_genre ( char **  sz_genre,
ai_async_status_t cmd_ai_status 
)

Return genre of current song file selected.

Parameters
stringpointer to store the string allocated by the routine
Returns
number of character (unit 2B for UNICODE) allocated

References ai_usb_ms_nav_file_info_genre(), and ai_usb_ms_song_read_info().

void* ai_usb_ms_audio_nav_file_info_image ( ai_image_size_t size,
ai_async_status_t cmd_ai_status 
)

Returns a pointer and image information of the embedded image of the selected track.

Parameters
sizeThe desire width and height of the decoded image.
Returns
pointer on the image data. NULL in case of error.

References CMD_DONE, file_format_supported, FS_NAV_ID_AUDIO, is_metadata_compatible_file, nav_select(), and read_metadata_image.

uint16_t ai_usb_ms_audio_nav_file_info_title ( char **  sz_title,
ai_async_status_t cmd_ai_status 
)

Return title of current song file selected.

Parameters
stringpointer to store the string allocated by the routine
Returns
number of character (unit 2B for UNICODE) allocated

References ai_usb_ms_nav_file_info_title(), and ai_usb_ms_song_read_info().

uint32_t ai_usb_ms_audio_nav_file_info_track ( ai_async_status_t cmd_ai_status)

Return track of current song file selected.

Returns
track number

References ai_usb_ms_nav_file_info_track(), CMD_DONE, CMD_ERROR, FS_NAV_ID_AUDIO, FS_NAV_ID_FILESYSTEM, nav_getindex(), nav_gotoindex(), and nav_select().

uint32_t ai_usb_ms_audio_nav_file_info_type ( ai_async_status_t cmd_ai_status)

Return the type of the song for the selected file.

Returns
Type of file

References AUDIO_TYPE_MP1, AUDIO_TYPE_MP2, AUDIO_TYPE_MP3, AUDIO_TYPE_UNKNOWN, AUDIO_TYPE_WAV, CMD_DONE, FS_NAV_ID_AUDIO, nav_file_checkext(), and nav_select().

St_ai_info_version ai_usb_ms_audio_nav_file_info_version ( ai_async_status_t cmd_ai_status)

Return the version of the metadata storage method used for the selected file.

Returns
Metadata version

References ai_usb_ms_nav_file_info_version(), CMD_DONE, CMD_ERROR, St_ai_info_version::digit, FS_NAV_ID_AUDIO, FS_NAV_ID_FILESYSTEM, St_ai_info_version::major, nav_getindex(), nav_gotoindex(), and nav_select().

uint16_t ai_usb_ms_audio_nav_file_info_year ( ai_async_status_t cmd_ai_status)

Return year of current song file selected.

Returns
year

References ai_usb_ms_nav_file_info_year(), CMD_DONE, CMD_ERROR, FS_NAV_ID_AUDIO, FS_NAV_ID_FILESYSTEM, nav_getindex(), nav_gotoindex(), and nav_select().

uint16_t ai_usb_ms_audio_nav_getname ( char **  string,
ai_async_status_t cmd_ai_status 
)

Get name of current file played.

Parameters
stringbuffer to fill
Returns
size of string, if no 0 then you must free it

References ai_usb_ms_read_string(), CMD_DONE, FS_NAV_ID_AUDIO, nav_file_getname(), and nav_select().

uint16_t ai_usb_ms_audio_nav_getpos ( ai_async_status_t cmd_ai_status)

Give the position of play file.

Returns
1 to nb file in directory or play list

References CMD_DONE, FS_NAV_ID_AUDIO, nav_select(), and navauto_getpos().

uint16_t ai_usb_ms_audio_nav_nb ( ai_async_status_t cmd_ai_status)

Number of song file present in current directory played or the number of file present in playlist played.

Returns
nb file in directory or play list

References CMD_DONE, FS_NAV_ID_AUDIO, nav_select(), and navauto_getnb().

bool ai_usb_ms_audio_nav_next ( ai_async_status_t cmd_ai_status)

Go to next file to play.

Returns
false in case of error

References ai_usb_ms_audio_nav_mov(), and FS_FIND_NEXT.

Referenced by ai_usb_ms_audio_nav_shuffle_set().

bool ai_usb_ms_audio_nav_previous ( ai_async_status_t cmd_ai_status)

Go to previous file to play.

Returns
false in case of error

References ai_usb_ms_audio_nav_mov(), and FS_FIND_PREV.

Ai_repeat_mode ai_usb_ms_audio_nav_repeat_get ( ai_async_status_t cmd_ai_status)

Get repeat mode.

Returns
repeat mode used (AUDIO_REPEAT_OFF, AUDIO_REPEAT_TRACK, AUDIO_REPEAT_FOLDER, AUDIO_REPEAT_ALL)

References CMD_DONE, and g_ai_usb_ms_repeat_mode.

void ai_usb_ms_audio_nav_repeat_set ( Ai_repeat_mode  repeat_mode,
ai_async_status_t cmd_ai_status 
)

Set repeat mode.

Parameters
repeat_moderepeat mode to select (AUDIO_REPEAT_OFF, AUDIO_REPEAT_TRACK, AUDIO_REPEAT_FOLDER, AUDIO_REPEAT_ALL)

References CMD_DONE.

Referenced by ai_usb_ms_audio_context_restore().

bool ai_usb_ms_audio_nav_setpos ( uint16_t  ,
ai_async_status_t cmd_ai_status 
)

Set audio navigation at a position.

Parameters
u16_posposition to set
Returns
false in case of error

References ai_usb_ms_audio_ctrl_resume(), ai_usb_ms_audio_ctrl_stop(), CMD_DONE, CMD_ERROR, CMD_EXECUTING, FS_NAV_ID_AUDIO, nav_select(), navauto_setpos(), PLAYER_FLAG_PAUSE, PLAYER_FLAG_STOP, and Ai_player_flag_t::status.

Ai_shuffle_mode ai_usb_ms_audio_nav_shuffle_get ( ai_async_status_t cmd_ai_status)

This function return the shuffle mode used.

Returns
shuffle mode used (AUDIO_SHUFFLE_OFF, AUDIO_SHUFFLE_FOLDER, AUDIO_SHUFFLE_ALL)

References CMD_DONE, FS_NAV_ID_AUDIO, g_ai_usb_ms_shuffle_mode, and nav_select().

void ai_usb_ms_audio_nav_shuffle_set ( Ai_shuffle_mode  shuffle,
ai_async_status_t cmd_ai_status 
)

This function selects the shuffle mode.

Parameters
shuffleshuffle mode to select (AUDIO_SHUFFLE_OFF, AUDIO_SHUFFLE_FOLDER, AUDIO_SHUFFLE_ALL)

References ai_usb_ms_audio_nav_next(), AUDIO_SHUFFLE_ALL, AUDIO_SHUFFLE_FOLDER, AUDIO_SHUFFLE_OFF, CMD_DONE, FS_NAV_ID_AUDIO, nav_select(), NAVAUTO_RAND_OFF, NAVAUTO_RAND_ON, and navauto_setrand().

Referenced by ai_usb_ms_audio_context_restore().

uint16_t ai_usb_ms_get_product_id ( ai_async_status_t cmd_ai_status)

Here is the list of the SYNCHRONOUS functions.

Here is the list of the SYNCHRONOUS functions.Return the product ID of the connected USB mass storage device

Returns
product ID

References CMD_DONE, and Get_PID.

uint16_t ai_usb_ms_get_serial_number ( char **  sz_sn,
ai_async_status_t cmd_ai_status 
)

Return the serial number of the connected USB mass storage device.

Parameters
sz_sna string to store the serial number
Returns
the length in byte of the serial number

References CMD_DONE.

uint16_t ai_usb_ms_get_vendor_id ( ai_async_status_t cmd_ai_status)

Return the vendor ID of the connected USB mass storage device.

Returns
vendor ID

References CMD_DONE, and Get_VID.

void ai_usb_ms_init ( void  )

Initialize the Mass Storage Audio Interface.

Parameters
filter_filelist of the files that will be filtered in the disk navigator.
filter_songfilelist of the audio files that will be filtered in the audio navigator.
filter_filelist of the playlist files that will be filtered in the audio navigator.

References file_ext, file_format_supported, and PLAYLIST_FILE_EXT.

bool ai_usb_ms_nav_dir_cd ( ai_async_status_t cmd_ai_status)

Enters in the current directory selected in file list filtered.

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

References CMD_DONE, CMD_ERROR, FS_NAV_ID_FILESYSTEM, nav_dir_cd(), nav_filterlist_reset(), and nav_select().

bool ai_usb_ms_nav_dir_gotoparent ( ai_async_status_t cmd_ai_status)

Goes to the parent directory of current directory corresponding at file list filtered.

@return  false in case of error, see global value "fs_g_status" for more detail
@return  true otherwise
//! After, the file list change and contains the files of parent directory,
//! also the file selected is the old directory.
//! "Filter list" is a list of files filtered and directories present in current directory
//! 

References CMD_DONE, CMD_ERROR, FS_NAV_ID_FILESYSTEM, nav_filterlist_gotoparent(), and nav_select().

uint16_t ai_usb_ms_nav_dir_name ( char **  string,
ai_async_status_t cmd_ai_status 
)

Return the file name of current parent directory.

Parameters
stringpointer to store the string allocated by the routine
Returns
number of character (unit 2B for UNICODE) allocated

References ai_usb_ms_read_string(), CMD_DONE, FS_NAV_ID_FILESYSTEM, nav_dir_name(), and nav_select().

uint16_t ai_usb_ms_nav_dir_nb ( ai_async_status_t cmd_ai_status)

Computes the number of directories in the filtered list.

@return    number of directories present in list filtered
//! "Filter list" is a list of files filtered and directories present in current directory
//! 

References CMD_DONE, CMD_EXECUTING, EX_RETRY_COUNT, FL_DIR, FS_NAV_ID_FILESYSTEM, g_Cmd_state, g_u16_count, nav_filterlist_nb_ex(), and nav_select().

bool ai_usb_ms_nav_dir_root ( ai_async_status_t cmd_ai_status)

Initializes the file list filtered on the root directory.

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

References CMD_DONE, CMD_ERROR, FS_NAV_ID_FILESYSTEM, nav_dir_root(), and nav_select().

uint64_t ai_usb_ms_nav_drive_free_space ( ai_async_status_t cmd_ai_status)

Get the free space in bytes available on the device.

Returns
the free space available on the drive in bytes

References CMD_DONE, FS_NAV_ID_FILESYSTEM, FS_SIZE_OF_SECTOR, nav_partition_freespace(), and nav_select().

uint8_t ai_usb_ms_nav_drive_get ( ai_async_status_t cmd_ai_status)

Returns the number of the selected drive.

Returns
0 to nav_drive_nb()-1
0xFF in case of no drive selected

References CMD_DONE, FS_NAV_ID_FILESYSTEM, MAX_LUN, nav_drive_get(), and nav_select().

bool ai_usb_ms_nav_drive_mount ( ai_async_status_t cmd_ai_status)

Mounts the current drive selected.

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

References CMD_DONE, CMD_ERROR, FS_NAV_ID_FILESYSTEM, nav_partition_mount(), and nav_select().

uint8_t ai_usb_ms_nav_drive_nb ( ai_async_status_t cmd_ai_status)

Return the number of drives.

Returns
number of drives, 0 = NO DEVICE AVAILABLE

References CMD_DONE, FS_NAV_ID_FILESYSTEM, MAX_LUN, nav_drive_nb(), and nav_select().

bool ai_usb_ms_nav_drive_set ( uint8_t  u8_number,
ai_async_status_t cmd_ai_status 
)

Selects the drive in current navigator but do not mount it.

Parameters
u8_numberdevice number (0 to nav_drive_nb()-1 )
Returns
false in case of error, see global value "fs_g_status" for more detail
true otherwise

References ai_usb_ms_init_drive(), CMD_DONE, CMD_ERROR, MAX_LUN, and nav_drive_set().

uint64_t ai_usb_ms_nav_drive_total_space ( ai_async_status_t cmd_ai_status)

Get the total space in bytes available on the device.

Returns
the capacity of the drive in bytes

References CMD_DONE, FS_NAV_ID_FILESYSTEM, FS_SIZE_OF_SECTOR, nav_partition_space(), and nav_select().

bool ai_usb_ms_nav_file_goto ( uint32_t  u32_newpos,
ai_async_status_t cmd_ai_status 
)

Goes to a position in the filtered list.

@param     u16_newpos     new position to select in file list, 0 is the first position

@return    false in case of error, see global value "fs_g_status" for more detail
@return    true otherwise
//! "Filter list" is a list of files filtered and directories present in current directory
//! 

References CMD_DONE, CMD_ERROR, CMD_EXECUTING, FS_NAV_ID_FILESYSTEM, nav_filterlist_goto(), and nav_select().

uint16_t ai_usb_ms_nav_file_info_album ( char **  sz_album,
ai_async_status_t cmd_ai_status 
)

Return album of current file selected.

Parameters
stringpointer to store the string allocated by the routine
Returns
number of character (unit 2B for UNICODE) allocated

References ai_usb_ms_read_string(), CMD_DONE, file_format_supported, FS_NAV_ID_FILESYSTEM, is_metadata_compatible_file, nav_select(), and read_metadata_album.

Referenced by ai_usb_ms_audio_nav_file_info_album().

uint16_t ai_usb_ms_nav_file_info_artist ( char **  sz_artist,
ai_async_status_t cmd_ai_status 
)

Return artist of current file selected.

Parameters
stringpointer to store the string allocated by the routine
Returns
number of character (unit 2B for UNICODE) allocated

References ai_usb_ms_read_string(), CMD_DONE, file_format_supported, FS_NAV_ID_FILESYSTEM, is_metadata_compatible_file, nav_select(), and read_metadata_artist.

Referenced by ai_usb_ms_audio_nav_file_info_artist().

uint32_t ai_usb_ms_nav_file_info_duration ( ai_async_status_t cmd_ai_status)

Return duration of current file selected.

Returns
duration (ms)

References CMD_DONE, file_format_supported, FS_NAV_ID_FILESYSTEM, is_metadata_compatible_file, nav_select(), and read_metadata_duration.

Referenced by ai_usb_ms_audio_nav_file_info_duration().

uint16_t ai_usb_ms_nav_file_info_genre ( char **  sz_genre,
ai_async_status_t cmd_ai_status 
)

Return genre of current file selected.

Parameters
stringpointer to store the string allocated by the routine
Returns
number of character (unit 2B for UNICODE) allocated

References ai_usb_ms_read_string(), CMD_DONE, file_format_supported, FS_NAV_ID_FILESYSTEM, is_metadata_compatible_file, nav_select(), and read_metadata_genre.

Referenced by ai_usb_ms_audio_nav_file_info_genre().

void* ai_usb_ms_nav_file_info_image ( ai_image_size_t size,
ai_async_status_t cmd_ai_status 
)

Returns a pointer and image information of the embedded image of the selected track.

Parameters
sizeThe desire width and height of the decoded image.
Returns
pointer on the image data. NULL in case of error.

References CMD_DONE, file_format_supported, FS_NAV_ID_FILESYSTEM, is_metadata_compatible_file, nav_select(), and read_metadata_image.

uint16_t ai_usb_ms_nav_file_info_title ( char **  sz_title,
ai_async_status_t cmd_ai_status 
)

Return title of current file selected.

Parameters
stringpointer to store the string allocated by the routine
Returns
number of character (unit 2B for UNICODE) allocated

References ai_usb_ms_read_string(), CMD_DONE, file_format_supported, FS_NAV_ID_FILESYSTEM, is_metadata_compatible_file, nav_select(), and read_metadata_title.

Referenced by ai_usb_ms_audio_nav_file_info_title().

uint32_t ai_usb_ms_nav_file_info_track ( ai_async_status_t cmd_ai_status)

Return track of current file selected.

Returns
track number

References CMD_DONE, file_format_supported, FS_NAV_ID_FILESYSTEM, is_metadata_compatible_file, nav_select(), and read_metadata_track.

Referenced by ai_usb_ms_audio_nav_file_info_track().

uint32_t ai_usb_ms_nav_file_info_type ( ai_async_status_t cmd_ai_status)

Return the type of the song for the selected file.

Returns
Type of file

References AUDIO_TYPE_MP1, AUDIO_TYPE_MP2, AUDIO_TYPE_MP3, AUDIO_TYPE_UNKNOWN, AUDIO_TYPE_WAV, CMD_DONE, FS_NAV_ID_FILESYSTEM, nav_file_checkext(), and nav_select().

St_ai_info_version ai_usb_ms_nav_file_info_version ( ai_async_status_t cmd_ai_status)

Return the version of the metadata storage method used for the selected file.

Returns
Metadata version

References CMD_DONE, St_ai_info_version::digit, file_format_supported, FS_NAV_ID_FILESYSTEM, is_metadata_compatible_file, St_ai_info_version::major, nav_select(), and read_metadata_version.

Referenced by ai_usb_ms_audio_nav_file_info_version().

uint16_t ai_usb_ms_nav_file_info_year ( ai_async_status_t cmd_ai_status)
bool ai_usb_ms_nav_file_isdir ( ai_async_status_t cmd_ai_status)

Returns the type of the selected file.

Returns
true, it is a directory
false, in other case

References CMD_DONE, FS_NAV_ID_FILESYSTEM, nav_file_isdir(), and nav_select().

uint16_t ai_usb_ms_nav_file_name ( char **  string,
ai_async_status_t cmd_ai_status 
)

Return the file name of current file selected.

Parameters
stringpointer to store the string allocated by the routine
Returns
number of character (unit 2B for UNICODE) allocated

References ai_usb_ms_read_string(), CMD_DONE, FS_NAV_ID_FILESYSTEM, nav_file_getname(), and nav_select().

uint16_t ai_usb_ms_nav_file_nb ( ai_async_status_t cmd_ai_status)

Computes the number of files in the filtered list.

@return    number of files present in list filtered
//! "Filter list" is a list of files filtered and directories present in current directory
//! 

References ai_usb_ms_filter_songfile, CMD_DONE, CMD_EXECUTING, EX_RETRY_COUNT, FL_FILE, FS_NAV_ID_FILESYSTEM, g_Cmd_state, g_u16_count, nav_filterlist_nb_ex(), and nav_select().

bool ai_usb_ms_nav_file_next ( ai_async_status_t cmd_ai_status)

Goes to the next file of the filtered list.

Returns
cmd_out_status - false in case of error, true is success

References CMD_DONE, FS_NAV_ID_FILESYSTEM, nav_filterlist_next(), and nav_select().

uint32_t ai_usb_ms_nav_file_pos ( ai_async_status_t cmd_ai_status)

Returns the position of selected file in list filtered.

@return    position of selected file in current directory, 0 is the first position
@return    FS_NO_SEL, in case of no file selected
//! "Filter list" is a list of files filtered and directories present in current directory
//! 

References CMD_DONE, FS_NAV_ID_FILESYSTEM, nav_filterlist_get(), and nav_select().

bool ai_usb_ms_nav_file_previous ( ai_async_status_t cmd_ai_status)

Goes to the previous file of the filtered list.

Returns
cmd_out_status - false in case of error, true is success

References CMD_DONE, FS_NAV_ID_FILESYSTEM, nav_filterlist_previous(), and nav_select().

bool ai_usb_ms_nav_getplayfile ( ai_async_status_t cmd_ai_status)

Position the File system navigation on the file play.

Returns
false in case of error

References CMD_DONE, CMD_ERROR, FS_NAV_ID_AUDIO, FS_NAV_ID_FILESYSTEM, nav_dir_root(), nav_filterlist_gotoindex(), nav_getindex(), and nav_select().

uint16_t ai_usb_ms_nav_playlist_nb ( ai_async_status_t cmd_ai_status)

Computes the number of playlists in the filtered list.

@return    number of playlists present in list filtered
//! "Filter list" is a list of files filtered and directories present in current directory
//! 

References CMD_DONE, CMD_EXECUTING, EX_RETRY_COUNT, FL_FILE, FS_NAV_ID_FILESYSTEM, g_Cmd_state, g_u16_count, nav_filterlist_nb_ex(), and nav_select().

void ai_usb_ms_new_connection ( void  )