the rest of the functions wrapped with macro
This commit is contained in:
parent
c492cfab6b
commit
b79a2534fc
7 changed files with 485 additions and 485 deletions
|
@ -633,12 +633,6 @@ typedef struct Header {
|
|||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
/**
|
||||
* Call this function at the beginning of main to enable rust logging controlled by the
|
||||
* `RUST_LOG` environment variable. See [env_logger](https://docs.rs/env_logger/latest/env_logger/).
|
||||
*/
|
||||
void init_env_logger(void);
|
||||
|
||||
/**
|
||||
*Clones a [`Bitmap`] instance.
|
||||
*
|
||||
|
@ -1655,7 +1649,7 @@ void sp_cmd_clear_free(struct ClearCommand */*notnull*/ instance);
|
|||
*
|
||||
* Does not affect brightness.
|
||||
*
|
||||
* Returns: a new [ClearCommand] instance.
|
||||
* Returns: a new [`ClearCommand`] instance.
|
||||
*
|
||||
* This function is part of the sp_cmd_clear module.
|
||||
*/
|
||||
|
@ -1752,7 +1746,7 @@ void sp_cmd_fade_out_free(struct FadeOutCommand */*notnull*/ instance);
|
|||
/**
|
||||
* A yet-to-be-tested command.
|
||||
*
|
||||
* Returns: a new [FadeOutCommand] instance.
|
||||
* Returns: a new [`FadeOutCommand`] instance.
|
||||
*
|
||||
* This function is part of the sp_cmd_fade_out module.
|
||||
*/
|
||||
|
@ -1762,6 +1756,8 @@ struct FadeOutCommand */*notnull*/ sp_cmd_fade_out_new(void);
|
|||
* Clones an [SPCommand] instance.
|
||||
*
|
||||
* returns: a new [SPCommand] instance.
|
||||
*
|
||||
* This function is part of the sp_cmd_generic module.
|
||||
*/
|
||||
struct Command sp_cmd_generic_clone(struct Command command);
|
||||
|
||||
|
@ -1776,6 +1772,8 @@ struct Command sp_cmd_generic_clone(struct Command command);
|
|||
* SPCommand c = sp_cmd_clear_into_generic(sp_cmd_clear_new());
|
||||
* sp_command_free(c);
|
||||
* ```
|
||||
*
|
||||
* This function is part of the sp_cmd_generic module.
|
||||
*/
|
||||
void sp_cmd_generic_free(struct Command command);
|
||||
|
||||
|
@ -1784,6 +1782,8 @@ void sp_cmd_generic_free(struct Command command);
|
|||
* The [SPCommand] gets consumed.
|
||||
*
|
||||
* Returns tag [CommandTag::Invalid] in case of an error.
|
||||
*
|
||||
* This function is part of the sp_cmd_generic module.
|
||||
*/
|
||||
struct Packet *sp_cmd_generic_into_packet(struct Command command);
|
||||
|
||||
|
@ -1793,6 +1793,8 @@ struct Packet *sp_cmd_generic_into_packet(struct Command command);
|
|||
* The packet is dropped in the process.
|
||||
*
|
||||
* Returns: pointer to new [SPCommand] instance or NULL if parsing failed.
|
||||
*
|
||||
* This function is part of the sp_cmd_generic module.
|
||||
*/
|
||||
struct Command sp_cmd_generic_try_from_packet(struct Packet */*notnull*/ packet);
|
||||
|
||||
|
@ -1808,7 +1810,7 @@ void sp_cmd_hard_reset_free(struct HardResetCommand */*notnull*/ instance);
|
|||
*
|
||||
* Please do not send this in your normal program flow.
|
||||
*
|
||||
* Returns: a new [HardResetCommand] instance.
|
||||
* Returns: a new [`HardResetCommand`] instance.
|
||||
*
|
||||
* This function is part of the sp_cmd_hard_reset module.
|
||||
*/
|
||||
|
@ -1942,6 +1944,14 @@ void sp_cp437_grid_set(Cp437Grid */*notnull*/ instance,
|
|||
*/
|
||||
size_t sp_cp437_grid_width(Cp437Grid */*notnull*/ instance);
|
||||
|
||||
/**
|
||||
* Call this function at the beginning of main to enable rust logging controlled by the
|
||||
* `RUST_LOG` environment variable. See [env_logger](https://docs.rs/env_logger/latest/env_logger/).
|
||||
*
|
||||
* This function is part of the sp_envlogger module.
|
||||
*/
|
||||
void sp_envlogger_init(void);
|
||||
|
||||
/**
|
||||
*Clones a [`Packet`] instance.
|
||||
*
|
||||
|
@ -1960,6 +1970,8 @@ void sp_packet_free(struct Packet */*notnull*/ instance);
|
|||
* Creates a raw [Packet] from parts.
|
||||
*
|
||||
* returns: new instance. Will never return null.
|
||||
*
|
||||
* This function is part of the sp_packet module.
|
||||
*/
|
||||
struct Packet */*notnull*/ sp_packet_from_parts(struct Header header,
|
||||
struct ByteSlice payload);
|
||||
|
@ -1972,11 +1984,14 @@ struct Packet */*notnull*/ sp_packet_from_parts(struct Header header,
|
|||
struct Header sp_packet_get_header(struct Packet */*notnull*/ instance);
|
||||
|
||||
/**
|
||||
* Returns a pointer to the header field of the provided packet.
|
||||
* Gets a reference to the field `header` of the [`servicepoint::Packet`].
|
||||
*
|
||||
* The returned header can be changed and will be valid for the lifetime of the packet.
|
||||
* - 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 sp_packet module.
|
||||
*/
|
||||
struct Header */*notnull*/ sp_packet_get_header_mut(struct Packet */*notnull*/ packet);
|
||||
struct Header */*notnull*/ sp_packet_get_header_mut(struct Packet */*notnull*/ instance);
|
||||
|
||||
/**
|
||||
* Returns a pointer to the current payload of the provided packet.
|
||||
|
@ -1984,6 +1999,8 @@ struct Header */*notnull*/ sp_packet_get_header_mut(struct Packet */*notnull*/ p
|
|||
* Returns an [ByteSlice::INVALID] instance in case the packet does not have any payload.
|
||||
*
|
||||
* The returned memory can be changed and will be valid until a new payload is set.
|
||||
*
|
||||
* This function is part of the sp_packet module.
|
||||
*/
|
||||
struct ByteSlice sp_packet_get_payload(struct Packet */*notnull*/ packet);
|
||||
|
||||
|
@ -1993,9 +2010,11 @@ struct ByteSlice sp_packet_get_payload(struct Packet */*notnull*/ packet);
|
|||
* # Panics
|
||||
*
|
||||
* - if the buffer is not big enough to hold header+payload.
|
||||
*
|
||||
* This function is part of the sp_packet module.
|
||||
*/
|
||||
void sp_packet_serialize_to(struct Packet */*notnull*/ packet,
|
||||
struct ByteSlice buffer);
|
||||
size_t sp_packet_serialize_to(struct Packet */*notnull*/ packet,
|
||||
struct ByteSlice buffer);
|
||||
|
||||
/**
|
||||
* Sets the value of field `header` of the [`servicepoint::Packet`].
|
||||
|
@ -2009,6 +2028,8 @@ void sp_packet_set_header(struct Packet */*notnull*/ instance,
|
|||
* Sets the payload of the provided packet to the provided data.
|
||||
*
|
||||
* This makes previous payload pointers invalid.
|
||||
*
|
||||
* This function is part of the sp_packet module.
|
||||
*/
|
||||
void sp_packet_set_payload(struct Packet */*notnull*/ packet,
|
||||
struct ByteSlice data);
|
||||
|
@ -2017,6 +2038,8 @@ void sp_packet_set_payload(struct Packet */*notnull*/ packet,
|
|||
* Tries to load a [Packet] from the passed array with the specified length.
|
||||
*
|
||||
* returns: NULL in case of an error, pointer to the allocated packet otherwise
|
||||
*
|
||||
* This function is part of the sp_packet module.
|
||||
*/
|
||||
struct Packet *sp_packet_try_load(struct ByteSlice data);
|
||||
|
||||
|
@ -2024,6 +2047,8 @@ struct Packet *sp_packet_try_load(struct ByteSlice data);
|
|||
* Converts u16 into [CommandCode].
|
||||
*
|
||||
* If the provided value is not valid, false is returned and result is not changed.
|
||||
*
|
||||
* This function is part of the sp module.
|
||||
*/
|
||||
bool sp_u16_to_command_code(uint16_t code,
|
||||
CommandCode *result);
|
||||
|
@ -2047,6 +2072,8 @@ void sp_udp_free(struct UdpSocket */*notnull*/ instance);
|
|||
* if (connection != NULL)
|
||||
* sp_udp_send_command(connection, sp_command_clear());
|
||||
* ```
|
||||
*
|
||||
* This function is part of the sp_udp module.
|
||||
*/
|
||||
struct UdpSocket *sp_udp_open(char */*notnull*/ host);
|
||||
|
||||
|
@ -2062,6 +2089,8 @@ struct UdpSocket *sp_udp_open(char */*notnull*/ host);
|
|||
* if (connection != NULL)
|
||||
* sp_udp_send_command(connection, sp_command_clear());
|
||||
* ```
|
||||
*
|
||||
* This function is part of the sp_udp module.
|
||||
*/
|
||||
struct UdpSocket *sp_udp_open_ipv4(uint8_t ip1,
|
||||
uint8_t ip2,
|
||||
|
@ -2081,6 +2110,8 @@ struct UdpSocket *sp_udp_open_ipv4(uint8_t ip1,
|
|||
* ```C
|
||||
* sp_udp_send_command(connection, sp_command_brightness(5));
|
||||
* ```
|
||||
*
|
||||
* This function is part of the sp_udp module.
|
||||
*/
|
||||
bool sp_udp_send_command(struct UdpSocket */*notnull*/ connection,
|
||||
struct Command command);
|
||||
|
@ -2095,6 +2126,8 @@ bool sp_udp_send_command(struct UdpSocket */*notnull*/ connection,
|
|||
* ```C
|
||||
* sp_udp_send_header(connection, sp_command_brightness(5));
|
||||
* ```
|
||||
*
|
||||
* This function is part of the sp_udp module.
|
||||
*/
|
||||
bool sp_udp_send_header(struct UdpSocket */*notnull*/ udp_connection,
|
||||
struct Header header);
|
||||
|
@ -2105,6 +2138,8 @@ bool sp_udp_send_header(struct UdpSocket */*notnull*/ udp_connection,
|
|||
* The passed `packet` gets consumed.
|
||||
*
|
||||
* returns: true in case of success
|
||||
*
|
||||
* This function is part of the sp_udp module.
|
||||
*/
|
||||
bool sp_udp_send_packet(struct UdpSocket */*notnull*/ connection,
|
||||
struct Packet */*notnull*/ packet);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue