chore: 更新。

This commit is contained in:
Ivan Li 2023-03-16 20:13:08 +08:00
parent eeddff1dc1
commit 653729fcc2
6 changed files with 673 additions and 671 deletions

View File

@ -10,13 +10,13 @@
"tauri": "tauri"
},
"dependencies": {
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@fortawesome/fontawesome-svg-core": "^6.3.0",
"@fortawesome/free-regular-svg-icons": "^6.3.0",
"@fortawesome/free-solid-svg-icons": "^6.3.0",
"@fortawesome/react-fontawesome": "^0.2.0",
"@mui/material": "^5.11.8",
"@mui/material": "^5.11.13",
"@tauri-apps/api": "^1.2.0",
"clsx": "^1.2.1",
"debug": "^4.3.4",
@ -27,26 +27,26 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@babel/plugin-transform-react-jsx": "^7.20.13",
"@babel/plugin-transform-react-jsx": "^7.21.0",
"@emotion/babel-plugin-jsx-pragmatic": "^0.2.0",
"@emotion/serialize": "^1.1.1",
"@tauri-apps/cli": "^1.2.3",
"@types/debug": "^4.1.7",
"@types/node": "^18.13.0",
"@types/node": "^18.15.3",
"@types/ramda": "^0.28.23",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.10",
"@types/react-dom": "^18.0.11",
"@vitejs/plugin-react": "^2.2.0",
"autoprefixer": "^10.4.13",
"autoprefixer": "^10.4.14",
"babel-plugin-macros": "^3.1.0",
"eslint-config-prettier": "^8.6.0",
"eslint-config-prettier": "^8.7.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-simple-import-sort": "^8.0.0",
"postcss": "^8.4.21",
"prettier": "^2.8.4",
"tailwindcss": "^3.2.6",
"tailwindcss": "^3.2.7",
"twin.macro": "^3.1.0",
"typescript": "^4.9.5",
"vite": "^3.2.5"

File diff suppressed because it is too large Load Diff

870
src-tauri/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -158,16 +158,10 @@ impl Manager {
let rpc = rpc::Manager::global().await;
rpc.publish_desktop_cmd(&models::CmdRespMqMessage::Brightness(
models::ConfigDisplayCmd {
display_index: config.id,
value: models::CmdRespWithRange {
value: config.brightness,
min: config.min_brightness,
max: config.max_brightness,
},
},
))
rpc.publish_desktop_cmd(
format!("display{}/brightness", display_brightness.display_index).as_str(),
target.to_be_bytes().to_vec(),
)
.await;
}
Err(err) => {

View File

@ -52,11 +52,9 @@ impl Manager {
pub async fn publish_led_sub_pixels(&self, payload: Vec<u8>) -> anyhow::Result<()> {
self.client.publish_led_sub_pixels(payload).await
}
pub async fn publish_desktop_cmd<T>(&self, msg: &T) -> anyhow::Result<()>
where
T: ?Sized + serde::Serialize,
pub async fn publish_desktop_cmd(&self, field: &str, payload: Vec<u8>) -> anyhow::Result<()>
{
self.client.publish_desktop_cmd(msg).await
self.client.publish_desktop_cmd(field, payload).await
}
pub fn client(&self) -> &MqttRpc {

View File

@ -12,7 +12,6 @@ const DISPLAY_TOPIC: &'static str = "display-ambient-light/display";
const DESKTOP_TOPIC: &'static str = "display-ambient-light/desktop";
const DISPLAY_BRIGHTNESS_TOPIC: &'static str = "display-ambient-light/board/brightness";
const BOARD_SEND_CMD: &'static str = "display-ambient-light/board/cmd";
const DESKTOP_SEND_CMD: &'static str = "display-ambient-light/desktop/cmd";
pub struct MqttRpc {
client: mqtt::AsyncClient,
@ -227,16 +226,12 @@ impl MqttRpc {
) -> broadcast::Receiver<display::DisplayBrightness> {
self.change_display_brightness_tx.subscribe()
}
pub async fn publish_desktop_cmd<T>(&self, msg: &T) -> anyhow::Result<()>
where
T: ?Sized + serde::Serialize,
pub async fn publish_desktop_cmd(&self, field: &str, payload: Vec<u8>) -> anyhow::Result<()>
{
let str = serde_json::to_string(msg)
.map_err(|err| anyhow::anyhow!("can not serialize. {:?}", err))?;
self.client
.publish(mqtt::Message::new(
DESKTOP_SEND_CMD,
str.as_bytes(),
format!("{}/{}", DESKTOP_TOPIC, field),
payload,
mqtt::QOS_1,
))
.await