2011-06-13 93 views
1

我正在致力於建立與藍牙客戶端的連接並打開用於數據傳輸的RFCOMM通道的簡單主機程序(C++/xcode/osx)。當我從BT客戶端向主機發送數據時,我將數據與隨機轉儲混合在一起,看起來是Bluetooth Audio Agent。是否有可能與OS X Bluetooth Audio Agent共享我的RFCOMM頻道?音頻數據使用IOBluetooth框架污染我的RFCOMM頻道

我的藍牙設備需要支持串行(SPP)和免提(HFP)配置文件。所以我堅信這個問題是圍繞着HFP或SCO配置文件來污染我的RFCOMM頻道和它的數據。有沒有辦法確保我只通過頻道收到我的數據?

這裏是我的項目的精簡版。當客戶端連接時,它開始回顯a的字母。主機應用程序打印從客戶端收到的內容,如果接收到的數據是a,則它也會記錄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); 
} 

下面是該程序的輸出:

 
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\[email protected]\204\204\204NSMutableDictionarya)*\251\253\274_BluetoothVersionNumber_PersistentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionarya\251\253\274_BluetoothVersionNumber_PersistentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionarya_BluetoothVersionNumber_PersistentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryauetoothVersionNumber_PersistentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryathVersionNumber_PersistentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryasionNumber_PersistentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaumber_PersistentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionarya_PersistentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryarsistentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaentServicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryarvicesZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryasZHIDDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaDevices_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaes_SCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaSCOAudioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryadioDevices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryavices_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionarya_DaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaemonNoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaoRoleSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaSwitchDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryahDeviceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaceList_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryat_!DaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaaemonControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaControllersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaollersConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryasConfigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaigurationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryationKey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaey_ControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaControllerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaollerPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaPowerState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaState_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionarya_BluetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryauetoothAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryathAutoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaoSeekHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaHIDDevices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryavices_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionarya_PersistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryarsistentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaentPortsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryartsZPANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaANDevices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaices]PairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaPairedDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryadDevices_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaces_PersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaPersistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaistentPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryatPortsServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryasServicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaicesOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaOMstreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryastreamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaamtyped\201\350\[email protected]\204\204\204NSMutableDictionaryaed\201\350\[email protected]\204\204\204NSMutableDictionarya\[email protected]\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! 


回答

0

好吧,我敢肯定,我發現我的問題。我複製到char *的數據指針未終止。我改寫了這一點:

const char *data_const = (const char *)event->u.data.dataPtr; 
char *dataAsBytes = const_cast<char *>(data_const); 
string in_s = (string)dataAsBytes; 

要這樣:

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);