objc2_io_bluetooth/generated/IOBluetoothUtilities.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4#[cfg(feature = "objc2")]
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-foundation")]
7use objc2_foundation::*;
8
9use crate::*;
10
11extern "C-unwind" {
12 /// Convenience routine to take an NSString and turn it into a BluetoothDeviceAddress structure.
13 ///
14 /// Parameter `inNameString`: Ptr to an NSString that contains the data to turn into the device address.
15 ///
16 /// Parameter `outDeviceAddress`: Ptr to an address structure that will be returned.
17 ///
18 /// Returns: Returns success (0) or failure code.
19 ///
20 /// Pass in most types of strings, such as "001122334455" or "00-11-22-33-44-55" and the conversion should be successful. Also, you should have 2 characters per byte for the conversion to work properly.
21 ///
22 /// # Safety
23 ///
24 /// - `in_name_string` might not allow `None`.
25 /// - `out_device_address` must be a valid pointer.
26 #[cfg(all(feature = "Bluetooth", feature = "objc2-foundation"))]
27 pub fn IOBluetoothNSStringToDeviceAddress(
28 in_name_string: Option<&NSString>,
29 out_device_address: *mut BluetoothDeviceAddress,
30 ) -> IOReturn;
31}
32
33/// Convenience routine to take a device address structure and create an NSString.
34///
35/// Parameter `deviceAddress`: A valid bluetooth device structure.
36///
37/// Returns: Returns the created address string.
38///
39/// The resultant string will be in this format: "00-11-22-33-44-55"
40///
41/// # Safety
42///
43/// `device_address` must be a valid pointer.
44#[cfg(all(feature = "Bluetooth", feature = "objc2", feature = "objc2-foundation"))]
45#[inline]
46pub unsafe extern "C-unwind" fn IOBluetoothNSStringFromDeviceAddress(
47 device_address: *const BluetoothDeviceAddress,
48) -> Option<Retained<NSString>> {
49 extern "C-unwind" {
50 fn IOBluetoothNSStringFromDeviceAddress(
51 device_address: *const BluetoothDeviceAddress,
52 ) -> *mut NSString;
53 }
54 let ret = unsafe { IOBluetoothNSStringFromDeviceAddress(device_address) };
55 unsafe { Retained::retain_autoreleased(ret) }
56}
57
58/// Convenience routine to take a device address structure and create an NSString.
59///
60/// Parameter `deviceAddress`: A valid bluetooth device structure.
61///
62/// Returns: Returns the created address string.
63///
64/// The resultant string will be in this format: "00:11:22:33:44:55"
65///
66/// # Safety
67///
68/// `device_address` must be a valid pointer.
69#[cfg(all(feature = "Bluetooth", feature = "objc2", feature = "objc2-foundation"))]
70#[inline]
71pub unsafe extern "C-unwind" fn IOBluetoothNSStringFromDeviceAddressColon(
72 device_address: *const BluetoothDeviceAddress,
73) -> Option<Retained<NSString>> {
74 extern "C-unwind" {
75 fn IOBluetoothNSStringFromDeviceAddressColon(
76 device_address: *const BluetoothDeviceAddress,
77 ) -> *mut NSString;
78 }
79 let ret = unsafe { IOBluetoothNSStringFromDeviceAddressColon(device_address) };
80 unsafe { Retained::retain_autoreleased(ret) }
81}
82
83/// Apple designated PIM data is classified as: .vcard, .vcal, .vcf, .vnote, .vmsg, .vcs
84///
85/// Parameter `inFileName`: Name of file - should include extension!
86///
87/// Returns: Yes or no, is it Apple-designated PIM data?
88///
89/// Not much to talk about.
90///
91/// # Safety
92///
93/// `in_file_name` might not allow `None`.
94#[cfg(feature = "objc2-foundation")]
95#[inline]
96pub unsafe extern "C-unwind" fn IOBluetoothIsFileAppleDesignatedPIMData(
97 in_file_name: Option<&NSString>,
98) -> bool {
99 extern "C-unwind" {
100 fn IOBluetoothIsFileAppleDesignatedPIMData(in_file_name: Option<&NSString>) -> Boolean;
101 }
102 let ret = unsafe { IOBluetoothIsFileAppleDesignatedPIMData(in_file_name) };
103 ret != 0
104}
105
106/// Parameter `inName`: Name of file that needs unique name in the specified path.
107///
108/// Parameter `inPath`: Path you are trying to put file into.
109///
110/// Returns: String with a unique name appended on it for the provided path.
111///
112/// When passed a VALID filename and a VALID path, this routine will return you a the path with the name
113/// appended onto it. If it already exist, it will insert a #1, #2, etc. Example:
114/// If you pass
115/// @
116/// "TestFile.txt" and
117/// @
118/// "~/Documents", you will get
119/// @
120/// "~Documents/TestFile.txt".
121/// If one already exists, you will be returned:
122/// @
123/// "~Documents/TestFile #1.txt".
124///
125/// # Safety
126///
127/// - `in_name` might not allow `None`.
128/// - `in_path` might not allow `None`.
129#[cfg(all(feature = "objc2", feature = "objc2-foundation"))]
130#[inline]
131pub unsafe extern "C-unwind" fn IOBluetoothGetUniqueFileNameAndPath(
132 in_name: Option<&NSString>,
133 in_path: Option<&NSString>,
134) -> Option<Retained<NSString>> {
135 extern "C-unwind" {
136 fn IOBluetoothGetUniqueFileNameAndPath(
137 in_name: Option<&NSString>,
138 in_path: Option<&NSString>,
139 ) -> *mut NSString;
140 }
141 let ret = unsafe { IOBluetoothGetUniqueFileNameAndPath(in_name, in_path) };
142 unsafe { Retained::retain_autoreleased(ret) }
143}
144
145extern "C-unwind" {
146 /// Returns total number of HID devices on the system (Bluetooth + USB)
147 ///
148 /// Returns: Number of HID devices.
149 pub fn IOBluetoothNumberOfAvailableHIDDevices() -> c_long;
150}
151
152extern "C-unwind" {
153 /// Returns number of "pointing" HID devices on the system (Bluetooth + USB)
154 ///
155 /// Returns: Number of HID devices.
156 pub fn IOBluetoothNumberOfPointingHIDDevices() -> c_long;
157}
158
159extern "C-unwind" {
160 /// Returns number of keyboard HID devices on the system (Bluetooth + USB)
161 ///
162 /// Returns: Number of HID devices.
163 pub fn IOBluetoothNumberOfKeyboardHIDDevices() -> c_long;
164}
165
166extern "C-unwind" {
167 /// Returns number of "Tablet" HID devices on the system (Bluetooth + USB)
168 ///
169 /// Returns: Number of HID devices.
170 pub fn IOBluetoothNumberOfTabletHIDDevices() -> c_long;
171}
172
173extern "C-unwind" {
174 /// Returns total number of registry entries with the provided device classname. e.g. "IOHIPointing"
175 ///
176 /// Returns: Number of HID devices.
177 ///
178 /// # Safety
179 ///
180 /// `device_type` must be a valid pointer.
181 pub fn IOBluetoothFindNumberOfRegistryEntriesOfClassName(device_type: *const c_char) -> c_long;
182}