wip 80k example
This commit is contained in:
parent
57d9e90b0f
commit
0d4bf5ac10
8 changed files with 115 additions and 44 deletions
|
@ -168,6 +168,19 @@ 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.
|
||||
*
|
||||
|
@ -189,19 +202,6 @@ 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].
|
||||
|
@ -1456,7 +1456,7 @@ SPCommand *sp_command_utf8_data(size_t x,
|
|||
SPCharGrid *grid);
|
||||
|
||||
/**
|
||||
* Closes and deallocates a [SPUdpConnection].
|
||||
* Closes and deallocates a [SPConnection].
|
||||
*
|
||||
* # Panics
|
||||
*
|
||||
|
@ -1466,13 +1466,13 @@ SPCommand *sp_command_utf8_data(size_t x,
|
|||
*
|
||||
* The caller has to make sure that:
|
||||
*
|
||||
* - `connection` points to a valid [SPUdpConnection]
|
||||
* - `connection` points to a valid [SPConnection]
|
||||
* - `connection` is not used concurrently or after this call
|
||||
*/
|
||||
void sp_connection_free(SPUdpConnection *connection);
|
||||
void sp_connection_free(SPConnection *connection);
|
||||
|
||||
/**
|
||||
* Creates a new instance of [SPUdpConnection].
|
||||
* Creates a new instance of [SPConnection].
|
||||
*
|
||||
* returns: NULL if connection fails, or connected instance
|
||||
*
|
||||
|
@ -1487,10 +1487,10 @@ void sp_connection_free(SPUdpConnection *connection);
|
|||
* - the returned instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_connection_free`.
|
||||
*/
|
||||
SPUdpConnection *sp_connection_open(const char *host);
|
||||
SPConnection *sp_connection_open(const char *host);
|
||||
|
||||
/**
|
||||
* Sends a [SPCommand] to the display using the [SPUdpConnection].
|
||||
* Sends a [SPCommand] to the display using the [SPConnection].
|
||||
*
|
||||
* The passed `command` gets consumed.
|
||||
*
|
||||
|
@ -1505,15 +1505,15 @@ SPUdpConnection *sp_connection_open(const char *host);
|
|||
*
|
||||
* The caller has to make sure that:
|
||||
*
|
||||
* - `connection` points to a valid instance of [SPUdpConnection]
|
||||
* - `connection` points to a valid instance of [SPConnection]
|
||||
* - `command` points to a valid instance of [SPPacket]
|
||||
* - `command` is not used concurrently or after this call
|
||||
*/
|
||||
bool sp_connection_send_command(const SPUdpConnection *connection,
|
||||
bool sp_connection_send_command(const SPConnection *connection,
|
||||
SPCommand *command);
|
||||
|
||||
/**
|
||||
* Sends a [SPPacket] to the display using the [SPUdpConnection].
|
||||
* Sends a [SPPacket] to the display using the [SPConnection].
|
||||
*
|
||||
* The passed `packet` gets consumed.
|
||||
*
|
||||
|
@ -1528,11 +1528,11 @@ bool sp_connection_send_command(const SPUdpConnection *connection,
|
|||
*
|
||||
* The caller has to make sure that:
|
||||
*
|
||||
* - `connection` points to a valid instance of [SPUdpConnection]
|
||||
* - `connection` points to a valid instance of [SPConnection]
|
||||
* - `packet` points to a valid instance of [SPPacket]
|
||||
* - `packet` is not used concurrently or after this call
|
||||
*/
|
||||
bool sp_connection_send_packet(const SPUdpConnection *connection,
|
||||
bool sp_connection_send_packet(const SPConnection *connection,
|
||||
SPPacket *packet);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue