Skip to content

Commit 1b1a88a

Browse files
committed
modbus disconnect
1 parent 93d4617 commit 1b1a88a

File tree

6 files changed

+14
-5
lines changed

6 files changed

+14
-5
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55
license-file = "LICENSE"
66
name = "lebai_sdk"
77
repository = "https://github.com/lebai-robotics/lebai-sdk.rs"
8-
version = "0.2.26"
8+
version = "0.2.27"
99

1010
[workspace]
1111
members = [

proto/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ keywords = ["protobuf"]
66
license = "MIT"
77
name = "lebai-proto"
88
repository = "https://github.com/lebai-robotics/lebai-sdk.rs"
9-
version = "3.2.4"
9+
version = "3.2.5"
1010

1111
[dependencies]
1212
jsonrpsee = {version = "0.24", features = ["client-core", "macros"]}

proto/lebai-proto

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,10 @@ mod lebai_sdk {
390390

391391
//MODBUS
392392
#[classmethod]
393+
pub async fn disconnect_modbus(&self, device: String) -> Result<()> {
394+
self.0.disconnect_modbus(device).await
395+
}
396+
#[classmethod]
393397
pub async fn set_modbus_timeout(&self, device: String, timeout: u32) -> Result<()> {
394398
self.0.set_modbus_timeout(device, timeout).await
395399
}

src/rpc/modbus.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ use cmod::Result;
33
use proto::lebai::modbus::*;
44

55
impl Robot {
6+
pub(crate) async fn disconnect_modbus(&self, device: String) -> Result<()> {
7+
let req = DisconnectModbusRequest { device };
8+
let _ = self.c.disconnect_modbus(Some(req)).await.map_err(|e| e.to_string())?;
9+
Ok(())
10+
}
611
pub(crate) async fn set_modbus_timeout(&self, device: String, timeout: u32) -> Result<()> {
712
let req = SetModbusTimeoutRequest { device, timeout };
813
let _ = self.c.set_modbus_timeout(Some(req)).await.map_err(|e| e.to_string())?;

0 commit comments

Comments
 (0)