Crate servicepoint

Source
Expand description

Abstractions for the UDP protocol of the CCCB servicepoint display.

Your starting point is a Connection to the display. With a connection, you can send Commands. When received, the display will update the state of its pixels.

§Examples

§Clear display

use servicepoint::{Connection, Command};

// establish a connection
let connection = Connection::open("127.0.0.1:2342")
    .expect("connection failed");

 // turn off all pixels on display
 connection.send(Command::Clear)
    .expect("send failed");

§Set all pixels to on

 // turn on all pixels in a grid
 let mut pixels = Bitmap::max_sized();
 pixels.fill(true);

 // create command to send pixels
 let command = Command::BitmapLinearWin(
    servicepoint::Origin::ZERO,
    pixels,
    CompressionCode::default()
 );

 // send command to display
 connection.send(command).expect("send failed");

§Send text

// create a text grid
let mut grid = CharGrid::from("Hello\nCCCB?");
// modify the grid
grid.set(grid.width() - 1, 1, '!');
// create the command to send the data
let command = Command::Utf8Data(servicepoint::Origin::ZERO, grid);
// send command to display
connection.send(command).expect("send failed");

Modules§

bitvec
Re-export of the used library bitvec.

Structs§

Bitmap
A fixed-size 2D grid of booleans.
Brightness
A display brightness value, checked for correct value range
Cp437Converter
Contains functions to convert between UTF-8 and Codepage 437.
Header
A raw header.
IterGridRows
An iterator iver the rows in a ValueGrid
Origin
An origin marks the top left position of a window sent to the display.
Packet
The raw packet.
Pixels
Marks something to be measured in number of pixels.
Tiles
Marks something to be measured in number of iles.
ValueGrid
A 2D grid of values.

Enums§

Command
A low-level display command.
CompressionCode
Specifies the kind of compression to use. Availability depends on features.
Connection
A connection to the display.
SetValueSeriesError
Error type for methods that change a whole column or row at once
TryLoadValueGridError
Errors that can occur when loading a grid

Constants§

FRAME_PACING
Actual hardware limit is around 28-29ms/frame. Rounded up for less dropped packets.
PIXEL_COUNT
pixel count on whole screen
PIXEL_HEIGHT
Display height in pixels
PIXEL_WIDTH
Display width in pixels
TILE_HEIGHT
Display tile count in the y-direction
TILE_SIZE
size of a single tile in one dimension
TILE_WIDTH
Display tile count in the x-direction

Traits§

DataRef
A trait for getting the underlying raw byte slices of data containers.
Grid
A two-dimensional grid of T
Value
A type that can be stored in a ValueGrid, e.g. char, u8.

Type Aliases§

BitVec
A byte-packed vector of booleans.
BrightnessGrid
A grid containing brightness values.
ByteGrid
A 2d grid of bytes - see ValueGrid.
CharGrid
A grid containing UTF-8 characters.
Cp437Grid
A grid containing codepage 437 characters.
Offset
Type alias for documenting the meaning of the u16 in enum values
Payload
The raw payload.