maix.comm

maix.comm module

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

Module

No module

Enum

Variable

Function

Class

CommProtocol

item doc
brief Class for communication protocol

C++ defination code:

class CommProtocol

__init__

item doc
type func
brief Construct a new CommProtocol object
param buff_size: buffer size, default to 1024 bytes
static False

C++ defination code:

CommProtocol(int buff_size = 1024)

get_msg

item doc
type func
brief Read data to buffer, and try to decode it as maix.protocol.MSG object
return decoded data, if nullptr, means no valid frame found.
Attentioin, delete it after use in C++.
static False

C++ defination code:

protocol::MSG *get_msg()

resp_ok

item doc
type func
brief Send response ok(success) message
param cmd: CMD value
body: response body, can be null
return encoded data, if nullptr, means error, and the error code is -err.Err.
Attentioin, delete it after use in C++.
static False

C++ defination code:

err::Err resp_ok(uint8_t cmd, Bytes *body = nullptr)

report

item doc
type func
brief Send report message
param cmd: CMD value
body: report body, can be null
return encoded data, if nullptr, means error, and the error code is -err.Err.
Attentioin, delete it after use in C++.
static False

C++ defination code:

err::Err report(uint8_t cmd, Bytes *body = nullptr)

resp_err

item doc
type func
brief Encode response error message to buffer
param cmd: CMD value
code: error code
msg: error message
return encoded data, if nullptr, means error, and the error code is -err.Err.
Attentioin, delete it after use in C++.
static False

C++ defination code:

err::Err resp_err(uint8_t cmd, err::Err code, const std::string &msg)