// // This code is generated by csbindgen. // DON'T CHANGE THIS DIRECTLY. // #pragma warning disable CS8500 #pragma warning disable CS8981 using System; using System.Runtime.InteropServices; namespace ServicePoint.BindGen { public static unsafe partial class CommandNative { const string __DllName = "servicepoint_binding_c"; /// /// Tries to turn a [SPPacket] into a [SPCommand]. /// /// The packet is deallocated in the process. /// /// Returns: pointer to new [SPCommand] instance or NULL if parsing failed. /// /// # Panics /// /// - when `packet` is NULL /// /// # Safety /// /// The caller has to make sure that: /// /// - [SPPacket] points to a valid instance of [SPPacket] /// - [SPPacket] is not used concurrently or after this call /// - the result is checked for NULL /// - the returned [SPCommand] instance is freed in some way, either by using a consuming function or /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_try_from_packet", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_try_from_packet(Packet* packet); /// /// Clones a [SPCommand] instance. /// /// returns: new [SPCommand] instance. Will never return NULL. /// /// # Panics /// /// - when `command` is NULL /// /// # Safety /// /// The caller has to make sure that: /// /// - `command` points to a valid instance of [SPCommand] /// - `command` is not written to concurrently /// - the returned [SPCommand] instance is freed in some way, either by using a consuming function or /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_clone(Command* command); /// /// Set all pixels to the off state. /// /// Does not affect brightness. /// /// Returns: a new [Command::Clear] instance. Will never return NULL. /// /// # Examples /// /// ```C /// sp_connection_send_command(connection, sp_command_clear()); /// ``` /// /// # Safety /// /// The caller has to make sure that: /// /// - the returned [SPCommand] instance is freed in some way, either by using a consuming function or /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_clear", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_clear(); /// /// Kills the udp daemon on the display, which usually results in a restart. /// /// Please do not send this in your normal program flow. /// /// Returns: a new [Command::HardReset] instance. Will never return NULL. /// /// # Safety /// /// The caller has to make sure that: /// /// - the returned [SPCommand] instance is freed in some way, either by using a consuming function or /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_hard_reset", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_hard_reset(); /// /// A yet-to-be-tested command. /// /// Returns: a new `Command::FadeOut` instance. Will never return NULL. /// /// # Safety /// /// The caller has to make sure that: /// /// - the returned [SPCommand] instance is freed in some way, either by using a consuming function or /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_fade_out", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_fade_out(); /// /// Set the brightness of all tiles to the same value. /// /// Returns: a new [Command::Brightness] instance. Will never return NULL. /// /// # Panics /// /// - When the provided brightness value is out of range (0-11). /// /// # Safety /// /// The caller has to make sure that: /// /// - the returned [SPCommand] instance is freed in some way, either by using a consuming function or /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_brightness", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_brightness(byte brightness); /// /// Set the brightness of individual tiles in a rectangular area of the display. /// /// The passed [SPBrightnessGrid] gets consumed. /// /// Returns: a new [Command::CharBrightness] instance. Will never return NULL. /// /// # Panics /// /// - when `grid` is NULL /// /// # Safety /// /// The caller has to make sure that: /// /// - `grid` points to a valid instance of [SPBrightnessGrid] /// - `grid` is not used concurrently or after this call /// - the returned [SPCommand] instance is freed in some way, either by using a consuming function or /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_char_brightness", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_char_brightness(nuint x, nuint y, BrightnessGrid* grid); /// /// 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 contained [SPBitVec] is always uncompressed. /// /// The passed [SPBitVec] gets consumed. /// /// Returns: a new [Command::BitmapLinear] instance. Will never return NULL. /// /// # Panics /// /// - when `bit_vec` is null /// - when `compression_code` is not a valid value /// /// # Safety /// /// The caller has to make sure that: /// /// - `bit_vec` points to a valid instance of [SPBitVec] /// - `bit_vec` is not used concurrently or after this call /// - `compression` matches one of the allowed enum values /// - the returned [SPCommand] instance is freed in some way, either by using a consuming function or /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_bitmap_linear(nuint offset, BitVec* bit_vec, CompressionCode compression); /// /// Set pixel data according to an and-mask starting at the offset. /// /// 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 contained [SPBitVec] is always uncompressed. /// /// The passed [SPBitVec] gets consumed. /// /// Returns: a new [Command::BitmapLinearAnd] instance. Will never return NULL. /// /// # Panics /// /// - when `bit_vec` is null /// - when `compression_code` is not a valid value /// /// # Safety /// /// The caller has to make sure that: /// /// - `bit_vec` points to a valid instance of [SPBitVec] /// - `bit_vec` is not used concurrently or after this call /// - `compression` matches one of the allowed enum values /// - the returned [SPCommand] instance is freed in some way, either by using a consuming function or /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear_and", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_bitmap_linear_and(nuint offset, BitVec* bit_vec, CompressionCode compression); /// /// Set pixel data according to an or-mask starting at the offset. /// /// 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 contained [SPBitVec] is always uncompressed. /// /// The passed [SPBitVec] gets consumed. /// /// Returns: a new [Command::BitmapLinearOr] instance. Will never return NULL. /// /// # Panics /// /// - when `bit_vec` is null /// - when `compression_code` is not a valid value /// /// # Safety /// /// The caller has to make sure that: /// /// - `bit_vec` points to a valid instance of [SPBitVec] /// - `bit_vec` is not used concurrently or after this call /// - `compression` matches one of the allowed enum values /// - the returned [SPCommand] instance is freed in some way, either by using a consuming function or /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear_or", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_bitmap_linear_or(nuint offset, BitVec* bit_vec, CompressionCode compression); /// /// Set pixel data according to a xor-mask starting at the offset. /// /// 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 contained [SPBitVec] is always uncompressed. /// /// The passed [SPBitVec] gets consumed. /// /// Returns: a new [Command::BitmapLinearXor] instance. Will never return NULL. /// /// # Panics /// /// - when `bit_vec` is null /// - when `compression_code` is not a valid value /// /// # Safety /// /// The caller has to make sure that: /// /// - `bit_vec` points to a valid instance of [SPBitVec] /// - `bit_vec` is not used concurrently or after this call /// - `compression` matches one of the allowed enum values /// - the returned [SPCommand] instance is freed in some way, either by using a consuming function or /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear_xor", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_bitmap_linear_xor(nuint offset, BitVec* bit_vec, CompressionCode compression); /// /// Show text on the screen. /// /// The passed [SPCp437Grid] gets consumed. /// /// Returns: a new [Command::Cp437Data] instance. Will never return NULL. /// /// # Panics /// /// - when `grid` is null /// /// # Safety /// /// The caller has to make sure that: /// /// - `grid` points to a valid instance of [SPCp437Grid] /// - `grid` is not used concurrently or after this call /// - the returned [SPCommand] instance is freed in some way, either by using a consuming function or /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_cp437_data", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_cp437_data(nuint x, nuint y, Cp437Grid* grid); /// /// Sets a window of pixels to the specified values. /// /// The passed [SPBitmap] gets consumed. /// /// Returns: a new [Command::BitmapLinearWin] instance. Will never return NULL. /// /// # Panics /// /// - when `bitmap` is null /// - when `compression_code` is not a valid value /// /// # Safety /// /// The caller has to make sure that: /// /// - `bitmap` points to a valid instance of [SPBitmap] /// - `bitmap` is not used concurrently or after this call /// - `compression` matches one of the allowed enum values /// - the returned [SPCommand] instance is freed in some way, either by using a consuming function or /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear_win", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_bitmap_linear_win(nuint x, nuint y, Bitmap* bitmap, CompressionCode compression_code); /// /// Deallocates a [SPCommand]. /// /// # Examples /// /// ```C /// SPCommand c = sp_command_clear(); /// sp_command_free(c); /// ``` /// /// # Panics /// /// - when `command` is NULL /// /// # Safety /// /// The caller has to make sure that: /// /// - `command` points to a valid [SPCommand] /// - `command` is not used concurrently or after this call /// - `command` was not passed to another consuming function, e.g. to create a [SPPacket] /// [DllImport(__DllName, EntryPoint = "sp_command_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp_command_free(Command* command); } [StructLayout(LayoutKind.Sequential)] public unsafe partial struct Command { } }