Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
libindigo-rs
Rust API for writing client applications and device drivers for astronomy equipment using the INDIGO protocol and architecture.
π Refactoring Complete
The project has been successfully refactored into a multi-crate workspace! See REFACTORING_COMPLETE.md for full details.
Architecture
This project is organized as a Cargo workspace with multiple crates:
| Crate | Purpose | FFI Dependencies |
|---|---|---|
libindigo |
Core API, traits, and types | None |
libindigo-rs |
Pure Rust implementation | None |
libindigo-ffi |
FFI-based implementation | Yes (via libindigo-sys) |
libindigo-sys |
Raw C bindings | Yes |
βββββββββββββββββββ
β libindigo β β Core API (traits, types, constants)
β (root crate) β
ββββββββββ¬βββββββββ
β
ββββββ΄βββββ
β β
βΌ βΌ
βββββββββββ ββββββββββββββββ
βlibindigoβ β libindigo-ffiβ
β -rs β β β
βββββββββββ ββββββββ¬ββββββββ
β
βΌ
ββββββββββββββββ
β libindigo-sysβ
ββββββββββββββββ
Goal
- A pure Rust API that is 100% compatible with the INDIGO platform and its default C-implementation
Objectives
- β Provide an API that uses idiomatic Rust for integrating with the INDIGO Bus
- β Provide a Service Provider Interface (SPI) for decoupling the API from its implementation
- β Provide a default RS (Rust) implementation of the SPI without any FFI bindings to the INDIGO C-libraries or other non-rust dependencies
- β Provide an FFI implementation of the SPI that uses the INDIGO C-library with any necessary dependencies
Quick Start
β οΈ Important: Crate Name vs Import Name
The crate libindigo-rs must be imported as libindigo_rs (with underscore) in your code.
Rust automatically converts hyphens to underscores in crate names. Always use:
use ; // β
CORRECT (underscore)
// NOT: use libindigo::{...}; // β WRONG
Pure Rust Client (Recommended - No C Dependencies)
Add to your Cargo.toml:
[]
= "0.3"
= { = "1.35", = ["full"] }
Example code:
use ;
async
FFI-Based Client (Maximum Compatibility)
Add to your Cargo.toml:
[]
= "0.3"
= { = "1.35", = ["full"] }
Example code:
use ;
async
Features
Pure Rust Strategy (libindigo-rs)
The pure Rust strategy provides a complete INDIGO client implementation without C FFI dependencies:
- β Zero FFI: No C dependencies, pure Rust implementation
- β Async-First: Built on tokio for efficient async I/O
- β Type Safe: Leverages Rust's type system for protocol correctness
- β Cross-Platform: Works anywhere Rust compiles
- β Dual Protocol: Full INDIGO JSON and XML protocol support with automatic negotiation
- β JSON-First: Defaults to modern JSON protocol with XML fallback
- β mDNS Discovery: Optional pure Rust server discovery (no FFI)
Feature Flags:
client(default): Client functionalitydevice: Device driver support (stub for future)discovery: mDNS server discovery via pure Rustmdns-sdcrate
FFI Strategy (libindigo-ffi)
The FFI strategy wraps the official C INDIGO library:
- β οΈ Status: Structure in place, implementation pending
- β Maximum Compatibility: Uses the official INDIGO C library
- β Async Support: Async wrappers around synchronous FFI calls
- β Battle-Tested: Leverages mature C implementation
- β Feature Complete: Access to all INDIGO features (when implemented)
Feature Flags:
client(default): Client functionalitydevice: Device driver support (stub for future)async: Async wrapper for non-blocking operations
JSON Protocol Support β
libindigo-rs supports both INDIGO JSON and XML protocols with intelligent negotiation:
Automatic Protocol Negotiation (Default)
The client automatically negotiates the best protocol with the server:
use ;
async
Protocol Comparison
| Feature | JSON Protocol | XML Protocol |
|---|---|---|
| Version | 512 (numeric) | "2.0" (string) |
| Switch Values | true/false |
On/Off |
| Number Format | Native JSON numbers | String with format |
| BLOBs | URL only | URL or BASE64 |
| Parsing Speed | β‘ Faster | Slightly slower |
| Size | π¦ More compact | More verbose |
| Use Case | Modern clients, web apps | Legacy compatibility |
| Server Support | INDIGO 2.0+ | All INDIGO versions |
Protocol Selection Examples
See rs/src/lib.rs documentation for advanced protocol negotiation options.
Server Discovery
The pure Rust implementation includes optional mDNS server discovery:
[]
= { = "0.3", = ["discovery"] }
use ;
async
See rs/PHASE5_DISCOVERY_MIGRATION.md for migration details.
Strategy Comparison
| Feature | libindigo-rs | libindigo-ffi |
|---|---|---|
| C Dependencies | β None | β Required |
| Async Support | β Native | β Wrapped |
| Cross-Platform | β Excellent | β οΈ Limited |
| Performance | β Fast | β Fast |
| JSON Protocol | β Yes | β οΈ Via C lib |
| XML Protocol | β Yes | β Yes |
| Protocol Negotiation | β Automatic | β No |
| mDNS Discovery | β Pure Rust | β No |
| Maturity | β Production | β οΈ Stub |
| Use Case | Modern apps | Legacy compat |
Usage Examples
Receiving Property Updates
use ;
async
Sending Property Updates
use ;
use ;
async
Documentation
Crate Documentation
- This README: Overview and quick start
libindigo- Core API documentation in sourcelibindigo-rs- Pure Rust implementation (seers/src/lib.rs)libindigo-ffi- FFI implementation (seeffi/README.md)libindigo-sys- Raw bindings (seesys/README.md)
Architecture & Planning
REFACTORING_COMPLETE.md- Complete refactoring summarydoc/reviews/issue-6-refactoring-review.md- Detailed reviewdoc/architecture/client-strategies.md- Strategy patternplans/code-review-and-architecture.md- Architecture plan
Phase Documentation
plans/archive/phase1-complete.md- Foundation & Core Typesplans/archive/phase2-complete.md- Async FFI Strategyplans/archive/phase3-complete.md- Rust Client Strategyplans/archive/phase3-json-complete.md- JSON Protocolrs/PHASE5_DISCOVERY_MIGRATION.md- Discovery MigrationPHASE6_CONSTANTS_EXTRACTION.md- Constants Extractionsys/REFACTORING_PHASE4.md- FFI Refactoring
Additional Documentation
doc/constants-extraction.md- Constants generationBUILD.md- Build instructionsCHANGES.md- Changelog
Testing
Run All Tests
Run Pure Rust Tests
# All pure Rust tests (including JSON protocol tests)
# JSON protocol tests only (61 tests)
# Protocol negotiation tests only (59 tests)
Run Discovery Tests
Integration Tests
Integration tests require a running INDIGO server:
# Start INDIGO server (in another terminal)
# Run integration tests
Test Coverage Summary
| Test Suite | Tests | Coverage |
|---|---|---|
| JSON Protocol | 61 | All PROTOCOLS.md examples + edge cases |
| Protocol Negotiation | 59 | Auto-detection, fallback, preferences |
| Rust Client | ~50 | Connection, properties, lifecycle |
| Discovery | ~20 | mDNS discovery, filtering |
| Total | ~190 | Comprehensive coverage |
Examples
The examples/ directory contains usage examples:
discover_servers.rs- Server discoverydiscovery_with_filter.rs- Filtered discoveryauto_connect.rs- Auto-connect to discovered servers (β οΈ needs update)continuous_discovery.rs- Continuous discovery (β οΈ needs update)
Run examples:
# Server discovery
# Discovery with filter
Note: Some examples use deprecated features and need updating. See REFACTORING_COMPLETE.md for details.
Project Structure
libindigo-rs/
βββ Cargo.toml # Workspace root
βββ README.md # This file
βββ REFACTORING_COMPLETE.md # Refactoring summary
βββ src/ # libindigo (core API)
β βββ lib.rs # Main library entry point
β βββ error.rs # Error types
β βββ constants.rs # INDIGO protocol constants
β βββ client/ # Client API
β β βββ mod.rs
β β βββ builder.rs # Client builder
β β βββ strategy.rs # ClientStrategy trait (SPI)
β βββ types/ # Core types
β βββ mod.rs
β βββ property.rs # Property types
β βββ device.rs # Device types
β βββ value.rs # Value types
βββ rs/ # libindigo-rs (pure Rust)
β βββ Cargo.toml
β βββ src/
β β βββ lib.rs # Re-exports + RS strategy
β β βββ client.rs # RsClientStrategy
β β βββ protocol.rs # XML protocol parser
β β βββ protocol_json.rs # JSON protocol parser
β β βββ protocol_negotiation.rs
β β βββ transport.rs # TCP transport layer
β β βββ discovery/ # mDNS discovery (optional)
β β βββ mod.rs
β β βββ api.rs
β β βββ error.rs
β β βββ mdns_impl.rs
βββ ffi/ # libindigo-ffi (FFI-based)
β βββ Cargo.toml
β βββ README.md
β βββ src/
β βββ lib.rs # Re-exports + FFI strategy
β βββ ffi.rs # FfiClientStrategy
β βββ async_ffi.rs # AsyncFfiStrategy
βββ sys/ # libindigo-sys (raw bindings)
β βββ Cargo.toml
β βββ README.md
β βββ build.rs # C library build
β βββ src/lib.rs # bindgen output
βββ relm/ # libindigo-relm (GTK demo, excluded)
βββ examples/ # Usage examples
βββ tests/ # Integration tests
βββ doc/ # Documentation
βββ plans/ # Planning documents
βββ scripts/ # Utility scripts
βββ update_constants.sh # Update INDIGO constants
Migration from Old API
If you're upgrading from the old monolithic API, see the migration guide in REFACTORING_COMPLETE.md.
Quick summary:
# Cargo.toml
- libindigo = { version = "0.1", features = ["rs"] }
+ libindigo-rs = "0.3"
# Code
- use libindigo::strategies::RsClientStrategy;
- use libindigo::client::ClientBuilder;
+ use libindigo_rs::{RsClientStrategy, ClientBuilder};
Troubleshooting: "unresolved module libindigo" Error
If you see this error after adding libindigo-rs to your dependencies:
error[E0432]: unresolved import `libindigo`
Solution: The crate name uses a hyphen (libindigo-rs) but imports must use an underscore (libindigo_rs).
// β WRONG - causes "unresolved module" error
use ;
// β
CORRECT - use underscore in imports
use ;
This is a Rust convention: hyphens in crate names are automatically converted to underscores for imports.
Contributing
Contributions are welcome! Please:
- Read
doc/ways-of-working.md - Follow
doc/roo-workflow-scheme.md - Use appropriate issue templates
- Write tests for new features
- Update documentation
Known Issues & Future Work
See REFACTORING_COMPLETE.md for:
- FFI implementation status
- BLOB handling improvements
- Device driver support (future)
- Example updates needed
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Acknowledgments
- INDIGO Astronomy - The INDIGO protocol and C library
- The Rust community for excellent async ecosystem tools
Related Projects
- INDIGO - Official C implementation
libindigo-sys- Low-level FFI bindings to INDIGO C library
Status
Current Version: 0.3.0
Status: Production-ready for pure Rust client applications
- β libindigo-rs: Complete and production-ready
- β οΈ libindigo-ffi: Structure in place, implementation pending
- β
Multi-crate refactoring: Complete (see
REFACTORING_COMPLETE.md)
For production use, we recommend:
- Pure Rust Strategy (
libindigo-rs) for new projects without C dependencies - FFI Strategy (
libindigo-ffi) for maximum compatibility (when implementation is complete)
Support
For questions, issues, or contributions:
- Open an issue on GitHub
- Check existing documentation
- Review the architecture plan