mcumgr-core
Core functionality of the Mcu Manager library.
This module defines the base transport interface, the protocol managers, and the response data structures used to communicate with devices running nRF Connect SDK, Zephyr, or Apache Mynewt.
Key Components
McuMgrTransport: The interface for sending and receiving SMP packets.Managers: Specialized classes for different Mcu Manager groups:
DefaultManager: OS-level commands like echo, reset, and task statistics.ImageManager: Firmware image management (list, upload, test, confirm).FsManager: File system operations (download, upload).StatsManager: Statistics retrieval.LogManager: Log retrieval.McuMgrResponse: Base class for all Mcu Manager responses, handling CBOR/JSON decoding.
Example
To use a manager, you need an implementation of McuMgrTransport (e.g., McuMgrBleTransport from the :mcumgr-ble module).
// Initialize a manager (e.g., DefaultManager)
DefaultManager manager = new DefaultManager(transport);
// Send an echo command asynchronously
manager.echo("Hello World!", new McuMgrCallback<McuMgrEchoResponse>() {
@Override
public void onResponse(@NonNull McuMgrEchoResponse response) {
// Handle success
String echo = response.r;
}
@Override
public void onError(@NonNull McuMgrException error) {
// Handle error
}
});