2015-02-04 2 views
5

요즘 저는 MFI가 아닌 Bluetooth 장치를 iPhone에 연결해야하는 프로젝트에서 작업하고 있으며 해당 장치가 지원되지 않습니다. BLE 주변 클라이언트이므로 클래식 블루투스에서이 작업을 수행해야합니다. BluetoothManager.framework를 사용하여 데이터를 보내고받는 방법 iOS의 비공개 API

나는 내가 클래스 -에서 API를 찾을 수 없습니다, 짝을 관리하고 demo project BeeTee

의 가이드와 함께 BluetoothManager.framework를 사용하여 아이폰에 장치를 연결하지만이 방법 RECV 데이터를 전송하고 알려져 있지 않습니다 덤프 헤더.

답이 세 가지 structs:BTAccessoryManagerImpl & BTSessionImpl & BTDeviceImpl에 있다고 보인다, 그러나 나는 그 (것)들의 정의를 얻을 수 없습니다.

@class NSMutableDictionary; 

struct BTSessionImpl { }; 
struct BTDeviceImpl { }; 


@interface BluetoothManager : NSObject { 
    struct BTAccessoryManagerImpl { } *_accessoryManager; 
    BOOL _audioConnected; 
    int _available; 
    NSMutableDictionary *_btAddrDict; 
    NSMutableDictionary *_btDeviceDict; 
    struct BTDiscoveryAgentImpl { } *_discoveryAgent; 
    struct BTLocalDeviceImpl { } *_localDevice; 
    struct BTPairingAgentImpl { } *_pairingAgent; 
    BOOL _scanningEnabled; 
    BOOL _scanningInProgress; 
    unsigned int _scanningServiceMask; 
    struct BTSessionImpl *_session; // struct BTSessionImpl { } *_session; 

} 

+ (int)lastInitError; 
+ (id)sharedInstance; 

- (struct BTAccessoryManagerImpl *)_accessoryManager; // - (struct BTAccessoryManagerImpl { }*)_accessoryManager; 
- (void)_advertisingChanged; 
- (BOOL)_attach:(id)arg1; 
- (void)_cleanup:(BOOL)arg1; 
- (void)_connectabilityChanged; 
- (void)_connectedStatusChanged; 
- (void)_discoveryStateChanged; 
- (BOOL)_onlySensorsConnected; 
- (void)_postNotification:(id)arg1; 
- (void)_postNotificationWithArray:(id)arg1; 
- (void)_powerChanged; 
- (void)_removeDevice:(id)arg1; 
- (void)_restartScan; 
- (void)_scanForServices:(unsigned int)arg1 withMode:(int)arg2; 
- (void)_setScanState:(int)arg1; 
- (BOOL)_setup:(struct BTSessionImpl*)arg1; 
- (void)acceptSSP:(int)arg1 forDevice:(id)arg2; 
- (id)addDeviceIfNeeded:(struct BTDeviceImpl *)arg1; 
- (BOOL)audioConnected; 
- (BOOL)available; 
- (void)cancelPairing; 
- (void)connectDevice:(id)arg1 withServices:(unsigned int)arg2; 
- (void)connectDevice:(id)arg1; 
- (BOOL)connectable; 
- (BOOL)connected; 
- (id)connectedDevices; 
- (id)connectingDevices; 
- (void)dealloc; 
- (BOOL)devicePairingEnabled; 
- (BOOL)deviceScanningEnabled; 
- (BOOL)deviceScanningInProgress; 
- (void)enableTestMode; 
- (BOOL)enabled; 
- (void)endVoiceCommand:(id)arg1; 
- (id)init; 
- (BOOL)isAnyoneAdvertising; 
- (BOOL)isAnyoneScanning; 
- (BOOL)isDiscoverable; 
- (BOOL)isServiceSupported:(unsigned int)arg1; 
- (int)localDeviceSupportsService:(unsigned int)arg1; 
- (id)pairedDevices; 
- (void)postNotification:(id)arg1; 
- (void)postNotificationName:(id)arg1 object:(id)arg2 error:(id)arg3; 
- (void)postNotificationName:(id)arg1 object:(id)arg2; 
- (int)powerState; 
- (BOOL)powered; 
- (void)resetDeviceScanning; 
- (void)scanForConnectableDevices:(unsigned int)arg1; 
- (void)scanForServices:(unsigned int)arg1; 
- (void)setAudioConnected:(BOOL)arg1; 
- (void)setConnectable:(BOOL)arg1; 
- (void)setDevicePairingEnabled:(BOOL)arg1; 
- (void)setDeviceScanningEnabled:(BOOL)arg1; 
- (void)setDiscoverable:(BOOL)arg1; 
- (BOOL)setEnabled:(BOOL)arg1; 
- (void)setPincode:(id)arg1 forDevice:(id)arg2; 
- (BOOL)setPowered:(BOOL)arg1; 
- (void)showPowerPrompt; 
- (void)startVoiceCommand:(id)arg1; 
- (void)unpairDevice:(id)arg1; 
- (BOOL)wasDeviceDiscovered:(id)arg1; 

@end 
+0

Bee 티 블루투스 프레임 워크를 사용하여 블루투스에 연결하는 방법 –

답변

2

가상 파일 /dev/ttys*을 통해 블루투스 연결에서 데이터를 읽거나 쓸 수 있습니다. 올바른 서비스에 성공적으로 연결되면 BTDeviceGetComPortForServiceMobileBluetooth.framework에서 호출해야 올바른 파일 경로를 검색 할 수 있습니다. 오른쪽 헤더 파일의 전체 예제는 here입니다.

파일을 열고 읽거나 쓰십시오. 그게 전부 야. 데이터를 비동기 적으로 읽으려면 openTtyreadCompletionNotification 메서드에서 look here이있을 수 있습니다.

jailbroken IOS 7 iPhone에서 저에게 효과적입니다. 다른 사람이이 솔루션으로 성공했는지 알고 싶습니다.

+0

고마워요! alu. – Nick

+0

안녕하세요. iOS 10.0을 사용하는 블루투스 장치에 연결하려고합니다. 블루투스 관리자를 사용하여이를 달성하지만 데이터를 보내거나받을 필요가 있으며 MobileBluetooth.framework를 사용하는 방법을 모르겠습니다. 장치에서 데이터를 검색하는 방법을 알고 있습니까? 감사 ;) – llKoull

관련 문제