This commit is contained in:
Annika Hannig 2024-05-23 20:34:02 +02:00
parent 9406eb3faa
commit b9783ffac6
No known key found for this signature in database
GPG key ID: 62E226E47DDCE58D
4 changed files with 27 additions and 5 deletions

View file

@ -10,7 +10,7 @@ pub struct Display {
impl Display { impl Display {
/// Open a new UDP socket and create a display instance /// Open a new UDP socket and create a display instance
pub fn open(addr: String) -> Result<Self> { pub fn connect(addr: String) -> Result<Self> {
let socket = UdpSocket::bind("0.0.0.0:0")?; let socket = UdpSocket::bind("0.0.0.0:0")?;
Ok(Self { Ok(Self {
addr: addr, addr: addr,

View file

@ -1,9 +1,9 @@
use airportdisplay::{text::Text, Command, Display}; use airportdisplay::{text::Buffer, Command, Display};
use anyhow::Result; use anyhow::Result;
fn main() -> Result<()> { fn main() -> Result<()> {
println!("Sending hello display..."); 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 = let text: String =
"♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥\n♥ mauuu ♥\n♥ mau mauuuunz! ♥\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥".into(); "♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥\n♥ mauuu ♥\n♥ mau mauuuunz! ♥\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥".into();
@ -11,7 +11,8 @@ fn main() -> Result<()> {
println!("{}", text); println!("{}", text);
display.send(Command::Clear)?; display.send(Command::Clear)?;
display.send(Command::Text(Text::Buffer(text.into())))?; display.send(Buffer::from(text).into())?;
Ok(()) Ok(())
} }

21
send_text/examples/cc.txt Normal file
View file

@ -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 ♥ |
♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ |
\
`

View file

@ -14,7 +14,7 @@ fn main() -> Result<()> {
} }
// Send content to display // 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(Command::Clear)?;
display.send(Buffer::from(text).into())?; display.send(Buffer::from(text).into())?;