refactor: introduce plugin_ids constants, replace hardcoded plugin ID strings
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use crate::core::message::{Destination, Envelope, Message, PlayerCommand, WifiCommand};
|
||||
use crate::core::plugin_ids;
|
||||
|
||||
/// 命令解析结果
|
||||
pub struct DispatchResult {
|
||||
@@ -137,7 +138,7 @@ fn ok_video(from: &str, message: Message) -> Result<DispatchResult, String> {
|
||||
Ok(DispatchResult {
|
||||
envelope: Envelope {
|
||||
from: from.to_string(),
|
||||
to: Destination::Plugin("video".to_string()),
|
||||
to: Destination::Plugin(plugin_ids::VIDEO.to_string()),
|
||||
message,
|
||||
},
|
||||
})
|
||||
@@ -147,7 +148,7 @@ fn ok_wifi(from: &str, message: Message) -> Result<DispatchResult, String> {
|
||||
Ok(DispatchResult {
|
||||
envelope: Envelope {
|
||||
from: from.to_string(),
|
||||
to: Destination::Plugin("wifi".to_string()),
|
||||
to: Destination::Plugin(plugin_ids::WIFI.to_string()),
|
||||
message,
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user