Skip to content

Commit

Permalink
docs: 标准化接口关于 recognition detail 的约定
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed Sep 19, 2024
1 parent 3a887ad commit 3ed86d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/en_us/4.2-StandardizedInterfaceDesign.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ If you wish to add a binding for a certain language to MaaFW, you can choose one

1. The NotificationCallback wrapped interface parses the message and dispatches it to different methods (refer to MaaMsg.h). For example, `on_resource_loading_starting(data)`. ResourceLoading can also be dispatched as an Event enumeration and Starting as a Type enumeration, such as `on_notification(event, type, data)`. Among them, `data` is the structure parsed by detail_json, instead of directly giving the original json.
2. For the NotificationCallback wrapped interface, you can consider adding the on_unknown_notification method to temporarily deal with the subsequent messages added by MaaFW. You can also consider adding the raw field or other fields representing unknown content to the structure parsed by detail_json.
3. More: TODO...
3. Split detail_json obtained by `MaaTaskerGetRecognitionDetail` into all_results, filtered_results, best_result (note that best may be null), and parse them into different structures according to the algorithm
4. More: TODO...
3 changes: 2 additions & 1 deletion docs/zh_cn/4.2-标准化接口设计.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ binding 可以分为两步:

1. NotificationCallback 包装的接口,解析 message 再派发到不同的方法中(参考 MaaMsg.h)。如 `on_resource_loading_starting(data)`。也可将 ResourceLoading 作为 Event 枚举,Starting 作为 Type 枚举派发,如 `on_notification(event, type, data)`。其中 `data` 为 detail_json 解析出的结构体,而不是直接给出原始 json 。
2. NotificationCallback 包装的接口,可以考虑增加 on_unknown_notification 方法,用于暂时应对 MaaFW 后续新增的消息。detail_json 解析出的结构体中也可考虑加入 raw 字段或其他表示未知内容的字段。
3. 更多:TODO...
3. `MaaTaskerGetRecognitionDetail` 获取的 detail_json,请拆分成 all_results, filtered_results, best_result(注意 best 可能为 null),并根据 algorithm 解析成不同的结构体
4. 更多:TODO...

0 comments on commit 3ed86d8

Please sign in to comment.