move bin file and add fallback

This commit is contained in:
Christoph Brandau
2025-11-15 20:56:33 +01:00
parent f22ac8075a
commit c8718fb62c
7 changed files with 155 additions and 98 deletions
View File
View File
+155 -98
View File
@@ -1,6 +1,6 @@
#![allow(non_snake_case)] #![allow(non_snake_case)]
use libloading::{Library, Symbol}; use libloading::{ Library, Symbol };
use std::path::Path; use std::path::{ Path, PathBuf };
/// Pointer to a UTF-16 string (wide char) terminated with `0`. /// Pointer to a UTF-16 string (wide char) terminated with `0`.
pub type PCWSTR = *const u16; pub type PCWSTR = *const u16;
@@ -256,15 +256,21 @@ type DisconnectFn = unsafe extern "C" fn() -> OpenReturnCodes;
type OpenProjectFn = unsafe extern "C" fn(PCWSTR) -> OpenReturnCodes; type OpenProjectFn = unsafe extern "C" fn(PCWSTR) -> OpenReturnCodes;
type CreateProjectFn = unsafe extern "C" fn(PCWSTR, PCWSTR) -> OpenReturnCodes; type CreateProjectFn = unsafe extern "C" fn(PCWSTR, PCWSTR) -> OpenReturnCodes;
type CreateProjectWithScalingFn = unsafe extern "C" fn(PCWSTR, PCWSTR, PCWSTR) -> OpenReturnCodes; type CreateProjectWithScalingFn = unsafe extern "C" fn(PCWSTR, PCWSTR, PCWSTR) -> OpenReturnCodes;
type CreateProjectWithScalingNcuNumberFn = type CreateProjectWithScalingNcuNumberFn = unsafe extern "C" fn(
unsafe extern "C" fn(PCWSTR, PCWSTR, PCWSTR, u32) -> OpenReturnCodes; PCWSTR,
PCWSTR,
PCWSTR,
u32
) -> OpenReturnCodes;
type SaveProjectFn = unsafe extern "C" fn() -> OpenReturnCodes; type SaveProjectFn = unsafe extern "C" fn() -> OpenReturnCodes;
type CloseProjectFn = unsafe extern "C" fn() -> OpenReturnCodes; type CloseProjectFn = unsafe extern "C" fn() -> OpenReturnCodes;
type BootControllerFn = unsafe extern "C" fn() -> OpenReturnCodes; type BootControllerFn = unsafe extern "C" fn() -> OpenReturnCodes;
type ShutdownControllerFn = unsafe extern "C" fn() -> OpenReturnCodes; type ShutdownControllerFn = unsafe extern "C" fn() -> OpenReturnCodes;
type ResetControllerFn = unsafe extern "C" fn() -> OpenReturnCodes; type ResetControllerFn = unsafe extern "C" fn() -> OpenReturnCodes;
type RegisterForEventsFn = type RegisterForEventsFn = unsafe extern "C" fn(
unsafe extern "C" fn(u32, *const OpenEventMaskDefinition) -> OpenReturnCodes; u32,
*const OpenEventMaskDefinition
) -> OpenReturnCodes;
type UnregisterEventsFn = unsafe extern "C" fn() -> OpenReturnCodes; type UnregisterEventsFn = unsafe extern "C" fn() -> OpenReturnCodes;
type WaitForEventsFn = unsafe extern "C" fn() -> OpenReturnCodes; type WaitForEventsFn = unsafe extern "C" fn() -> OpenReturnCodes;
type ContinueSimulationFn = unsafe extern "C" fn() -> OpenReturnCodes; type ContinueSimulationFn = unsafe extern "C" fn() -> OpenReturnCodes;
@@ -411,9 +417,20 @@ pub struct OpenApi {
impl OpenApi { impl OpenApi {
/// Load DLL from a path, binding required symbols. /// Load DLL from a path, binding required symbols.
///
/// If `path` resolves to an empty string (e.g. `""`), the default `bin/open.dll`
/// relative to the current working directory is used.
pub unsafe fn load<P: AsRef<Path>>(path: P) -> Result<Self, libloading::Error> { pub unsafe fn load<P: AsRef<Path>>(path: P) -> Result<Self, libloading::Error> {
// Load the DLL // Load the DLL
let lib = Library::new(path.as_ref())?; let provided_path = path.as_ref();
let fallback_path;
let dll_path = if provided_path.as_os_str().is_empty() {
fallback_path = PathBuf::from("bin").join("open.dll");
fallback_path.as_path()
} else {
provided_path
};
let lib = Library::new(dll_path)?;
// Extend the library's lifetime to 'static by leaking it. // Extend the library's lifetime to 'static by leaking it.
// (Alternatively: design OpenApi with lifetimes and avoid leaking.) // (Alternatively: design OpenApi with lifetimes and avoid leaking.)
let lib: &'static Library = Box::leak(Box::new(lib)); let lib: &'static Library = Box::leak(Box::new(lib));
@@ -424,13 +441,15 @@ impl OpenApi {
let disconnect = load_symbol::<DisconnectFn>(lib, b"disconnect")?; let disconnect = load_symbol::<DisconnectFn>(lib, b"disconnect")?;
let open_project = load_symbol::<OpenProjectFn>(lib, b"openProject")?; let open_project = load_symbol::<OpenProjectFn>(lib, b"openProject")?;
let create_project = load_symbol::<CreateProjectFn>(lib, b"createProject")?; let create_project = load_symbol::<CreateProjectFn>(lib, b"createProject")?;
let create_project_with_scaling = let create_project_with_scaling = load_symbol::<CreateProjectWithScalingFn>(
load_symbol::<CreateProjectWithScalingFn>(lib, b"createProjectWithScaling")?; lib,
let create_project_with_scaling_ncu_number = load_symbol::< b"createProjectWithScaling"
CreateProjectWithScalingNcuNumberFn,
>(
lib, b"createProjectWithScalingNCUNumber"
)?; )?;
let create_project_with_scaling_ncu_number =
load_symbol::<CreateProjectWithScalingNcuNumberFn>(
lib,
b"createProjectWithScalingNCUNumber"
)?;
let save_project = load_symbol::<SaveProjectFn>(lib, b"saveProject")?; let save_project = load_symbol::<SaveProjectFn>(lib, b"saveProject")?;
let close_project = load_symbol::<CloseProjectFn>(lib, b"closeProject")?; let close_project = load_symbol::<CloseProjectFn>(lib, b"closeProject")?;
let boot_controller = load_symbol::<BootControllerFn>(lib, b"bootController")?; let boot_controller = load_symbol::<BootControllerFn>(lib, b"bootController")?;
@@ -443,36 +462,62 @@ impl OpenApi {
let get_dictionary_id = load_symbol::<GetDictionaryIdFn>(lib, b"getDictionaryId")?; let get_dictionary_id = load_symbol::<GetDictionaryIdFn>(lib, b"getDictionaryId")?;
let register_watch = load_symbol::<RegisterWatchFn>(lib, b"registerWatch")?; let register_watch = load_symbol::<RegisterWatchFn>(lib, b"registerWatch")?;
let unregister_watch = load_symbol::<UnregisterWatchFn>(lib, b"unregisterWatch")?; let unregister_watch = load_symbol::<UnregisterWatchFn>(lib, b"unregisterWatch")?;
let get_dictionary_element_type = let get_dictionary_element_type = load_symbol::<GetDictionaryElementTypeFn>(
load_symbol::<GetDictionaryElementTypeFn>(lib, b"getDictionaryElementType")?; lib,
let read_unsigned_integer_64_bit_array = b"getDictionaryElementType"
load_symbol::<ReadUnsignedInteger64BitArrayFn>(lib, b"readUnsignedInteger64BitArray")?; )?;
let read_signed_integer_32_bit_array = let read_unsigned_integer_64_bit_array = load_symbol::<ReadUnsignedInteger64BitArrayFn>(
load_symbol::<ReadSignedInteger32BitArrayFn>(lib, b"readSignedInteger32BitArray")?; lib,
let read_unsigned_integer_32_bit_array = b"readUnsignedInteger64BitArray"
load_symbol::<ReadUnsignedInteger32BitArrayFn>(lib, b"readUnsignedInteger32BitArray")?; )?;
let read_unsigned_integer_16_bit_array = let read_signed_integer_32_bit_array = load_symbol::<ReadSignedInteger32BitArrayFn>(
load_symbol::<ReadUnsignedInteger16BitArrayFn>(lib, b"readUnsignedInteger16BitArray")?; lib,
let read_unsigned_integer_8_bit_array = b"readSignedInteger32BitArray"
load_symbol::<ReadUnsignedInteger8BitArrayFn>(lib, b"readUnsignedInteger8BitArray")?; )?;
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_bool_array = load_symbol::<ReadBoolArrayFn>(lib, b"readBoolArray")?;
let read_double_array = load_symbol::<ReadDoubleArrayFn>(lib, b"readDoubleArray")?; let read_double_array = load_symbol::<ReadDoubleArrayFn>(lib, b"readDoubleArray")?;
let read_string = load_symbol::<ReadStringFn>(lib, b"readString")?; let read_string = load_symbol::<ReadStringFn>(lib, b"readString")?;
let read_string_array = load_symbol::<ReadStringArrayFn>(lib, b"readStringArray")?; let read_string_array = load_symbol::<ReadStringArrayFn>(lib, b"readStringArray")?;
let read_unsigned_integer_16_bit = let read_unsigned_integer_16_bit = load_symbol::<ReadUnsignedInteger16BitFn>(
load_symbol::<ReadUnsignedInteger16BitFn>(lib, b"readUnsignedInteger16Bit")?; lib,
let read_signed_integer_16_bit = b"readUnsignedInteger16Bit"
load_symbol::<ReadSignedInteger16BitFn>(lib, b"readSignedInteger16Bit")?; )?;
let read_unsigned_integer_32_bit = let read_signed_integer_16_bit = load_symbol::<ReadSignedInteger16BitFn>(
load_symbol::<ReadUnsignedInteger32BitFn>(lib, b"readUnsignedInteger32Bit")?; lib,
let read_signed_integer_32_bit = b"readSignedInteger16Bit"
load_symbol::<ReadSignedInteger32BitFn>(lib, b"readSignedInteger32Bit")?; )?;
let read_unsigned_integer_64_bit = let read_unsigned_integer_32_bit = load_symbol::<ReadUnsignedInteger32BitFn>(
load_symbol::<ReadUnsignedInteger64BitFn>(lib, b"readUnsignedInteger64Bit")?; lib,
let read_signed_integer_64_bit = b"readUnsignedInteger32Bit"
load_symbol::<ReadSignedInteger64BitFn>(lib, b"readSignedInteger64Bit")?; )?;
let get_num_array_elements = let read_signed_integer_32_bit = load_symbol::<ReadSignedInteger32BitFn>(
load_symbol::<GetNumArrayElementsFn>(lib, b"getNumArrayElements")?; 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_bit = load_symbol::<ReadBitFn>(lib, b"readBit")?;
let read_bool = load_symbol::<ReadBoolFn>(lib, b"readBool")?; let read_bool = load_symbol::<ReadBoolFn>(lib, b"readBool")?;
let read_byte = load_symbol::<ReadByteFn>(lib, b"readByte")?; let read_byte = load_symbol::<ReadByteFn>(lib, b"readByte")?;
@@ -481,8 +526,10 @@ impl OpenApi {
let read_double_word = load_symbol::<ReadDoubleWordFn>(lib, b"readDoubleWord")?; let read_double_word = load_symbol::<ReadDoubleWordFn>(lib, b"readDoubleWord")?;
let read_long_word = load_symbol::<ReadLongWordFn>(lib, b"readLongWord")?; let read_long_word = load_symbol::<ReadLongWordFn>(lib, b"readLongWord")?;
let read_next_event = load_symbol::<ReadNextEventFn>(lib, b"readNextEvent")?; let read_next_event = load_symbol::<ReadNextEventFn>(lib, b"readNextEvent")?;
let read_next_event_with_ncu_index = let read_next_event_with_ncu_index = load_symbol::<ReadNextEventWithNcuIndexFn>(
load_symbol::<ReadNextEventWithNcuIndexFn>(lib, b"readNextEventWithNcuIndex")?; lib,
b"readNextEventWithNcuIndex"
)?;
let write_bit = load_symbol::<WriteBitFn>(lib, b"writeBit")?; let write_bit = load_symbol::<WriteBitFn>(lib, b"writeBit")?;
let write_bool = load_symbol::<WriteBoolFn>(lib, b"writeBool")?; let write_bool = load_symbol::<WriteBoolFn>(lib, b"writeBool")?;
let write_byte = load_symbol::<WriteByteFn>(lib, b"writeByte")?; let write_byte = load_symbol::<WriteByteFn>(lib, b"writeByte")?;
@@ -502,20 +549,34 @@ impl OpenApi {
let delete_directory = load_symbol::<DeleteDirectoryFn>(lib, b"deleteDirectory")?; let delete_directory = load_symbol::<DeleteDirectoryFn>(lib, b"deleteDirectory")?;
let create_directory = load_symbol::<CreateDirectoryFn>(lib, b"createDirectory")?; let create_directory = load_symbol::<CreateDirectoryFn>(lib, b"createDirectory")?;
let list_directory = load_symbol::<ListDirectoryFn>(lib, b"listDirectory")?; let list_directory = load_symbol::<ListDirectoryFn>(lib, b"listDirectory")?;
let get_version_information = let get_version_information = load_symbol::<GetVersionInformationFn>(
load_symbol::<GetVersionInformationFn>(lib, b"getVersionInformation")?; lib,
let get_project_information = b"getVersionInformation"
load_symbol::<GetProjectInformationFn>(lib, b"getProjectInformation")?; )?;
let get_current_project_information = let get_project_information = load_symbol::<GetProjectInformationFn>(
load_symbol::<GetCurrentProjectInformationFn>(lib, b"getCurrentProjectInformation")?; lib,
let get_current_project_state = b"getProjectInformation"
load_symbol::<GetCurrentProjectStateFn>(lib, b"getCurrentProjectState")?; )?;
let import_project_settings = let get_current_project_information = load_symbol::<GetCurrentProjectInformationFn>(
load_symbol::<ImportProjectSettingsFn>(lib, b"importProjectSettings")?; lib,
let export_project_settings = b"getCurrentProjectInformation"
load_symbol::<ExportProjectSettingsFn>(lib, b"exportProjectSettings")?; )?;
let write_unsigned_integer_8_bit_array = let get_current_project_state = load_symbol::<GetCurrentProjectStateFn>(
load_symbol::<WriteUnsignedInteger8BitArrayFn>(lib, b"writeUnsignedInteger8BitArray")?; 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")?; let get_number_of_ncus = load_symbol::<GetNumberOfNcusFn>(lib, b"getNumberOfNCUs")?;
Ok(Self { Ok(Self {
@@ -624,7 +685,7 @@ impl OpenApi {
pub unsafe fn create_project( pub unsafe fn create_project(
&self, &self,
str_file_name: PCWSTR, str_file_name: PCWSTR,
str_version: PCWSTR, str_version: PCWSTR
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.create_project)(str_file_name, str_version) (self.create_project)(str_file_name, str_version)
} }
@@ -634,7 +695,7 @@ impl OpenApi {
&self, &self,
str_file_name: PCWSTR, str_file_name: PCWSTR,
str_version: PCWSTR, str_version: PCWSTR,
str_nck_scaling: PCWSTR, str_nck_scaling: PCWSTR
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.create_project_with_scaling)(str_file_name, str_version, str_nck_scaling) (self.create_project_with_scaling)(str_file_name, str_version, str_nck_scaling)
} }
@@ -645,13 +706,13 @@ impl OpenApi {
str_file_name: PCWSTR, str_file_name: PCWSTR,
str_version: PCWSTR, str_version: PCWSTR,
str_nck_scaling: PCWSTR, str_nck_scaling: PCWSTR,
ncu_number: u32, ncu_number: u32
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.create_project_with_scaling_ncu_number)( (self.create_project_with_scaling_ncu_number)(
str_file_name, str_file_name,
str_version, str_version,
str_nck_scaling, str_nck_scaling,
ncu_number, ncu_number
) )
} }
@@ -684,7 +745,7 @@ impl OpenApi {
pub unsafe fn register_for_events( pub unsafe fn register_for_events(
&self, &self,
event_list_length: u32, event_list_length: u32,
event_list: *const OpenEventMaskDefinition, event_list: *const OpenEventMaskDefinition
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.register_for_events)(event_list_length, event_list) (self.register_for_events)(event_list_length, event_list)
} }
@@ -708,7 +769,7 @@ impl OpenApi {
pub unsafe fn get_dictionary_id( pub unsafe fn get_dictionary_id(
&self, &self,
dictionary_element: PCWSTR, dictionary_element: PCWSTR,
dictionary_id: *mut u32, dictionary_id: *mut u32
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.get_dictionary_id)(dictionary_element, dictionary_id) (self.get_dictionary_id)(dictionary_element, dictionary_id)
} }
@@ -717,7 +778,7 @@ impl OpenApi {
pub unsafe fn register_watch( pub unsafe fn register_watch(
&self, &self,
watch_list_length: u32, watch_list_length: u32,
dictionary_id_list: *const u32, dictionary_id_list: *const u32
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.register_watch)(watch_list_length, dictionary_id_list) (self.register_watch)(watch_list_length, dictionary_id_list)
} }
@@ -731,7 +792,7 @@ impl OpenApi {
pub unsafe fn get_dictionary_element_type( pub unsafe fn get_dictionary_element_type(
&self, &self,
dictionary_id: u32, dictionary_id: u32,
value: *mut u8, value: *mut u8
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.get_dictionary_element_type)(dictionary_id, value) (self.get_dictionary_element_type)(dictionary_id, value)
} }
@@ -741,7 +802,7 @@ impl OpenApi {
&self, &self,
dictionary_id: u32, dictionary_id: u32,
value_list_max_length: u32, value_list_max_length: u32,
value_list: *mut u64, value_list: *mut u64
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.read_unsigned_integer_64_bit_array)(dictionary_id, value_list_max_length, value_list) (self.read_unsigned_integer_64_bit_array)(dictionary_id, value_list_max_length, value_list)
} }
@@ -751,7 +812,7 @@ impl OpenApi {
&self, &self,
dictionary_id: u32, dictionary_id: u32,
value_list_max_length: u32, value_list_max_length: u32,
value_list: *mut i32, value_list: *mut i32
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.read_signed_integer_32_bit_array)(dictionary_id, value_list_max_length, value_list) (self.read_signed_integer_32_bit_array)(dictionary_id, value_list_max_length, value_list)
} }
@@ -761,7 +822,7 @@ impl OpenApi {
&self, &self,
dictionary_id: u32, dictionary_id: u32,
value_list_max_length: u32, value_list_max_length: u32,
value_list: *mut u32, value_list: *mut u32
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.read_unsigned_integer_32_bit_array)(dictionary_id, value_list_max_length, value_list) (self.read_unsigned_integer_32_bit_array)(dictionary_id, value_list_max_length, value_list)
} }
@@ -771,7 +832,7 @@ impl OpenApi {
&self, &self,
dictionary_id: u32, dictionary_id: u32,
value_list_max_length: u32, value_list_max_length: u32,
value_list: *mut u16, value_list: *mut u16
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.read_unsigned_integer_16_bit_array)(dictionary_id, value_list_max_length, value_list) (self.read_unsigned_integer_16_bit_array)(dictionary_id, value_list_max_length, value_list)
} }
@@ -781,7 +842,7 @@ impl OpenApi {
&self, &self,
dictionary_id: u32, dictionary_id: u32,
value_list_max_length: u32, value_list_max_length: u32,
value_list: *mut u8, value_list: *mut u8
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.read_unsigned_integer_8_bit_array)(dictionary_id, value_list_max_length, value_list) (self.read_unsigned_integer_8_bit_array)(dictionary_id, value_list_max_length, value_list)
} }
@@ -791,7 +852,7 @@ impl OpenApi {
&self, &self,
dictionary_id: u32, dictionary_id: u32,
value_list_max_length: u32, value_list_max_length: u32,
value_list: *mut bool, value_list: *mut bool
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.read_bool_array)(dictionary_id, value_list_max_length, value_list) (self.read_bool_array)(dictionary_id, value_list_max_length, value_list)
} }
@@ -801,7 +862,7 @@ impl OpenApi {
&self, &self,
dictionary_id: u32, dictionary_id: u32,
value_list_max_length: u32, value_list_max_length: u32,
value_list: *mut f64, value_list: *mut f64
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.read_double_array)(dictionary_id, value_list_max_length, value_list) (self.read_double_array)(dictionary_id, value_list_max_length, value_list)
} }
@@ -811,7 +872,7 @@ impl OpenApi {
&self, &self,
dictionary_id: u32, dictionary_id: u32,
string_max_length: u32, string_max_length: u32,
string_buffer: PWSTR, string_buffer: PWSTR
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.read_string)(dictionary_id, string_max_length, string_buffer) (self.read_string)(dictionary_id, string_max_length, string_buffer)
} }
@@ -822,13 +883,13 @@ impl OpenApi {
dictionary_id: u32, dictionary_id: u32,
string_array_max_length: u32, string_array_max_length: u32,
string_max_length: u32, string_max_length: u32,
string_array: PPWSTR, string_array: PPWSTR
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.read_string_array)( (self.read_string_array)(
dictionary_id, dictionary_id,
string_array_max_length, string_array_max_length,
string_max_length, string_max_length,
string_array, string_array
) )
} }
@@ -836,7 +897,7 @@ impl OpenApi {
pub unsafe fn read_unsigned_integer_16_bit( pub unsafe fn read_unsigned_integer_16_bit(
&self, &self,
dictionary_id: u32, dictionary_id: u32,
value: *mut u16, value: *mut u16
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.read_unsigned_integer_16_bit)(dictionary_id, value) (self.read_unsigned_integer_16_bit)(dictionary_id, value)
} }
@@ -845,7 +906,7 @@ impl OpenApi {
pub unsafe fn read_signed_integer_16_bit( pub unsafe fn read_signed_integer_16_bit(
&self, &self,
dictionary_id: u32, dictionary_id: u32,
value: *mut i16, value: *mut i16
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.read_signed_integer_16_bit)(dictionary_id, value) (self.read_signed_integer_16_bit)(dictionary_id, value)
} }
@@ -854,7 +915,7 @@ impl OpenApi {
pub unsafe fn read_unsigned_integer_32_bit( pub unsafe fn read_unsigned_integer_32_bit(
&self, &self,
dictionary_id: u32, dictionary_id: u32,
value: *mut u32, value: *mut u32
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.read_unsigned_integer_32_bit)(dictionary_id, value) (self.read_unsigned_integer_32_bit)(dictionary_id, value)
} }
@@ -863,7 +924,7 @@ impl OpenApi {
pub unsafe fn read_signed_integer_32_bit( pub unsafe fn read_signed_integer_32_bit(
&self, &self,
dictionary_id: u32, dictionary_id: u32,
value: *mut i32, value: *mut i32
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.read_signed_integer_32_bit)(dictionary_id, value) (self.read_signed_integer_32_bit)(dictionary_id, value)
} }
@@ -872,7 +933,7 @@ impl OpenApi {
pub unsafe fn read_unsigned_integer_64_bit( pub unsafe fn read_unsigned_integer_64_bit(
&self, &self,
dictionary_id: u32, dictionary_id: u32,
value: *mut u64, value: *mut u64
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.read_unsigned_integer_64_bit)(dictionary_id, value) (self.read_unsigned_integer_64_bit)(dictionary_id, value)
} }
@@ -881,7 +942,7 @@ impl OpenApi {
pub unsafe fn read_signed_integer_64_bit( pub unsafe fn read_signed_integer_64_bit(
&self, &self,
dictionary_id: u32, dictionary_id: u32,
value: *mut i64, value: *mut i64
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.read_signed_integer_64_bit)(dictionary_id, value) (self.read_signed_integer_64_bit)(dictionary_id, value)
} }
@@ -890,7 +951,7 @@ impl OpenApi {
pub unsafe fn get_num_array_elements( pub unsafe fn get_num_array_elements(
&self, &self,
dictionary_id: u32, dictionary_id: u32,
num_array_elements: *mut u32, num_array_elements: *mut u32
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.get_num_array_elements)(dictionary_id, num_array_elements) (self.get_num_array_elements)(dictionary_id, num_array_elements)
} }
@@ -939,7 +1000,7 @@ impl OpenApi {
pub unsafe fn read_next_event_with_ncu_index( pub unsafe fn read_next_event_with_ncu_index(
&self, &self,
event: *mut u64, event: *mut u64,
ncu_index: *mut i32, ncu_index: *mut i32
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.read_next_event_with_ncu_index)(event, ncu_index) (self.read_next_event_with_ncu_index)(event, ncu_index)
} }
@@ -984,7 +1045,7 @@ impl OpenApi {
&self, &self,
dictionary_id: u32, dictionary_id: u32,
value_list_length: u32, value_list_length: u32,
value_list: *const bool, value_list: *const bool
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.write_bool_array)(dictionary_id, value_list_length, value_list) (self.write_bool_array)(dictionary_id, value_list_length, value_list)
} }
@@ -1003,7 +1064,7 @@ impl OpenApi {
pub unsafe fn get_card_path( pub unsafe fn get_card_path(
&self, &self,
card_path_max_length: u32, card_path_max_length: u32,
card_path: PWSTR, card_path: PWSTR
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.get_card_path)(card_path_max_length, card_path) (self.get_card_path)(card_path_max_length, card_path)
} }
@@ -1013,20 +1074,16 @@ impl OpenApi {
&self, &self,
card_paths_array_max_length: u32, card_paths_array_max_length: u32,
card_path_max_length: u32, card_path_max_length: u32,
card_paths: PPWSTR, card_paths: PPWSTR
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.get_card_paths)( (self.get_card_paths)(card_paths_array_max_length, card_path_max_length, card_paths)
card_paths_array_max_length,
card_path_max_length,
card_paths,
)
} }
#[inline] #[inline]
pub unsafe fn get_file( pub unsafe fn get_file(
&self, &self,
source_file_path: PCWSTR, source_file_path: PCWSTR,
destination_file_path: PCWSTR, destination_file_path: PCWSTR
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.get_file)(source_file_path, destination_file_path) (self.get_file)(source_file_path, destination_file_path)
} }
@@ -1035,7 +1092,7 @@ impl OpenApi {
pub unsafe fn put_file( pub unsafe fn put_file(
&self, &self,
source_file_path: PCWSTR, source_file_path: PCWSTR,
destination_file_path: PCWSTR, destination_file_path: PCWSTR
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.put_file)(source_file_path, destination_file_path) (self.put_file)(source_file_path, destination_file_path)
} }
@@ -1044,7 +1101,7 @@ impl OpenApi {
pub unsafe fn select_file( pub unsafe fn select_file(
&self, &self,
source_file_path: PCWSTR, source_file_path: PCWSTR,
channel_name: PCWSTR, channel_name: PCWSTR
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.select_file)(source_file_path, channel_name) (self.select_file)(source_file_path, channel_name)
} }
@@ -1068,7 +1125,7 @@ impl OpenApi {
pub unsafe fn list_directory( pub unsafe fn list_directory(
&self, &self,
directory_path: PCWSTR, directory_path: PCWSTR,
result_file_path: PCWSTR, result_file_path: PCWSTR
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.list_directory)(directory_path, result_file_path) (self.list_directory)(directory_path, result_file_path)
} }
@@ -1082,7 +1139,7 @@ impl OpenApi {
pub unsafe fn get_project_information( pub unsafe fn get_project_information(
&self, &self,
vcp_file_path: PCWSTR, vcp_file_path: PCWSTR,
destination_file_path: PCWSTR, destination_file_path: PCWSTR
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.get_project_information)(vcp_file_path, destination_file_path) (self.get_project_information)(vcp_file_path, destination_file_path)
} }
@@ -1090,7 +1147,7 @@ impl OpenApi {
#[inline] #[inline]
pub unsafe fn get_current_project_information( pub unsafe fn get_current_project_information(
&self, &self,
destination_file_path: PCWSTR, destination_file_path: PCWSTR
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.get_current_project_information)(destination_file_path) (self.get_current_project_information)(destination_file_path)
} }
@@ -1098,7 +1155,7 @@ impl OpenApi {
#[inline] #[inline]
pub unsafe fn get_current_project_state( pub unsafe fn get_current_project_state(
&self, &self,
project_state: *mut OpenProjectStates, project_state: *mut OpenProjectStates
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.get_current_project_state)(project_state) (self.get_current_project_state)(project_state)
} }
@@ -1107,7 +1164,7 @@ impl OpenApi {
pub unsafe fn import_project_settings( pub unsafe fn import_project_settings(
&self, &self,
file_name: PCWSTR, file_name: PCWSTR,
import_content_file_name: PCWSTR, import_content_file_name: PCWSTR
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.import_project_settings)(file_name, import_content_file_name) (self.import_project_settings)(file_name, import_content_file_name)
} }
@@ -1122,7 +1179,7 @@ impl OpenApi {
&self, &self,
dictionary_id: u32, dictionary_id: u32,
value_list_max_length: u32, value_list_max_length: u32,
value_list: *const u8, value_list: *const u8
) -> OpenReturnCodes { ) -> OpenReturnCodes {
(self.write_unsigned_integer_8_bit_array)(dictionary_id, value_list_max_length, value_list) (self.write_unsigned_integer_8_bit_array)(dictionary_id, value_list_max_length, value_list)
} }