Emote

[中文]

  • Component registry: espressif/brookesia_expression_emote

  • Helper header: #include "brookesia/service_helper/expression/emote.hpp"

  • Helper class: esp_brookesia::service::helper::ExpressionEmote

Overview

brookesia_expression_emote manages emotes on the Brookesia service framework:

  • Resources: Load and configure emoji/animation assets.

  • Emotes: Set and manage emoji for emotional states.

  • Animation: Playback control; wait for frames; stop.

  • QR codes: Show and hide QR overlays.

  • Event messages: Show and hide event text.

Standard Include / Helper Class

  • Standard include: #include \"brookesia/service_helper/expression/emote.hpp\"

  • Helper class: esp_brookesia::service::helper::ExpressionEmote

Service Interfaces

Functions

SetConfig

Description

Set emote config.

Execution
  • Requires scheduler: Not required

Parameters
  • Config

    • Type: Object

    • Required: required

    • Description: Config. Example: {“h_res”:320,”v_res”:240,”buf_pixels”:7680,”fps”:30,”task_priority”:5,”task_stack”:4096,”task_affinity”:0,”task_stack_in_ext”:true,”flag_swap_color_bytes”:false,”flag_double_buffer”:false,”flag_buff_dma”:false,”flag_buff_spiram”:true}

Schema JSON
Show raw JSON

{
  "name": "SetConfig",
  "description": "Set emote config.",
  "require_scheduler": false,
  "parameters": [
    {
      "name": "Config",
      "description": "Config. Example: {\"h_res\":320,\"v_res\":240,\"buf_pixels\":7680,\"fps\":30,\"task_priority\":5,\"task_stack\":4096,\"task_affinity\":0,\"task_stack_in_ext\":true,\"flag_swap_color_bytes\":false,\"flag_double_buffer\":false,\"flag_buff_dma\":false,\"flag_buff_spiram\":true}",
      "type": "Object",
      "required": true,
      "default_value": null
    }
  ]
}
CLI Command
svc_call Emote SetConfig {"Config":null}

LoadAssetsSource

Description

Load assets from the specified source.

Execution
  • Requires scheduler: Not required

Parameters
  • Source

    • Type: Object

    • Required: required

    • Description: Asset source as a JSON object. Example: {“source”:”anim_icon”,”type”:”PartitionLabel”,”flag_enable_mmap”:false}

Schema JSON
Show raw JSON

{
  "name": "LoadAssetsSource",
  "description": "Load assets from the specified source.",
  "require_scheduler": false,
  "parameters": [
    {
      "name": "Source",
      "description": "Asset source as a JSON object. Example: {\"source\":\"anim_icon\",\"type\":\"PartitionLabel\",\"flag_enable_mmap\":false}",
      "type": "Object",
      "required": true,
      "default_value": null
    }
  ]
}
CLI Command
svc_call Emote LoadAssetsSource {"Source":null}

SetEmoji

Description

Set emoji and hide animation immediately.

Execution
  • Requires scheduler: Not required

Parameters
  • Emoji

    • Type: String

    • Required: required

    • Description: Emoji name.

Schema JSON
Show raw JSON

{
  "name": "SetEmoji",
  "description": "Set emoji and hide animation immediately.",
  "require_scheduler": false,
  "parameters": [
    {
      "name": "Emoji",
      "description": "Emoji name.",
      "type": "String",
      "required": true,
      "default_value": null
    }
  ]
}
CLI Command
svc_call Emote SetEmoji {"Emoji":null}

HideEmoji

Description

Hide current emoji.

Execution
  • Requires scheduler: Not required

Parameters
  • No parameters.

Schema JSON
Show raw JSON

{
  "name": "HideEmoji",
  "description": "Hide current emoji.",
  "require_scheduler": false,
  "parameters": []
}
CLI Command
svc_call Emote HideEmoji

SetAnimation

Description

Set animation and hide emoji immediately.

Execution
  • Requires scheduler: Not required

Parameters
  • Animation

    • Type: String

    • Required: required

    • Description: Animation name.

Schema JSON
Show raw JSON

{
  "name": "SetAnimation",
  "description": "Set animation and hide emoji immediately.",
  "require_scheduler": false,
  "parameters": [
    {
      "name": "Animation",
      "description": "Animation name.",
      "type": "String",
      "required": true,
      "default_value": null
    }
  ]
}
CLI Command
svc_call Emote SetAnimation {"Animation":null}

InsertAnimation

Description

Insert animation; it hides immediately and shows after the duration.

Execution
  • Requires scheduler: Not required

Parameters
  • Animation

    • Type: String

    • Required: required

    • Description: Animation name.

  • DurationMs

    • Type: Number

    • Required: required

    • Description: Animation duration in milliseconds. Stops automatically after this duration.

Schema JSON
Show raw JSON

{
  "name": "InsertAnimation",
  "description": "Insert animation; it hides immediately and shows after the duration.",
  "require_scheduler": false,
  "parameters": [
    {
      "name": "Animation",
      "description": "Animation name.",
      "type": "String",
      "required": true,
      "default_value": null
    },
    {
      "name": "DurationMs",
      "description": "Animation duration in milliseconds. Stops automatically after this duration.",
      "type": "Number",
      "required": true,
      "default_value": null
    }
  ]
}
CLI Command
svc_call Emote InsertAnimation {"Animation":null,"DurationMs":null}

StopAnimation

Description

Stop current animation and hide it immediately.

Execution
  • Requires scheduler: Not required

Parameters
  • No parameters.

Schema JSON
Show raw JSON

{
  "name": "StopAnimation",
  "description": "Stop current animation and hide it immediately.",
  "require_scheduler": false,
  "parameters": []
}
CLI Command
svc_call Emote StopAnimation

WaitAnimationFrameDone

Description

Wait for each animation frame to finish.

Execution
  • Requires scheduler: Not required

Parameters
  • TimeoutMs

    • Type: Number

    • Required: optional

    • Default: 0E0

    • Description: Timeout in milliseconds. 0 means wait forever.

Schema JSON
Show raw JSON

{
  "name": "WaitAnimationFrameDone",
  "description": "Wait for each animation frame to finish.",
  "require_scheduler": false,
  "parameters": [
    {
      "name": "TimeoutMs",
      "description": "Timeout in milliseconds. `0` means wait forever.",
      "type": "Number",
      "required": false,
      "default_value": 0.0
    }
  ]
}
CLI Command
svc_call Emote WaitAnimationFrameDone {"TimeoutMs":null}

SetEventMessage

Description

Set message for a specified emote event.

Execution
  • Requires scheduler: Not required

Parameters
  • Event

    • Type: String

    • Required: required

    • Description: Event type. Allowed values: [Idle, Speak, Listen, System, User, Battery]

  • Message

    • Type: String

    • Required: optional

    • Default: ""

    • Description: Message text.

Schema JSON
Show raw JSON

{
  "name": "SetEventMessage",
  "description": "Set message for a specified emote event.",
  "require_scheduler": false,
  "parameters": [
    {
      "name": "Event",
      "description": "Event type. Allowed values: [Idle, Speak, Listen, System, User, Battery]",
      "type": "String",
      "required": true,
      "default_value": null
    },
    {
      "name": "Message",
      "description": "Message text.",
      "type": "String",
      "required": false,
      "default_value": ""
    }
  ]
}
CLI Command
svc_call Emote SetEventMessage {"Event":null,"Message":null}

HideEventMessage

Description

Hide current event message.

Execution
  • Requires scheduler: Not required

Parameters
  • No parameters.

Schema JSON
Show raw JSON

{
  "name": "HideEventMessage",
  "description": "Hide current event message.",
  "require_scheduler": false,
  "parameters": []
}
CLI Command
svc_call Emote HideEventMessage

SetQrcode

Description

Set QR code and hide emoji and animation immediately.

Execution
  • Requires scheduler: Not required

Parameters
  • Qrcode

    • Type: String

    • Required: required

    • Description: QR code content.

Schema JSON
Show raw JSON

{
  "name": "SetQrcode",
  "description": "Set QR code and hide emoji and animation immediately.",
  "require_scheduler": false,
  "parameters": [
    {
      "name": "Qrcode",
      "description": "QR code content.",
      "type": "String",
      "required": true,
      "default_value": null
    }
  ]
}
CLI Command
svc_call Emote SetQrcode {"Qrcode":null}

HideQrcode

Description

Hide current QR code and show emoji immediately.

Execution
  • Requires scheduler: Not required

Parameters
  • No parameters.

Schema JSON
Show raw JSON

{
  "name": "HideQrcode",
  "description": "Hide current QR code and show emoji immediately.",
  "require_scheduler": false,
  "parameters": []
}
CLI Command
svc_call Emote HideQrcode

NotifyFlushFinished

Description

Notify emote flush finished.

Execution
  • Requires scheduler: Not required

Parameters
  • No parameters.

Schema JSON
Show raw JSON

{
  "name": "NotifyFlushFinished",
  "description": "Notify emote flush finished.",
  "require_scheduler": false,
  "parameters": []
}
CLI Command
svc_call Emote NotifyFlushFinished

RefreshAll

Description

Refresh the screen.

Execution
  • Requires scheduler: Not required

Parameters
  • No parameters.

Schema JSON
Show raw JSON

{
  "name": "RefreshAll",
  "description": "Refresh the screen.",
  "require_scheduler": false,
  "parameters": []
}
CLI Command
svc_call Emote RefreshAll

Events

FlushReady

Description

Emitted when emote flush is ready.

Execution
  • Requires scheduler: Not required

Items
  • Param

    • Type: Object

    • Description: Flush-ready parameter as a JSON object. Example: {“x_start”:0,”y_start”:0,”x_end”:100,”y_end”:100,”data”:”@0x12345678”}

Schema JSON
Show raw JSON

{
  "name": "FlushReady",
  "description": "Emitted when emote flush is ready.",
  "require_scheduler": false,
  "items": [
    {
      "name": "Param",
      "description": "Flush-ready parameter as a JSON object. Example: {\"x_start\":0,\"y_start\":0,\"x_end\":100,\"y_end\":100,\"data\":\"@0x12345678\"}",
      "type": "Object"
    }
  ]
}
CLI Command
svc_subscribe Emote FlushReady