// // 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 ConnectionNative { const string __DllName = "servicepoint_binding_c"; /// /// Creates a new instance of [SPConnection]. /// /// returns: NULL if connection fails, or connected instance /// /// # Panics /// /// - when `host` is null or an invalid host /// /// # 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`. /// [DllImport(__DllName, EntryPoint = "sp_connection_open", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Connection* sp_connection_open(byte* host); /// /// Sends a [SPPacket] to the display using the [SPConnection]. /// /// The passed `packet` gets consumed. /// /// returns: true in case of success /// /// # Panics /// /// - when `connection` is NULL /// - when `packet` is NULL /// /// # Safety /// /// The caller has to make sure that: /// /// - `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 /// [DllImport(__DllName, EntryPoint = "sp_connection_send_packet", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: MarshalAs(UnmanagedType.U1)] public static extern bool sp_connection_send_packet(Connection* connection, Packet* packet); /// /// Sends a [SPCommand] to the display using the [SPConnection]. /// /// The passed `command` gets consumed. /// /// returns: true in case of success /// /// # Panics /// /// - when `connection` is NULL /// - when `command` is NULL /// /// # Safety /// /// The caller has to make sure that: /// /// - `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 /// [DllImport(__DllName, EntryPoint = "sp_connection_send_command", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: MarshalAs(UnmanagedType.U1)] public static extern bool sp_connection_send_command(Connection* connection, Command* command); /// /// Closes and deallocates a [SPConnection]. /// /// # Panics /// /// - when `connection` is NULL /// /// # Safety /// /// The caller has to make sure that: /// /// - `connection` points to a valid [SPConnection] /// - `connection` is not used concurrently or after this call /// [DllImport(__DllName, EntryPoint = "sp_connection_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp_connection_free(Connection* connection); } [StructLayout(LayoutKind.Sequential)] public unsafe partial struct Connection { } }