Skip to content
github-actions[bot] edited this page Aug 10, 2026 · 11 revisions

Class MiP

Public Elements

MIP_CMD_DISCONNECT_APP

Signature: constexpr uint8_t MIP_CMD_DISCONNECT_APP

Summary: MiP protocol command bytes related to core functions.

Details:

These values are placed in the first byte of requests sent to the MiP (and appear in the corresponding responses). See the official MiP BLE Protocol for the complete list.


MIP_CMD_SLEEP

Signature: constexpr uint8_t MIP_CMD_SLEEP


MIP_CMD_GET_STATUS

Signature: constexpr uint8_t MIP_CMD_GET_STATUS


MIP_ERROR_NONE

Signature: constexpr uint8_t MIP_ERROR_NONE

Summary: Integer error codes that can be encountered by the MiP library.


MIP_ERROR_TIMEOUT

Signature: constexpr uint8_t MIP_ERROR_TIMEOUT


MIP_ERROR_NO_EVENT

Signature: constexpr uint8_t MIP_ERROR_NO_EVENT


MIP_ERROR_BAD_RESPONSE

Signature: constexpr uint8_t MIP_ERROR_BAD_RESPONSE


MIP_ERROR_MAX_RETRIES

Signature: constexpr uint8_t MIP_ERROR_MAX_RETRIES


battery

Signature: MiP_Battery battery


chestLED

Signature: MiP_ChestLED chestLED


clap

Signature: MiP_Clap clap


eeprom

Signature: MiP_EEPROM eeprom


gesture

Signature: MiP_Gesture gesture


headLEDs

Signature: MiP_HeadLEDs headLEDs


infrared

Signature: MiP_Infrared infrared


mode

Signature: MiP_Mode mode


motion

Signature: MiP_Motion motion


odometer

Signature: MiP_Odometer odometer


position

Signature: MiP_Position position


radar

Signature: MiP_Radar radar


serial

Signature: MiP_Serial serial


shake

Signature: MiP_Shake shake


sound

Signature: MiP_Sound sound


version

Signature: MiP_Version version


weight

Signature: MiP_Weight weight


wifi

Signature: MiP_Wifi wifi


MiP

Signature: MiP()


~MiP

Signature: ~MiP()


begin

Signature: bool begin()

Summary: Initializes the core UART connection to the MiP robot.

Details:

Attempts connection at both 115200 and 9600 baud rates with retries. Sets up debug output on Serial1 and prepares internal state.

Returns: true if successfully connected to MiP, false otherwise.


end

Signature: void end()

Summary: Cleans up the connection to MiP and shuts down network services.

Details:

Restores default volume, sends disconnect command, and ends Serial/WiFi/OTA.


sleep

Signature: void sleep()

Summary: Puts the MiP robot to sleep.

Details:

The robot will need to be physically reset before another begin() call.


isInitialized

Signature: bool isInitialized()

Summary: Check whether the MiP library has completed initialization.

Details:

Returns true when the internal initialization flag (MRI_FLAG_INITIALIZED) is set, indicating that begin() completed successfully and the MiP instance is ready for use. Returns false if initialization failed or has not yet been performed.

This accessor does not modify object state and has no side effects. Consider calling this before invoking API methods that require an active connection to the robot.

Returns: true if the MiP instance is initialized and ready; false otherwise.


lastCallResult

Signature: int8_t lastCallResult()

Summary: Retrieves the error code from the most recently executed MiP API function.

Details:

The library automatically attempts to handle communication errors by retrying read/write operations behind the scenes. If an operation ultimately fails to recover, this function provides the specific reason for the failure. int8_t The error code generated by the last operation (e.g., MIP_ERROR_NONE, MIP_ERROR_TIMEOUT, MIP_ERROR_BAD_RESPONSE).

Returns: int8_t The error code generated by the last operation (e.g., MIP_ERROR_NONE, MIP_ERROR_TIMEOUT, MIP_ERROR_BAD_RESPONSE).


didLastCallFail

Signature: bool didLastCallFail()

Summary: Checks if the most recently executed MiP API function encountered a critical error.

Details:

A quick convenience method to determine if a command was successful without needing to evaluate the specific error code. true If the last operation failed (m_lastError is not MIP_ERROR_NONE).

false If the last operation succeeded.

Returns: true If the last operation failed (m_lastError is not MIP_ERROR_NONE).


dispatchEvent

Signature: void dispatchEvent(uint8_t command, const uint8_t *payload, size_t)

Summary: Central dispatcher for all Out-of-Band events from the transport layer.

Details:

This method receives raw event data and routes it to the appropriate subsystem component (Clap, Gesture, Status, etc.).


printLastCallResult

Signature: void printLastCallResult()

Summary: Prints a human-readable description of the last error to the debug channel (Serial1).


Clone this wiki locally