Expand description
C API wrapper for the servicepoint crate.
§Examples
Make sure to check out this GitHub repo as well!
#include <stdio.h>
#include "servicepoint.h"
int main(void) {
UdpConnection *connection = sp_udp_open("172.23.42.29:2342");
if (connection == NULL)
return 1;
Bitmap *pixels = sp_bitmap_new(SP_PIXEL_WIDTH, SP_PIXEL_HEIGHT);
sp_bitmap_fill(pixels, true);
TypedCommand *command = sp_command_bitmap_linear_win(0, 0, pixels, Uncompressed);
while (sp_udp_send_command(connection, sp_command_clone(command)));
sp_command_free(command);
sp_udp_free(connection);
return 0;
}
Structs§
- Byte
Slice - Represents a span of memory (
&mut [u8]
) as a struct. - SPBit
Vec - A vector of bits
- UdpSocket
- This is a type only used by cbindgen to have a type for pointers.
Enums§
- Command
Code - The u16 command codes used for the [Command]s.
Constants§
- SP_
FRAME_ PACING_ MS - Actual hardware limit is around 28-29ms/frame. Rounded up for less dropped packets.
Functions§
- sp_
bitmap_ ⚠clone - Clones a Bitmap.
- sp_
bitmap_ ⚠fill - Sets the state of all pixels in the Bitmap.
- sp_
bitmap_ ⚠free - Deallocates a Bitmap.
- sp_
bitmap_ ⚠from_ bitvec - Tries to convert the BitVec to a Bitmap.
- sp_
bitmap_ ⚠get - Gets the current value at the specified position in the Bitmap.
- sp_
bitmap_ ⚠height - Gets the height in pixels of the Bitmap instance.
- sp_
bitmap_ ⚠into_ bitvec - Consumes the Bitmap and returns the contained BitVec
- sp_
bitmap_ ⚠into_ packet - Creates a BitmapCommand and immediately turns that into a Packet.
- sp_
bitmap_ ⚠load - Loads a Bitmap with the specified dimensions from the provided data.
- sp_
bitmap_ ⚠new - Creates a new Bitmap with the specified dimensions.
- sp_
bitmap_ ⚠new_ max_ sized - Creates a new Bitmap with a size matching the screen.
- sp_
bitmap_ ⚠set - Sets the value of the specified position in the Bitmap.
- sp_
bitmap_ ⚠unsafe_ data_ ref - Gets an unsafe reference to the data of the Bitmap instance.
- sp_
bitmap_ ⚠width - Gets the width in pixels of the Bitmap instance.
- sp_
bitvec_ ⚠clone - Clones a SPBitVec.
- sp_
bitvec_ ⚠fill - Sets the value of all bits in the SPBitVec.
- sp_
bitvec_ ⚠free - Deallocates a SPBitVec.
- sp_
bitvec_ ⚠get - Gets the value of a bit from the SPBitVec.
- sp_
bitvec_ ⚠into_ packet - Creates a BitVecCommand and immediately turns that into a Packet.
- sp_
bitvec_ ⚠is_ empty - Returns true if length is 0.
- sp_
bitvec_ ⚠len - Gets the length of the SPBitVec in bits.
- sp_
bitvec_ ⚠load - Interpret the data as a series of bits and load then into a new SPBitVec instance.
- sp_
bitvec_ ⚠new - Creates a new SPBitVec instance.
- sp_
bitvec_ ⚠set - Sets the value of a bit in the SPBitVec.
- sp_
bitvec_ ⚠unsafe_ data_ ref - Gets an unsafe reference to the data of the SPBitVec instance.
- sp_
brightness_ ⚠grid_ clone - Clones a BrightnessGrid.
- sp_
brightness_ ⚠grid_ fill - Sets the value of all cells in the BrightnessGrid.
- sp_
brightness_ ⚠grid_ free - Deallocates a BrightnessGrid.
- sp_
brightness_ ⚠grid_ get - Gets the current value at the specified position.
- sp_
brightness_ ⚠grid_ height - Gets the height of the BrightnessGrid instance.
- sp_
brightness_ ⚠grid_ into_ packet - Creates a BrightnessGridCommand and immediately turns that into a Packet.
- sp_
brightness_ ⚠grid_ load - Loads a BrightnessGrid with the specified dimensions from the provided data.
- sp_
brightness_ ⚠grid_ new - Creates a new BrightnessGrid with the specified dimensions.
- sp_
brightness_ ⚠grid_ set - Sets the value of the specified position in the BrightnessGrid.
- sp_
brightness_ ⚠grid_ unsafe_ data_ ref - Gets an unsafe reference to the data of the BrightnessGrid instance.
- sp_
brightness_ ⚠grid_ width - Gets the width of the BrightnessGrid instance.
- sp_
char_ ⚠grid_ clone - Clones a CharGrid.
- sp_
char_ ⚠grid_ fill - Sets the value of all cells in the CharGrid.
- sp_
char_ ⚠grid_ free - Deallocates a CharGrid.
- sp_
char_ ⚠grid_ get - Returns the current value at the specified position.
- sp_
char_ ⚠grid_ height - Gets the height of the CharGrid instance.
- sp_
char_ ⚠grid_ into_ packet - Creates a CharGridCommand and immediately turns that into a Packet.
- sp_
char_ ⚠grid_ load - Loads a CharGrid with the specified dimensions from the provided data.
- sp_
char_ ⚠grid_ new - Creates a new CharGrid with the specified dimensions.
- sp_
char_ ⚠grid_ set - Sets the value of the specified position in the CharGrid.
- sp_
char_ ⚠grid_ width - Gets the width of the CharGrid instance.
- sp_
command_ ⚠bitmap - Sets a window of pixels to the specified values.
- sp_
command_ ⚠bitvec - Set pixel data starting at the pixel offset on screen.
- sp_
command_ ⚠brightness_ grid - Set the brightness of individual tiles in a rectangular area of the display.
- sp_
command_ ⚠char_ grid - Show UTF-8 encoded text on the screen.
- sp_
command_ ⚠clear - Set all pixels to the off state.
- sp_
command_ ⚠clone - Clones a TypedCommand instance.
- sp_
command_ ⚠cp437_ grid - Show codepage 437 encoded text on the screen.
- sp_
command_ ⚠fade_ out - A yet-to-be-tested command.
- sp_
command_ ⚠free - Deallocates a TypedCommand.
- sp_
command_ ⚠global_ brightness - Set the brightness of all tiles to the same value.
- sp_
command_ ⚠hard_ reset - Kills the udp daemon on the display, which usually results in a restart.
- sp_
command_ ⚠try_ from_ packet - Tries to turn a Packet into a TypedCommand.
- sp_
cp437_ ⚠grid_ clone - Clones a Cp437Grid.
- sp_
cp437_ ⚠grid_ fill - Sets the value of all cells in the Cp437Grid.
- sp_
cp437_ ⚠grid_ free - Deallocates a Cp437Grid.
- sp_
cp437_ ⚠grid_ get - Gets the current value at the specified position.
- sp_
cp437_ ⚠grid_ height - Gets the height of the Cp437Grid instance.
- sp_
cp437_ ⚠grid_ into_ packet - Creates a Cp437GridCommand and immediately turns that into a Packet.
- sp_
cp437_ ⚠grid_ load - Loads a Cp437Grid with the specified dimensions from the provided data.
- sp_
cp437_ ⚠grid_ new - Creates a new Cp437Grid with the specified dimensions.
- sp_
cp437_ ⚠grid_ set - Sets the value of the specified position in the Cp437Grid.
- sp_
cp437_ ⚠grid_ unsafe_ data_ ref - Gets an unsafe reference to the data of the Cp437Grid instance.
- sp_
cp437_ ⚠grid_ width - Gets the width of the Cp437Grid instance.
- sp_
packet_ ⚠clone - Clones a Packet.
- sp_
packet_ ⚠free - Deallocates a Packet.
- sp_
packet_ ⚠from_ command - Turns a TypedCommand into a Packet. The TypedCommand gets consumed.
- sp_
packet_ ⚠from_ parts - Creates a raw Packet from parts.
- sp_
packet_ ⚠get_ header - Returns a pointer to the header field of the provided packet.
- sp_
packet_ ⚠get_ payload - Returns a pointer to the current payload of the provided packet.
- sp_
packet_ ⚠serialize_ to - Serialize the packet into the provided buffer.
- sp_
packet_ ⚠set_ payload - Sets the payload of the provided packet to the provided data.
- sp_
packet_ ⚠try_ load - Tries to load a Packet from the passed array with the specified length.
- sp_
u16_ ⚠to_ command_ code - Converts u16 into CommandCode.
- sp_
udp_ ⚠free - Closes and deallocates a [UdpConnection].
- sp_
udp_ ⚠open - Creates a new instance of [UdpConnection].
- sp_
udp_ ⚠open_ ipv4 - Creates a new instance of [UdpConnection].
- sp_
udp_ ⚠send_ command - Sends a TypedCommand to the display using the [UdpConnection].
- sp_
udp_ ⚠send_ header - Sends a Header to the display using the [UdpConnection].
- sp_
udp_ ⚠send_ packet - Sends a Packet to the display using the [UdpConnection].