Skip to content

Commit

Permalink
chore: 回滚一些没必要的重命名
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed Jan 9, 2025
1 parent 55cbe6e commit 5078397
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
14 changes: 7 additions & 7 deletions include/MaaFramework/MaaMsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

/**
* @{
* @brief Message for the tasks.
* @brief Message for the task.
*
* payload: {
* task_id: number,
Expand All @@ -66,11 +66,11 @@

/**
* @{
* @brief Message for the next List.
* @brief Message for the next list of node.
*
* payload: {
* task_id: number,
* node: string,
* name: string,
* list: string[],
* }
*/
Expand All @@ -81,12 +81,12 @@

/**
* @{
* @brief Message for the recognition list.
* @brief Message for the recognition list of node.
*
* payload: {
* task_id: number,
* reco_id: number,
* node: string,
* name: string,
* }
*/
#define MaaMsg_Node_Recognition_Starting ("Node.Recognition.Starting")
Expand All @@ -96,12 +96,12 @@

/**
* @{
* @brief Message for the node action.
* @brief Message for the action of node.
*
* payload: {
* task_id: number,
* node_id: number,
* node: string,
* name: string,
* }
*/
#define MaaMsg_Node_Action_Starting ("Node.Action.Starting")
Expand Down
18 changes: 9 additions & 9 deletions sample/python/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,24 +99,24 @@ def on_tasker_task(
):
print(f"on_tasker_task: {noti_type}, {detail}")

def on_task_next_list(
def on_node_next_list(
self,
noti_type: NotificationType,
detail: NotificationHandler.TaskNextListDetail,
detail: NotificationHandler.NodeNextListDetail,
):
print(f"on_task_next_list: {noti_type}, {detail}")
print(f"on_node_next_list: {noti_type}, {detail}")

def on_task_recognition(
def on_node_recognition(
self,
noti_type: NotificationType,
detail: NotificationHandler.TaskRecognitionDetail,
detail: NotificationHandler.NodeRecognitionDetail,
):
print(f"on_task_recognition: {noti_type}, {detail}")
print(f"on_node_recognition: {noti_type}, {detail}")

def on_task_action(
self, noti_type: NotificationType, detail: NotificationHandler.TaskActionDetail
def on_node_action(
self, noti_type: NotificationType, detail: NotificationHandler.NodeActionDetail
):
print(f"on_task_action: {noti_type}, {detail}")
print(f"on_node_action: {noti_type}, {detail}")


if __name__ == "__main__":
Expand Down
10 changes: 5 additions & 5 deletions source/MaaFramework/Task/TaskBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ RecoResult TaskBase::run_recognition(const cv::Mat& image, const PipelineData::N

const json::value reco_list_cb_detail {
{ "task_id", task_id() },
{ "node", cur_node_ },
{ "name", cur_node_ },
{ "list", json::array(list) },
};
if (debug_mode() || focus) {
Expand All @@ -106,7 +106,7 @@ RecoResult TaskBase::run_recognition(const cv::Mat& image, const PipelineData::N
const json::value reco_cb_detail {
{ "task_id", task_id() },
{ "reco_id", 0 },
{ "node", node },
{ "name", node },
};
notify(MaaMsg_Node_Recognition_Starting, reco_cb_detail);
}
Expand All @@ -117,7 +117,7 @@ RecoResult TaskBase::run_recognition(const cv::Mat& image, const PipelineData::N
const json::value reco_cb_detail {
{ "task_id", task_id() },
{ "reco_id", result.reco_id },
{ "node", node },
{ "name", node },
};
notify(result.box ? MaaMsg_Node_Recognition_Succeeded : MaaMsg_Node_Recognition_Failed, reco_cb_detail);
}
Expand Down Expand Up @@ -165,7 +165,7 @@ NodeDetail TaskBase::run_action(const RecoResult& reco)
const json::value cb_detail {
{ "task_id", task_id() },
{ "node_id", 0 },
{ "node", reco.name },
{ "name", reco.name },
};
notify(MaaMsg_Node_Action_Starting, cb_detail);
}
Expand All @@ -186,7 +186,7 @@ NodeDetail TaskBase::run_action(const RecoResult& reco)
const json::value cb_detail {
{ "task_id", task_id() },
{ "node_id", result.node_id },
{ "node", reco.name },
{ "name", reco.name },
};
notify(result.completed ? MaaMsg_Node_Action_Succeeded : MaaMsg_Node_Action_Failed, cb_detail);
}
Expand Down
34 changes: 17 additions & 17 deletions source/binding/Python/maa/notification_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,34 +59,34 @@ def on_tasker_task(self, noti_type: NotificationType, detail: TaskerTaskDetail):
pass

@dataclass
class TaskNextListDetail:
class NodeNextListDetail:
task_id: int
node: str
name: str
next_list: list[str]

def on_task_next_list(
self, noti_type: NotificationType, detail: TaskNextListDetail
def on_node_next_list(
self, noti_type: NotificationType, detail: NodeNextListDetail
):
pass

@dataclass
class TaskRecognitionDetail:
class NodeRecognitionDetail:
task_id: int
reco_id: int
node: str
name: str

def on_task_recognition(
self, noti_type: NotificationType, detail: TaskRecognitionDetail
def on_node_recognition(
self, noti_type: NotificationType, detail: NodeRecognitionDetail
):
pass

@dataclass
class TaskActionDetail:
class NodeActionDetail:
task_id: int
node_id: int
node: str
name: str

def on_task_action(self, noti_type: NotificationType, detail: TaskActionDetail):
def on_node_action(self, noti_type: NotificationType, detail: NodeActionDetail):
pass

def on_unknown_notification(self, msg: str, details: dict):
Expand Down Expand Up @@ -122,26 +122,26 @@ def on_raw_notification(self, msg: str, details: dict):
self.on_tasker_task(noti_type, detail)

elif msg.startswith("Node.NextList"):
detail = self.TaskNextListDetail(
detail = self.NodeNextListDetail(
task_id=details["task_id"],
node=details["node"],
name=details["name"],
next_list=details["list"],
)
self.on_node_next_list(noti_type, detail)

elif msg.startswith("Node.Recognition"):
detail = self.TaskRecognitionDetail(
detail = self.NodeRecognitionDetail(
task_id=details["task_id"],
reco_id=details["reco_id"],
node=details["node"],
name=details["name"],
)
self.on_node_recognition(noti_type, detail)

elif msg.startswith("Node.Action"):
detail = self.TaskActionDetail(
detail = self.NodeActionDetail(
task_id=details["task_id"],
node_id=details["node_id"],
node=details["node"],
name=details["name"],
)
self.on_node_action(noti_type, detail)

Expand Down

0 comments on commit 5078397

Please sign in to comment.