|
|
Log In | Not a Member? |
Contact ADC |
|
ADC Home > Reference Library > Reference > Hardware & Drivers > Bluetooth > Bluetooth Framework Reference
|
IOBluetoothUtilities.h |
| Include Path: | <IOBluetooth/IOBluetoothUtilities.h> |
| Path: | /System/Library/Frameworks/IOBluetooth.framework/Versions/A/Headers/IOBluetoothUtilities.h |
| Includes: | <stdio.h> <stdlib.h> <string.h> <sysexits.h> <sys/errno.h> <unistd.h> <IOBluetooth/Bluetooth.h> <IOKit/IOReturn.h> <IOBluetooth/IOBluetoothUserLib.h> |
This header defines various functions for working with Bluetooth devices and data.
For more information about accessing Bluetooth devices, see Working With Bluetooth Devices.
IOBluetoothFindNumberOfRegistryEntriesOfClassName |
Returns total number of registry entries with the provided device classname. e.g. "IOHIPointing"
extern long IOBluetoothFindNumberOfRegistryEntriesOfClassName( const char *deviceType ) AVAILABLE_BLUETOOTH_VERSION_1_3_AND_LATER;
Number of HID devices.
IOBluetoothGetUniqueFileNameAndPath |
extern NSString* IOBluetoothGetUniqueFileNameAndPath( NSString *inName, NSString *inPath );
inNameinPathString with a unique name appended on it for the provided path.
When passed a VALID filename and a VALID path, this routine will return you a the path with the name appended onto it. If it already exist, it will insert a #1, #2, etc. Example: If you pass @"TestFile.txt" and @"~/Documents", you will get @"~Documents/TestFile.txt". If one already exists, you will be returned: @"~Documents/TestFile #1.txt".
IOBluetoothIsFileAppleDesignatedPIMData |
Apple designated PIM data is classified as: .vcard, .vcal, .vcf, .vnote, .vmsg, .vcs
extern Boolean IOBluetoothIsFileAppleDesignatedPIMData( NSString *inFileName );
inFileNameYes or no, is it Apple-designated PIM data?
Not much to talk about.
IOBluetoothNSStringFromDeviceAddress |
Convenience routine to take a device address structure and create an NSString.
extern NSString * IOBluetoothNSStringFromDeviceAddress( const BluetoothDeviceAddress *deviceAddress );
deviceAddressReturns the created address string.
The resultant string will be in this format: "00-11-22-33-44-55"
IOBluetoothNSStringToDeviceAddress |
Convenience routine to take an NSString and turn it into a BluetoothDeviceAddress structure.
extern IOReturn IOBluetoothNSStringToDeviceAddress( NSString *inNameString, BluetoothDeviceAddress *outDeviceAddress );
inNameStringoutDeviceAddressReturns success (0) or failure code.
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.
IOBluetoothNumberOfAvailableHIDDevices |
Returns total number of HID devices on the system (Bluetooth + USB)
extern long IOBluetoothNumberOfAvailableHIDDevices() AVAILABLE_BLUETOOTH_VERSION_1_3_AND_LATER;
Number of HID devices.
IOBluetoothNumberOfKeyboardHIDDevices |
Returns number of keyboard HID devices on the system (Bluetooth + USB)
extern long IOBluetoothNumberOfKeyboardHIDDevices() AVAILABLE_BLUETOOTH_VERSION_1_3_AND_LATER;
Number of HID devices.
IOBluetoothNumberOfPointingHIDDevices |
Returns number of "pointing" HID devices on the system (Bluetooth + USB)
extern long IOBluetoothNumberOfPointingHIDDevices() AVAILABLE_BLUETOOTH_VERSION_1_3_AND_LATER;
Number of HID devices.
IOBluetoothNumberOfTabletHIDDevices |
Returns number of "Tablet" HID devices on the system (Bluetooth + USB)
extern long IOBluetoothNumberOfTabletHIDDevices() AVAILABLE_BLUETOOTH_VERSION_1_3_AND_LATER;
Number of HID devices.
IOBluetoothPackData |
Packs a variable amount of parameters into a buffer according to a printf-style format string.
extern long IOBluetoothPackData( void *ioBuffer, const char *inFormat, ... );
ioBufferinFormatvarArginArgsNumber of bytes packed or -1 if an error occurred.
Supported format characters:
'b' 1 byte of data ('b'yte)
'h' 2 bytes of data ('h'alf-word)
'H' 2 bytes of data ('h'alf-word) to byte reverse.
't' 3 bytes of data ('t'riple byte, least significant 24-bits).
'T' 3 bytes of data ('t'riple byte, least significant 24-bits) to byte reverse.
'w' 4 bytes of data ('w'ord).
'W' 4 bytes of data ('w'ord) to byte reverse.
'1' Ptr to 1 byte of data.
'2' Ptr to 2 bytes of data.
'@' (shift-2) Ptr to 2 bytes of data to byte reverse.
'3' Ptr to 3 bytes of data.
'#' (shift-3) Ptr to 3 bytes of data to byte reverse.
'4' Ptr to 4 bytes of data.
'$' (shift-4) Ptr to 4 bytes of data to byte reverse.
'5' Ptr to 5 bytes of data.
'%' (shift-5) Ptr to 5 bytes of data to byte reverse.
'6' Ptr to 6 bytes of data.
'^' (shift-6) Ptr to 6 bytes of data to byte reverse.
'7' Ptr to 6 bytes of data.
'&' (shift-7) Ptr to 7 bytes of data to byte reverse.
'8' Ptr to 6 bytes of data.
'*' (shift-8) Ptr to 8 bytes of data to byte reverse.
'9' Ptr to 6 bytes of data.
'(' (shift-9) Ptr to 9 bytes of data to byte reverse.
'n' Ptr to n bytes of data (first param is size, second is ptr).
'N' Ptr to n bytes of data to byte reverse (first param is size, second is ptr).
's' Ptr to C-string (includes null terminator)
'p' Ptr to Pascal-string (includes length byte).
Example usage:
bytesPacked = PackData( buffer, "bts", 'U', 'XYZ', "This is a C-style string" );Warning: Raw values packed with 'b', 'h', 't', and 'w' have their bytes packed into the buffer from left to right even on little-endian systems. For example, the value 0x12345678 would be sent out as 0x12 0x34 0x56 0x78. This needs to be taken into consideration if the value is expected to be in little-endian format in the buffer. This case requires you byte swap the value on all systems before sending it to this routine.
IOBluetoothUnpackData |
Unpacks a variable amount of data from a buffer into a variable number of parameters according to a printf-style format string.
extern long IOBluetoothUnpackData( ByteCount inBufferSize, const void *inBuffer, const char *inFormat, ... );
inBufferSizeinBufferinFormatvarArginArgsNumber of bytes unpacked or -1 if an error occurred.
Supported format characters:
'b' Ptr to receive 1 byte of data ('b'yte).
'h' Ptr to receive 2 bytes of data ('h'alf-word).
'H' Ptr to receive 2 bytes of byte-reversed data ('h'alf-word).
't' Ptr to receive 3 bytes of data ('t'riple byte, least significant 24-bits).
'T' Ptr to receive 3 bytes of byte-reversed data ('t'riple byte, least significant 24-bits).
'w' Ptr to receive 4 bytes of data ('w'ord).
'W' Ptr to receive 4 bytes of byte-reversed data ('w'ord).
'1' Ptr to receive 1 byte of data.
'2' Ptr to receive 2 bytes of data.
'@' (shift-2) Ptr to 2 bytes of data, byte reversed.
'3' Ptr to receive 3 bytes of data.
'#' (shift-3) Ptr to receive 3 bytes of data, byte reversed.
'4' Ptr to receive 4 bytes of data.
'$' (shift-4) Ptr to receive 4 bytes of data, byte reversed.
'5' Ptr to receive 5 bytes of data.
'%' (shift-5) Ptr to receive 5 bytes of data, byte reversed.
'6' Ptr to receive 6 bytes of data.
'^' (shift-6) Ptr to receive 6 bytes of data, byte reversed.
'7' Ptr to receive 7 bytes of data.
'&' (shift-7) Ptr to receive 7 bytes of data, byte reversed.
'8' Ptr to receive 8 bytes of data.
'*' (shift-8) Ptr to receive 8 bytes of data, byte reversed.
'9' Ptr to receive 9 bytes of data.
'(' (shift-9) Ptr to receive 9 bytes of data, byte reversed.
'n' Ptr to receive n bytes of data (first param is size, second is ptr to receive data).
'N' Ptr to receive n bytes of data to byte reverse (first param is size, second is ptr to receive data).
's' Ptr to receive C-string (first param is max size, second is ptr to receive data).
'p' Ptr to receive Pascal-string (first param is max size including length-byte, second is ptr to receive data).
Example usage:
bytesUnpacked = UnpackData( 100, buffer, "bwnsp", &myByte1, &myWord, 50, buffer1, 128, buffer2, 255, pString );
|