// // 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 ServicePoint2.BindGen { public static unsafe partial class NativeMethods { const string __DllName = "servicepoint2"; /// Creates a new `BitVec` instance. The returned instance has to be freed with `bit_vec_dealloc`. [DllImport(__DllName, EntryPoint = "sp2_bit_vec_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern BitVec* sp2_bit_vec_new(nuint size); /// Loads a `BitVec` from the provided data. The returned instance has to be freed with `bit_vec_dealloc`. [DllImport(__DllName, EntryPoint = "sp2_bit_vec_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern BitVec* sp2_bit_vec_load(byte* data, nuint data_length); /// Clones a `BitVec`. The returned instance has to be freed with `bit_vec_dealloc`. [DllImport(__DllName, EntryPoint = "sp2_bit_vec_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern BitVec* sp2_bit_vec_clone(BitVec* @this); /// Deallocates a `BitVec`. Note: do not call this if the grid has been consumed in another way, e.g. to create a command. [DllImport(__DllName, EntryPoint = "sp2_bit_vec_dealloc", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp2_bit_vec_dealloc(BitVec* @this); /// Gets the value of a bit from the `BitVec`. [DllImport(__DllName, EntryPoint = "sp2_bit_vec_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: MarshalAs(UnmanagedType.U1)] public static extern bool sp2_bit_vec_get(BitVec* @this, nuint index); /// Sets the value of a bit in the `BitVec`. [DllImport(__DllName, EntryPoint = "sp2_bit_vec_set", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: MarshalAs(UnmanagedType.U1)] public static extern bool sp2_bit_vec_set(BitVec* @this, nuint index, [MarshalAs(UnmanagedType.U1)] bool value); /// Sets the value of all bits in the `BitVec`. [DllImport(__DllName, EntryPoint = "sp2_bit_vec_fill", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp2_bit_vec_fill(BitVec* @this, [MarshalAs(UnmanagedType.U1)] bool value); /// Gets the length of the `BitVec` in bits. [DllImport(__DllName, EntryPoint = "sp2_bit_vec_len", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern nuint sp2_bit_vec_len(BitVec* @this); /// Creates a new `ByteGrid` instance. The returned instance has to be freed with `byte_grid_dealloc`. [DllImport(__DllName, EntryPoint = "sp2_byte_grid_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern ByteGrid* sp2_byte_grid_new(nuint width, nuint height); /// Loads a `ByteGrid` with the specified dimensions from the provided data. The returned instance has to be freed with `byte_grid_dealloc`. [DllImport(__DllName, EntryPoint = "sp2_byte_grid_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern ByteGrid* sp2_byte_grid_load(nuint width, nuint height, byte* data, nuint data_length); /// Clones a `ByteGrid`. The returned instance has to be freed with `byte_grid_dealloc`. [DllImport(__DllName, EntryPoint = "sp2_byte_grid_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern ByteGrid* sp2_byte_grid_clone(ByteGrid* @this); /// Deallocates a `ByteGrid`. Note: do not call this if the grid has been consumed in another way, e.g. to create a command. [DllImport(__DllName, EntryPoint = "sp2_byte_grid_dealloc", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp2_byte_grid_dealloc(ByteGrid* @this); /// Get the current value at the specified position [DllImport(__DllName, EntryPoint = "sp2_byte_grid_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern byte sp2_byte_grid_get(ByteGrid* @this, nuint x, nuint y); /// Sets the current value at the specified position [DllImport(__DllName, EntryPoint = "sp2_byte_grid_set", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp2_byte_grid_set(ByteGrid* @this, nuint x, nuint y, byte value); /// Fills the whole `ByteGrid` with the specified value [DllImport(__DllName, EntryPoint = "sp2_byte_grid_fill", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp2_byte_grid_fill(ByteGrid* @this, byte value); /// Gets the width in pixels of the `ByteGrid` instance. [DllImport(__DllName, EntryPoint = "sp2_byte_grid_width", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern nuint sp2_byte_grid_width(ByteGrid* @this); /// Gets the height in pixels of the `ByteGrid` instance. [DllImport(__DllName, EntryPoint = "sp2_byte_grid_height", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern nuint sp2_byte_grid_height(ByteGrid* @this); /// Tries to load a `Command` from the passed array with the specified length. returns: NULL in case of an error, pointer to the allocated command otherwise [DllImport(__DllName, EntryPoint = "sp2_command_try_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp2_command_try_load(byte* data, nuint length); /// Clones a `Command` instance [DllImport(__DllName, EntryPoint = "sp2_command_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp2_command_clone(Command* original); /// Allocates a new `Command::Clear` instance [DllImport(__DllName, EntryPoint = "sp2_command_clear", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp2_command_clear(); /// Allocates a new `Command::HardReset` instance [DllImport(__DllName, EntryPoint = "sp2_command_hard_reset", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp2_command_hard_reset(); /// Allocates a new `Command::FadeOut` instance [DllImport(__DllName, EntryPoint = "sp2_command_fade_out", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp2_command_fade_out(); /// Allocates a new `Command::Brightness` instance [DllImport(__DllName, EntryPoint = "sp2_command_brightness", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp2_command_brightness(byte brightness); /// Allocates a new `Command::CharBrightness` instance. The passed `ByteGrid` gets deallocated in the process. [DllImport(__DllName, EntryPoint = "sp2_command_char_brightness", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp2_command_char_brightness(ushort x, ushort y, ByteGrid* byte_grid); /// Allocates a new `Command::BitmapLinear` instance. The passed `BitVec` gets deallocated in the process. [DllImport(__DllName, EntryPoint = "sp2_command_bitmap_linear", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp2_command_bitmap_linear(ushort offset, BitVec* bit_vec, CompressionCode compression); /// Allocates a new `Command::BitmapLinearAnd` instance. The passed `BitVec` gets deallocated in the process. [DllImport(__DllName, EntryPoint = "sp2_command_bitmap_linear_and", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp2_command_bitmap_linear_and(ushort offset, BitVec* bit_vec, CompressionCode compression); /// Allocates a new `Command::BitmapLinearOr` instance. The passed `BitVec` gets deallocated in the process. [DllImport(__DllName, EntryPoint = "sp2_command_bitmap_linear_or", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp2_command_bitmap_linear_or(ushort offset, BitVec* bit_vec, CompressionCode compression); /// Allocates a new `Command::BitmapLinearXor` instance. The passed `BitVec` gets deallocated in the process. [DllImport(__DllName, EntryPoint = "sp2_command_bitmap_linear_xor", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp2_command_bitmap_linear_xor(ushort offset, BitVec* bit_vec, CompressionCode compression); /// Allocates a new `Command::Cp437Data` instance. The passed `ByteGrid` gets deallocated in the process. [DllImport(__DllName, EntryPoint = "sp2_command_cp437_data", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp2_command_cp437_data(ushort x, ushort y, ByteGrid* byte_grid); /// Allocates a new `Command::BitmapLinearWin` instance. The passed `PixelGrid` gets deallocated in the process. [DllImport(__DllName, EntryPoint = "sp2_command_bitmap_linear_win", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp2_command_bitmap_linear_win(ushort x, ushort y, PixelGrid* byte_grid); /// Deallocates a `Command`. Note that connection_send does this implicitly, so you only need to do this if you use the library for parsing commands. [DllImport(__DllName, EntryPoint = "sp2_command_dealloc", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp2_command_dealloc(Command* ptr); /// Creates a new instance of Connection. The returned instance has to be deallocated with `connection_dealloc`. returns: NULL if connection fails or connected instance Panics: bad string encoding [DllImport(__DllName, EntryPoint = "sp2_connection_open", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Connection* sp2_connection_open(byte* host); /// Sends the command instance. The instance is consumed / destroyed and cannot be used after this call. [DllImport(__DllName, EntryPoint = "sp2_connection_send", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: MarshalAs(UnmanagedType.U1)] public static extern bool sp2_connection_send(Connection* connection, Command* command_ptr); /// Closes and deallocates a connection instance [DllImport(__DllName, EntryPoint = "sp2_connection_dealloc", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp2_connection_dealloc(Connection* ptr); /// Creates a new `PixelGrid` instance. The returned instance has to be freed with `pixel_grid_dealloc`. [DllImport(__DllName, EntryPoint = "sp2_pixel_grid_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern PixelGrid* sp2_pixel_grid_new(nuint width, nuint height); /// Loads a `PixelGrid` with the specified dimensions from the provided data. The returned instance has to be freed with `pixel_grid_dealloc`. [DllImport(__DllName, EntryPoint = "sp2_pixel_grid_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern PixelGrid* sp2_pixel_grid_load(nuint width, nuint height, byte* data, nuint data_length); /// Clones a `PixelGrid`. The returned instance has to be freed with `pixel_grid_dealloc`. [DllImport(__DllName, EntryPoint = "sp2_pixel_grid_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern PixelGrid* sp2_pixel_grid_clone(PixelGrid* @this); /// Deallocates a `PixelGrid`. Note: do not call this if the grid has been consumed in another way, e.g. to create a command. [DllImport(__DllName, EntryPoint = "sp2_pixel_grid_dealloc", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp2_pixel_grid_dealloc(PixelGrid* @this); /// Get the current value at the specified position [DllImport(__DllName, EntryPoint = "sp2_pixel_grid_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: MarshalAs(UnmanagedType.U1)] public static extern bool sp2_pixel_grid_get(PixelGrid* @this, nuint x, nuint y); /// Sets the current value at the specified position [DllImport(__DllName, EntryPoint = "sp2_pixel_grid_set", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp2_pixel_grid_set(PixelGrid* @this, nuint x, nuint y, [MarshalAs(UnmanagedType.U1)] bool value); /// Fills the whole `PixelGrid` with the specified value [DllImport(__DllName, EntryPoint = "sp2_pixel_grid_fill", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp2_pixel_grid_fill(PixelGrid* @this, [MarshalAs(UnmanagedType.U1)] bool value); /// Gets the width in pixels of the `PixelGrid` instance. [DllImport(__DllName, EntryPoint = "sp2_pixel_grid_width", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern nuint sp2_pixel_grid_width(PixelGrid* @this); /// Gets the height in pixels of the `PixelGrid` instance. [DllImport(__DllName, EntryPoint = "sp2_pixel_grid_height", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern nuint sp2_pixel_grid_height(PixelGrid* @this); /// Gets a reference to the data of the `PixelGrid` instance. [DllImport(__DllName, EntryPoint = "sp2_pixel_grid_data_ref", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern byte* sp2_pixel_grid_data_ref(PixelGrid* @this); } [StructLayout(LayoutKind.Sequential)] public unsafe partial struct BitVec { } [StructLayout(LayoutKind.Sequential)] public unsafe partial struct ByteGrid { } [StructLayout(LayoutKind.Sequential)] public unsafe partial struct Connection { } [StructLayout(LayoutKind.Sequential)] public unsafe partial struct PixelGrid { } public enum Command { Clear, HardReset, FadeOut, CharBrightness, Brightness, BitmapLegacy, BitmapLinear, BitmapLinearAnd, BitmapLinearOr, BitmapLinearXor, Cp437Data, BitmapLinearWin, } public enum CompressionCode : ushort { Uncompressed = 0, Gz = 26490, Bz = 25210, Lz = 27770, Zs = 31347, } }