update edtion to 2024 and reworke lib unsfae functions
This commit is contained in:
Generated
+1
-1
@@ -26,7 +26,7 @@ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
[[package]]
|
||||
name = "xMVMOpenApiWrapper"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
dependencies = [
|
||||
"libloading",
|
||||
]
|
||||
|
||||
+5
-2
@@ -1,7 +1,10 @@
|
||||
[package]
|
||||
name = "xMVMOpenApiWrapper"
|
||||
version = "0.1.2"
|
||||
edition = "2021"
|
||||
version = "0.1.3"
|
||||
edition = "2024"
|
||||
description = "A Wrapper for the XMVM Open interface for Rust"
|
||||
license = "AGPL-3.0"
|
||||
repository = "https://git.cbsk-tech.de/Christoph/xMVMOpenApiWrapper"
|
||||
publish = ["cbsk"]
|
||||
|
||||
[dependencies]
|
||||
|
||||
+210
-214
@@ -1,6 +1,6 @@
|
||||
#![allow(non_snake_case)]
|
||||
use libloading::{ Library, Symbol };
|
||||
use std::path::{ Path, PathBuf };
|
||||
use libloading::{Library, Symbol};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
/// Pointer to a UTF-16 string (wide char) terminated with `0`.
|
||||
pub type PCWSTR = *const u16;
|
||||
@@ -256,21 +256,15 @@ type DisconnectFn = unsafe extern "C" fn() -> OpenReturnCodes;
|
||||
type OpenProjectFn = unsafe extern "C" fn(PCWSTR) -> OpenReturnCodes;
|
||||
type CreateProjectFn = unsafe extern "C" fn(PCWSTR, PCWSTR) -> OpenReturnCodes;
|
||||
type CreateProjectWithScalingFn = unsafe extern "C" fn(PCWSTR, PCWSTR, PCWSTR) -> OpenReturnCodes;
|
||||
type CreateProjectWithScalingNcuNumberFn = unsafe extern "C" fn(
|
||||
PCWSTR,
|
||||
PCWSTR,
|
||||
PCWSTR,
|
||||
u32
|
||||
) -> OpenReturnCodes;
|
||||
type CreateProjectWithScalingNcuNumberFn =
|
||||
unsafe extern "C" fn(PCWSTR, PCWSTR, PCWSTR, u32) -> OpenReturnCodes;
|
||||
type SaveProjectFn = unsafe extern "C" fn() -> OpenReturnCodes;
|
||||
type CloseProjectFn = unsafe extern "C" fn() -> OpenReturnCodes;
|
||||
type BootControllerFn = unsafe extern "C" fn() -> OpenReturnCodes;
|
||||
type ShutdownControllerFn = unsafe extern "C" fn() -> OpenReturnCodes;
|
||||
type ResetControllerFn = unsafe extern "C" fn() -> OpenReturnCodes;
|
||||
type RegisterForEventsFn = unsafe extern "C" fn(
|
||||
u32,
|
||||
*const OpenEventMaskDefinition
|
||||
) -> OpenReturnCodes;
|
||||
type RegisterForEventsFn =
|
||||
unsafe extern "C" fn(u32, *const OpenEventMaskDefinition) -> OpenReturnCodes;
|
||||
type UnregisterEventsFn = unsafe extern "C" fn() -> OpenReturnCodes;
|
||||
type WaitForEventsFn = unsafe extern "C" fn() -> OpenReturnCodes;
|
||||
type ContinueSimulationFn = unsafe extern "C" fn() -> OpenReturnCodes;
|
||||
@@ -430,7 +424,7 @@ impl OpenApi {
|
||||
} else {
|
||||
provided_path
|
||||
};
|
||||
let lib = Library::new(dll_path)?;
|
||||
let lib = unsafe { Library::new(dll_path)? };
|
||||
// Extend the library's lifetime to 'static by leaking it.
|
||||
// (Alternatively: design OpenApi with lifetimes and avoid leaking.)
|
||||
let lib: &'static Library = Box::leak(Box::new(lib));
|
||||
@@ -441,14 +435,12 @@ impl OpenApi {
|
||||
let disconnect = load_symbol::<DisconnectFn>(lib, b"disconnect")?;
|
||||
let open_project = load_symbol::<OpenProjectFn>(lib, b"openProject")?;
|
||||
let create_project = load_symbol::<CreateProjectFn>(lib, b"createProject")?;
|
||||
let create_project_with_scaling = load_symbol::<CreateProjectWithScalingFn>(
|
||||
lib,
|
||||
b"createProjectWithScaling"
|
||||
)?;
|
||||
let create_project_with_scaling_ncu_number =
|
||||
load_symbol::<CreateProjectWithScalingNcuNumberFn>(
|
||||
lib,
|
||||
b"createProjectWithScalingNCUNumber"
|
||||
let create_project_with_scaling =
|
||||
load_symbol::<CreateProjectWithScalingFn>(lib, b"createProjectWithScaling")?;
|
||||
let create_project_with_scaling_ncu_number = load_symbol::<
|
||||
CreateProjectWithScalingNcuNumberFn,
|
||||
>(
|
||||
lib, b"createProjectWithScalingNCUNumber"
|
||||
)?;
|
||||
let save_project = load_symbol::<SaveProjectFn>(lib, b"saveProject")?;
|
||||
let close_project = load_symbol::<CloseProjectFn>(lib, b"closeProject")?;
|
||||
@@ -462,62 +454,36 @@ impl OpenApi {
|
||||
let get_dictionary_id = load_symbol::<GetDictionaryIdFn>(lib, b"getDictionaryId")?;
|
||||
let register_watch = load_symbol::<RegisterWatchFn>(lib, b"registerWatch")?;
|
||||
let unregister_watch = load_symbol::<UnregisterWatchFn>(lib, b"unregisterWatch")?;
|
||||
let get_dictionary_element_type = load_symbol::<GetDictionaryElementTypeFn>(
|
||||
lib,
|
||||
b"getDictionaryElementType"
|
||||
)?;
|
||||
let read_unsigned_integer_64_bit_array = load_symbol::<ReadUnsignedInteger64BitArrayFn>(
|
||||
lib,
|
||||
b"readUnsignedInteger64BitArray"
|
||||
)?;
|
||||
let read_signed_integer_32_bit_array = load_symbol::<ReadSignedInteger32BitArrayFn>(
|
||||
lib,
|
||||
b"readSignedInteger32BitArray"
|
||||
)?;
|
||||
let read_unsigned_integer_32_bit_array = load_symbol::<ReadUnsignedInteger32BitArrayFn>(
|
||||
lib,
|
||||
b"readUnsignedInteger32BitArray"
|
||||
)?;
|
||||
let read_unsigned_integer_16_bit_array = load_symbol::<ReadUnsignedInteger16BitArrayFn>(
|
||||
lib,
|
||||
b"readUnsignedInteger16BitArray"
|
||||
)?;
|
||||
let read_unsigned_integer_8_bit_array = load_symbol::<ReadUnsignedInteger8BitArrayFn>(
|
||||
lib,
|
||||
b"readUnsignedInteger8BitArray"
|
||||
)?;
|
||||
let get_dictionary_element_type =
|
||||
load_symbol::<GetDictionaryElementTypeFn>(lib, b"getDictionaryElementType")?;
|
||||
let read_unsigned_integer_64_bit_array =
|
||||
load_symbol::<ReadUnsignedInteger64BitArrayFn>(lib, b"readUnsignedInteger64BitArray")?;
|
||||
let read_signed_integer_32_bit_array =
|
||||
load_symbol::<ReadSignedInteger32BitArrayFn>(lib, b"readSignedInteger32BitArray")?;
|
||||
let read_unsigned_integer_32_bit_array =
|
||||
load_symbol::<ReadUnsignedInteger32BitArrayFn>(lib, b"readUnsignedInteger32BitArray")?;
|
||||
let read_unsigned_integer_16_bit_array =
|
||||
load_symbol::<ReadUnsignedInteger16BitArrayFn>(lib, b"readUnsignedInteger16BitArray")?;
|
||||
let read_unsigned_integer_8_bit_array =
|
||||
load_symbol::<ReadUnsignedInteger8BitArrayFn>(lib, b"readUnsignedInteger8BitArray")?;
|
||||
let read_bool_array = load_symbol::<ReadBoolArrayFn>(lib, b"readBoolArray")?;
|
||||
let read_double_array = load_symbol::<ReadDoubleArrayFn>(lib, b"readDoubleArray")?;
|
||||
let read_string = load_symbol::<ReadStringFn>(lib, b"readString")?;
|
||||
let read_string_array = load_symbol::<ReadStringArrayFn>(lib, b"readStringArray")?;
|
||||
let read_unsigned_integer_16_bit = load_symbol::<ReadUnsignedInteger16BitFn>(
|
||||
lib,
|
||||
b"readUnsignedInteger16Bit"
|
||||
)?;
|
||||
let read_signed_integer_16_bit = load_symbol::<ReadSignedInteger16BitFn>(
|
||||
lib,
|
||||
b"readSignedInteger16Bit"
|
||||
)?;
|
||||
let read_unsigned_integer_32_bit = load_symbol::<ReadUnsignedInteger32BitFn>(
|
||||
lib,
|
||||
b"readUnsignedInteger32Bit"
|
||||
)?;
|
||||
let read_signed_integer_32_bit = load_symbol::<ReadSignedInteger32BitFn>(
|
||||
lib,
|
||||
b"readSignedInteger32Bit"
|
||||
)?;
|
||||
let read_unsigned_integer_64_bit = load_symbol::<ReadUnsignedInteger64BitFn>(
|
||||
lib,
|
||||
b"readUnsignedInteger64Bit"
|
||||
)?;
|
||||
let read_signed_integer_64_bit = load_symbol::<ReadSignedInteger64BitFn>(
|
||||
lib,
|
||||
b"readSignedInteger64Bit"
|
||||
)?;
|
||||
let get_num_array_elements = load_symbol::<GetNumArrayElementsFn>(
|
||||
lib,
|
||||
b"getNumArrayElements"
|
||||
)?;
|
||||
let read_unsigned_integer_16_bit =
|
||||
load_symbol::<ReadUnsignedInteger16BitFn>(lib, b"readUnsignedInteger16Bit")?;
|
||||
let read_signed_integer_16_bit =
|
||||
load_symbol::<ReadSignedInteger16BitFn>(lib, b"readSignedInteger16Bit")?;
|
||||
let read_unsigned_integer_32_bit =
|
||||
load_symbol::<ReadUnsignedInteger32BitFn>(lib, b"readUnsignedInteger32Bit")?;
|
||||
let read_signed_integer_32_bit =
|
||||
load_symbol::<ReadSignedInteger32BitFn>(lib, b"readSignedInteger32Bit")?;
|
||||
let read_unsigned_integer_64_bit =
|
||||
load_symbol::<ReadUnsignedInteger64BitFn>(lib, b"readUnsignedInteger64Bit")?;
|
||||
let read_signed_integer_64_bit =
|
||||
load_symbol::<ReadSignedInteger64BitFn>(lib, b"readSignedInteger64Bit")?;
|
||||
let get_num_array_elements =
|
||||
load_symbol::<GetNumArrayElementsFn>(lib, b"getNumArrayElements")?;
|
||||
let read_bit = load_symbol::<ReadBitFn>(lib, b"readBit")?;
|
||||
let read_bool = load_symbol::<ReadBoolFn>(lib, b"readBool")?;
|
||||
let read_byte = load_symbol::<ReadByteFn>(lib, b"readByte")?;
|
||||
@@ -526,10 +492,8 @@ impl OpenApi {
|
||||
let read_double_word = load_symbol::<ReadDoubleWordFn>(lib, b"readDoubleWord")?;
|
||||
let read_long_word = load_symbol::<ReadLongWordFn>(lib, b"readLongWord")?;
|
||||
let read_next_event = load_symbol::<ReadNextEventFn>(lib, b"readNextEvent")?;
|
||||
let read_next_event_with_ncu_index = load_symbol::<ReadNextEventWithNcuIndexFn>(
|
||||
lib,
|
||||
b"readNextEventWithNcuIndex"
|
||||
)?;
|
||||
let read_next_event_with_ncu_index =
|
||||
load_symbol::<ReadNextEventWithNcuIndexFn>(lib, b"readNextEventWithNcuIndex")?;
|
||||
let write_bit = load_symbol::<WriteBitFn>(lib, b"writeBit")?;
|
||||
let write_bool = load_symbol::<WriteBoolFn>(lib, b"writeBool")?;
|
||||
let write_byte = load_symbol::<WriteByteFn>(lib, b"writeByte")?;
|
||||
@@ -549,34 +513,20 @@ impl OpenApi {
|
||||
let delete_directory = load_symbol::<DeleteDirectoryFn>(lib, b"deleteDirectory")?;
|
||||
let create_directory = load_symbol::<CreateDirectoryFn>(lib, b"createDirectory")?;
|
||||
let list_directory = load_symbol::<ListDirectoryFn>(lib, b"listDirectory")?;
|
||||
let get_version_information = load_symbol::<GetVersionInformationFn>(
|
||||
lib,
|
||||
b"getVersionInformation"
|
||||
)?;
|
||||
let get_project_information = load_symbol::<GetProjectInformationFn>(
|
||||
lib,
|
||||
b"getProjectInformation"
|
||||
)?;
|
||||
let get_current_project_information = load_symbol::<GetCurrentProjectInformationFn>(
|
||||
lib,
|
||||
b"getCurrentProjectInformation"
|
||||
)?;
|
||||
let get_current_project_state = load_symbol::<GetCurrentProjectStateFn>(
|
||||
lib,
|
||||
b"getCurrentProjectState"
|
||||
)?;
|
||||
let import_project_settings = load_symbol::<ImportProjectSettingsFn>(
|
||||
lib,
|
||||
b"importProjectSettings"
|
||||
)?;
|
||||
let export_project_settings = load_symbol::<ExportProjectSettingsFn>(
|
||||
lib,
|
||||
b"exportProjectSettings"
|
||||
)?;
|
||||
let write_unsigned_integer_8_bit_array = load_symbol::<WriteUnsignedInteger8BitArrayFn>(
|
||||
lib,
|
||||
b"writeUnsignedInteger8BitArray"
|
||||
)?;
|
||||
let get_version_information =
|
||||
load_symbol::<GetVersionInformationFn>(lib, b"getVersionInformation")?;
|
||||
let get_project_information =
|
||||
load_symbol::<GetProjectInformationFn>(lib, b"getProjectInformation")?;
|
||||
let get_current_project_information =
|
||||
load_symbol::<GetCurrentProjectInformationFn>(lib, b"getCurrentProjectInformation")?;
|
||||
let get_current_project_state =
|
||||
load_symbol::<GetCurrentProjectStateFn>(lib, b"getCurrentProjectState")?;
|
||||
let import_project_settings =
|
||||
load_symbol::<ImportProjectSettingsFn>(lib, b"importProjectSettings")?;
|
||||
let export_project_settings =
|
||||
load_symbol::<ExportProjectSettingsFn>(lib, b"exportProjectSettings")?;
|
||||
let write_unsigned_integer_8_bit_array =
|
||||
load_symbol::<WriteUnsignedInteger8BitArrayFn>(lib, b"writeUnsignedInteger8BitArray")?;
|
||||
let get_number_of_ncus = load_symbol::<GetNumberOfNcusFn>(lib, b"getNumberOfNCUs")?;
|
||||
|
||||
Ok(Self {
|
||||
@@ -658,36 +608,36 @@ impl OpenApi {
|
||||
}
|
||||
#[inline]
|
||||
pub unsafe fn start_application(&self, str_profile_file_name: PCWSTR) -> OpenReturnCodes {
|
||||
(self.start_application)(str_profile_file_name)
|
||||
unsafe { (self.start_application)(str_profile_file_name) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn stop_application(&self) -> OpenReturnCodes {
|
||||
(self.stop_application)()
|
||||
unsafe { (self.stop_application)() }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn connect(&self) -> OpenReturnCodes {
|
||||
(self.connect)()
|
||||
unsafe { (self.connect)() }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn disconnect(&self) -> OpenReturnCodes {
|
||||
(self.disconnect)()
|
||||
unsafe { (self.disconnect)() }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn open_project(&self, str_file_name: PCWSTR) -> OpenReturnCodes {
|
||||
(self.open_project)(str_file_name)
|
||||
unsafe { (self.open_project)(str_file_name) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn create_project(
|
||||
&self,
|
||||
str_file_name: PCWSTR,
|
||||
str_version: PCWSTR
|
||||
str_version: PCWSTR,
|
||||
) -> OpenReturnCodes {
|
||||
(self.create_project)(str_file_name, str_version)
|
||||
unsafe { (self.create_project)(str_file_name, str_version) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -695,9 +645,9 @@ impl OpenApi {
|
||||
&self,
|
||||
str_file_name: PCWSTR,
|
||||
str_version: PCWSTR,
|
||||
str_nck_scaling: PCWSTR
|
||||
str_nck_scaling: PCWSTR,
|
||||
) -> OpenReturnCodes {
|
||||
(self.create_project_with_scaling)(str_file_name, str_version, str_nck_scaling)
|
||||
unsafe { (self.create_project_with_scaling)(str_file_name, str_version, str_nck_scaling) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -706,95 +656,97 @@ impl OpenApi {
|
||||
str_file_name: PCWSTR,
|
||||
str_version: PCWSTR,
|
||||
str_nck_scaling: PCWSTR,
|
||||
ncu_number: u32
|
||||
ncu_number: u32,
|
||||
) -> OpenReturnCodes {
|
||||
unsafe {
|
||||
(self.create_project_with_scaling_ncu_number)(
|
||||
str_file_name,
|
||||
str_version,
|
||||
str_nck_scaling,
|
||||
ncu_number
|
||||
ncu_number,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn save_project(&self) -> OpenReturnCodes {
|
||||
(self.save_project)()
|
||||
unsafe { (self.save_project)() }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn close_project(&self) -> OpenReturnCodes {
|
||||
(self.close_project)()
|
||||
unsafe { (self.close_project)() }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn boot_controller(&self) -> OpenReturnCodes {
|
||||
(self.boot_controller)()
|
||||
unsafe { (self.boot_controller)() }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn shutdown_controller(&self) -> OpenReturnCodes {
|
||||
(self.shutdown_controller)()
|
||||
unsafe { (self.shutdown_controller)() }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn reset_controller(&self) -> OpenReturnCodes {
|
||||
(self.reset_controller)()
|
||||
unsafe { (self.reset_controller)() }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn register_for_events(
|
||||
&self,
|
||||
event_list_length: u32,
|
||||
event_list: *const OpenEventMaskDefinition
|
||||
event_list: *const OpenEventMaskDefinition,
|
||||
) -> OpenReturnCodes {
|
||||
(self.register_for_events)(event_list_length, event_list)
|
||||
unsafe { (self.register_for_events)(event_list_length, event_list) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn unregister_events(&self) -> OpenReturnCodes {
|
||||
(self.unregister_events)()
|
||||
unsafe { (self.unregister_events)() }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn wait_for_events(&self) -> OpenReturnCodes {
|
||||
(self.wait_for_events)()
|
||||
unsafe { (self.wait_for_events)() }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn continue_simulation(&self) -> OpenReturnCodes {
|
||||
(self.continue_simulation)()
|
||||
unsafe { (self.continue_simulation)() }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn get_dictionary_id(
|
||||
&self,
|
||||
dictionary_element: PCWSTR,
|
||||
dictionary_id: *mut u32
|
||||
dictionary_id: *mut u32,
|
||||
) -> OpenReturnCodes {
|
||||
(self.get_dictionary_id)(dictionary_element, dictionary_id)
|
||||
unsafe { (self.get_dictionary_id)(dictionary_element, dictionary_id) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn register_watch(
|
||||
&self,
|
||||
watch_list_length: u32,
|
||||
dictionary_id_list: *const u32
|
||||
dictionary_id_list: *const u32,
|
||||
) -> OpenReturnCodes {
|
||||
(self.register_watch)(watch_list_length, dictionary_id_list)
|
||||
unsafe { (self.register_watch)(watch_list_length, dictionary_id_list) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn unregister_watch(&self) -> OpenReturnCodes {
|
||||
(self.unregister_watch)()
|
||||
unsafe { (self.unregister_watch)() }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn get_dictionary_element_type(
|
||||
&self,
|
||||
dictionary_id: u32,
|
||||
value: *mut u8
|
||||
value: *mut u8,
|
||||
) -> OpenReturnCodes {
|
||||
(self.get_dictionary_element_type)(dictionary_id, value)
|
||||
unsafe { (self.get_dictionary_element_type)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -802,9 +754,15 @@ impl OpenApi {
|
||||
&self,
|
||||
dictionary_id: u32,
|
||||
value_list_max_length: u32,
|
||||
value_list: *mut u64
|
||||
value_list: *mut u64,
|
||||
) -> OpenReturnCodes {
|
||||
(self.read_unsigned_integer_64_bit_array)(dictionary_id, value_list_max_length, value_list)
|
||||
unsafe {
|
||||
(self.read_unsigned_integer_64_bit_array)(
|
||||
dictionary_id,
|
||||
value_list_max_length,
|
||||
value_list,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -812,9 +770,15 @@ impl OpenApi {
|
||||
&self,
|
||||
dictionary_id: u32,
|
||||
value_list_max_length: u32,
|
||||
value_list: *mut i32
|
||||
value_list: *mut i32,
|
||||
) -> OpenReturnCodes {
|
||||
(self.read_signed_integer_32_bit_array)(dictionary_id, value_list_max_length, value_list)
|
||||
unsafe {
|
||||
(self.read_signed_integer_32_bit_array)(
|
||||
dictionary_id,
|
||||
value_list_max_length,
|
||||
value_list,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -822,9 +786,15 @@ impl OpenApi {
|
||||
&self,
|
||||
dictionary_id: u32,
|
||||
value_list_max_length: u32,
|
||||
value_list: *mut u32
|
||||
value_list: *mut u32,
|
||||
) -> OpenReturnCodes {
|
||||
(self.read_unsigned_integer_32_bit_array)(dictionary_id, value_list_max_length, value_list)
|
||||
unsafe {
|
||||
(self.read_unsigned_integer_32_bit_array)(
|
||||
dictionary_id,
|
||||
value_list_max_length,
|
||||
value_list,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -832,9 +802,15 @@ impl OpenApi {
|
||||
&self,
|
||||
dictionary_id: u32,
|
||||
value_list_max_length: u32,
|
||||
value_list: *mut u16
|
||||
value_list: *mut u16,
|
||||
) -> OpenReturnCodes {
|
||||
(self.read_unsigned_integer_16_bit_array)(dictionary_id, value_list_max_length, value_list)
|
||||
unsafe {
|
||||
(self.read_unsigned_integer_16_bit_array)(
|
||||
dictionary_id,
|
||||
value_list_max_length,
|
||||
value_list,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -842,9 +818,15 @@ impl OpenApi {
|
||||
&self,
|
||||
dictionary_id: u32,
|
||||
value_list_max_length: u32,
|
||||
value_list: *mut u8
|
||||
value_list: *mut u8,
|
||||
) -> OpenReturnCodes {
|
||||
(self.read_unsigned_integer_8_bit_array)(dictionary_id, value_list_max_length, value_list)
|
||||
unsafe {
|
||||
(self.read_unsigned_integer_8_bit_array)(
|
||||
dictionary_id,
|
||||
value_list_max_length,
|
||||
value_list,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -852,9 +834,9 @@ impl OpenApi {
|
||||
&self,
|
||||
dictionary_id: u32,
|
||||
value_list_max_length: u32,
|
||||
value_list: *mut bool
|
||||
value_list: *mut bool,
|
||||
) -> OpenReturnCodes {
|
||||
(self.read_bool_array)(dictionary_id, value_list_max_length, value_list)
|
||||
unsafe { (self.read_bool_array)(dictionary_id, value_list_max_length, value_list) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -862,9 +844,9 @@ impl OpenApi {
|
||||
&self,
|
||||
dictionary_id: u32,
|
||||
value_list_max_length: u32,
|
||||
value_list: *mut f64
|
||||
value_list: *mut f64,
|
||||
) -> OpenReturnCodes {
|
||||
(self.read_double_array)(dictionary_id, value_list_max_length, value_list)
|
||||
unsafe { (self.read_double_array)(dictionary_id, value_list_max_length, value_list) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -872,9 +854,9 @@ impl OpenApi {
|
||||
&self,
|
||||
dictionary_id: u32,
|
||||
string_max_length: u32,
|
||||
string_buffer: PWSTR
|
||||
string_buffer: PWSTR,
|
||||
) -> OpenReturnCodes {
|
||||
(self.read_string)(dictionary_id, string_max_length, string_buffer)
|
||||
unsafe { (self.read_string)(dictionary_id, string_max_length, string_buffer) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -883,161 +865,163 @@ impl OpenApi {
|
||||
dictionary_id: u32,
|
||||
string_array_max_length: u32,
|
||||
string_max_length: u32,
|
||||
string_array: PPWSTR
|
||||
string_array: PPWSTR,
|
||||
) -> OpenReturnCodes {
|
||||
unsafe {
|
||||
(self.read_string_array)(
|
||||
dictionary_id,
|
||||
string_array_max_length,
|
||||
string_max_length,
|
||||
string_array
|
||||
string_array,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn read_unsigned_integer_16_bit(
|
||||
&self,
|
||||
dictionary_id: u32,
|
||||
value: *mut u16
|
||||
value: *mut u16,
|
||||
) -> OpenReturnCodes {
|
||||
(self.read_unsigned_integer_16_bit)(dictionary_id, value)
|
||||
unsafe { (self.read_unsigned_integer_16_bit)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn read_signed_integer_16_bit(
|
||||
&self,
|
||||
dictionary_id: u32,
|
||||
value: *mut i16
|
||||
value: *mut i16,
|
||||
) -> OpenReturnCodes {
|
||||
(self.read_signed_integer_16_bit)(dictionary_id, value)
|
||||
unsafe { (self.read_signed_integer_16_bit)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn read_unsigned_integer_32_bit(
|
||||
&self,
|
||||
dictionary_id: u32,
|
||||
value: *mut u32
|
||||
value: *mut u32,
|
||||
) -> OpenReturnCodes {
|
||||
(self.read_unsigned_integer_32_bit)(dictionary_id, value)
|
||||
unsafe { (self.read_unsigned_integer_32_bit)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn read_signed_integer_32_bit(
|
||||
&self,
|
||||
dictionary_id: u32,
|
||||
value: *mut i32
|
||||
value: *mut i32,
|
||||
) -> OpenReturnCodes {
|
||||
(self.read_signed_integer_32_bit)(dictionary_id, value)
|
||||
unsafe { (self.read_signed_integer_32_bit)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn read_unsigned_integer_64_bit(
|
||||
&self,
|
||||
dictionary_id: u32,
|
||||
value: *mut u64
|
||||
value: *mut u64,
|
||||
) -> OpenReturnCodes {
|
||||
(self.read_unsigned_integer_64_bit)(dictionary_id, value)
|
||||
unsafe { (self.read_unsigned_integer_64_bit)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn read_signed_integer_64_bit(
|
||||
&self,
|
||||
dictionary_id: u32,
|
||||
value: *mut i64
|
||||
value: *mut i64,
|
||||
) -> OpenReturnCodes {
|
||||
(self.read_signed_integer_64_bit)(dictionary_id, value)
|
||||
unsafe { (self.read_signed_integer_64_bit)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn get_num_array_elements(
|
||||
&self,
|
||||
dictionary_id: u32,
|
||||
num_array_elements: *mut u32
|
||||
num_array_elements: *mut u32,
|
||||
) -> OpenReturnCodes {
|
||||
(self.get_num_array_elements)(dictionary_id, num_array_elements)
|
||||
unsafe { (self.get_num_array_elements)(dictionary_id, num_array_elements) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn read_bit(&self, dictionary_id: u32, value: *mut Bool32) -> OpenReturnCodes {
|
||||
(self.read_bit)(dictionary_id, value)
|
||||
unsafe { (self.read_bit)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn read_bool(&self, dictionary_id: u32, value: *mut Bool32) -> OpenReturnCodes {
|
||||
(self.read_bool)(dictionary_id, value)
|
||||
unsafe { (self.read_bool)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn read_byte(&self, dictionary_id: u32, value: *mut u8) -> OpenReturnCodes {
|
||||
(self.read_byte)(dictionary_id, value)
|
||||
unsafe { (self.read_byte)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn read_double(&self, dictionary_id: u32, value: *mut f64) -> OpenReturnCodes {
|
||||
(self.read_double)(dictionary_id, value)
|
||||
unsafe { (self.read_double)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn read_word(&self, dictionary_id: u32, value: *mut u16) -> OpenReturnCodes {
|
||||
(self.read_word)(dictionary_id, value)
|
||||
unsafe { (self.read_word)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn read_double_word(&self, dictionary_id: u32, value: *mut u32) -> OpenReturnCodes {
|
||||
(self.read_double_word)(dictionary_id, value)
|
||||
unsafe { (self.read_double_word)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn read_long_word(&self, dictionary_id: u32, value: *mut u64) -> OpenReturnCodes {
|
||||
(self.read_long_word)(dictionary_id, value)
|
||||
unsafe { (self.read_long_word)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn read_next_event(&self, event: *mut u64) -> OpenReturnCodes {
|
||||
(self.read_next_event)(event)
|
||||
unsafe { (self.read_next_event)(event) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn read_next_event_with_ncu_index(
|
||||
&self,
|
||||
event: *mut u64,
|
||||
ncu_index: *mut i32
|
||||
ncu_index: *mut i32,
|
||||
) -> OpenReturnCodes {
|
||||
(self.read_next_event_with_ncu_index)(event, ncu_index)
|
||||
unsafe { (self.read_next_event_with_ncu_index)(event, ncu_index) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn write_bit(&self, dictionary_id: u32, value: Bool32) -> OpenReturnCodes {
|
||||
(self.write_bit)(dictionary_id, value)
|
||||
unsafe { (self.write_bit)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn write_bool(&self, dictionary_id: u32, value: Bool32) -> OpenReturnCodes {
|
||||
(self.write_bool)(dictionary_id, value)
|
||||
unsafe { (self.write_bool)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn write_byte(&self, dictionary_id: u32, value: u8) -> OpenReturnCodes {
|
||||
(self.write_byte)(dictionary_id, value)
|
||||
unsafe { (self.write_byte)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn write_double(&self, dictionary_id: u32, value: f64) -> OpenReturnCodes {
|
||||
(self.write_double)(dictionary_id, value)
|
||||
unsafe { (self.write_double)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn write_word(&self, dictionary_id: u32, value: u16) -> OpenReturnCodes {
|
||||
(self.write_word)(dictionary_id, value)
|
||||
unsafe { (self.write_word)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn write_double_word(&self, dictionary_id: u32, value: u32) -> OpenReturnCodes {
|
||||
(self.write_double_word)(dictionary_id, value)
|
||||
unsafe { (self.write_double_word)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn write_long_word(&self, dictionary_id: u32, value: u64) -> OpenReturnCodes {
|
||||
(self.write_long_word)(dictionary_id, value)
|
||||
unsafe { (self.write_long_word)(dictionary_id, value) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -1045,28 +1029,28 @@ impl OpenApi {
|
||||
&self,
|
||||
dictionary_id: u32,
|
||||
value_list_length: u32,
|
||||
value_list: *const bool
|
||||
value_list: *const bool,
|
||||
) -> OpenReturnCodes {
|
||||
(self.write_bool_array)(dictionary_id, value_list_length, value_list)
|
||||
unsafe { (self.write_bool_array)(dictionary_id, value_list_length, value_list) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn get_simulation_speed(&self, percent: *mut u32) -> OpenReturnCodes {
|
||||
(self.get_simulation_speed)(percent)
|
||||
unsafe { (self.get_simulation_speed)(percent) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn set_simulation_speed(&self, percent: u32) -> OpenReturnCodes {
|
||||
(self.set_simulation_speed)(percent)
|
||||
unsafe { (self.set_simulation_speed)(percent) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn get_card_path(
|
||||
&self,
|
||||
card_path_max_length: u32,
|
||||
card_path: PWSTR
|
||||
card_path: PWSTR,
|
||||
) -> OpenReturnCodes {
|
||||
(self.get_card_path)(card_path_max_length, card_path)
|
||||
unsafe { (self.get_card_path)(card_path_max_length, card_path) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -1074,104 +1058,110 @@ impl OpenApi {
|
||||
&self,
|
||||
card_paths_array_max_length: u32,
|
||||
card_path_max_length: u32,
|
||||
card_paths: PPWSTR
|
||||
card_paths: PPWSTR,
|
||||
) -> OpenReturnCodes {
|
||||
(self.get_card_paths)(card_paths_array_max_length, card_path_max_length, card_paths)
|
||||
unsafe {
|
||||
(self.get_card_paths)(
|
||||
card_paths_array_max_length,
|
||||
card_path_max_length,
|
||||
card_paths,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn get_file(
|
||||
&self,
|
||||
source_file_path: PCWSTR,
|
||||
destination_file_path: PCWSTR
|
||||
destination_file_path: PCWSTR,
|
||||
) -> OpenReturnCodes {
|
||||
(self.get_file)(source_file_path, destination_file_path)
|
||||
unsafe { (self.get_file)(source_file_path, destination_file_path) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn put_file(
|
||||
&self,
|
||||
source_file_path: PCWSTR,
|
||||
destination_file_path: PCWSTR
|
||||
destination_file_path: PCWSTR,
|
||||
) -> OpenReturnCodes {
|
||||
(self.put_file)(source_file_path, destination_file_path)
|
||||
unsafe { (self.put_file)(source_file_path, destination_file_path) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn select_file(
|
||||
&self,
|
||||
source_file_path: PCWSTR,
|
||||
channel_name: PCWSTR
|
||||
channel_name: PCWSTR,
|
||||
) -> OpenReturnCodes {
|
||||
(self.select_file)(source_file_path, channel_name)
|
||||
unsafe { (self.select_file)(source_file_path, channel_name) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn delete_file(&self, file_path: PCWSTR) -> OpenReturnCodes {
|
||||
(self.delete_file)(file_path)
|
||||
unsafe { (self.delete_file)(file_path) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn delete_directory(&self, directory_path: PCWSTR) -> OpenReturnCodes {
|
||||
(self.delete_directory)(directory_path)
|
||||
unsafe { (self.delete_directory)(directory_path) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn create_directory(&self, directory_path: PCWSTR) -> OpenReturnCodes {
|
||||
(self.create_directory)(directory_path)
|
||||
unsafe { (self.create_directory)(directory_path) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn list_directory(
|
||||
&self,
|
||||
directory_path: PCWSTR,
|
||||
result_file_path: PCWSTR
|
||||
result_file_path: PCWSTR,
|
||||
) -> OpenReturnCodes {
|
||||
(self.list_directory)(directory_path, result_file_path)
|
||||
unsafe { (self.list_directory)(directory_path, result_file_path) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn get_version_information(&self, destination_file_path: PCWSTR) -> OpenReturnCodes {
|
||||
(self.get_version_information)(destination_file_path)
|
||||
unsafe { (self.get_version_information)(destination_file_path) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn get_project_information(
|
||||
&self,
|
||||
vcp_file_path: PCWSTR,
|
||||
destination_file_path: PCWSTR
|
||||
destination_file_path: PCWSTR,
|
||||
) -> OpenReturnCodes {
|
||||
(self.get_project_information)(vcp_file_path, destination_file_path)
|
||||
unsafe { (self.get_project_information)(vcp_file_path, destination_file_path) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn get_current_project_information(
|
||||
&self,
|
||||
destination_file_path: PCWSTR
|
||||
destination_file_path: PCWSTR,
|
||||
) -> OpenReturnCodes {
|
||||
(self.get_current_project_information)(destination_file_path)
|
||||
unsafe { (self.get_current_project_information)(destination_file_path) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn get_current_project_state(
|
||||
&self,
|
||||
project_state: *mut OpenProjectStates
|
||||
project_state: *mut OpenProjectStates,
|
||||
) -> OpenReturnCodes {
|
||||
(self.get_current_project_state)(project_state)
|
||||
unsafe { (self.get_current_project_state)(project_state) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn import_project_settings(
|
||||
&self,
|
||||
file_name: PCWSTR,
|
||||
import_content_file_name: PCWSTR
|
||||
import_content_file_name: PCWSTR,
|
||||
) -> OpenReturnCodes {
|
||||
(self.import_project_settings)(file_name, import_content_file_name)
|
||||
unsafe { (self.import_project_settings)(file_name, import_content_file_name) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn export_project_settings(&self, file_name: PCWSTR) -> OpenReturnCodes {
|
||||
(self.export_project_settings)(file_name)
|
||||
unsafe { (self.export_project_settings)(file_name) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -1179,13 +1169,19 @@ impl OpenApi {
|
||||
&self,
|
||||
dictionary_id: u32,
|
||||
value_list_max_length: u32,
|
||||
value_list: *const u8
|
||||
value_list: *const u8,
|
||||
) -> OpenReturnCodes {
|
||||
(self.write_unsigned_integer_8_bit_array)(dictionary_id, value_list_max_length, value_list)
|
||||
unsafe {
|
||||
(self.write_unsigned_integer_8_bit_array)(
|
||||
dictionary_id,
|
||||
value_list_max_length,
|
||||
value_list,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn get_number_of_ncus(&self, number_of_ncus: *mut u32) -> OpenReturnCodes {
|
||||
(self.get_number_of_ncus)(number_of_ncus)
|
||||
unsafe { (self.get_number_of_ncus)(number_of_ncus) }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user