2017-10-21 9 views
-1

나는 iOS에서 장치의 Mac ID를 직접 가져올 수 없다는 것을 알고 있습니다. 거기에 어떤 방식 으로든, 그래서 만약 내가 MAC ID를 가지고, 내가 CoreBluetooth가 제공하는 식별자로 변환 할 수 있습니다.알려진 MAC 주소를 CBPheheherheral 식별자로 변환하는 방법은 무엇입니까?

내 용도는 다음과 같습니다. 나는 서버에서 Mac을 알게되었습니다. 사용 가능한 장치 목록에서 알려진 Mac ID가있는 장치와 연결해야합니다. 해결 방법은 없습니까? 감사.

+0

없음 당신이, 당신은 아마 반대하지 않는 한을 설계 할 수는 iOS에서 사용하는 "무작위"MAC 대 UUID. 그러나 장치를 제어 할 수있는 경우이를 연결할 올바른 장치를 식별하는 데 도움이되는 광고 데이터 또는 특성 값에 장치를 넣을 수 있습니다. – Larme

답변

1

직접 MAC 주소를 사용할 수 없습니다. 하지만 UUID를 발견 한 서비스 인 장치를 식별 할 수있는 방법이 있습니다.

- (void)scanForPeripheralsWithServices:(NSArray<CBUUID *> *)serviceUUIDs 
           options:(NSDictionary<NSString *,id> *)options 

예를 호출되지 API가 :

[self.centralManager 
scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:DEVICE_INFO_SERVICE_UUID]] 
         options:nil]; 

고토 가장 좋은 방법에 대한 https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/BestPracticesForInteractingWithARemotePeripheralDevice/BestPracticesForInteractingWithARemotePeripheralDevice.html

대한 추가 정보 : https://medium.com/@yostane/getting-started-with-bluetooth-low-energy-on-ios-ada3090fc9cc