1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
//! Tools for testing and debugging Luminator sign communications.
//!
//! For the basic task of sign communication, you likely want to use the high-level API
//! in the [`flipdot`] crate instead.
//!
//! This crate isn't directly related to controlling a real sign, but provides some helpful diagnostic tools.
//! [`VirtualSignBus`] is a general-purpose mock implementation of one or more signs attached to the bus,
//! and [`Odk`] allows connecting a real ODK over serial to a [`SignBus`](flipdot_core::SignBus).
//!
//! Intended only for hobbyist and educational purposes. Not affiliated with Luminator in any way.
//!
//! # Examples
//!
//! ```no_run
//! use flipdot_core::PageFlipStyle;
//! use flipdot_serial::SerialSignBus;
//! use flipdot_testing::{Address, Odk, VirtualSign, VirtualSignBus};
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! #
//! // Populate bus with signs from addresses 2 to 126
//! // (which seems to be the possible range for actual signs).
//! let signs = (2..127).map(Address).map(|addr| VirtualSign::new(addr, PageFlipStyle::Manual));
//! let bus = VirtualSignBus::new(signs);
//!
//! // Hook up ODK to virtual bus.
//! let port = serial::open("COM3")?;
//! let mut odk = Odk::try_new(port, bus)?;
//! loop {
//! // ODK communications are forwarded to/from the virtual bus.
//! odk.process_message()?;
//! }
//! #
//! # Ok(()) }
//! ```
//!
//! [`flipdot`]: https://docs.rs/flipdot
#![doc(html_root_url = "https://docs.rs/flipdot-testing/0.7.1")]
#![deny(
missing_copy_implementations,
missing_debug_implementations,
trivial_casts,
trivial_numeric_casts,
unsafe_code
)]
#![warn(
missing_docs,
unused_extern_crates,
unused_import_braces,
unused_qualifications,
unused_results
)]
mod odk;
mod virtual_sign_bus;
pub use self::odk::{Odk, OdkError};
pub use self::virtual_sign_bus::{VirtualSign, VirtualSignBus};
pub use flipdot_core::Address;