35 lines
841 B
C
35 lines
841 B
C
#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_cmd_bitmap_from_bitmap(sp_bitmap_clone(bitmap));
|
|
Packet *packet = sp_cmd_bitmap_try_into_packet(command);
|
|
if (packet == NULL) {
|
|
result = -2;
|
|
goto exit;
|
|
}
|
|
|
|
if (!sp_udp_send_packet(sock, packet)) {
|
|
result = -3;
|
|
goto exit;
|
|
}
|
|
|
|
msleep(SP_FRAME_PACING_MS);
|
|
}
|
|
|
|
exit:
|
|
sp_bitmap_free(bitmap);
|
|
return result;
|
|
}
|