ohos_vsync_sys/vsync_ffi.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
// automatically generated by rust-bindgen 0.71.1
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#[repr(C)]
pub struct OH_NativeVSync {
_unused: [u8; 0],
}
pub type OH_NativeVSync_FrameCallback = ::core::option::Option<
unsafe extern "C" fn(timestamp: ::core::ffi::c_longlong, data: *mut ::core::ffi::c_void),
>;
extern "C" {
/// Creates a <b>NativeVsync</b> instance.
///
/// A new <b>NativeVsync</b> instance is created each time this function is called.
///
///
/// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeVsync
/// # Arguments
///
/// `name` - Indicates the vsync connection name.
///
/// `length` - Indicates the name's length.
///
/// # Returns
///
/// Returns the pointer to the <b>NativeVsync</b> instance created.
///
/// Available since API-level: 9
///
/// Version: 1.0
pub fn OH_NativeVSync_Create(
name: *const ::core::ffi::c_char,
length: ::core::ffi::c_uint,
) -> *mut OH_NativeVSync;
/// Delete the NativeVsync instance.
///
///
/// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeVsync
/// # Arguments
///
/// `window` - Indicates the pointer to a <b>NativeVsync</b> instance.
///
/// Available since API-level: 9
///
/// Version: 1.0
pub fn OH_NativeVSync_Destroy(nativeVsync: *mut OH_NativeVSync);
/// Request next vsync with callback.
/// If you call this interface multiple times in one frame, it will only call the last callback.
///
///
/// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeVsync
/// # Arguments
///
/// `nativeVsync` - Indicates the pointer to a NativeVsync.
///
/// `callback` - Indicates the OH_NativeVSync_FrameCallback which will be called when next vsync coming.
///
/// `data` - Indicates data which will be used in callback.
///
/// # Returns
///
/// [`NATIVE_ERROR_OK`] 0 - Success.
/// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - the parameter nativeVsync is NULL or callback is NULL.
/// [`NATIVE_ERROR_BINDER_ERROR`] 50401000 - ipc send failed.
///
/// Available since API-level: 9
///
/// Version: 1.0
pub fn OH_NativeVSync_RequestFrame(
nativeVsync: *mut OH_NativeVSync,
callback: OH_NativeVSync_FrameCallback,
data: *mut ::core::ffi::c_void,
) -> ::core::ffi::c_int;
/// Request next vsync with callback.
/// If this function is called multiple times in one vsync period, all these callbacks and dataset will be called.
///
///
/// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeVsync
/// # Arguments
///
/// `nativeVsync` - Indicates the pointer to a NativeVsync.
///
/// `callback` - Indicates the OH_NativeVSync_FrameCallback which will be called when next vsync coming.
///
/// `data` - Indicates data which will be used in callback.
///
/// # Returns
///
/// [`NATIVE_ERROR_OK`] 0 - Success.
/// [`NATIVE_ERROR_INVALID_ARGUMENTS`] 40001000 - the parameter nativeVsync is NULL or callback is NULL.
/// [`NATIVE_ERROR_BINDER_ERROR`] 50401000 - ipc send failed.
///
/// Available since API-level: 12
///
/// Version: 1.0
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
pub fn OH_NativeVSync_RequestFrameWithMultiCallback(
nativeVsync: *mut OH_NativeVSync,
callback: OH_NativeVSync_FrameCallback,
data: *mut ::core::ffi::c_void,
) -> ::core::ffi::c_int;
/// Get vsync period.
///
///
/// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeVsync
/// # Arguments
///
/// `nativeVsync` - Indicates the pointer to a NativeVsync.
///
/// `period` - Indicates the vsync period.
///
/// # Returns
///
/// Returns int32_t, return value == 0, success, otherwise, failed.
///
/// Available since API-level: 10
///
/// Version: 1.0
pub fn OH_NativeVSync_GetPeriod(
nativeVsync: *mut OH_NativeVSync,
period: *mut ::core::ffi::c_longlong,
) -> ::core::ffi::c_int;
}