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    #[cfg(all(feature = "Bluetooth", feature = "objc2-foundation"))]
22    pub fn IOBluetoothNSStringToDeviceAddress(
23        in_name_string: Option<&NSString>,
24        out_device_address: *mut BluetoothDeviceAddress,
25    ) -> IOReturn;
26}
27
28/// Convenience routine to take a device address structure and create an NSString.
29///
30/// Parameter `deviceAddress`: A valid bluetooth device structure.
31///
32/// Returns: Returns the created address string.
33///
34/// The resultant string will be in this format: "00-11-22-33-44-55"
35#[cfg(all(feature = "Bluetooth", feature = "objc2", feature = "objc2-foundation"))]
36#[inline]
37pub unsafe extern "C-unwind" fn IOBluetoothNSStringFromDeviceAddress(
38    device_address: *const BluetoothDeviceAddress,
39) -> Option<Retained<NSString>> {
40    extern "C-unwind" {
41        fn IOBluetoothNSStringFromDeviceAddress(
42            device_address: *const BluetoothDeviceAddress,
43        ) -> *mut NSString;
44    }
45    let ret = unsafe { IOBluetoothNSStringFromDeviceAddress(device_address) };
46    unsafe { Retained::retain_autoreleased(ret) }
47}
48
49/// Convenience routine to take a device address structure and create an NSString.
50///
51/// Parameter `deviceAddress`: A valid bluetooth device structure.
52///
53/// Returns: Returns the created address string.
54///
55/// The resultant string will be in this format: "00:11:22:33:44:55"
56#[cfg(all(feature = "Bluetooth", feature = "objc2", feature = "objc2-foundation"))]
57#[inline]
58pub unsafe extern "C-unwind" fn IOBluetoothNSStringFromDeviceAddressColon(
59    device_address: *const BluetoothDeviceAddress,
60) -> Option<Retained<NSString>> {
61    extern "C-unwind" {
62        fn IOBluetoothNSStringFromDeviceAddressColon(
63            device_address: *const BluetoothDeviceAddress,
64        ) -> *mut NSString;
65    }
66    let ret = unsafe { IOBluetoothNSStringFromDeviceAddressColon(device_address) };
67    unsafe { Retained::retain_autoreleased(ret) }
68}
69
70/// Apple designated PIM data is classified as: .vcard, .vcal, .vcf, .vnote, .vmsg, .vcs
71///
72/// Parameter `inFileName`: Name of file - should include extension!
73///
74/// Returns: Yes or no, is it Apple-designated PIM data?
75///
76/// Not much to talk about.
77#[cfg(feature = "objc2-foundation")]
78#[inline]
79pub unsafe extern "C-unwind" fn IOBluetoothIsFileAppleDesignatedPIMData(
80    in_file_name: Option<&NSString>,
81) -> bool {
82    extern "C-unwind" {
83        fn IOBluetoothIsFileAppleDesignatedPIMData(in_file_name: Option<&NSString>) -> Boolean;
84    }
85    let ret = unsafe { IOBluetoothIsFileAppleDesignatedPIMData(in_file_name) };
86    ret != 0
87}
88
89/// Parameter `inName`: Name of file that needs unique name in the specified path.
90///
91/// Parameter `inPath`: Path you are trying to put file into.
92///
93/// Returns: String with a unique name appended on it for the provided path.
94///
95/// When passed a VALID filename and a VALID path, this routine will return you a the path with the name
96/// appended onto it. If it already exist, it will insert a #1, #2, etc. Example:
97/// If you pass
98/// &#64
99/// "TestFile.txt" and
100/// &#64
101/// "~/Documents", you will get
102/// &#64
103/// "~Documents/TestFile.txt".
104/// If one already exists, you will be returned:
105/// &#64
106/// "~Documents/TestFile #1.txt".
107#[cfg(all(feature = "objc2", feature = "objc2-foundation"))]
108#[inline]
109pub unsafe extern "C-unwind" fn IOBluetoothGetUniqueFileNameAndPath(
110    in_name: Option<&NSString>,
111    in_path: Option<&NSString>,
112) -> Option<Retained<NSString>> {
113    extern "C-unwind" {
114        fn IOBluetoothGetUniqueFileNameAndPath(
115            in_name: Option<&NSString>,
116            in_path: Option<&NSString>,
117        ) -> *mut NSString;
118    }
119    let ret = unsafe { IOBluetoothGetUniqueFileNameAndPath(in_name, in_path) };
120    unsafe { Retained::retain_autoreleased(ret) }
121}
122
123extern "C-unwind" {
124    /// Returns total number of HID devices on the system (Bluetooth + USB)
125    ///
126    /// Returns: Number of HID devices.
127    pub fn IOBluetoothNumberOfAvailableHIDDevices() -> c_long;
128}
129
130extern "C-unwind" {
131    /// Returns number of "pointing" HID devices on the system (Bluetooth + USB)
132    ///
133    /// Returns: Number of HID devices.
134    pub fn IOBluetoothNumberOfPointingHIDDevices() -> c_long;
135}
136
137extern "C-unwind" {
138    /// Returns number of keyboard HID devices on the system (Bluetooth + USB)
139    ///
140    /// Returns: Number of HID devices.
141    pub fn IOBluetoothNumberOfKeyboardHIDDevices() -> c_long;
142}
143
144extern "C-unwind" {
145    /// Returns number of "Tablet" HID devices on the system (Bluetooth + USB)
146    ///
147    /// Returns: Number of HID devices.
148    pub fn IOBluetoothNumberOfTabletHIDDevices() -> c_long;
149}
150
151extern "C-unwind" {
152    /// Returns total number of registry entries with the provided device classname. e.g. "IOHIPointing"
153    ///
154    /// Returns: Number of HID devices.
155    pub fn IOBluetoothFindNumberOfRegistryEntriesOfClassName(device_type: *const c_char) -> c_long;
156}