Skip to content

Commit

Permalink
Bump docs
Browse files Browse the repository at this point in the history
  • Loading branch information
RReverser committed May 27, 2023
1 parent 3773e02 commit 5f417dc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The [`Device`](https://docs.rs/ascom-alpaca/latest/ascom_alpaca/api/trait.Device

### Implementing a device server

Since async traits are not yet natively supported on stable Rust, the traits are implemented using the [async_trait](https://crates.io/crates/async-trait) crate. Other than that, you should implement trait with all the Alpaca methods as usual:
Since async traits are not yet natively supported on stable Rust, the traits are implemented using the [async-trait](https://crates.io/crates/async-trait) crate. Other than that, you should implement trait with all the Alpaca methods as usual:

```rust
use ascom_alpaca::ASCOMResult;
Expand Down Expand Up @@ -131,6 +131,9 @@ This will start both the main Alpaca server as well as an auto-discovery respond

- [`examples/camera-server.rs`](https://github.com/RReverser/ascom-alpaca-rs/blob/main/examples/camera-server.rs):
A cross-platform example exposing your connected webcam(s) as Alpaca `Camera`s.

Long exposures are simulated by stacking up individual frames up to the total duration.
This approach can't provide precise requested exposure, but works well enough otherwise.
- [`star-adventurer-alpaca`](https://github.com/RReverser/star-adventurer-alpaca):
A fork of [`jsorrell/star-adventurer-alpaca`](https://github.com/jsorrell/star-adventurer-alpaca) which implements the Alpaca API for the Star Adventurer mount over serial port.
The original project has pretty extensive functionality and used manual implementation of the Alpaca API, so it was a good test case for porting to this library.
Expand Down Expand Up @@ -174,7 +177,7 @@ bound_client.discover_addrs()
.map(|addr| Ok(Client::new_from_addr(addr)))
.try_for_each(|client| async move {
/* ...do something with devices via each client... */
Ok(())
Ok::<_, eyre::Error>(())
})
.await?;
```
Expand All @@ -183,12 +186,10 @@ Or, if you just want to list all available devices and don't care about per-serv

```rust
bound_client.discover_devices()
.map(Ok)
.try_for_each(|device| async move {
.for_each(|device| async move {
/* ...do something with each device... */
Ok(())
})
.await?;
.await;
```

Keep in mind that discovery is a UDP-based protocol, so it's not guaranteed to be reliable.
Expand All @@ -212,7 +213,7 @@ let devices =
.await;

// Now you can iterate over all the discovered devices via `iter_all`:
for (typed_device, index_within_category) in devices {
for (typed_device, index_within_category) in devices.iter_all() {
println!("Discovered device: {typed_device:#?} (index: {index_within_category})");
}

Expand All @@ -229,6 +230,8 @@ for camera in devices.iter::<dyn Camera>() {
- [`examples/camera-client.rs`](https://github.com/RReverser/ascom-alpaca-rs/blob/main/examples/camera-client.rs):
A cross-platform GUI example showing a live preview stream from discovered Alpaca cameras.

Includes support for colour, monochrome and Bayer sensors with automatic colour conversion for the preview.

### Logging and tracing

This crate uses [`tracing`](https://crates.io/crates/tracing) framework for logging spans and events, integrating with the Alpaca `ClientID`, `ClientTransactionID` and `ServerTransactionID` fields.
Expand Down
7 changes: 6 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The [`Device`](crate::api::Device) supertrait includes "ASCOM Methods Common To
### Implementing a device server
Since async traits are not yet natively supported on stable Rust, the traits are implemented using the [async_trait](https://crates.io/crates/async-trait) crate. Other than that, you should implement trait with all the Alpaca methods as usual:
Since async traits are not yet natively supported on stable Rust, the traits are implemented using the [async-trait](https://crates.io/crates/async-trait) crate. Other than that, you should implement trait with all the Alpaca methods as usual:
```no_run
use ascom_alpaca::ASCOMResult;
Expand Down Expand Up @@ -137,6 +137,9 @@ This will start both the main Alpaca server as well as an auto-discovery respond
- [`examples/camera-server.rs`](https://github.com/RReverser/ascom-alpaca-rs/blob/main/examples/camera-server.rs):
A cross-platform example exposing your connected webcam(s) as Alpaca `Camera`s.
Long exposures are simulated by stacking up individual frames up to the total duration.
This approach can't provide precise requested exposure, but works well enough otherwise.
- [`star-adventurer-alpaca`](https://github.com/RReverser/star-adventurer-alpaca):
A fork of [`jsorrell/star-adventurer-alpaca`](https://github.com/jsorrell/star-adventurer-alpaca) which implements the Alpaca API for the Star Adventurer mount over serial port.
The original project has pretty extensive functionality and used manual implementation of the Alpaca API, so it was a good test case for porting to this library.
Expand Down Expand Up @@ -253,6 +256,8 @@ for camera in devices.iter::<dyn Camera>() {
- [`examples/camera-client.rs`](https://github.com/RReverser/ascom-alpaca-rs/blob/main/examples/camera-client.rs):
A cross-platform GUI example showing a live preview stream from discovered Alpaca cameras.
Includes support for colour, monochrome and Bayer sensors with automatic colour conversion for the preview.
### Logging and tracing
This crate uses [`tracing`](https://crates.io/crates/tracing) framework for logging spans and events, integrating with the Alpaca `ClientID`, `ClientTransactionID` and `ServerTransactionID` fields.
Expand Down

0 comments on commit 5f417dc

Please sign in to comment.