Compare commits

...
Author SHA1 Message Date
Vinzenz Schroeter
8c40d959e8 object name to snake case
Some checks failed
Rust / build-gnu-apt (pull_request) Failing after 1m44s
Rust / build-size-gnu-unstable (pull_request) Failing after 41s
2025-06-28 18:38:20 +02:00
2 changed files with 583 additions and 565 deletions

View file

@ -447,6 +447,11 @@ typedef struct ValueGrid_char ValueGrid_char;
*/
typedef struct ValueGrid_u8 ValueGrid_u8;
/**
* Type alias for documenting the meaning of the u16 in enum values
*/
typedef size_t Offset;
/**
* Represents a span of memory (`&mut [u8]` ) as a struct.
*
@ -476,11 +481,6 @@ typedef struct ByteSlice {
size_t length;
} ByteSlice;
/**
* Type alias for documenting the meaning of the u16 in enum values
*/
typedef size_t Offset;
/**
* A grid containing brightness values.
*
@ -636,7 +636,119 @@ extern "C" {
#endif // __cplusplus
/**
* Calls method [`servicepoint::Bitmap::clone`].
* Calls method [`BitVecCommand::clone`].
*
*Clones a [`BitVecCommand`] instance.
*
* This function is part of the `bit_vec_command` module.
*/
struct BitVecCommand */*notnull*/ sp_bit_vec_command_clone(struct BitVecCommand */*notnull*/ instance);
/**
*Deallocates a [`BitVecCommand`] instance.
*
* This function is part of the `bit_vec_command` module.
*/
void sp_bit_vec_command_free(struct BitVecCommand */*notnull*/ instance);
/**
* Gets a reference to the field `bitvec` of the [`servicepoint::BitVecCommand`].
*
* - The returned reference inherits the lifetime of object in which it is contained.
* - The returned pointer may not be used in a function that consumes the instance, e.g. to create a command.
*
* This function is part of the `bit_vec_command` module.
*/
DisplayBitVec */*notnull*/ sp_bit_vec_command_get_bitvec_mut(struct BitVecCommand */*notnull*/ instance);
/**
* Gets the value of field `compression` of the [`servicepoint::BitVecCommand`].
*
* This function is part of the `bit_vec_command` module.
*/
CompressionCode sp_bit_vec_command_get_compression(struct BitVecCommand */*notnull*/ instance);
/**
* Gets the value of field `offset` of the [`servicepoint::BitVecCommand`].
*
* This function is part of the `bit_vec_command` module.
*/
Offset sp_bit_vec_command_get_offset(struct BitVecCommand */*notnull*/ instance);
/**
* Gets the value of field `operation` of the [`servicepoint::BitVecCommand`].
*
* This function is part of the `bit_vec_command` module.
*/
BinaryOperation sp_bit_vec_command_get_operation(struct BitVecCommand */*notnull*/ instance);
/**
* Set pixel data starting at the pixel offset on screen.
*
* The screen will continuously overwrite more pixel data without regarding the offset, meaning
* once the starting row is full, overwriting will continue on column 0.
*
* The [`BinaryOperation`] will be applied on the display comparing old and sent bit.
*
* `new_bit = old_bit op sent_bit`
*
* For example, [`BinaryOperation::Or`] can be used to turn on some pixels without affecting other pixels.
*
* The contained [`DisplayBitVec`] is always uncompressed.
*
* This function is part of the `bit_vec_command` module.
*/
struct BitVecCommand */*notnull*/ sp_bit_vec_command_new(DisplayBitVec */*notnull*/ bitvec,
size_t offset,
BinaryOperation operation,
CompressionCode compression);
/**
* Sets the value of field `bitvec` of the [`servicepoint::BitVecCommand`].
* The provided value is moved into the instance, potentially invalidating previously taken references.
*
* This function is part of the `bit_vec_command` module.
*/
void sp_bit_vec_command_set_bitvec(struct BitVecCommand */*notnull*/ instance,
DisplayBitVec */*notnull*/ value);
/**
* Sets the value of field `compression` of the [`servicepoint::BitVecCommand`].
*
* This function is part of the `bit_vec_command` module.
*/
void sp_bit_vec_command_set_compression(struct BitVecCommand */*notnull*/ instance,
CompressionCode value);
/**
* Sets the value of field `offset` of the [`servicepoint::BitVecCommand`].
*
* This function is part of the `bit_vec_command` module.
*/
void sp_bit_vec_command_set_offset(struct BitVecCommand */*notnull*/ instance,
Offset value);
/**
* Sets the value of field `operation` of the [`servicepoint::BitVecCommand`].
*
* This function is part of the `bit_vec_command` module.
*/
void sp_bit_vec_command_set_operation(struct BitVecCommand */*notnull*/ instance,
BinaryOperation value);
/**
*Tries to turn a [`BitVecCommand`] into a [Packet].
*
* Returns: NULL or a [Packet] containing the command.
*
* [Packet]: [`servicepoint::Packet`]
*
* This function is part of the `bit_vec_command` module.
*/
struct Packet *sp_bit_vec_command_try_into_packet(struct BitVecCommand */*notnull*/ instance);
/**
* Calls method [`Bitmap::clone`].
*
*Clones a [`Bitmap`] instance.
*
@ -645,7 +757,110 @@ extern "C" {
struct Bitmap */*notnull*/ sp_bitmap_clone(struct Bitmap */*notnull*/ instance);
/**
* Calls method [`servicepoint::Bitmap::data_ref_mut`].
* Calls method [`BitmapCommand::clone`].
*
*Clones a [`BitmapCommand`] instance.
*
* This function is part of the `bitmap_command` module.
*/
struct BitmapCommand */*notnull*/ sp_bitmap_command_clone(struct BitmapCommand */*notnull*/ instance);
/**
*Deallocates a [`BitmapCommand`] instance.
*
* This function is part of the `bitmap_command` module.
*/
void sp_bitmap_command_free(struct BitmapCommand */*notnull*/ instance);
/**
* Move the provided [Bitmap] into a new [BitmapCommand],
* leaving other fields as their default values.
*
* Rust equivalent: `BitmapCommand::from(bitmap)`
*
* This function is part of the `bitmap_command` module.
*/
struct BitmapCommand */*notnull*/ sp_bitmap_command_from_bitmap(struct Bitmap */*notnull*/ bitmap);
/**
* Gets a reference to the field `bitmap` of the [`servicepoint::BitmapCommand`].
*
* - The returned reference inherits the lifetime of object in which it is contained.
* - The returned pointer may not be used in a function that consumes the instance, e.g. to create a command.
*
* This function is part of the `bitmap_command` module.
*/
struct Bitmap */*notnull*/ sp_bitmap_command_get_bitmap_mut(struct BitmapCommand */*notnull*/ instance);
/**
* Gets the value of field `compression` of the [`servicepoint::BitmapCommand`].
*
* This function is part of the `bitmap_command` module.
*/
CompressionCode sp_bitmap_command_get_compression(struct BitmapCommand */*notnull*/ instance);
/**
* Reads the origin field of the [`BitmapCommand`].
*
* This function is part of the `bitmap_command` module.
*/
void sp_bitmap_command_get_origin(struct BitmapCommand */*notnull*/ command,
size_t */*notnull*/ origin_x,
size_t */*notnull*/ origin_y);
/**
* Sets a window of pixels to the specified values.
*
* The passed [Bitmap] gets consumed.
*
* Returns: a new [BitmapCommand] instance.
*
* This function is part of the `bitmap_command` module.
*/
struct BitmapCommand */*notnull*/ sp_bitmap_command_new(struct Bitmap */*notnull*/ bitmap,
size_t origin_x,
size_t origin_y,
CompressionCode compression);
/**
* Sets the value of field `bitmap` of the [`servicepoint::BitmapCommand`].
* The provided value is moved into the instance, potentially invalidating previously taken references.
*
* This function is part of the `bitmap_command` module.
*/
void sp_bitmap_command_set_bitmap(struct BitmapCommand */*notnull*/ instance,
struct Bitmap */*notnull*/ value);
/**
* Sets the value of field `compression` of the [`servicepoint::BitmapCommand`].
*
* This function is part of the `bitmap_command` module.
*/
void sp_bitmap_command_set_compression(struct BitmapCommand */*notnull*/ instance,
CompressionCode value);
/**
* Overwrites the origin field of the [`BitmapCommand`].
*
* This function is part of the `bitmap_command` module.
*/
void sp_bitmap_command_set_origin(struct BitmapCommand */*notnull*/ command,
size_t origin_x,
size_t origin_y);
/**
*Tries to turn a [`BitmapCommand`] into a [Packet].
*
* Returns: NULL or a [Packet] containing the command.
*
* [Packet]: [`servicepoint::Packet`]
*
* This function is part of the `bitmap_command` module.
*/
struct Packet *sp_bitmap_command_try_into_packet(struct BitmapCommand */*notnull*/ instance);
/**
* Calls method [`Bitmap::data_ref_mut`].
*
* Gets an unsafe reference to the data of the [Bitmap] instance.
*
@ -656,7 +871,7 @@ struct Bitmap */*notnull*/ sp_bitmap_clone(struct Bitmap */*notnull*/ instance);
struct ByteSlice sp_bitmap_data_ref_mut(struct Bitmap */*notnull*/ instance);
/**
* Calls method [`servicepoint::Bitmap::fill`].
* Calls method [`Bitmap::fill`].
*
* Sets the state of all cells in the grid.
*
@ -688,7 +903,7 @@ struct Bitmap *sp_bitmap_from_bitvec(size_t width,
DisplayBitVec */*notnull*/ bitvec);
/**
* Calls method [`servicepoint::Bitmap::get`].
* Calls method [`Bitmap::get`].
*
* Gets the current value at the specified position.
*
@ -705,7 +920,7 @@ struct Bitmap *sp_bitmap_from_bitvec(size_t width,
bool sp_bitmap_get(struct Bitmap */*notnull*/ instance, size_t x, size_t y);
/**
* Calls method [`servicepoint::Bitmap::height`].
* Calls method [`Bitmap::height`].
*
* Gets the height.
*
@ -775,7 +990,7 @@ struct Bitmap *sp_bitmap_new(size_t width, size_t height);
struct Bitmap */*notnull*/ sp_bitmap_new_max_sized(void);
/**
* Calls method [`servicepoint::Bitmap::set`].
* Calls method [`Bitmap::set`].
*
* Sets the value of the specified position.
*
@ -810,7 +1025,7 @@ struct Packet *sp_bitmap_try_into_packet(struct Bitmap */*notnull*/ bitmap,
CompressionCode compression);
/**
* Calls method [`servicepoint::Bitmap::width`].
* Calls method [`Bitmap::width`].
*
* Gets the width.
*
@ -819,236 +1034,110 @@ struct Packet *sp_bitmap_try_into_packet(struct Bitmap */*notnull*/ bitmap,
size_t sp_bitmap_width(struct Bitmap */*notnull*/ instance);
/**
* Calls method [`servicepoint::BitmapCommand::clone`].
*
*Clones a [`BitmapCommand`] instance.
*
* This function is part of the `bitmapcommand` module.
*/
struct BitmapCommand */*notnull*/ sp_bitmapcommand_clone(struct BitmapCommand */*notnull*/ instance);
/**
*Deallocates a [`BitmapCommand`] instance.
*
* This function is part of the `bitmapcommand` module.
*/
void sp_bitmapcommand_free(struct BitmapCommand */*notnull*/ instance);
/**
* Move the provided [Bitmap] into a new [BitmapCommand],
* leaving other fields as their default values.
*
* Rust equivalent: `BitmapCommand::from(bitmap)`
*
* This function is part of the `bitmapcommand` module.
*/
struct BitmapCommand */*notnull*/ sp_bitmapcommand_from_bitmap(struct Bitmap */*notnull*/ bitmap);
/**
* Gets a reference to the field `bitmap` of the [`servicepoint::BitmapCommand`].
*
* - The returned reference inherits the lifetime of object in which it is contained.
* - The returned pointer may not be used in a function that consumes the instance, e.g. to create a command.
*
* This function is part of the `bitmapcommand` module.
*/
struct Bitmap */*notnull*/ sp_bitmapcommand_get_bitmap_mut(struct BitmapCommand */*notnull*/ instance);
/**
* Gets the value of field `compression` of the [`servicepoint::BitmapCommand`].
*
* This function is part of the `bitmapcommand` module.
*/
CompressionCode sp_bitmapcommand_get_compression(struct BitmapCommand */*notnull*/ instance);
/**
* Reads the origin field of the [`BitmapCommand`].
*
* This function is part of the `bitmapcommand` module.
*/
void sp_bitmapcommand_get_origin(struct BitmapCommand */*notnull*/ command,
size_t */*notnull*/ origin_x,
size_t */*notnull*/ origin_y);
/**
* Sets a window of pixels to the specified values.
*
* The passed [Bitmap] gets consumed.
*
* Returns: a new [BitmapCommand] instance.
*
* This function is part of the `bitmapcommand` module.
*/
struct BitmapCommand */*notnull*/ sp_bitmapcommand_new(struct Bitmap */*notnull*/ bitmap,
size_t origin_x,
size_t origin_y,
CompressionCode compression);
/**
* Sets the value of field `bitmap` of the [`servicepoint::BitmapCommand`].
* The provided value is moved into the instance, potentially invalidating previously taken references.
*
* This function is part of the `bitmapcommand` module.
*/
void sp_bitmapcommand_set_bitmap(struct BitmapCommand */*notnull*/ instance,
struct Bitmap */*notnull*/ value);
/**
* Sets the value of field `compression` of the [`servicepoint::BitmapCommand`].
*
* This function is part of the `bitmapcommand` module.
*/
void sp_bitmapcommand_set_compression(struct BitmapCommand */*notnull*/ instance,
CompressionCode value);
/**
* Overwrites the origin field of the [`BitmapCommand`].
*
* This function is part of the `bitmapcommand` module.
*/
void sp_bitmapcommand_set_origin(struct BitmapCommand */*notnull*/ command,
size_t origin_x,
size_t origin_y);
/**
*Tries to turn a [`BitmapCommand`] into a [Packet].
*
* Returns: NULL or a [Packet] containing the command.
*
* This function is part of the `bitmapcommand` module.
*/
struct Packet *sp_bitmapcommand_try_into_packet(struct BitmapCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::BitVecCommand::clone`].
*
*Clones a [`BitVecCommand`] instance.
*
* This function is part of the `bitveccommand` module.
*/
struct BitVecCommand */*notnull*/ sp_bitveccommand_clone(struct BitVecCommand */*notnull*/ instance);
/**
*Deallocates a [`BitVecCommand`] instance.
*
* This function is part of the `bitveccommand` module.
*/
void sp_bitveccommand_free(struct BitVecCommand */*notnull*/ instance);
/**
* Gets a reference to the field `bitvec` of the [`servicepoint::BitVecCommand`].
*
* - The returned reference inherits the lifetime of object in which it is contained.
* - The returned pointer may not be used in a function that consumes the instance, e.g. to create a command.
*
* This function is part of the `bitveccommand` module.
*/
DisplayBitVec */*notnull*/ sp_bitveccommand_get_bitvec_mut(struct BitVecCommand */*notnull*/ instance);
/**
* Gets the value of field `compression` of the [`servicepoint::BitVecCommand`].
*
* This function is part of the `bitveccommand` module.
*/
CompressionCode sp_bitveccommand_get_compression(struct BitVecCommand */*notnull*/ instance);
/**
* Gets the value of field `offset` of the [`servicepoint::BitVecCommand`].
*
* This function is part of the `bitveccommand` module.
*/
Offset sp_bitveccommand_get_offset(struct BitVecCommand */*notnull*/ instance);
/**
* Gets the value of field `operation` of the [`servicepoint::BitVecCommand`].
*
* This function is part of the `bitveccommand` module.
*/
BinaryOperation sp_bitveccommand_get_operation(struct BitVecCommand */*notnull*/ instance);
/**
* Set pixel data starting at the pixel offset on screen.
*
* The screen will continuously overwrite more pixel data without regarding the offset, meaning
* once the starting row is full, overwriting will continue on column 0.
*
* The [`BinaryOperation`] will be applied on the display comparing old and sent bit.
*
* `new_bit = old_bit op sent_bit`
*
* For example, [`BinaryOperation::Or`] can be used to turn on some pixels without affecting other pixels.
*
* The contained [`DisplayBitVec`] is always uncompressed.
*
* This function is part of the `bitveccommand` module.
*/
struct BitVecCommand */*notnull*/ sp_bitveccommand_new(DisplayBitVec */*notnull*/ bitvec,
size_t offset,
BinaryOperation operation,
CompressionCode compression);
/**
* Sets the value of field `bitvec` of the [`servicepoint::BitVecCommand`].
* The provided value is moved into the instance, potentially invalidating previously taken references.
*
* This function is part of the `bitveccommand` module.
*/
void sp_bitveccommand_set_bitvec(struct BitVecCommand */*notnull*/ instance,
DisplayBitVec */*notnull*/ value);
/**
* Sets the value of field `compression` of the [`servicepoint::BitVecCommand`].
*
* This function is part of the `bitveccommand` module.
*/
void sp_bitveccommand_set_compression(struct BitVecCommand */*notnull*/ instance,
CompressionCode value);
/**
* Sets the value of field `offset` of the [`servicepoint::BitVecCommand`].
*
* This function is part of the `bitveccommand` module.
*/
void sp_bitveccommand_set_offset(struct BitVecCommand */*notnull*/ instance,
Offset value);
/**
* Sets the value of field `operation` of the [`servicepoint::BitVecCommand`].
*
* This function is part of the `bitveccommand` module.
*/
void sp_bitveccommand_set_operation(struct BitVecCommand */*notnull*/ instance,
BinaryOperation value);
/**
*Tries to turn a [`BitVecCommand`] into a [Packet].
*
* Returns: NULL or a [Packet] containing the command.
*
* This function is part of the `bitveccommand` module.
*/
struct Packet *sp_bitveccommand_try_into_packet(struct BitVecCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::BrightnessGrid::clone`].
* Calls method [`BrightnessGrid::clone`].
*
*Clones a [`BrightnessGrid`] instance.
*
* This function is part of the `brightnessgrid` module.
* This function is part of the `brightness_grid` module.
*/
BrightnessGrid */*notnull*/ sp_brightnessgrid_clone(BrightnessGrid */*notnull*/ instance);
BrightnessGrid */*notnull*/ sp_brightness_grid_clone(BrightnessGrid */*notnull*/ instance);
/**
* Calls method [`BrightnessGridCommand::clone`].
*
*Clones a [`BrightnessGridCommand`] instance.
*
* This function is part of the `brightness_grid_command` module.
*/
struct BrightnessGridCommand */*notnull*/ sp_brightness_grid_command_clone(struct BrightnessGridCommand */*notnull*/ instance);
/**
*Deallocates a [`BrightnessGridCommand`] instance.
*
* This function is part of the `brightness_grid_command` module.
*/
void sp_brightness_grid_command_free(struct BrightnessGridCommand */*notnull*/ instance);
/**
* Moves the provided [BrightnessGrid] into a new [BrightnessGridCommand],
* leaving other fields as their default values.
*
* This function is part of the `brightness_grid_command` module.
*/
struct BrightnessGridCommand */*notnull*/ sp_brightness_grid_command_from_grid(BrightnessGrid */*notnull*/ grid);
/**
* Gets a reference to the field `grid` of the [`servicepoint::BrightnessGridCommand`].
*
* - The returned reference inherits the lifetime of object in which it is contained.
* - The returned pointer may not be used in a function that consumes the instance, e.g. to create a command.
*
* This function is part of the `brightness_grid_command` module.
*/
BrightnessGrid */*notnull*/ sp_brightness_grid_command_get_grid_mut(struct BrightnessGridCommand */*notnull*/ instance);
/**
* Reads the origin field of the [`BrightnessGridCommand`].
*
* This function is part of the `brightness_grid_command` module.
*/
void sp_brightness_grid_command_get_origin(struct BrightnessGridCommand */*notnull*/ command,
size_t */*notnull*/ origin_x,
size_t */*notnull*/ origin_y);
/**
* Set the brightness of individual tiles in a rectangular area of the display.
*
* The passed [BrightnessGrid] gets consumed.
*
* Returns: a new [BrightnessGridCommand] instance.
*
* This function is part of the `brightness_grid_command` module.
*/
struct BrightnessGridCommand */*notnull*/ sp_brightness_grid_command_new(BrightnessGrid */*notnull*/ grid,
size_t origin_x,
size_t origin_y);
/**
* Sets the value of field `grid` of the [`servicepoint::BrightnessGridCommand`].
* The provided value is moved into the instance, potentially invalidating previously taken references.
*
* This function is part of the `brightness_grid_command` module.
*/
void sp_brightness_grid_command_set_grid(struct BrightnessGridCommand */*notnull*/ instance,
BrightnessGrid */*notnull*/ value);
/**
* Overwrites the origin field of the [`BrightnessGridCommand`].
*
* This function is part of the `brightness_grid_command` module.
*/
void sp_brightness_grid_command_set_origin(struct BrightnessGridCommand */*notnull*/ command,
size_t origin_x,
size_t origin_y);
/**
*Tries to turn a [`BrightnessGridCommand`] into a [Packet].
*
* Returns: NULL or a [Packet] containing the command.
*
* [Packet]: [`servicepoint::Packet`]
*
* This function is part of the `brightness_grid_command` module.
*/
struct Packet *sp_brightness_grid_command_try_into_packet(struct BrightnessGridCommand */*notnull*/ instance);
/**
* Gets an unsafe reference to the data of the instance.
*
* The returned memory is valid for the lifetime of the grid.
*
* This function is part of the `brightnessgrid` module.
* This function is part of the `brightness_grid` module.
*/
struct ByteSlice sp_brightnessgrid_data_ref_mut(BrightnessGrid */*notnull*/ instance);
struct ByteSlice sp_brightness_grid_data_ref_mut(BrightnessGrid */*notnull*/ instance);
/**
* Calls method [`servicepoint::BrightnessGrid::fill`].
* Calls method [`BrightnessGrid::fill`].
*
* Sets the state of all cells in the grid.
*
@ -1056,20 +1145,20 @@ struct ByteSlice sp_brightnessgrid_data_ref_mut(BrightnessGrid */*notnull*/ inst
*
* - `value`: the value to set all cells to
*
* This function is part of the `brightnessgrid` module.
* This function is part of the `brightness_grid` module.
*/
void sp_brightnessgrid_fill(BrightnessGrid */*notnull*/ instance,
Brightness value);
void sp_brightness_grid_fill(BrightnessGrid */*notnull*/ instance,
Brightness value);
/**
*Deallocates a [`BrightnessGrid`] instance.
*
* This function is part of the `brightnessgrid` module.
* This function is part of the `brightness_grid` module.
*/
void sp_brightnessgrid_free(BrightnessGrid */*notnull*/ instance);
void sp_brightness_grid_free(BrightnessGrid */*notnull*/ instance);
/**
* Calls method [`servicepoint::BrightnessGrid::get`].
* Calls method [`BrightnessGrid::get`].
*
* Gets the current value at the specified position.
*
@ -1081,20 +1170,20 @@ void sp_brightnessgrid_free(BrightnessGrid */*notnull*/ instance);
*
* - when accessing `x` or `y` out of bounds
*
* This function is part of the `brightnessgrid` module.
* This function is part of the `brightness_grid` module.
*/
Brightness sp_brightnessgrid_get(BrightnessGrid */*notnull*/ instance,
size_t x,
size_t y);
Brightness sp_brightness_grid_get(BrightnessGrid */*notnull*/ instance,
size_t x,
size_t y);
/**
* Calls method [`servicepoint::BrightnessGrid::height`].
* Calls method [`BrightnessGrid::height`].
*
* Gets the height.
*
* This function is part of the `brightnessgrid` module.
* This function is part of the `brightness_grid` module.
*/
size_t sp_brightnessgrid_height(BrightnessGrid */*notnull*/ instance);
size_t sp_brightness_grid_height(BrightnessGrid */*notnull*/ instance);
/**
* Loads a [BrightnessGrid] with the specified dimensions from the provided data.
@ -1103,11 +1192,11 @@ size_t sp_brightnessgrid_height(BrightnessGrid */*notnull*/ instance);
*
* returns: new [BrightnessGrid] instance, or NULL in case of an error.
*
* This function is part of the `brightnessgrid` module.
* This function is part of the `brightness_grid` module.
*/
BrightnessGrid *sp_brightnessgrid_load(size_t width,
size_t height,
struct ByteSlice data);
BrightnessGrid *sp_brightness_grid_load(size_t width,
size_t height,
struct ByteSlice data);
/**
* Creates a new [BrightnessGrid] with the specified dimensions.
@ -1128,12 +1217,12 @@ BrightnessGrid *sp_brightnessgrid_load(size_t width,
* sp_udp_free(connection);
* ```
*
* This function is part of the `brightnessgrid` module.
* This function is part of the `brightness_grid` module.
*/
BrightnessGrid */*notnull*/ sp_brightnessgrid_new(size_t width, size_t height);
BrightnessGrid */*notnull*/ sp_brightness_grid_new(size_t width, size_t height);
/**
* Calls method [`servicepoint::BrightnessGrid::set`].
* Calls method [`BrightnessGrid::set`].
*
* Sets the value of the specified position.
*
@ -1146,12 +1235,12 @@ BrightnessGrid */*notnull*/ sp_brightnessgrid_new(size_t width, size_t height);
*
* - when accessing `x` or `y` out of bounds
*
* This function is part of the `brightnessgrid` module.
* This function is part of the `brightness_grid` module.
*/
void sp_brightnessgrid_set(BrightnessGrid */*notnull*/ instance,
size_t x,
size_t y,
Brightness value);
void sp_brightness_grid_set(BrightnessGrid */*notnull*/ instance,
size_t x,
size_t y,
Brightness value);
/**
* Creates a [BrightnessGridCommand] and immediately turns that into a [Packet].
@ -1160,112 +1249,114 @@ void sp_brightnessgrid_set(BrightnessGrid */*notnull*/ instance,
*
* Returns NULL in case of an error.
*
* This function is part of the `brightnessgrid` module.
* This function is part of the `brightness_grid` module.
*/
struct Packet *sp_brightnessgrid_try_into_packet(BrightnessGrid */*notnull*/ grid,
size_t x,
size_t y);
struct Packet *sp_brightness_grid_try_into_packet(BrightnessGrid */*notnull*/ grid,
size_t x,
size_t y);
/**
* Calls method [`servicepoint::BrightnessGrid::width`].
* Calls method [`BrightnessGrid::width`].
*
* Gets the width.
*
* This function is part of the `brightnessgrid` module.
* This function is part of the `brightness_grid` module.
*/
size_t sp_brightnessgrid_width(BrightnessGrid */*notnull*/ instance);
size_t sp_brightness_grid_width(BrightnessGrid */*notnull*/ instance);
/**
* Calls method [`servicepoint::BrightnessGridCommand::clone`].
* Calls method [`CharGrid::clone`].
*
*Clones a [`BrightnessGridCommand`] instance.
*Clones a [`CharGrid`] instance.
*
* This function is part of the `brightnessgridcommand` module.
* This function is part of the `char_grid` module.
*/
struct BrightnessGridCommand */*notnull*/ sp_brightnessgridcommand_clone(struct BrightnessGridCommand */*notnull*/ instance);
CharGrid */*notnull*/ sp_char_grid_clone(CharGrid */*notnull*/ instance);
/**
*Deallocates a [`BrightnessGridCommand`] instance.
* Calls method [`CharGridCommand::clone`].
*
* This function is part of the `brightnessgridcommand` module.
*Clones a [`CharGridCommand`] instance.
*
* This function is part of the `char_grid_command` module.
*/
void sp_brightnessgridcommand_free(struct BrightnessGridCommand */*notnull*/ instance);
struct CharGridCommand */*notnull*/ sp_char_grid_command_clone(struct CharGridCommand */*notnull*/ instance);
/**
* Moves the provided [BrightnessGrid] into a new [BrightnessGridCommand],
*Deallocates a [`CharGridCommand`] instance.
*
* This function is part of the `char_grid_command` module.
*/
void sp_char_grid_command_free(struct CharGridCommand */*notnull*/ instance);
/**
* Moves the provided [CharGrid] into a new [CharGridCommand],
* leaving other fields as their default values.
*
* This function is part of the `brightnessgridcommand` module.
* This function is part of the `char_grid_command` module.
*/
struct BrightnessGridCommand */*notnull*/ sp_brightnessgridcommand_from_grid(BrightnessGrid */*notnull*/ grid);
struct CharGridCommand */*notnull*/ sp_char_grid_command_from_grid(CharGrid */*notnull*/ grid);
/**
* Gets a reference to the field `grid` of the [`servicepoint::BrightnessGridCommand`].
* Gets a reference to the field `grid` of the [`servicepoint::CharGridCommand`].
*
* - The returned reference inherits the lifetime of object in which it is contained.
* - The returned pointer may not be used in a function that consumes the instance, e.g. to create a command.
*
* This function is part of the `brightnessgridcommand` module.
* This function is part of the `char_grid_command` module.
*/
BrightnessGrid */*notnull*/ sp_brightnessgridcommand_get_grid_mut(struct BrightnessGridCommand */*notnull*/ instance);
CharGrid */*notnull*/ sp_char_grid_command_get_grid_mut(struct CharGridCommand */*notnull*/ instance);
/**
* Reads the origin field of the [`BrightnessGridCommand`].
* Reads the origin field of the [`CharGridCommand`].
*
* This function is part of the `brightnessgridcommand` module.
* This function is part of the `char_grid_command` module.
*/
void sp_brightnessgridcommand_get_origin(struct BrightnessGridCommand */*notnull*/ command,
size_t */*notnull*/ origin_x,
size_t */*notnull*/ origin_y);
void sp_char_grid_command_get_origin(struct CharGridCommand */*notnull*/ command,
size_t */*notnull*/ origin_x,
size_t */*notnull*/ origin_y);
/**
* Set the brightness of individual tiles in a rectangular area of the display.
* Show UTF-8 encoded text on the screen.
*
* The passed [BrightnessGrid] gets consumed.
* The passed [CharGrid] gets consumed.
*
* Returns: a new [BrightnessGridCommand] instance.
* Returns: a new [CharGridCommand] instance.
*
* This function is part of the `brightnessgridcommand` module.
* This function is part of the `char_grid_command` module.
*/
struct BrightnessGridCommand */*notnull*/ sp_brightnessgridcommand_new(BrightnessGrid */*notnull*/ grid,
size_t origin_x,
size_t origin_y);
struct CharGridCommand */*notnull*/ sp_char_grid_command_new(CharGrid */*notnull*/ grid,
size_t origin_x,
size_t origin_y);
/**
* Sets the value of field `grid` of the [`servicepoint::BrightnessGridCommand`].
* Sets the value of field `grid` of the [`servicepoint::CharGridCommand`].
* The provided value is moved into the instance, potentially invalidating previously taken references.
*
* This function is part of the `brightnessgridcommand` module.
* This function is part of the `char_grid_command` module.
*/
void sp_brightnessgridcommand_set_grid(struct BrightnessGridCommand */*notnull*/ instance,
BrightnessGrid */*notnull*/ value);
void sp_char_grid_command_set_grid(struct CharGridCommand */*notnull*/ instance,
CharGrid */*notnull*/ value);
/**
* Overwrites the origin field of the [`BrightnessGridCommand`].
* Overwrites the origin field of the [`CharGridCommand`].
*
* This function is part of the `brightnessgridcommand` module.
* This function is part of the `char_grid_command` module.
*/
void sp_brightnessgridcommand_set_origin(struct BrightnessGridCommand */*notnull*/ command,
size_t origin_x,
size_t origin_y);
void sp_char_grid_command_set_origin(struct CharGridCommand */*notnull*/ command,
size_t origin_x,
size_t origin_y);
/**
*Tries to turn a [`BrightnessGridCommand`] into a [Packet].
*Tries to turn a [`CharGridCommand`] into a [Packet].
*
* Returns: NULL or a [Packet] containing the command.
*
* This function is part of the `brightnessgridcommand` module.
*/
struct Packet *sp_brightnessgridcommand_try_into_packet(struct BrightnessGridCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::CharGrid::clone`].
* [Packet]: [`servicepoint::Packet`]
*
*Clones a [`CharGrid`] instance.
*
* This function is part of the `chargrid` module.
* This function is part of the `char_grid_command` module.
*/
CharGrid */*notnull*/ sp_chargrid_clone(CharGrid */*notnull*/ instance);
struct Packet *sp_char_grid_command_try_into_packet(struct CharGridCommand */*notnull*/ instance);
/**
* Sets the value of all cells in the grid.
@ -1275,16 +1366,16 @@ CharGrid */*notnull*/ sp_chargrid_clone(CharGrid */*notnull*/ instance);
* - `value`: the value to set all cells to
* - when providing values that cannot be converted to Rust's `char`.
*
* This function is part of the `chargrid` module.
* This function is part of the `char_grid` module.
*/
void sp_chargrid_fill(CharGrid */*notnull*/ instance, uint32_t value);
void sp_char_grid_fill(CharGrid */*notnull*/ instance, uint32_t value);
/**
*Deallocates a [`CharGrid`] instance.
*
* This function is part of the `chargrid` module.
* This function is part of the `char_grid` module.
*/
void sp_chargrid_free(CharGrid */*notnull*/ instance);
void sp_char_grid_free(CharGrid */*notnull*/ instance);
/**
* Returns the current value at the specified position.
@ -1297,27 +1388,27 @@ void sp_chargrid_free(CharGrid */*notnull*/ instance);
*
* - when accessing `x` or `y` out of bounds
*
* This function is part of the `chargrid` module.
* This function is part of the `char_grid` module.
*/
uint32_t sp_chargrid_get(CharGrid */*notnull*/ instance, size_t x, size_t y);
uint32_t sp_char_grid_get(CharGrid */*notnull*/ instance, size_t x, size_t y);
/**
* Calls method [`servicepoint::CharGrid::height`].
* Calls method [`CharGrid::height`].
*
* Gets the height.
*
* This function is part of the `chargrid` module.
* This function is part of the `char_grid` module.
*/
size_t sp_chargrid_height(CharGrid */*notnull*/ instance);
size_t sp_char_grid_height(CharGrid */*notnull*/ instance);
/**
* Loads a [CharGrid] with the specified dimensions from the provided data.
*
* returns: new CharGrid or NULL in case of an error
*
* This function is part of the `chargrid` module.
* This function is part of the `char_grid` module.
*/
CharGrid *sp_chargrid_load(size_t width, size_t height, struct ByteSlice data);
CharGrid *sp_char_grid_load(size_t width, size_t height, struct ByteSlice data);
/**
* Creates a new [CharGrid] with the specified dimensions.
@ -1333,9 +1424,9 @@ CharGrid *sp_chargrid_load(size_t width, size_t height, struct ByteSlice data);
* sp_char_grid_free(grid);
* ```
*
* This function is part of the `chargrid` module.
* This function is part of the `char_grid` module.
*/
CharGrid */*notnull*/ sp_chargrid_new(size_t width, size_t height);
CharGrid */*notnull*/ sp_char_grid_new(size_t width, size_t height);
/**
* Sets the value of the specified position in the grid.
@ -1352,12 +1443,12 @@ CharGrid */*notnull*/ sp_chargrid_new(size_t width, size_t height);
* - when accessing `x` or `y` out of bounds
* - when providing values that cannot be converted to Rust's `char`.
*
* This function is part of the `chargrid` module.
* This function is part of the `char_grid` module.
*/
void sp_chargrid_set(CharGrid */*notnull*/ instance,
size_t x,
size_t y,
uint32_t value);
void sp_char_grid_set(CharGrid */*notnull*/ instance,
size_t x,
size_t y,
uint32_t value);
/**
* Creates a [CharGridCommand] and immediately turns that into a [Packet].
@ -1366,119 +1457,36 @@ void sp_chargrid_set(CharGrid */*notnull*/ instance,
*
* Returns NULL in case of an error.
*
* This function is part of the `chargrid` module.
* This function is part of the `char_grid` module.
*/
struct Packet *sp_chargrid_try_into_packet(CharGrid */*notnull*/ grid,
size_t x,
size_t y);
struct Packet *sp_char_grid_try_into_packet(CharGrid */*notnull*/ grid,
size_t x,
size_t y);
/**
* Calls method [`servicepoint::CharGrid::width`].
* Calls method [`CharGrid::width`].
*
* Gets the width.
*
* This function is part of the `chargrid` module.
* This function is part of the `char_grid` module.
*/
size_t sp_chargrid_width(CharGrid */*notnull*/ instance);
size_t sp_char_grid_width(CharGrid */*notnull*/ instance);
/**
* Calls method [`servicepoint::CharGridCommand::clone`].
*
*Clones a [`CharGridCommand`] instance.
*
* This function is part of the `chargridcommand` module.
*/
struct CharGridCommand */*notnull*/ sp_chargridcommand_clone(struct CharGridCommand */*notnull*/ instance);
/**
*Deallocates a [`CharGridCommand`] instance.
*
* This function is part of the `chargridcommand` module.
*/
void sp_chargridcommand_free(struct CharGridCommand */*notnull*/ instance);
/**
* Moves the provided [CharGrid] into a new [CharGridCommand],
* leaving other fields as their default values.
*
* This function is part of the `chargridcommand` module.
*/
struct CharGridCommand */*notnull*/ sp_chargridcommand_from_grid(CharGrid */*notnull*/ grid);
/**
* Gets a reference to the field `grid` of the [`servicepoint::CharGridCommand`].
*
* - The returned reference inherits the lifetime of object in which it is contained.
* - The returned pointer may not be used in a function that consumes the instance, e.g. to create a command.
*
* This function is part of the `chargridcommand` module.
*/
CharGrid */*notnull*/ sp_chargridcommand_get_grid_mut(struct CharGridCommand */*notnull*/ instance);
/**
* Reads the origin field of the [`CharGridCommand`].
*
* This function is part of the `chargridcommand` module.
*/
void sp_chargridcommand_get_origin(struct CharGridCommand */*notnull*/ command,
size_t */*notnull*/ origin_x,
size_t */*notnull*/ origin_y);
/**
* Show UTF-8 encoded text on the screen.
*
* The passed [CharGrid] gets consumed.
*
* Returns: a new [CharGridCommand] instance.
*
* This function is part of the `chargridcommand` module.
*/
struct CharGridCommand */*notnull*/ sp_chargridcommand_new(CharGrid */*notnull*/ grid,
size_t origin_x,
size_t origin_y);
/**
* Sets the value of field `grid` of the [`servicepoint::CharGridCommand`].
* The provided value is moved into the instance, potentially invalidating previously taken references.
*
* This function is part of the `chargridcommand` module.
*/
void sp_chargridcommand_set_grid(struct CharGridCommand */*notnull*/ instance,
CharGrid */*notnull*/ value);
/**
* Overwrites the origin field of the [`CharGridCommand`].
*
* This function is part of the `chargridcommand` module.
*/
void sp_chargridcommand_set_origin(struct CharGridCommand */*notnull*/ command,
size_t origin_x,
size_t origin_y);
/**
*Tries to turn a [`CharGridCommand`] into a [Packet].
*
* Returns: NULL or a [Packet] containing the command.
*
* This function is part of the `chargridcommand` module.
*/
struct Packet *sp_chargridcommand_try_into_packet(struct CharGridCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::ClearCommand::clone`].
* Calls method [`ClearCommand::clone`].
*
*Clones a [`ClearCommand`] instance.
*
* This function is part of the `clearcommand` module.
* This function is part of the `clear_command` module.
*/
struct ClearCommand */*notnull*/ sp_clearcommand_clone(struct ClearCommand */*notnull*/ instance);
struct ClearCommand */*notnull*/ sp_clear_command_clone(struct ClearCommand */*notnull*/ instance);
/**
*Deallocates a [`ClearCommand`] instance.
*
* This function is part of the `clearcommand` module.
* This function is part of the `clear_command` module.
*/
void sp_clearcommand_free(struct ClearCommand */*notnull*/ instance);
void sp_clear_command_free(struct ClearCommand */*notnull*/ instance);
/**
* Set all pixels to the off state.
@ -1487,41 +1495,128 @@ void sp_clearcommand_free(struct ClearCommand */*notnull*/ instance);
*
* Returns: a new [`ClearCommand`] instance.
*
* This function is part of the `clearcommand` module.
* This function is part of the `clear_command` module.
*/
struct ClearCommand */*notnull*/ sp_clearcommand_new(void);
struct ClearCommand */*notnull*/ sp_clear_command_new(void);
/**
*Tries to turn a [`ClearCommand`] into a [Packet].
*
* Returns: NULL or a [Packet] containing the command.
*
* This function is part of the `clearcommand` module.
* [Packet]: [`servicepoint::Packet`]
*
* This function is part of the `clear_command` module.
*/
struct Packet *sp_clearcommand_try_into_packet(struct ClearCommand */*notnull*/ instance);
struct Packet *sp_clear_command_try_into_packet(struct ClearCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::Cp437Grid::clone`].
* Calls method [`Cp437Grid::clone`].
*
*Clones a [`Cp437Grid`] instance.
*
* This function is part of the `cp437grid` module.
* This function is part of the `cp437_grid` module.
*/
Cp437Grid */*notnull*/ sp_cp437grid_clone(Cp437Grid */*notnull*/ instance);
Cp437Grid */*notnull*/ sp_cp437_grid_clone(Cp437Grid */*notnull*/ instance);
/**
* Calls method [`servicepoint::Cp437Grid::data_ref_mut`].
* Calls method [`Cp437GridCommand::clone`].
*
*Clones a [`Cp437GridCommand`] instance.
*
* This function is part of the `cp437_grid_command` module.
*/
struct Cp437GridCommand */*notnull*/ sp_cp437_grid_command_clone(struct Cp437GridCommand */*notnull*/ instance);
/**
*Deallocates a [`Cp437GridCommand`] instance.
*
* This function is part of the `cp437_grid_command` module.
*/
void sp_cp437_grid_command_free(struct Cp437GridCommand */*notnull*/ instance);
/**
* Moves the provided [Cp437Grid] into a new [Cp437GridCommand],
* leaving other fields as their default values.
*
* This function is part of the `cp437_grid_command` module.
*/
struct Cp437GridCommand */*notnull*/ sp_cp437_grid_command_from_grid(Cp437Grid */*notnull*/ grid);
/**
* Gets a reference to the field `grid` of the [`servicepoint::Cp437GridCommand`].
*
* - The returned reference inherits the lifetime of object in which it is contained.
* - The returned pointer may not be used in a function that consumes the instance, e.g. to create a command.
*
* This function is part of the `cp437_grid_command` module.
*/
Cp437Grid */*notnull*/ sp_cp437_grid_command_get_grid_mut(struct Cp437GridCommand */*notnull*/ instance);
/**
* Reads the origin field of the [`Cp437GridCommand`].
*
* This function is part of the `cp437_grid_command` module.
*/
void sp_cp437_grid_command_get_origin(struct Cp437GridCommand */*notnull*/ command,
size_t */*notnull*/ origin_x,
size_t */*notnull*/ origin_y);
/**
* Show text on the screen.
*
* The text is sent in the form of a 2D grid of [CP-437] encoded characters.
*
* The origin is relative to the top-left of the display.
*
* This function is part of the `cp437_grid_command` module.
*/
struct Cp437GridCommand */*notnull*/ sp_cp437_grid_command_new(Cp437Grid */*notnull*/ grid,
size_t origin_x,
size_t origin_y);
/**
* Sets the value of field `grid` of the [`servicepoint::Cp437GridCommand`].
* The provided value is moved into the instance, potentially invalidating previously taken references.
*
* This function is part of the `cp437_grid_command` module.
*/
void sp_cp437_grid_command_set_grid(struct Cp437GridCommand */*notnull*/ instance,
Cp437Grid */*notnull*/ value);
/**
* Overwrites the origin field of the [`Cp437GridCommand`].
*
* This function is part of the `cp437_grid_command` module.
*/
void sp_cp437_grid_command_set_origin(struct Cp437GridCommand */*notnull*/ command,
size_t origin_x,
size_t origin_y);
/**
*Tries to turn a [`Cp437GridCommand`] into a [Packet].
*
* Returns: NULL or a [Packet] containing the command.
*
* [Packet]: [`servicepoint::Packet`]
*
* This function is part of the `cp437_grid_command` module.
*/
struct Packet *sp_cp437_grid_command_try_into_packet(struct Cp437GridCommand */*notnull*/ instance);
/**
* Calls method [`Cp437Grid::data_ref_mut`].
*
* Gets an unsafe reference to the data of the grid.
*
* The returned memory is valid for the lifetime of the instance.
*
* This function is part of the `cp437grid` module.
* This function is part of the `cp437_grid` module.
*/
struct ByteSlice sp_cp437grid_data_ref_mut(Cp437Grid */*notnull*/ instance);
struct ByteSlice sp_cp437_grid_data_ref_mut(Cp437Grid */*notnull*/ instance);
/**
* Calls method [`servicepoint::Cp437Grid::fill`].
* Calls method [`Cp437Grid::fill`].
*
* Sets the state of all cells in the grid.
*
@ -1529,19 +1624,19 @@ struct ByteSlice sp_cp437grid_data_ref_mut(Cp437Grid */*notnull*/ instance);
*
* - `value`: the value to set all cells to
*
* This function is part of the `cp437grid` module.
* This function is part of the `cp437_grid` module.
*/
void sp_cp437grid_fill(Cp437Grid */*notnull*/ instance, uint8_t value);
void sp_cp437_grid_fill(Cp437Grid */*notnull*/ instance, uint8_t value);
/**
*Deallocates a [`Cp437Grid`] instance.
*
* This function is part of the `cp437grid` module.
* This function is part of the `cp437_grid` module.
*/
void sp_cp437grid_free(Cp437Grid */*notnull*/ instance);
void sp_cp437_grid_free(Cp437Grid */*notnull*/ instance);
/**
* Calls method [`servicepoint::Cp437Grid::get`].
* Calls method [`Cp437Grid::get`].
*
* Gets the current value at the specified position.
*
@ -1553,39 +1648,39 @@ void sp_cp437grid_free(Cp437Grid */*notnull*/ instance);
*
* - when accessing `x` or `y` out of bounds
*
* This function is part of the `cp437grid` module.
* This function is part of the `cp437_grid` module.
*/
uint8_t sp_cp437grid_get(Cp437Grid */*notnull*/ instance, size_t x, size_t y);
uint8_t sp_cp437_grid_get(Cp437Grid */*notnull*/ instance, size_t x, size_t y);
/**
* Calls method [`servicepoint::Cp437Grid::height`].
* Calls method [`Cp437Grid::height`].
*
* Gets the height.
*
* This function is part of the `cp437grid` module.
* This function is part of the `cp437_grid` module.
*/
size_t sp_cp437grid_height(Cp437Grid */*notnull*/ instance);
size_t sp_cp437_grid_height(Cp437Grid */*notnull*/ instance);
/**
* Loads a [Cp437Grid] with the specified dimensions from the provided data.
*
* This function is part of the `cp437grid` module.
* This function is part of the `cp437_grid` module.
*/
Cp437Grid *sp_cp437grid_load(size_t width,
size_t height,
struct ByteSlice data);
Cp437Grid *sp_cp437_grid_load(size_t width,
size_t height,
struct ByteSlice data);
/**
* Creates a new [Cp437Grid] with the specified dimensions.
*
* returns: [Cp437Grid] initialized to 0.
*
* This function is part of the `cp437grid` module.
* This function is part of the `cp437_grid` module.
*/
Cp437Grid */*notnull*/ sp_cp437grid_new(size_t width, size_t height);
Cp437Grid */*notnull*/ sp_cp437_grid_new(size_t width, size_t height);
/**
* Calls method [`servicepoint::Cp437Grid::set`].
* Calls method [`Cp437Grid::set`].
*
* Sets the value of the specified position.
*
@ -1598,12 +1693,12 @@ Cp437Grid */*notnull*/ sp_cp437grid_new(size_t width, size_t height);
*
* - when accessing `x` or `y` out of bounds
*
* This function is part of the `cp437grid` module.
* This function is part of the `cp437_grid` module.
*/
void sp_cp437grid_set(Cp437Grid */*notnull*/ instance,
size_t x,
size_t y,
uint8_t value);
void sp_cp437_grid_set(Cp437Grid */*notnull*/ instance,
size_t x,
size_t y,
uint8_t value);
/**
* Creates a [Cp437GridCommand] and immediately turns that into a [Packet].
@ -1612,126 +1707,43 @@ void sp_cp437grid_set(Cp437Grid */*notnull*/ instance,
*
* Returns NULL in case of an error.
*
* This function is part of the `cp437grid` module.
* This function is part of the `cp437_grid` module.
*/
struct Packet *sp_cp437grid_try_into_packet(Cp437Grid */*notnull*/ grid,
size_t x,
size_t y);
struct Packet *sp_cp437_grid_try_into_packet(Cp437Grid */*notnull*/ grid,
size_t x,
size_t y);
/**
* Calls method [`servicepoint::Cp437Grid::width`].
* Calls method [`Cp437Grid::width`].
*
* Gets the width.
*
* This function is part of the `cp437grid` module.
* This function is part of the `cp437_grid` module.
*/
size_t sp_cp437grid_width(Cp437Grid */*notnull*/ instance);
size_t sp_cp437_grid_width(Cp437Grid */*notnull*/ instance);
/**
* Calls method [`servicepoint::Cp437GridCommand::clone`].
*
*Clones a [`Cp437GridCommand`] instance.
*
* This function is part of the `cp437gridcommand` module.
*/
struct Cp437GridCommand */*notnull*/ sp_cp437gridcommand_clone(struct Cp437GridCommand */*notnull*/ instance);
/**
*Deallocates a [`Cp437GridCommand`] instance.
*
* This function is part of the `cp437gridcommand` module.
*/
void sp_cp437gridcommand_free(struct Cp437GridCommand */*notnull*/ instance);
/**
* Moves the provided [Cp437Grid] into a new [Cp437GridCommand],
* leaving other fields as their default values.
*
* This function is part of the `cp437gridcommand` module.
*/
struct Cp437GridCommand */*notnull*/ sp_cp437gridcommand_from_grid(Cp437Grid */*notnull*/ grid);
/**
* Gets a reference to the field `grid` of the [`servicepoint::Cp437GridCommand`].
*
* - The returned reference inherits the lifetime of object in which it is contained.
* - The returned pointer may not be used in a function that consumes the instance, e.g. to create a command.
*
* This function is part of the `cp437gridcommand` module.
*/
Cp437Grid */*notnull*/ sp_cp437gridcommand_get_grid_mut(struct Cp437GridCommand */*notnull*/ instance);
/**
* Reads the origin field of the [`Cp437GridCommand`].
*
* This function is part of the `cp437gridcommand` module.
*/
void sp_cp437gridcommand_get_origin(struct Cp437GridCommand */*notnull*/ command,
size_t */*notnull*/ origin_x,
size_t */*notnull*/ origin_y);
/**
* Show text on the screen.
*
* The text is sent in the form of a 2D grid of [CP-437] encoded characters.
*
* The origin is relative to the top-left of the display.
*
* This function is part of the `cp437gridcommand` module.
*/
struct Cp437GridCommand */*notnull*/ sp_cp437gridcommand_new(Cp437Grid */*notnull*/ grid,
size_t origin_x,
size_t origin_y);
/**
* Sets the value of field `grid` of the [`servicepoint::Cp437GridCommand`].
* The provided value is moved into the instance, potentially invalidating previously taken references.
*
* This function is part of the `cp437gridcommand` module.
*/
void sp_cp437gridcommand_set_grid(struct Cp437GridCommand */*notnull*/ instance,
Cp437Grid */*notnull*/ value);
/**
* Overwrites the origin field of the [`Cp437GridCommand`].
*
* This function is part of the `cp437gridcommand` module.
*/
void sp_cp437gridcommand_set_origin(struct Cp437GridCommand */*notnull*/ command,
size_t origin_x,
size_t origin_y);
/**
*Tries to turn a [`Cp437GridCommand`] into a [Packet].
*
* Returns: NULL or a [Packet] containing the command.
*
* This function is part of the `cp437gridcommand` module.
*/
struct Packet *sp_cp437gridcommand_try_into_packet(struct Cp437GridCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::DisplayBitVec::as_raw_mut_slice`].
* Calls method [`DisplayBitVec::as_raw_mut_slice`].
*
* Gets an unsafe reference to the data of the [DisplayBitVec] instance.
*
* The returned memory is valid for the lifetime of the bitvec.
*
* This function is part of the `displaybitvec` module.
* This function is part of the `display_bit_vec` module.
*/
struct ByteSlice sp_displaybitvec_as_raw_mut_slice(DisplayBitVec */*notnull*/ instance);
struct ByteSlice sp_display_bit_vec_as_raw_mut_slice(DisplayBitVec */*notnull*/ instance);
/**
* Calls method [`servicepoint::DisplayBitVec::clone`].
* Calls method [`DisplayBitVec::clone`].
*
*Clones a [`DisplayBitVec`] instance.
*
* This function is part of the `displaybitvec` module.
* This function is part of the `display_bit_vec` module.
*/
DisplayBitVec */*notnull*/ sp_displaybitvec_clone(DisplayBitVec */*notnull*/ instance);
DisplayBitVec */*notnull*/ sp_display_bit_vec_clone(DisplayBitVec */*notnull*/ instance);
/**
* Calls method [`servicepoint::DisplayBitVec::fill`].
* Calls method [`DisplayBitVec::fill`].
*
* Sets the value of all bits.
*
@ -1739,16 +1751,16 @@ DisplayBitVec */*notnull*/ sp_displaybitvec_clone(DisplayBitVec */*notnull*/ ins
*
* - `value`: the value to set all bits to
*
* This function is part of the `displaybitvec` module.
* This function is part of the `display_bit_vec` module.
*/
void sp_displaybitvec_fill(DisplayBitVec */*notnull*/ instance, bool value);
void sp_display_bit_vec_fill(DisplayBitVec */*notnull*/ instance, bool value);
/**
*Deallocates a [`DisplayBitVec`] instance.
*
* This function is part of the `displaybitvec` module.
* This function is part of the `display_bit_vec` module.
*/
void sp_displaybitvec_free(DisplayBitVec */*notnull*/ instance);
void sp_display_bit_vec_free(DisplayBitVec */*notnull*/ instance);
/**
* Gets the value of a bit.
@ -1764,36 +1776,36 @@ void sp_displaybitvec_free(DisplayBitVec */*notnull*/ instance);
*
* - when accessing `index` out of bounds
*
* This function is part of the `displaybitvec` module.
* This function is part of the `display_bit_vec` module.
*/
bool sp_displaybitvec_get(DisplayBitVec */*notnull*/ instance, size_t index);
bool sp_display_bit_vec_get(DisplayBitVec */*notnull*/ instance, size_t index);
/**
* Calls method [`servicepoint::DisplayBitVec::is_empty`].
* Calls method [`DisplayBitVec::is_empty`].
*
* Returns true if length is 0.
*
* This function is part of the `displaybitvec` module.
* This function is part of the `display_bit_vec` module.
*/
bool sp_displaybitvec_is_empty(DisplayBitVec */*notnull*/ instance);
bool sp_display_bit_vec_is_empty(DisplayBitVec */*notnull*/ instance);
/**
* Calls method [`servicepoint::DisplayBitVec::len`].
* Calls method [`DisplayBitVec::len`].
*
* Gets the length in bits.
*
* This function is part of the `displaybitvec` module.
* This function is part of the `display_bit_vec` module.
*/
size_t sp_displaybitvec_len(DisplayBitVec */*notnull*/ instance);
size_t sp_display_bit_vec_len(DisplayBitVec */*notnull*/ instance);
/**
* Interpret the data as a series of bits and load then into a new [DisplayBitVec] instance.
*
* returns: [DisplayBitVec] instance containing data.
*
* This function is part of the `displaybitvec` module.
* This function is part of the `display_bit_vec` module.
*/
DisplayBitVec */*notnull*/ sp_displaybitvec_load(struct ByteSlice data);
DisplayBitVec */*notnull*/ sp_display_bit_vec_load(struct ByteSlice data);
/**
* Creates a new [DisplayBitVec] instance.
@ -1808,12 +1820,12 @@ DisplayBitVec */*notnull*/ sp_displaybitvec_load(struct ByteSlice data);
*
* - when `size` is not divisible by 8.
*
* This function is part of the `displaybitvec` module.
* This function is part of the `display_bit_vec` module.
*/
DisplayBitVec */*notnull*/ sp_displaybitvec_new(size_t size);
DisplayBitVec */*notnull*/ sp_display_bit_vec_new(size_t size);
/**
* Calls method [`servicepoint::DisplayBitVec::set`].
* Calls method [`DisplayBitVec::set`].
*
* Sets the value of a bit.
*
@ -1826,11 +1838,11 @@ DisplayBitVec */*notnull*/ sp_displaybitvec_new(size_t size);
*
* - when accessing `index` out of bounds
*
* This function is part of the `displaybitvec` module.
* This function is part of the `display_bit_vec` module.
*/
void sp_displaybitvec_set(DisplayBitVec */*notnull*/ instance,
size_t index,
bool value);
void sp_display_bit_vec_set(DisplayBitVec */*notnull*/ instance,
size_t index,
bool value);
/**
* Creates a [BitVecCommand] and immediately turns that into a [Packet].
@ -1839,12 +1851,12 @@ void sp_displaybitvec_set(DisplayBitVec */*notnull*/ instance,
*
* Returns NULL in case of an error.
*
* This function is part of the `displaybitvec` module.
* This function is part of the `display_bit_vec` module.
*/
struct Packet *sp_displaybitvec_try_into_packet(DisplayBitVec */*notnull*/ bitvec,
size_t offset,
BinaryOperation operation,
CompressionCode compression);
struct Packet *sp_display_bit_vec_try_into_packet(DisplayBitVec */*notnull*/ bitvec,
size_t offset,
BinaryOperation operation,
CompressionCode compression);
/**
* Call this function at the beginning of main to enable rust logging controlled by the
@ -1855,54 +1867,56 @@ struct Packet *sp_displaybitvec_try_into_packet(DisplayBitVec */*notnull*/ bitve
void sp_envlogger_init(void);
/**
* Calls method [`servicepoint::FadeOutCommand::clone`].
* Calls method [`FadeOutCommand::clone`].
*
*Clones a [`FadeOutCommand`] instance.
*
* This function is part of the `fadeoutcommand` module.
* This function is part of the `fade_out_command` module.
*/
struct FadeOutCommand */*notnull*/ sp_fadeoutcommand_clone(struct FadeOutCommand */*notnull*/ instance);
struct FadeOutCommand */*notnull*/ sp_fade_out_command_clone(struct FadeOutCommand */*notnull*/ instance);
/**
*Deallocates a [`FadeOutCommand`] instance.
*
* This function is part of the `fadeoutcommand` module.
* This function is part of the `fade_out_command` module.
*/
void sp_fadeoutcommand_free(struct FadeOutCommand */*notnull*/ instance);
void sp_fade_out_command_free(struct FadeOutCommand */*notnull*/ instance);
/**
* A yet-to-be-tested command.
*
* Returns: a new [`FadeOutCommand`] instance.
*
* This function is part of the `fadeoutcommand` module.
* This function is part of the `fade_out_command` module.
*/
struct FadeOutCommand */*notnull*/ sp_fadeoutcommand_new(void);
struct FadeOutCommand */*notnull*/ sp_fade_out_command_new(void);
/**
*Tries to turn a [`FadeOutCommand`] into a [Packet].
*
* Returns: NULL or a [Packet] containing the command.
*
* This function is part of the `fadeoutcommand` module.
* [Packet]: [`servicepoint::Packet`]
*
* This function is part of the `fade_out_command` module.
*/
struct Packet *sp_fadeoutcommand_try_into_packet(struct FadeOutCommand */*notnull*/ instance);
struct Packet *sp_fade_out_command_try_into_packet(struct FadeOutCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::GenericCommand::clone`].
* Calls method [`GenericCommand::clone`].
*
*Clones a [`GenericCommand`] instance.
*
* This function is part of the `genericcommand` module.
* This function is part of the `generic_command` module.
*/
struct GenericCommand */*notnull*/ sp_genericcommand_clone(struct GenericCommand */*notnull*/ instance);
struct GenericCommand */*notnull*/ sp_generic_command_clone(struct GenericCommand */*notnull*/ instance);
/**
*Deallocates a [`GenericCommand`] instance.
*
* This function is part of the `genericcommand` module.
* This function is part of the `generic_command` module.
*/
void sp_genericcommand_free(struct GenericCommand */*notnull*/ instance);
void sp_generic_command_free(struct GenericCommand */*notnull*/ instance);
/**
* Tries to turn a [Packet] into a [GenericCommand].
@ -1911,9 +1925,9 @@ void sp_genericcommand_free(struct GenericCommand */*notnull*/ instance);
*
* Returns: pointer to new [GenericCommand] instance or NULL if parsing failed.
*
* This function is part of the `genericcommand` module.
* This function is part of the `generic_command` module.
*/
struct GenericCommand */*notnull*/ sp_genericcommand_try_from_packet(struct Packet */*notnull*/ packet);
struct GenericCommand */*notnull*/ sp_generic_command_try_from_packet(struct Packet */*notnull*/ packet);
/**
* Tries to turn a [GenericCommand] into a [Packet].
@ -1921,74 +1935,76 @@ struct GenericCommand */*notnull*/ sp_genericcommand_try_from_packet(struct Pack
*
* Returns tag [CommandTag::Invalid] in case of an error.
*
* This function is part of the `genericcommand` module.
* This function is part of the `generic_command` module.
*/
struct Packet *sp_genericcommand_try_into_packet(struct GenericCommand */*notnull*/ command);
struct Packet *sp_generic_command_try_into_packet(struct GenericCommand */*notnull*/ command);
/**
* Calls method [`servicepoint::GlobalBrightnessCommand::clone`].
* Calls method [`GlobalBrightnessCommand::clone`].
*
*Clones a [`GlobalBrightnessCommand`] instance.
*
* This function is part of the `globalbrightnesscommand` module.
* This function is part of the `global_brightness_command` module.
*/
struct GlobalBrightnessCommand */*notnull*/ sp_globalbrightnesscommand_clone(struct GlobalBrightnessCommand */*notnull*/ instance);
struct GlobalBrightnessCommand */*notnull*/ sp_global_brightness_command_clone(struct GlobalBrightnessCommand */*notnull*/ instance);
/**
*Deallocates a [`GlobalBrightnessCommand`] instance.
*
* This function is part of the `globalbrightnesscommand` module.
* This function is part of the `global_brightness_command` module.
*/
void sp_globalbrightnesscommand_free(struct GlobalBrightnessCommand */*notnull*/ instance);
void sp_global_brightness_command_free(struct GlobalBrightnessCommand */*notnull*/ instance);
/**
* Gets the value of field `brightness` of the [`servicepoint::GlobalBrightnessCommand`].
*
* This function is part of the `globalbrightnesscommand` module.
* This function is part of the `global_brightness_command` module.
*/
Brightness sp_globalbrightnesscommand_get_brightness(struct GlobalBrightnessCommand */*notnull*/ instance);
Brightness sp_global_brightness_command_get_brightness(struct GlobalBrightnessCommand */*notnull*/ instance);
/**
* Set the brightness of all tiles to the same value.
*
* Returns: a new [GlobalBrightnessCommand] instance.
*
* This function is part of the `globalbrightnesscommand` module.
* This function is part of the `global_brightness_command` module.
*/
struct GlobalBrightnessCommand */*notnull*/ sp_globalbrightnesscommand_new(Brightness brightness);
struct GlobalBrightnessCommand */*notnull*/ sp_global_brightness_command_new(Brightness brightness);
/**
* Sets the value of field `brightness` of the [`servicepoint::GlobalBrightnessCommand`].
*
* This function is part of the `globalbrightnesscommand` module.
* This function is part of the `global_brightness_command` module.
*/
void sp_globalbrightnesscommand_set_brightness(struct GlobalBrightnessCommand */*notnull*/ instance,
Brightness value);
void sp_global_brightness_command_set_brightness(struct GlobalBrightnessCommand */*notnull*/ instance,
Brightness value);
/**
*Tries to turn a [`GlobalBrightnessCommand`] into a [Packet].
*
* Returns: NULL or a [Packet] containing the command.
*
* This function is part of the `globalbrightnesscommand` module.
* [Packet]: [`servicepoint::Packet`]
*
* This function is part of the `global_brightness_command` module.
*/
struct Packet *sp_globalbrightnesscommand_try_into_packet(struct GlobalBrightnessCommand */*notnull*/ instance);
struct Packet *sp_global_brightness_command_try_into_packet(struct GlobalBrightnessCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::HardResetCommand::clone`].
* Calls method [`HardResetCommand::clone`].
*
*Clones a [`HardResetCommand`] instance.
*
* This function is part of the `hardresetcommand` module.
* This function is part of the `hard_reset_command` module.
*/
struct HardResetCommand */*notnull*/ sp_hardresetcommand_clone(struct HardResetCommand */*notnull*/ instance);
struct HardResetCommand */*notnull*/ sp_hard_reset_command_clone(struct HardResetCommand */*notnull*/ instance);
/**
*Deallocates a [`HardResetCommand`] instance.
*
* This function is part of the `hardresetcommand` module.
* This function is part of the `hard_reset_command` module.
*/
void sp_hardresetcommand_free(struct HardResetCommand */*notnull*/ instance);
void sp_hard_reset_command_free(struct HardResetCommand */*notnull*/ instance);
/**
* Kills the udp daemon on the display, which usually results in a restart.
@ -1997,21 +2013,23 @@ void sp_hardresetcommand_free(struct HardResetCommand */*notnull*/ instance);
*
* Returns: a new [`HardResetCommand`] instance.
*
* This function is part of the `hardresetcommand` module.
* This function is part of the `hard_reset_command` module.
*/
struct HardResetCommand */*notnull*/ sp_hardresetcommand_new(void);
struct HardResetCommand */*notnull*/ sp_hard_reset_command_new(void);
/**
*Tries to turn a [`HardResetCommand`] into a [Packet].
*
* Returns: NULL or a [Packet] containing the command.
*
* This function is part of the `hardresetcommand` module.
* [Packet]: [`servicepoint::Packet`]
*
* This function is part of the `hard_reset_command` module.
*/
struct Packet *sp_hardresetcommand_try_into_packet(struct HardResetCommand */*notnull*/ instance);
struct Packet *sp_hard_reset_command_try_into_packet(struct HardResetCommand */*notnull*/ instance);
/**
* Calls method [`servicepoint::Packet::clone`].
* Calls method [`Packet::clone`].
*
*Clones a [`Packet`] instance.
*
@ -2116,9 +2134,9 @@ bool sp_sp_u16_to_command_code(uint16_t code,
/**
*Deallocates a [`UdpSocket`] instance.
*
* This function is part of the `udpsocket` module.
* This function is part of the `udp_socket` module.
*/
void sp_udpsocket_free(struct UdpSocket */*notnull*/ instance);
void sp_udp_socket_free(struct UdpSocket */*notnull*/ instance);
/**
* Creates a new instance of [UdpSocket].
@ -2133,9 +2151,9 @@ void sp_udpsocket_free(struct UdpSocket */*notnull*/ instance);
* sp_udp_send_command(connection, sp_command_clear());
* ```
*
* This function is part of the `udpsocket` module.
* This function is part of the `udp_socket` module.
*/
struct UdpSocket *sp_udpsocket_open(char */*notnull*/ host);
struct UdpSocket *sp_udp_socket_open(char */*notnull*/ host);
/**
* Creates a new instance of [UdpSocket].
@ -2150,13 +2168,13 @@ struct UdpSocket *sp_udpsocket_open(char */*notnull*/ host);
* sp_udp_send_command(connection, sp_command_clear());
* ```
*
* This function is part of the `udpsocket` module.
* This function is part of the `udp_socket` module.
*/
struct UdpSocket *sp_udpsocket_open_ipv4(uint8_t ip1,
uint8_t ip2,
uint8_t ip3,
uint8_t ip4,
uint16_t port);
struct UdpSocket *sp_udp_socket_open_ipv4(uint8_t ip1,
uint8_t ip2,
uint8_t ip3,
uint8_t ip4,
uint16_t port);
/**
* Sends a [GenericCommand] to the display using the [UdpSocket].
@ -2171,10 +2189,10 @@ struct UdpSocket *sp_udpsocket_open_ipv4(uint8_t ip1,
* sp_udp_send_command(connection, sp_command_brightness(5));
* ```
*
* This function is part of the `udpsocket` module.
* This function is part of the `udp_socket` module.
*/
bool sp_udpsocket_send_command(struct UdpSocket */*notnull*/ connection,
struct GenericCommand */*notnull*/ command);
bool sp_udp_socket_send_command(struct UdpSocket */*notnull*/ connection,
struct GenericCommand */*notnull*/ command);
/**
* Sends a [Header] to the display using the [UdpSocket].
@ -2187,10 +2205,10 @@ bool sp_udpsocket_send_command(struct UdpSocket */*notnull*/ connection,
* sp_udp_send_header(connection, sp_command_brightness(5));
* ```
*
* This function is part of the `udpsocket` module.
* This function is part of the `udp_socket` module.
*/
bool sp_udpsocket_send_header(struct UdpSocket */*notnull*/ udp_connection,
struct Header header);
bool sp_udp_socket_send_header(struct UdpSocket */*notnull*/ udp_connection,
struct Header header);
/**
* Sends a [Packet] to the display using the [UdpSocket].
@ -2199,10 +2217,10 @@ bool sp_udpsocket_send_header(struct UdpSocket */*notnull*/ udp_connection,
*
* returns: true in case of success
*
* This function is part of the `udpsocket` module.
* This function is part of the `udp_socket` module.
*/
bool sp_udpsocket_send_packet(struct UdpSocket */*notnull*/ connection,
struct Packet */*notnull*/ packet);
bool sp_udp_socket_send_packet(struct UdpSocket */*notnull*/ connection,
struct Packet */*notnull*/ packet);
#ifdef __cplusplus
} // extern "C"

View file

@ -46,7 +46,7 @@ macro_rules! wrap_method {
$impl:block;
) => {
paste::paste! {
$crate::macros::wrap_functions!([< $object_type:lower >];
$crate::macros::wrap_functions!(associate $object_type;
$(#[$meta])*
fn $function(
$instance: $ref_or_mut ::core::ptr::NonNull<$object_type>
@ -246,7 +246,7 @@ macro_rules! wrap_functions {
)+
) => {
::paste::paste! {
$crate::macros::wrap_functions!{[< $object_type:lower >];
$crate::macros::wrap_functions!{[< $object_type:snake >];
$(
$(#[$meta])+
fn $function($($param_name: $param_modifier $param_type),*) $(-> $return_modifier $return_type)?