Skip to content

Commit 9311e02

Browse files
yawaraY-NakWhiteBlackGoose
committed
feat: port GigE Vision implementation from PR #198
Co-authored-by: Yoshitomo Nakanishi <yurayura.rounin.3@gmail.com> Co-authored-by: WhiteBlackGoose <wbg@angouri.org>
1 parent af049d7 commit 9311e02

15 files changed

Lines changed: 1701 additions & 31 deletions

File tree

cameleon/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ tracing = "0.1.26"
2525
auto_impl = "1.0.1"
2626
cameleon-device = { path = "../device", version = "0.1.14" }
2727
cameleon-genapi = { path = "../genapi", version = "0.1.14" }
28+
cameleon-impl = { path = "../impl", version = "0.1.14" }
29+
ureq = "3.2.0"
30+
async-std = "1.13.2"
31+
futures-channel = "0.3.32"
32+
futures-util = "0.3.32"
2833

2934
[dev-dependencies]
3035
trybuild = "1.0.42"

cameleon/src/camera.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,10 +540,16 @@ pub trait DeviceControl {
540540
/// Reads data from the device's memory.
541541
///
542542
/// Reads length is same as `buf.len()`.
543-
fn read(&mut self, address: u64, buf: &mut [u8]) -> ControlResult<()>;
543+
fn read_mem(&mut self, address: u64, buf: &mut [u8]) -> ControlResult<()>;
544+
545+
/// Reads 4 bytes data from the address.
546+
fn read_reg(&mut self, address: u64) -> ControlResult<[u8; 4]>;
544547

545548
/// Writes data to the device's memory.
546-
fn write(&mut self, address: u64, data: &[u8]) -> ControlResult<()>;
549+
fn write_mem(&mut self, address: u64, data: &[u8]) -> ControlResult<()>;
550+
551+
/// Writes 4 bytes data to the address.
552+
fn write_reg(&mut self, address: u64, data: [u8; 4]) -> ControlResult<()>;
547553

548554
/// Returns `GenICam` xml string.
549555
fn genapi(&mut self) -> ControlResult<String>;

cameleon/src/genapi/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ where
447447
"invalid address: the given address has negative value".into(),
448448
)
449449
})?;
450-
Ok(self.inner.read(address, data)?)
450+
Ok(self.inner.read_mem(address, data)?)
451451
}
452452

453453
fn write_mem(
@@ -460,6 +460,6 @@ where
460460
"invalid address: the given address has negative value".into(),
461461
)
462462
})?;
463-
Ok(self.inner.write(address, data)?)
463+
Ok(self.inner.write_mem(address, data)?)
464464
}
465465
}

0 commit comments

Comments
 (0)