mirror of
https://github.com/cccb/servicepoint.git
synced 2025-01-19 10:20:12 +01:00
114 lines
3.7 KiB
C#
114 lines
3.7 KiB
C#
|
// <auto-generated>
|
||
|
// This code is generated by csbindgen.
|
||
|
// DON'T CHANGE THIS DIRECTLY.
|
||
|
// </auto-generated>
|
||
|
#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";
|
||
|
|
||
|
|
||
|
|
||
|
/// <summary>
|
||
|
/// 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`.
|
||
|
/// </summary>
|
||
|
[DllImport(__DllName, EntryPoint = "sp_connection_open", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||
|
public static extern SPConnection* sp_connection_open(byte* host);
|
||
|
|
||
|
/// <summary>
|
||
|
/// 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
|
||
|
/// </summary>
|
||
|
[DllImport(__DllName, EntryPoint = "sp_connection_send_packet", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||
|
[return: MarshalAs(UnmanagedType.U1)]
|
||
|
public static extern bool sp_connection_send_packet(SPConnection* connection, SPPacket* packet);
|
||
|
|
||
|
/// <summary>
|
||
|
/// 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
|
||
|
/// </summary>
|
||
|
[DllImport(__DllName, EntryPoint = "sp_connection_send_command", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||
|
[return: MarshalAs(UnmanagedType.U1)]
|
||
|
public static extern bool sp_connection_send_command(SPConnection* connection, SPCommand* command);
|
||
|
|
||
|
/// <summary>
|
||
|
/// 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
|
||
|
/// </summary>
|
||
|
[DllImport(__DllName, EntryPoint = "sp_connection_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||
|
public static extern void sp_connection_free(SPConnection* connection);
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
[StructLayout(LayoutKind.Sequential)]
|
||
|
public unsafe partial struct SPConnection
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
}
|