From b9783ffac6ea944ab6752303c3fe4e9a0cc163dc Mon Sep 17 00:00:00 2001 From: Annika Hannig Date: Thu, 23 May 2024 20:34:02 +0200 Subject: [PATCH] commit --- airportdisplay/src/display.rs | 2 +- hello_display/src/main.rs | 7 ++++--- send_text/examples/cc.txt | 21 +++++++++++++++++++++ send_text/src/main.rs | 2 +- 4 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 send_text/examples/cc.txt diff --git a/airportdisplay/src/display.rs b/airportdisplay/src/display.rs index 78a29af..f766117 100644 --- a/airportdisplay/src/display.rs +++ b/airportdisplay/src/display.rs @@ -10,7 +10,7 @@ pub struct Display { impl Display { /// Open a new UDP socket and create a display instance - pub fn open(addr: String) -> Result { + pub fn connect(addr: String) -> Result { let socket = UdpSocket::bind("0.0.0.0:0")?; Ok(Self { addr: addr, diff --git a/hello_display/src/main.rs b/hello_display/src/main.rs index 0653c59..634983b 100644 --- a/hello_display/src/main.rs +++ b/hello_display/src/main.rs @@ -1,9 +1,9 @@ -use airportdisplay::{text::Text, Command, Display}; +use airportdisplay::{text::Buffer, Command, Display}; use anyhow::Result; fn main() -> Result<()> { println!("Sending hello display..."); - let display = Display::open("172.23.42.29:2342".into())?; + let display = Display::connect("172.23.42.29:2342".into())?; let text: String = "♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥\n♥ mauuu ♥\n♥ mau mauuuunz! ♥\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥".into(); @@ -11,7 +11,8 @@ fn main() -> Result<()> { println!("{}", text); display.send(Command::Clear)?; - display.send(Command::Text(Text::Buffer(text.into())))?; + display.send(Buffer::from(text).into())?; + Ok(()) } diff --git a/send_text/examples/cc.txt b/send_text/examples/cc.txt new file mode 100644 index 0000000..0b1c7f0 --- /dev/null +++ b/send_text/examples/cc.txt @@ -0,0 +1,21 @@ + ,cCCCCCCCCCCCCCCCCCCCCCc, + CC' `\, C `CC + CC \\ C CC + CC `\, \================\, \ \ \ + CC \===================\\ \ \ \ + CC ,/====================\| |/|/\\ + CC ,// /=================\====///// + CC // C CC .=====/ / / + CC, // B ,CC /-=-/ // + `CCCCCCCCCCCCCCCCCCCCCCC' / .\|/\/ + X \ + / \ \____/ + Willkommen im / | | + Catzen Computer Club Berlin / / | + | / + ----|-` + ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ | + ♥ mau mau mau ♥ | + ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ | + \ + ` diff --git a/send_text/src/main.rs b/send_text/src/main.rs index 3146ea2..782fc2b 100644 --- a/send_text/src/main.rs +++ b/send_text/src/main.rs @@ -14,7 +14,7 @@ fn main() -> Result<()> { } // Send content to display - let display = Display::open("172.23.42.29:2342".into())?; + let display = Display::connect("172.23.42.29:2342".into())?; display.send(Command::Clear)?; display.send(Buffer::from(text).into())?;