Crates.io | servicepoint_binding_c |
lib.rs | servicepoint_binding_c |
version | 0.7.0 |
source | src |
created_at | 2024-05-28 20:01:53.274546 |
updated_at | 2024-06-27 17:47:21.222309 |
description | C bindings for the servicepoint crate. |
homepage | https://docs.rs/crate/servicepoint_binding_c |
repository | https://github.com/cccb/servicepoint |
max_upload_size | |
id | 1254763 |
size | 43,230 |
In CCCB, there is a big pixel matrix hanging on the wall. It is called "Service Point Display" or "Airport Display".
This crate contains C bindings for the servicepoint
library, enabling users to parse, encode and send packets to this display via UDP.
#include <stdio.h>
#include "servicepoint.h"
int main(void) {
sp_Connection *connection = sp_connection_open("localhost:2342");
if (connection == NULL)
return 1;
sp_PixelGrid *pixels = sp_pixel_grid_new(sp_PIXEL_WIDTH, sp_PIXEL_HEIGHT);
sp_pixel_grid_fill(pixels, true);
sp_Command *command = sp_command_bitmap_linear_win(0, 0, pixels, Uncompressed);
sp_Packet *packet = sp_packet_from_command(command);
if (!sp_connection_send(connection, packet))
return 1;
sp_connection_dealloc(connection);
return 0;
}
A full example including Makefile is available as part of this crate.
This library is still in early development. You can absolutely use it, and it works, but expect minor breaking changes with every version bump. Please specify the full version including patch in your Cargo.toml until 1.0 is released.
Copy the header to your project and compile against.
You have the choice of linking statically (recommended) or dynamically.
staticlib
variant.cdylib
at runtime in the same version, as there are no API/ABI guarantees yet.sp_
<struct_name> <rust name>.Look at the main project README for further information.