#include "servicepoint.h"
#include "helpers.h"
int main() {
sock_init();
Bitmap *enabled_pixels = sp_bitmap_new_max_sized();
sp_bitmap_fill(enabled_pixels, true);
int result = 0;
for (int x = 0; x < PIXEL_WIDTH; x++) {
for (int y = 0; y < PIXEL_HEIGHT; y++) {
sp_bitmap_set(enabled_pixels, x, y, false);
}
DisplayBitVec *bitvec = sp_bitmap_into_bitvec(sp_bitmap_clone(enabled_pixels));
BitVecCommand *command = sp_bit_vec_command_new(bitvec, 0, BINARY_OPERATION_AND, COMPRESSION_CODE_LZMA);
Packet *packet = sp_bit_vec_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(enabled_pixels);
return result;
}