Skip to content

Commit 5a9201c

Browse files
committed
set_modbus_retry
1 parent 25a835c commit 5a9201c

File tree

7 files changed

+16
-5
lines changed

7 files changed

+16
-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 = "2024"
55
license-file = "LICENSE"
66
name = "lebai_sdk"
77
repository = "https://github.com/lebai-robotics/lebai-sdk.rs"
8-
version = "0.3.0"
8+
version = "0.3.1"
99

1010
[workspace]
1111
members = [

lebai_sdk.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ class Robot:
160160
...
161161
def set_modbus_timeout(self, device: str, timeout: int) -> None:
162162
...
163+
def set_modbus_retry(self, device: str, retry: int) -> None:
164+
...
163165
def write_single_coil(self, device: str, pin: str, value: bool) -> None:
164166
...
165167
def write_multiple_coils(self, device: str, pin: str, values: list[bool]) -> None:

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.3.0"
9+
version = "3.3.1"
1010

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

proto/lebai-proto

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,10 @@ mod lebai_sdk {
398398
self.0.set_modbus_timeout(device, timeout).await
399399
}
400400
#[classmethod]
401+
pub async fn set_modbus_retry(&self, device: String, retry: u32) -> Result<()> {
402+
self.0.set_modbus_retry(device, retry).await
403+
}
404+
#[classmethod]
401405
pub async fn write_single_coil(&self, device: String, pin: String, value: bool) -> Result<()> {
402406
self.0.write_single_coil(device, pin, value).await
403407
}

src/rpc/modbus.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ impl Robot {
1313
let _ = self.c.set_modbus_timeout(Some(req)).await.map_err(|e| e.to_string())?;
1414
Ok(())
1515
}
16+
pub(crate) async fn set_modbus_retry(&self, device: String, retry: u32) -> Result<()> {
17+
let req = SetModbusRetryRequest { device, retry };
18+
let _ = self.c.set_modbus_retry(Some(req)).await.map_err(|e| e.to_string())?;
19+
Ok(())
20+
}
1621
pub(crate) async fn write_single_coil(&self, device: String, pin: String, value: bool) -> Result<()> {
1722
let req = SetCoilRequest { device, pin, value };
1823
let _ = self.c.write_single_coil(Some(req)).await.map_err(|e| e.to_string())?;

0 commit comments

Comments
 (0)