wip update to next servicepoint version
This commit is contained in:
		
							parent
							
								
									ac3c470b44
								
							
						
					
					
						commit
						da1c5ebb03
					
				
					 13 changed files with 242 additions and 235 deletions
				
			
		| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
/* Generated with cbindgen:0.27.0 */
 | 
			
		||||
/* Generated with cbindgen:0.28.0 */
 | 
			
		||||
 | 
			
		||||
/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -168,19 +168,6 @@ typedef struct SPCharGrid SPCharGrid;
 | 
			
		|||
 */
 | 
			
		||||
typedef struct SPCommand SPCommand;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * A connection to the display.
 | 
			
		||||
 *
 | 
			
		||||
 * # Examples
 | 
			
		||||
 *
 | 
			
		||||
 * ```C
 | 
			
		||||
 * CConnection connection = sp_connection_open("172.23.42.29:2342");
 | 
			
		||||
 * if (connection != NULL)
 | 
			
		||||
 *     sp_connection_send_command(connection, sp_command_clear());
 | 
			
		||||
 * ```
 | 
			
		||||
 */
 | 
			
		||||
typedef struct SPConnection SPConnection;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * A C-wrapper for grid containing codepage 437 characters.
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			@ -202,6 +189,19 @@ typedef struct SPCp437Grid SPCp437Grid;
 | 
			
		|||
 */
 | 
			
		||||
typedef struct SPPacket SPPacket;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * A connection to the display.
 | 
			
		||||
 *
 | 
			
		||||
 * # Examples
 | 
			
		||||
 *
 | 
			
		||||
 * ```C
 | 
			
		||||
 * CConnection connection = sp_connection_open("172.23.42.29:2342");
 | 
			
		||||
 * if (connection != NULL)
 | 
			
		||||
 *     sp_connection_send_command(connection, sp_command_clear());
 | 
			
		||||
 * ```
 | 
			
		||||
 */
 | 
			
		||||
typedef struct SPUdpConnection SPUdpConnection;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Represents a span of memory (`&mut [u8]` ) as a struct usable by C code.
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			@ -290,7 +290,7 @@ void sp_bitmap_fill(SPBitmap *bitmap, bool value);
 | 
			
		|||
 *
 | 
			
		||||
 * [SPCommand]: [crate::SPCommand]
 | 
			
		||||
 */
 | 
			
		||||
void sp_bitmap_free(SPBitmap *bitmap);
 | 
			
		||||
void sp_bitmap_free(SPBitmap **bitmap);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Gets the current value at the specified position in the [SPBitmap].
 | 
			
		||||
| 
						 | 
				
			
			@ -341,13 +341,18 @@ size_t sp_bitmap_height(const SPBitmap *bitmap);
 | 
			
		|||
 * - `width`: size in pixels in x-direction
 | 
			
		||||
 * - `height`: size in pixels in y-direction
 | 
			
		||||
 *
 | 
			
		||||
 * returns: [SPBitmap] that contains a copy of the provided data. Will never return NULL.
 | 
			
		||||
 * returns: [SPBitmap] that contains a copy of the provided data, or NULL in case of an error.
 | 
			
		||||
 *
 | 
			
		||||
 * # Errors
 | 
			
		||||
 *
 | 
			
		||||
 * In the following cases, this function will return NULL:
 | 
			
		||||
 *
 | 
			
		||||
 * - when the dimensions and data size do not match exactly.
 | 
			
		||||
 * - when the width is not dividable by 8
 | 
			
		||||
 *
 | 
			
		||||
 * # Panics
 | 
			
		||||
 *
 | 
			
		||||
 * - when `data` is NULL
 | 
			
		||||
 * - when the dimensions and data size do not match exactly.
 | 
			
		||||
 * - when the width is not dividable by 8
 | 
			
		||||
 *
 | 
			
		||||
 * # Safety
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			@ -370,9 +375,11 @@ SPBitmap *sp_bitmap_load(size_t width,
 | 
			
		|||
 * - `width`: size in pixels in x-direction
 | 
			
		||||
 * - `height`: size in pixels in y-direction
 | 
			
		||||
 *
 | 
			
		||||
 * returns: [SPBitmap] initialized to all pixels off. Will never return NULL.
 | 
			
		||||
 * returns: [SPBitmap] initialized to all pixels off, or NULL in case of an error.
 | 
			
		||||
 *
 | 
			
		||||
 * # Panics
 | 
			
		||||
 * # Errors
 | 
			
		||||
 *
 | 
			
		||||
 * In the following cases, this function will return NULL:
 | 
			
		||||
 *
 | 
			
		||||
 * - when the width is not dividable by 8
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			@ -1206,7 +1213,7 @@ SPCommand *sp_command_bitmap_linear_or(size_t offset,
 | 
			
		|||
SPCommand *sp_command_bitmap_linear_win(size_t x,
 | 
			
		||||
                                        size_t y,
 | 
			
		||||
                                        SPBitmap *bitmap,
 | 
			
		||||
                                        SPCompressionCode compression_code);
 | 
			
		||||
                                        SPCompressionCode compression);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Set pixel data according to a xor-mask starting at the offset.
 | 
			
		||||
| 
						 | 
				
			
			@ -1449,21 +1456,7 @@ SPCommand *sp_command_utf8_data(size_t x,
 | 
			
		|||
                                SPCharGrid *grid);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Creates a new instance of [SPConnection] for testing that does not actually send anything.
 | 
			
		||||
 *
 | 
			
		||||
 * returns: a new instance. Will never return NULL.
 | 
			
		||||
 *
 | 
			
		||||
 * # Safety
 | 
			
		||||
 *
 | 
			
		||||
 * The caller has to make sure that:
 | 
			
		||||
 *
 | 
			
		||||
 * - the returned instance is freed in some way, either by using a consuming function or
 | 
			
		||||
 *   by explicitly calling `sp_connection_free`.
 | 
			
		||||
 */
 | 
			
		||||
SPConnection *sp_connection_fake(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Closes and deallocates a [SPConnection].
 | 
			
		||||
 * Closes and deallocates a [SPUdpConnection].
 | 
			
		||||
 *
 | 
			
		||||
 * # Panics
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			@ -1473,13 +1466,13 @@ SPConnection *sp_connection_fake(void);
 | 
			
		|||
 *
 | 
			
		||||
 * The caller has to make sure that:
 | 
			
		||||
 *
 | 
			
		||||
 * - `connection` points to a valid [SPConnection]
 | 
			
		||||
 * - `connection` points to a valid [SPUdpConnection]
 | 
			
		||||
 * - `connection` is not used concurrently or after this call
 | 
			
		||||
 */
 | 
			
		||||
void sp_connection_free(SPConnection *connection);
 | 
			
		||||
void sp_connection_free(SPUdpConnection *connection);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Creates a new instance of [SPConnection].
 | 
			
		||||
 * Creates a new instance of [SPUdpConnection].
 | 
			
		||||
 *
 | 
			
		||||
 * returns: NULL if connection fails, or connected instance
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			@ -1494,10 +1487,10 @@ void sp_connection_free(SPConnection *connection);
 | 
			
		|||
 * - the returned instance is freed in some way, either by using a consuming function or
 | 
			
		||||
 *   by explicitly calling `sp_connection_free`.
 | 
			
		||||
 */
 | 
			
		||||
SPConnection *sp_connection_open(const char *host);
 | 
			
		||||
SPUdpConnection *sp_connection_open(const char *host);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sends a [SPCommand] to the display using the [SPConnection].
 | 
			
		||||
 * Sends a [SPCommand] to the display using the [SPUdpConnection].
 | 
			
		||||
 *
 | 
			
		||||
 * The passed `command` gets consumed.
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			@ -1512,15 +1505,15 @@ SPConnection *sp_connection_open(const char *host);
 | 
			
		|||
 *
 | 
			
		||||
 * The caller has to make sure that:
 | 
			
		||||
 *
 | 
			
		||||
 * - `connection` points to a valid instance of [SPConnection]
 | 
			
		||||
 * - `connection` points to a valid instance of [SPUdpConnection]
 | 
			
		||||
 * - `command` points to a valid instance of [SPPacket]
 | 
			
		||||
 * - `command` is not used concurrently or after this call
 | 
			
		||||
 */
 | 
			
		||||
bool sp_connection_send_command(const SPConnection *connection,
 | 
			
		||||
bool sp_connection_send_command(const SPUdpConnection *connection,
 | 
			
		||||
                                SPCommand *command);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sends a [SPPacket] to the display using the [SPConnection].
 | 
			
		||||
 * Sends a [SPPacket] to the display using the [SPUdpConnection].
 | 
			
		||||
 *
 | 
			
		||||
 * The passed `packet` gets consumed.
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			@ -1535,11 +1528,11 @@ bool sp_connection_send_command(const SPConnection *connection,
 | 
			
		|||
 *
 | 
			
		||||
 * The caller has to make sure that:
 | 
			
		||||
 *
 | 
			
		||||
 * - `connection` points to a valid instance of [SPConnection]
 | 
			
		||||
 * - `connection` points to a valid instance of [SPUdpConnection]
 | 
			
		||||
 * - `packet` points to a valid instance of [SPPacket]
 | 
			
		||||
 * - `packet` is not used concurrently or after this call
 | 
			
		||||
 */
 | 
			
		||||
bool sp_connection_send_packet(const SPConnection *connection,
 | 
			
		||||
bool sp_connection_send_packet(const SPUdpConnection *connection,
 | 
			
		||||
                               SPPacket *packet);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
#include "servicepoint.h"
 | 
			
		||||
 | 
			
		||||
int main(void) {
 | 
			
		||||
    SPConnection *connection = sp_connection_open("localhost:2342");
 | 
			
		||||
    SPUdpConnection *connection = sp_connection_open("localhost:2342");
 | 
			
		||||
    if (connection == NULL)
 | 
			
		||||
        return 1;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue