servicepoint_binding_c 0.15.0

C bindings for the servicepoint crate.
Documentation
#include "servicepoint.h"
#include "helpers.h"

int main(void) {
    sock_init();

    int result = 0;
    Bitmap *bitmap = sp_bitmap_new_max_sized();
    for (size_t x = 0; x < sp_bitmap_width(bitmap); x++) {
        sp_bitmap_fill(bitmap, false);

        for (size_t y = 0; y < sp_bitmap_height(bitmap); y++) {
            sp_bitmap_set(bitmap, (y + x) % PIXEL_WIDTH, y, true);
        }

        BitmapCommand *command = sp_bitmap_command_from_bitmap(sp_bitmap_clone(bitmap));
        Packet *packet = sp_bitmap_command_try_into_packet(command);
        if (packet == NULL) {
            result = -2;
            goto exit;
        }

        if (!sp_udp_socket_send_packet(sock, packet)) {
            result = -3;
            goto exit;
        }

        msleep(SP_FRAME_PACING_MS);
    }

    exit:
    sp_bitmap_free(bitmap);
    return result;
}