SWILIB API (SG)    
Loading...
Searching...
No Matches
Explorer

Detailed Description

Functions for the files explorer.

Usage: #include <swilib.h> or #include <swilib/explorer.h>

Data Structures

struct  NATIVE_EXPLORER_ITEM
 Item structure of the NativeExplorer. More...
 
struct  NativeExplorerData
 NativeExplorer options. More...
 
struct  REGEXPLEXT
 Extension registration structure. More...
 
struct  REGEXPLEXT_ARM_NEW
 Native Explorer extension entry returned by get_regextpnt_by_uid on SG and X75. More...
 

Typedefs

typedef enum ExplorerTransferStates ExplorerTransferStates
 
typedef struct NATIVE_EXPLORER_ITEM NATIVE_EXPLORER_ITEM
 
typedef struct NativeExplorerData NativeExplorerData
 
typedef struct REGEXPLEXT REGEXPLEXT
 
typedef struct REGEXPLEXT_ARM_NEW REGEXPLEXT_ARM_NEW
 
typedef struct REGEXPLEXT_ARM_NEW TREGEXPLEXT
 

Enumerations

enum  ExplorerTransferStates {
  EXPLORER_TRANSFER_STATE_STOP = 1 ,
  EXPLORER_TRANSFER_STATE_RUNNING = 2
}
 
enum  NativeExplorerMode {
  NATIVE_EXPLORER_MODE_DEFAULT = 0x00 ,
  NATIVE_EXPLORER_MODE_SELECT = 0x01 ,
  NATIVE_EXPLORER_MODE_COPY = 0x09 ,
  NATIVE_EXPLORER_MODE_MOVE = 0x0B
}
 Mode of the NativeExplorer. More...
 

Functions

void RegExplorerExt (const REGEXPLEXT *ext)
 Register own extension in the NativeExplorer.
 
int UnRegExplorerExt (const REGEXPLEXT *ext)
 Unregister extension from the NativeExplorer.
 
void * EXT_TOP (void)
 Get a pointer to the explorer extensions.
 
TREGEXPLEXT * get_regextpnt_by_uid (int uid)
 Get explorer extension definition by ID.
 
int GetExtUid_ws (const WSHDR *ext)
 Get the ID of the registered extension by its name.
 
int GetExtUidByFileName_ws (const WSHDR *file)
 Get the ID of the registered extension by path to the file.
 
void MediaSendCSM_Open (const WSHDR *file, const WSHDR *path)
 Open menu for sending file.
 
int PersMenuCSM_Open (const WSHDR *file_name, const WSHDR *dir, int flag, int open_mode)
 Open menu for setting resource as Wallpaper, Logo, Ringtone, etc.
 
int StartNativeExplorer (NativeExplorerData *data)
 Open NativeExplorer.
 
int OpenExplorer (NativeExplorerData *data)
 Open NativeExplorer.
 
int CardExplGetCurItem (void *csm)
 Get current item in open Explorer.
 
void CardExplGetFName (void *csm, int index, WSHDR *filename)
 Get filename of the item in the open Explorer.
 
int ExecuteFile (const WSHDR *filepath, const WSHDR *mime, void *param)
 Execute file by the NativeExplorer.
 
int ExplorerCopyFile (const char *from, const char *to, int overwrite, char transfer_id, uint32_t *errp)
 Copy file.
 
void ExplorerSetTransferState (char transfer_id, int state)
 Set transfer state.
 
int GetMimeType (int uid, WSHDR *mime_type, int occurrence)
 Get MIME type.
 
int BuildPath (WSHDR *path, const WSHDR *file_name, const WSHDR *dir)
 Build a full path by a file name and a directory name.
 

Data Structure Documentation

◆ NATIVE_EXPLORER_ITEM

struct NATIVE_EXPLORER_ITEM

◆ NativeExplorerData

struct NativeExplorerData

◆ REGEXPLEXT

struct REGEXPLEXT

◆ REGEXPLEXT_ARM_NEW

struct REGEXPLEXT_ARM_NEW

Typedef Documentation

◆ ExplorerTransferStates

Definition at line 23 of file explorer.h.

◆ NATIVE_EXPLORER_ITEM

typedef struct NATIVE_EXPLORER_ITEM NATIVE_EXPLORER_ITEM

Definition at line 25 of file explorer.h.

◆ NativeExplorerData

typedef struct NativeExplorerData NativeExplorerData

Definition at line 26 of file explorer.h.

◆ REGEXPLEXT

typedef struct REGEXPLEXT REGEXPLEXT

Definition at line 27 of file explorer.h.

◆ REGEXPLEXT_ARM_NEW

typedef struct REGEXPLEXT_ARM_NEW REGEXPLEXT_ARM_NEW

Definition at line 28 of file explorer.h.

◆ TREGEXPLEXT

Definition at line 33 of file explorer.h.

Enumeration Type Documentation

◆ ExplorerTransferStates

Enumerator
EXPLORER_TRANSFER_STATE_STOP 
EXPLORER_TRANSFER_STATE_RUNNING 

Definition at line 18 of file explorer.h.

◆ NativeExplorerMode

Mode of the NativeExplorer.

Enumerator
NATIVE_EXPLORER_MODE_DEFAULT 

Explore files, default mode.

NATIVE_EXPLORER_MODE_SELECT 

Select file.

NATIVE_EXPLORER_MODE_COPY 

Copy file mode.

NATIVE_EXPLORER_MODE_MOVE 

Move file mode.

Definition at line 39 of file explorer.h.

Function Documentation

◆ RegExplorerExt()

void RegExplorerExt ( const REGEXPLEXT * ext)

Register own extension in the NativeExplorer.

Parameters
extextension definition structure, see REGEXPLEXT

◆ UnRegExplorerExt()

int UnRegExplorerExt ( const REGEXPLEXT * ext)

Unregister extension from the NativeExplorer.

Parameters
extextension definition structure, see REGEXPLEXT
Returns
number of registered extensions
Builtin on platforms:
X75, SG

◆ EXT_TOP()

void * EXT_TOP ( void )

Get a pointer to the explorer extensions.

Returns
pointer
Builtin on platforms:
ELKA, NSG, X75, SG

◆ get_regextpnt_by_uid()

TREGEXPLEXT * get_regextpnt_by_uid ( int uid)

Get explorer extension definition by ID.

Parameters
uidID of the registered extension.
Returns
pointer to the extension definition

◆ GetExtUid_ws()

int GetExtUid_ws ( const WSHDR * ext)

Get the ID of the registered extension by its name.

Parameters
extname of the extension, for example: png
Returns
ID of the extension

◆ GetExtUidByFileName_ws()

int GetExtUidByFileName_ws ( const WSHDR * file)

Get the ID of the registered extension by path to the file.

Parameters
filepath to the file
Returns
ID of the extension

◆ MediaSendCSM_Open()

void MediaSendCSM_Open ( const WSHDR * file,
const WSHDR * path )

Open menu for sending file.

Parameters
filename of the file, example: "beans_recipe.jpg"
pathpath to the file, example: "0:\\Pictures\\"

◆ PersMenuCSM_Open()

int PersMenuCSM_Open ( const WSHDR * file_name,
const WSHDR * dir,
int flag,
int open_mode )

Open menu for setting resource as Wallpaper, Logo, Ringtone, etc.

Parameters
file_namename of the file, example "beans_recipe.jpg"
dirdirectory of the file, example "0:\\Pictures"
flag0 or 2
open_modeunknown param, set 0
Returns
CSM ID
Available on platforms:
NSG, ELKA

◆ StartNativeExplorer()

int StartNativeExplorer ( NativeExplorerData * data)

Open NativeExplorer.

Parameters
dataoptions for the opening explorer
Returns
CSM ID

◆ OpenExplorer()

int OpenExplorer ( NativeExplorerData * data)

Open NativeExplorer.

Parameters
dataoptions for the opening explorer
Returns
CSM ID

◆ CardExplGetCurItem()

int CardExplGetCurItem ( void * csm)

Get current item in open Explorer.

Parameters
csmpointer to the Explorer CSM
Returns
index of the current item

◆ CardExplGetFName()

void CardExplGetFName ( void * csm,
int index,
WSHDR * filename )

Get filename of the item in the open Explorer.

Parameters
csmpointer to the Explorer CSM
indexindex of the item
[out]filenameitem filename

◆ ExecuteFile()

int ExecuteFile ( const WSHDR * filepath,
const WSHDR * mime,
void * param )

Execute file by the NativeExplorer.

Parameters
filepathpath to the file
mimemime type of the file
paramcustom param for the extension handler
Returns
return code from the extension handler

◆ ExplorerCopyFile()

int ExplorerCopyFile ( const char * from,
const char * to,
int overwrite,
char transfer_id,
uint32_t * errp )

Copy file.

Parameters
fromsource file path
todestination file path
overwriteallow overwrite if exists
transfer_idtransfer ID (0 ... 31)
[out]errpvariable for error
Returns
0 or error
Note
Paths are WSHDR strings on NSG and ELKA, and C strings on SG and X75.
int transfer_id = 0; // warning: needed function for safe transfer_id allocation
ExplorerCopyFile(from, to, 1, transfer_id, &err);
void ExplorerSetTransferState(char transfer_id, int state)
Set transfer state.
int ExplorerCopyFile(const char *from, const char *to, int overwrite, char transfer_id, uint32_t *errp)
Copy file.
@ EXPLORER_TRANSFER_STATE_RUNNING
Definition explorer.h:20

◆ ExplorerSetTransferState()

void ExplorerSetTransferState ( char transfer_id,
int state )

Set transfer state.

Parameters
transfer_idtransfer ID (0 ... 31)
statesee ExplorerTransferStates
Available on platforms:
NSG, ELKA, X75, SG

◆ GetMimeType()

int GetMimeType ( int uid,
WSHDR * mime_type,
int occurrence )

Get MIME type.

Parameters
uidfile uid, see GetExtUid_ws, GetExtUidByFileName_ws
[out]mime_typeoutput string, or NULL to only test whether the requested mapping exists
occurrencezero-based index among entries matching uid; 0 selects the first match
Returns
1 if the requested mapping exists, 0 otherwise; when mime_type is non-NULL, the mapping is also copied
Available on platforms:
NSG, ELKA

◆ BuildPath()

int BuildPath ( WSHDR * path,
const WSHDR * file_name,
const WSHDR * dir )

Build a full path by a file name and a directory name.

Parameters
[out]pathpointer to WSHDR string
file_namepointer to WSHDR string, that contains a file name
dirpointer to WSHDR string, that contains a directory name
Returns
1 on success, 0 for NULL arguments; NSG and ELKA also return 0 for insufficient capacity in path
Warning
On SG and X75, path must have enough capacity for the complete result; firmware does not check it.