aboutsummaryrefslogtreecommitdiffhomepage
path: root/IOBluetooth-Compat/IOBluetooth-Compat/IOBluetooth_Compat.m
blob: 63989178d3e04cc38037174f0955542ded0ccb9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//
//  IOBluetooth_Compat.m
//  IOBluetooth-Compat
//
//  Created by TCMac on 15/11/2013.
//  Original Header is (c) Apple Inc.
//  Copyright (c) 2013 TC Wan
//

#import "IOBluetooth_Compat.h"

@implementation IOBluetooth_Compat


/*!
 @function IOBluetoothSDPServiceRecordGetRFCOMMChannelID
 @abstract Allows the discovery of the RFCOMM channel ID assigned to the service.
 @discussion This function will search through the ProtoclDescriptorList attribute to find an entry
 with the RFCOMM UUID (UUID16: 0x0003).  If one is found, it gets the second element of
 the data element sequence and sets the rfcommChannelID pointer to it.  The channel ID
 only gets set when kIOReturnSuccess is returned.
 @param	serviceRecord The target IOBluetoothSDPServiceRecordRef
 @param	rfcommChannelID A pointer to the location that will get the found RFCOMM channel ID.
 @result Returns kIOReturnSuccess if the channel ID is found.
 */

IOReturn IOBluetoothSDPServiceRecordGetRFCOMMChannelID(IOBluetoothSDPServiceRecordRef serviceRecord, BluetoothRFCOMMChannelID *channelID)
{
    return kIOReturnError;
}

/*!	@function	IOBluetoothRFCOMMChannelGetMTU
 @abstract
 @param		rfcommChannel (IOBluetoothRFCOMMChannelRef) The channel reference
 @result		Channel MTU size.
 @discussion Returns the length of the largest chunk of data that this channel can carry. If the
 caller wishes to use the write:length:sleep: api the length of the data can not be bigger than
 the channel MTU (maximum transfer unit).
 */

BluetoothRFCOMMMTU IOBluetoothRFCOMMChannelGetMTU( IOBluetoothRFCOMMChannelRef rfcommChannel ) {
    return 0;
}

/*!	@function	IOBluetoothRFCOMMChannelCloseChannel
 @param		rfcommChannel (IOBluetoothRFCOMMChannelRef) The channel reference
 @result		An error code value. 0 if successful.
 @discussion
 */

IOReturn	IOBluetoothRFCOMMChannelCloseChannel(IOBluetoothRFCOMMChannelRef rfcommChannel)
{
    return kIOReturnError;
}

/*!	@function	IOBluetoothRFCOMMChannelWriteAsync
 @abstract	Write data to a RFCOMM channel asynchronously.
 @param		rfcommChannel (IOBluetoothRFCOMMChannelRef) The channel reference
 @param 		data is a pointer to the data buffer to be sent.
 @param 		length the length of the buffer to be sent (in bytes).
 @param		refcon a NON NULL value that will be contained in the return event (once the data is sent).
 @result		An error code value. 0 if successful.
 @discussion	Sends data tough the channel. The number of bytes to be sent must not exceed the channel MTU.
 If the return value is an error condition none of the data was sent.
 
 NOTE: This function is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later.
 */

IOReturn	IOBluetoothRFCOMMChannelWriteAsync(IOBluetoothRFCOMMChannelRef rfcommChannel, void *data, UInt16 length, void *refcon)
{
    return kIOReturnError;
}

/*!
 @function	IOBluetoothDeviceOpenRFCOMMChannelAsync
 @abstract	Opens a new RFCOMM channel to the target device. Returns immedialty after starting the opening process.
 @discussion	This function will begin the process of opening a new RFCOMM channel to the target device.
 The baseband connection to the device will be opened if it is not open already.  The RFCOMM
 channel open process will not complete until the client has registered an incoming data
 listener on the new channel.
 
 Because a new IOBluetoothL2CAPChannelRef will be created for the client as a result of this
 function, the client is responsible for releasing the resulting IOBluetoothL2CAPChannelRef
 (by calling IOBluetoothObjectRelease()).
 
 NOTE: This function is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later.
 @param		btDevice The target IOBluetoothDeviceRef
 @param		rfcommChannel	A pointer to an IOBluetoothRFCOMMChannelRef to receive the RFCOMM channel
 requested to be opened.  The rfcommChannel pointer will only be set if
 kIOReturnSuccess is returned.
 @param		channelID		The RFCOMM channel ID for the new channel.
 @param		withEventListener a IOBluetoothRFCOMMChannelIncomingEventListener where to receive events
 regarding the channel (MUST be specified).
 @param		refCon			a refcon pointer (for the callback specified above).
 @result		Returns kIOReturnSuccess if the open process was successfully started .
 */

IOReturn IOBluetoothDeviceOpenRFCOMMChannelAsync(IOBluetoothDeviceRef btDevice, IOBluetoothRFCOMMChannelRef *newChannel, BluetoothRFCOMMChannelID channelID, IOBluetoothRFCOMMChannelIncomingEventListener eventListener, void *refcon) {
    return kIOReturnError;
}

@end