a bunch of minor changes combined:

- From instead of Into
- unsafe_data_ref for other payloads
- CByteSlice for returning memory spans
- send Packet instead of Into<Packet>
- expose packet layer to C/C#
This commit is contained in:
Vinzenz Schroeter 2024-05-15 20:34:51 +02:00
parent 5803b71f3a
commit 1dad113ca1
33 changed files with 462 additions and 733 deletions

View file

@ -3,11 +3,11 @@ OUT_DIR := ${ROOT_DIR}/out
SP2_DIR := ${ROOT_DIR}/../../servicepoint2
SP2_INCLUDE := ${ROOT_DIR}/../../servicepoint2-binding-c
SP2_TARGET_RELEASE := ${ROOT_DIR}/../../target/release
SP2_TARGET_RELEASE := ${SP2_DIR}/target/release
.PHONY: build run clean
build: ${OUT_DIR}/lang_c
all: ${OUT_DIR}/lang_c
run: ${OUT_DIR}/lang_c
out/lang_c

View file

@ -8,11 +8,11 @@ int main(void) {
sp2_PixelGrid *pixels = sp2_pixel_grid_new(sp2_PIXEL_WIDTH, sp2_PIXEL_HEIGHT);
sp2_pixel_grid_fill(pixels, true);
sp2_Command *command = sp2_command_bitmap_linear_win(0, 0, pixels);
if (command == NULL)
return 4;
if (!sp2_connection_send(connection, command))
return 5;
sp2_Packet *packet = sp2_packet_from_command(command);
if (!sp2_connection_send(connection, packet))
return 1;
sp2_connection_dealloc(connection);
return 0;