maix::sys

maix.sys module

This is maix::sys module of MaixCDK.
All of these elements are in namespace maix::sys.

For MaixCDK developer: DO NOT edit this doc file manually, this doc is auto generated!

Module

No module

Enum

Variable

Function

os_version

Get system version

item description
return version string, e.g. "maixcam-2024-08-13-maixpy-v4.4.20"

C++ defination code:

std::string os_version()

maixpy_version

Get MaixPy version, if get failed will return empty string.

item description
return version string, e.g. "4.4.21"

C++ defination code:

std::string maixpy_version()

runtime_version

Get runtime version

item description
return current runtime version

C++ defination code:

std::string runtime_version()

device_configs

Get device configs, we also say board configs. e.g. for MaixCAM it read form /boot/board

item description
param cache: read config from cache(if exists, or will call device_configs first internally) if true,
if false, always read fron config file.
return device config,json format
throw If board config file error will throw out exception(err.Exception)

C++ defination code:

std::map<std::string, std::string> device_configs(bool cache = true)

device_id

Get device id

item description
param cache: read id from cache(if exists, or will call device_configs first internally) if true,
if false, always read fron config file.
return device id, e.g. "maixcam" "maixcam_pro"

C++ defination code:

std::string device_id(bool cache = true)

device_name

Get device name

item description
param cache: read id from cache(if exists, or will call device_configs first internally) if true,
if false, always read fron config file.
return device name, e.g. "MaixCAM" "MaixCAM-Pro"

C++ defination code:

std::string device_name(bool cache = true)

host_name

Get host name

item description
return host name, e.g. "maixcam-2f9f"

C++ defination code:

std::string host_name()

host_domain

Get host domain

item description
return host domain, e.g. "maixcam-2f9f.local"

C++ defination code:

std::string host_domain()

ip_address

Get ip address

item description
return ip address, dict type, e.g. {"eth0": "192.168.0.195", "wlan0": "192.168.0.123", "usb0": "10.47.159.1"}

C++ defination code:

std::map<std::string, std::string> ip_address()

mac_address

Get mac address

item description
return mac address, dict type, e.g. {"eth0": "00:0c:29:2f:9f:00", "wlan0": "00:0c:29:2f:9f:01", "usb0": "00:0c:29:2f:9f:02"}

C++ defination code:

std::map<std::string, std::string> mac_address()

device_key

Get device key, can be unique id of device

item description
return device key, 32 bytes hex string, e.g. "1234567890abcdef1234567890abcdef"

C++ defination code:

std::string device_key()

memory_info

Get memory info

item description
return memory info, dict type, e.g. {"total": 1024, "used": 512, "hw_total": 25610241024}
total: total memory size in Byte.
used: used memory size in Byte.
hw_total: total memory size in Byte of hardware, the total <= hw_total,
OS kernel may reserve some memory for some hardware like camera, npu, display etc.

C++ defination code:

std::map<std::string, int> memory_info()

bytes_to_human

Bytes to human readable string

item description
param bytes:: bytes size,e.g. 1234B = 1234/1024 = 1.205 KB
precision:: decimal precision, default 2
base:: base number, default 1024
unit:: unit string, e.g. "B"
sep:: separator string, e.g. " "
return human readable string, e.g. "1.21 KB"

C++ defination code:

std::string bytes_to_human(unsigned long long bytes, int precision = 2, int base = 1024, const std::string &unit = "B", const std::string &sep = " ")

cpu_freq

Get CPU frequency

item description
return CPU frequency, dict type, e.g. {"cpu0": 1000000000, "cpu1": 1000000000}

C++ defination code:

std::map<std::string, unsigned long> cpu_freq()

cpu_temp

Get CPU temperature

item description
return CPU temperature, unit dgree, dict type, e.g. {"cpu": 50.0, "cpu0": 50, "cpu1": 50}

C++ defination code:

std::map<std::string, float> cpu_temp()

cpu_usage

Get CPU usage

item description
return CPU usage, dict type, e.g. {"cpu": 50.0, "cpu0": 50, "cpu1": 50}

C++ defination code:

std::map<std::string, float> cpu_usage()

npu_freq

Get NPU frequency

item description
return NPU frequency, dict type, e.g. {"npu0": 500000000}

C++ defination code:

std::map<std::string, unsigned long> npu_freq()

disk_usage

Get disk usage

item description
param path:: disk path, default "/"
return disk usage, dict type, e.g. {"total": 1024, "used": 512}

C++ defination code:

std::map<std::string, unsigned long long> disk_usage(const std::string &path = "/")

disk_partitions

Get disk partition and mount point info

item description
param only_disk: only return real disk, tempfs sysfs etc. not return, default true.
return disk partition and mount point info, list type, e.g. [{"device": "/dev/mmcblk0p1", "mountpoint": "/mnt/sdcard", "fstype": "vfat"}]

C++ defination code:

std::vector<std::map<std::string, std::string>> disk_partitions(bool only_disk = true)

register_default_signal_handle

register default signal handle

C++ defination code:

void register_default_signal_handle()

poweroff

Power off device

C++ defination code:

void poweroff()

reboot

Power off device and power on

C++ defination code:

void reboot()

Class