maix.app

maix.app module

You can use maix.app to access this module with MaixPy
This module is generated from MaixCDK

Module

No module

Enum

Variable

Function

app_id

def app_id() -> str
item doc
brief Get current APP ID.
return APP ID.

C++ defination code:

string app_id()

set_app_id

def set_app_id(app_id: str) -> str
item doc
brief Set current APP ID.
param app_id: APP ID.

C++ defination code:

string set_app_id(const string &app_id)

get_apps_info_path

def get_apps_info_path() -> str
item doc
brief Get APP info file path.

C++ defination code:

string get_apps_info_path()

get_apps_info

def get_apps_info(ignore_launcher: bool = False, ignore_app_store: bool = False) -> list[APP_Info]
item doc
brief Get APP info list.
param ignore_launcher: if true, ignore launcher APP. default false.
ignore_app_store: if true, ignore app store APP. default false.
return APP info list. APP_Info object list.

C++ defination code:

vector<app::APP_Info> &get_apps_info(bool ignore_launcher = false, bool ignore_app_store = false)

get_app_data_path

def get_app_data_path() -> str
item doc
brief Get APP info, APP can store private data in this directory.
return APP data path "./data", just return the data folder in current path because APP executed in app install path or project path.
So, you must execute your program in you project path to use the project/data folder when you debug your APP.

C++ defination code:

string get_app_data_path()

get_app_path

def get_app_path(app_id: str = '') -> str
item doc
brief Get APP path.
param app_id: APP ID, if empty, return current APP path, else return the APP path by app_id.
return APP path, just return the current path because APP executed in app install path or project path.
So, you must execute your program in you project path to use the project/data folder when you debug your APP.

C++ defination code:

string get_app_path(const string &app_id = "")

get_tmp_path

def get_tmp_path() -> str
item doc
brief Get global temporary data path, APPs can use this path as temporary data directory.
return temporary data path.

C++ defination code:

string get_tmp_path()

get_share_path

def get_share_path() -> str
item doc
brief Get data path of share, shared data like picture and video will put in this directory
return share data path.

C++ defination code:

string get_share_path()

get_picture_path

def get_picture_path() -> str
item doc
brief Get picture path of share, shared picture will put in this directory
return share picture path.

C++ defination code:

string get_picture_path()

get_video_path

def get_video_path() -> str
item doc
brief Get video path of share, shared video will put in this directory
return share video path.

C++ defination code:

string get_video_path()

get_font_path

def get_font_path() -> str
item doc
brief Get font path of share, shared font will put in this directory
return share font path.

C++ defination code:

string get_font_path()

get_icon_path

def get_icon_path() -> str
item doc
brief Get icon path of share, shared icon will put in this directory
return share icon path.

C++ defination code:

string get_icon_path()

get_sys_config_kv

def get_sys_config_kv(item: str, key: str, value: str = '', from_cache: bool = True) -> str
item doc
brief Get system config item value.
param item: name of setting item, e.g. wifi, language. more see settings APP.
key: config key, e.g. for wifi, key can be ssid, for language, key can be locale.
value: default value, if not found, return this value.
from_cache: if true, read from cache, if false, read from file.
return config value, always string type, if not found, return empty string.

C++ defination code:

string get_sys_config_kv(const string &item, const string &key, const string &value = "", bool from_cache = true)

get_app_config_kv

def get_app_config_kv(item: str, key: str, value: str = '', from_cache: bool = True) -> str
item doc
brief Get APP config item value.
param item: name of setting item, e.g. user_info
key: config key, e.g. for user_info, key can be name, age etc.
value: default value, if not found, return this value.
from_cache: if true, read from cache, if false, read from file.
return config value, always string type, if not found, return empty string.

C++ defination code:

string get_app_config_kv(const string &item, const string &key, const string &value = "", bool from_cache = true)

set_app_config_kv

def set_app_config_kv(item: str, key: str, value: str, write_file: bool = True) -> maix.err.Err
item doc
brief Set APP config item value.
param item: name of setting item, e.g. user_info
key: config key, e.g. for user_info, key can be name, age etc.
value: config value, always string type.
write_file: if true, write to file, if false, just write to cache.
return err::Err

C++ defination code:

err::Err set_app_config_kv(const string &item, const string &key, const string &value, bool write_file = true)

get_app_config_path

def get_app_config_path() -> str
item doc
brief Get APP config path, ini format, so you can use your own ini parser to parse it like configparser in Python.\nAll APP config info is recommended to store in this file.
return APP config path(ini format).

C++ defination code:

string get_app_config_path()

set_exit_msg

def set_exit_msg(code: maix.err.Err, msg: str) -> maix.err.Err
item doc
brief Set APP exit code and exit message.\nIf code != 0, the launcher will show a dialog to user, and display the msg.
param code: exit code, 0 means success, other means error, if code is 0, do nothing.
msg: exit message, if code is 0, msg is not used.
return exit code, the same as arg @code.

C++ defination code:

err::Err set_exit_msg(err::Err code, const string &msg)

get_exit_msg

def get_exit_msg(cache: bool = False) -> tuple[str, maix.err.Err, str]
item doc
brief Get APP exit code and exit message.
param cache: if true, read from cache, if false, read from file. default false.
return exit return app_id, exit code and exit message.

C++ defination code:

tuple<string, err::Err, string> get_exit_msg(bool cache = false)

have_exit_msg

def have_exit_msg(cache: bool = False) -> bool
item doc
brief Check if have exit msg
param cache: if true, just check from cache, if false, check from file. default false.
return true if have exit msg, false if not.

C++ defination code:

bool have_exit_msg(bool cache = false)

switch_app

def switch_app(app_id: str, idx: int = -1) -> None
item doc
brief Exit this APP and start another APP(by launcher).\nCall this API will call set_exit_flag(true), you should check app::need_exit() in your code.\nAnd exit this APP if app::need_exit() return true.
param app_id: APP ID which will be started. app_id and idx must have one is valid.
idx: APP index. app_id and idx must have one is valid.

C++ defination code:

void switch_app(const string &app_id, int idx = -1)

need_exit

def need_exit() -> bool
item doc
brief Shoule this APP exit?
return true if this APP should exit, false if not.
attention This API is a function, not a variable.

C++ defination code:

bool need_exit()

running

def running() -> bool
item doc
brief App should running? The same as !app::need_exit() (not app::need_exit() in MaixPy).
return true if this APP should running, false if not.
attention This API is a function, not a variable.

C++ defination code:

bool running()

set_exit_flag

def set_exit_flag(exit: bool) -> None
item doc
brief Set exit flag. You can get exit flag by app.need_exit().
param exit: true if this APP should exit, false if not.

C++ defination code:

void set_exit_flag(bool exit)

Class

Version

item doc
brief APP version

C++ defination code:

class Version

__str__

item doc
type func
brief Convert to string, e.g. 1.0.0
static False

C++ defination code:

std::string __str__()

from_str

item doc
type func
brief Convert from string, e.g. "1.0.0"
static True

C++ defination code:

static app::Version from_str(const string &version_str)

APP_Info

item doc
brief APP info

C++ defination code:

class APP_Info

id

item doc
type var
brief APP id
static False
readonly False

C++ defination code:

string id

name

item doc
type var
brief APP name
static False
readonly False

C++ defination code:

string name

icon

item doc
type var
brief APP icon
static False
readonly False

C++ defination code:

string icon

version

item doc
type var
brief APP version
static False
readonly False

C++ defination code:

Version version

exec

item doc
type var
brief APP exec
static False
readonly False

C++ defination code:

string exec

author

item doc
type var
brief APP author
static False
readonly False

C++ defination code:

string author

desc

item doc
type var
brief APP desc
static False
readonly False

C++ defination code:

string desc

names

item doc
type var
brief APP names
static False
readonly False

C++ defination code:

map<string, string> names

descs

item doc
type var
brief APP descs
static False
readonly False

C++ defination code:

map<string, string> descs