I'm working on simple host program (c++/xcode/osx) that establishes a connection to a Bluetooth client and opens an RFCOMM channel for data transmission. When I send data from the BT client to the host I get my data mixed with random dumps from what looks to be a Bluetooth Audio Agent. Is it possible that I'm sharing my RFCOMM channel with the OS X Bluetooth Audio Agent?
My Bluetooth device needs to support both Serial (SPP) and Hands-Free (HFP) profiles. So I strongly believe that the issue is around the HFP or SCO profile polluting my RFCOMM channel with it's data. Is there a way to make sure that I only get my data coming through the channel?
Here's a condensed version of my project. When the client is connected it starts echoing the letter a
. The host app prints what it receives from the client, and if the received data is an a
it also logs OK!\n
.
#include <IOBluetooth/IOBluetoothUserLib.h>
#include <IOBluetooth/IOBluetoothUtilities.h>
#include <IOBluetoothUI/IOBluetoothUI.h>
#include <IOBluetoothUI/IOBluetoothUIUserLib.h>
#include "testApp.h"
// Callback function create-connection
void bluetoothCreateConnection_c(void *userRefCon, IOBluetoothDeviceRef deviceRef, IOReturn status) {
printf("Created connection\n");
}
// Callback for RFCOMM events
void rfcommEventListener_c (IOBluetoothRFCOMMChannelRef channel_ref, void *userRefCon, IOBluetoothRFCOMMChannelEvent *event) {
if (event->eventType == kIOBluetoothRFCOMMNewDataEvent) {
const char *data_const = (const char *)event->u.data.dataPtr;
char *dataAsBytes = const_cast<char *>(data_const);
string in_s = (string)dataAsBytes;
printf("%s", dataAsBytes);
if(in_s == "a") {
printf("OK!\n");
}
}
}
void testApp::setup() {
BluetoothDeviceAddress *addr;
string s = "00-16-a4-00-72-3d"; // hardcoded BT address
CFStringRef str_addr;
str_addr = CFStringCreateWithCString(kCFAllocatorDefault, s.c_str(), kCFStringEncodingMacRoman);
IOBluetoothCFStringToDeviceAddress(str_addr, addr);
IOBluetoothDeviceRef dev = IOBluetoothDeviceCreateWithAddress(addr);
IOBluetoothDeviceOpenConnection(dev, &bluetoothCreateConnection_c, NULL);
printf("in openRFCOMMChannel\n");
CFArrayRef device_services = IOBluetoothDeviceGetServices(dev);
printf("Getting SDP service record\n");
IOBluetoothSDPServiceRecordRef service_record = (IOBluetoothSDPServiceRecordRef) CFArrayGetValueAtIndex(device_services, 0);
UInt8 channel_id;
IOBluetoothRFCOMMChannelRef channel_ref;
printf("Finding channel ID\n");
IOBluetoothSDPServiceRecordGetRFCOMMChannelID(service_record, &channel_id);
// Open channel and listen for RFCOMM data
IOBluetoothDeviceOpenRFCOMMChannelAsync(dev, &channel_ref, channel_id, &rfcommEventListener_c, NULL);
}
Here's the output from the program:
run [Switching to process 41228] Running… in openRFCOMMChannel 2011-06-13 13:44:04.762 test (Debug)[41228:a0f] *** __NSAutoreleaseNoPool(): Object 0x1d27770 of class NSCFArray autoreleased with no pool in place - just leaking Getting SDP service record Finding channel ID Created connection aOK! aaOK! aaOK! a!()*\251\253\274_BluetoothVersionNumber_PersistentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionarya)*\251\253\274_BluetoothVersionNumber_PersistentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionarya\251\253\274_BluetoothVersionNumber_PersistentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionarya_BluetoothVersionNumber_PersistentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryauetoothVersionNumber_PersistentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryathVersionNumber_PersistentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryasionNumber_PersistentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaumber_PersistentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped开发者_StackOverflow社区\201\350\204@\204\204\204NSMutableDictionarya_PersistentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryarsistentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryarvicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryasZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaes_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaSCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryadioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryavices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionarya_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryahDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryat_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaollersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryasConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaollerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionarya_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryauetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryathAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryavices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionarya_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryarsistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryartsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaPairedDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryadDevices_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaces_PersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaPersistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaistentPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryatPortsServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryasServicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaicesOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryaOMstreamtyped\201\350\204@\204\204\204NSMutableDictionaryastreamtyped\201\350\204@\204\204\204NSMutableDictionaryaamtyped\201\350\204@\204\204\204NSMutableDictionaryaed\201\350\204@\204\204\204NSMutableDictionarya\204@\204\204\204NSMutableDictionarya\204NSMutableDictionaryaaeDictionaryaionaryayaNSDictionaryationaryaryaNSObjectajectaa\206\242a_00-14-51-cc-20-41_00-0a-95-3f-fe-8a\324a0-14-51-cc-20-41_00-0a-95-3f-fe-8a\324a51-cc-20-41_00-0a-95-3f-fe-8a\324a-20-41_00-0a-95-3f-fe-8a\324a1_00-0a-95-3f-fe-8a\324a0-0a-95-3f-fe-8a\324a95-3f-fe-8a\324a-fe-8a\324aa\324a\324aOK! a\232a00-16-a4-00-17-7e_00-16-a4-00-72-3d_00-23-7f-49-98-a6_00-1a-10-04-13-9a\323a6-a4-00-17-7e_00-16-a4-00-72-3d_00-23-7f-49-98-a6_00-1a-10-04-13-9a\323a00-17-7e_00-16-a4-00-72-3d_00-23-7f-49-98-a6_00-1a-10-04-13-9a\323a-7e_00-16-a4-00-72-3d_00-23-7f-49-98-a6_00-1a-10-04-13-9a\323a00-16-a4-00-72-3d_00-23-7f-49-98-a6_00-1a-10-04-13-9a\323a6-a4-00-72-3d_00-23-7f-49-98-a6_00-1a-10-04-13-9a\323a00-72-3d_00-23-7f-49-98-a6_00-1a-10-04-13-9a\323a-3d_00-23-7f-49-98-a6_00-1a-10-04-13-9a\323a00-23-7f-49-98-a6_00-1a-10-04-13-9a\323a3-7f-49-98-a6_00-1a-10-04-13-9a\323a49-98-a6_00-1a-10-04-13-9a\323a-a6_00-1a-10-04-13-9a\323a00-1a-10-04-13-9a\323aa-10-04-13-9a\323a04-13-9a\323a-9a\323a\323aOK! aYAgentPathXDriverID_IOAudioControls_W/System/Library/CoreServices/BluetoothAudioAgent.app/Contents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244antPathXDriverID_IOAudioControls_W/System/Library/CoreServices/BluetoothAudioAgent.app/Contents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244ahXDriverID_IOAudioControls_W/System/Library/CoreServices/BluetoothAudioAgent.app/Contents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244averID_IOAudioControls_W/System/Library/CoreServices/BluetoothAudioAgent.app/Contents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244a_IOAudioControls_W/System/Library/CoreServices/BluetoothAudioAgent.app/Contents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244aAudioControls_W/System/Library/CoreServices/BluetoothAudioAgent.app/Contents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244aControls_W/System/Library/CoreServices/BluetoothAudioAgent.app/Contents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244aols_W/System/Library/CoreServices/BluetoothAudioAgent.app/Contents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244aW/System/Library/CoreServices/BluetoothAudioAgent.app/Contents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244atem/Library/CoreServices/BluetoothAudioAgent.app/Contents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244aibrary/CoreServices/BluetoothAudioAgent.app/Contents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244ay/CoreServices/BluetoothAudioAgent.app/Contents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244aeServices/BluetoothAudioAgent.app/Contents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244aices/BluetoothAudioAgent.app/Contents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244aBluetoothAudioAgent.app/Contents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244aoothAudioAgent.app/Contents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244audioAgent.app/Contents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244agent.app/Contents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244aapp/Contents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244aontents/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244ats/MacOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244acOS/BluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244aluetoothAudioAgent_00-16-a4-00-17-7e-SCO\244aothAudioAgent_00-16-a4-00-17-7e-SCO\244adioAgent_00-16-a4-00-17-7e-SCO\244aent_00-16-a4-00-17-7e-SCO\244a00-16-a4-00-17-7e-SCO\244a6-a4-00-17-7e-SCO\244a00-17-7e-SCO\244a-7e-SCO\244aCO\244aOK! aN\332a\332aOK! a%aOK! aaOK! a.aOK! aIOAudioControlType_IOAudioControlSubType_IOAudioControlChannelID_IOAudioControlValue_IOAudioControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaioControlType_IOAudioControlSubType_IOAudioControlChannelID_IOAudioControlValue_IOAudioControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeatrolType_IOAudioControlSubType_IOAudioControlChannelID_IOAudioControlValue_IOAudioControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaype_IOAudioControlSubType_IOAudioControlChannelID_IOAudioControlValue_IOAudioControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaIOAudioControlSubType_IOAudioControlChannelID_IOAudioControlValue_IOAudioControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeadioControlSubType_IOAudioControlChannelID_IOAudioControlValue_IOAudioControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeantrolSubType_IOAudioControlChannelID_IOAudioControlValue_IOAudioControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaSubType_IOAudioControlChannelID_IOAudioControlValue_IOAudioControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaaIOAudioControlChannelID_IOAudioControlValue_IOAudioControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaioControlChannelID_IOAudioControlValue_IOAudioControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeatrolChannelID_IOAudioControlValue_IOAudioControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeahannelID_IOAudioControlValue_IOAudioControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmealID_IOAudioControlValue_IOAudioControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaIOAudioControlValue_IOAudioControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeadioControlValue_IOAudioControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeantrolValue_IOAudioControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaValue_IOAudioControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmea_IOAudioControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaAudioControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaControlChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaolChannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeannelName_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaaaaaaaaaaaaaaaame_IOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaIOAudioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeadioLevelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeavelControlMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeantrolMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaMaxDB_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmea_IOAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaAudioLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaLevelControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaControlMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaolMaxValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaValue_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmea_IOAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaAudioLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaLevelControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaControlMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaolMinValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaValue_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmea_IOAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaAudioLevelControlMinDB_IOAudioControlUsagelevlvlmeaLevelControlMinDB_IOAudioControlUsagelevlvlmeaControlMinDB_IOAudioControlUsagelevlvlmeaolMinDB_IOAudioControlUsagelevlvlmeaaIOAudioControlUsagelevlvlmeaioControlUsagelevlvlmeatrolUsagelevlvlmeasagelevlvlmealevlvlmeavlmeaOK!
Ok, I'm pretty sure I found my problem. The data pointer that I copied over to a char *
wasn't 0 terminated. I rewrote this:
const char *data_const = (const char *)event->u.data.dataPtr;
char *dataAsBytes = const_cast<char *>(data_const);
string in_s = (string)dataAsBytes;
To this:
const char *data_const = (const char *)data.dataPtr;
char *dataAsBytes = const_cast<char *>(data_const);
dataAsBytes[data.dataSize] = '\0';
printf("%s %i %i\n", dataAsBytes, data.dataSize);
精彩评论