openharmony 鸿蒙 cem-tool

2023-02-03 浏览 (789)

Common Event Manager

The Common Event Manager enables you to print common event information and publish common events. It provides the common event debugging and testing capabilities, for example, printing all public event subscribers, sent public events, and recipients, and simulating public event release.

Environment Requirements

Before using this tool, you must obtain the hdc tool and run the hdc shell command.

cem Commands

CommandDescription
helpDisplays the cem help information.
publishPublishes a common event.
dumpDumps information about common events.

help

# Display the cem help information.
cem help

publish

# Publish a common event.
cem publish [<options>]

Parameters

NameDescription
-e/--eventName of the common event to publish. This parameter is mandatory.
-o/--orderedIndicates that the common event to publish is ordered. By default, non-ordered events are published. This parameter is optional.
-c/--codeResult code of the common event. This parameter is optional.
-d/--dataData carried in the common event. This parameter is optional.
-h/--helpHelp information.

Example

# Publish a common event named testevent.
cem publish --event "testevent"
# Publish an ordered common event named testevent. The result code of the event is 100 and the data carried is "this is data".
cem publish -e "testevent" -o -c 100 -d "this is data"

dump

NOTE

The Common Event Manager has two editions: eng and user. The dump command can be used only in the eng edition. If it is used in the user edition, the message error: user version cannot use dump is reported.

# Dumps information about common events.
cem dump [<options>]

Parameters

NameDescription
-a/--allInformation about all common events that have been sent since system startup.
-e/--eventInformation about a specific event.
-h/--helpHelp information.

Example

# Display details of a common event named testevent.
cem dump -e "testevent"

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Debugging Tools

harmony 鸿蒙Ability Assistant

harmony 鸿蒙Account Manager

harmony 鸿蒙Advanced Notification Manager

harmony 鸿蒙App Check Tool

harmony 鸿蒙Access Token Manager

harmony 鸿蒙Bundle Manager

harmony 鸿蒙devicedebug

harmony 鸿蒙EDM

harmony 鸿蒙LLDB

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/74866e29122745638cf2d2ab8c585d7a