commit
This commit is contained in:
		
							parent
							
								
									9406eb3faa
								
							
						
					
					
						commit
						b9783ffac6
					
				
					 4 changed files with 27 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -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<Self> {
 | 
			
		||||
    pub fn connect(addr: String) -> Result<Self> {
 | 
			
		||||
        let socket = UdpSocket::bind("0.0.0.0:0")?;
 | 
			
		||||
        Ok(Self {
 | 
			
		||||
            addr: addr,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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(())
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										21
									
								
								send_text/examples/cc.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								send_text/examples/cc.txt
									
										
									
									
									
										Normal 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 ♥                        |
 | 
			
		||||
  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥                        |
 | 
			
		||||
                                             \
 | 
			
		||||
                                              `
 | 
			
		||||
| 
						 | 
				
			
			@ -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())?;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue