아이폰 근거리 통신 리서치

18
아아아 아아아 아아 아아아 (Bluetooth, GameKit, Bonjour) A 아 아아아아아 아아아

Upload: junghyun-kim

Post on 10-May-2015

1.314 views

Category:

Technology


8 download

TRANSCRIPT

Page 1: 아이폰 근거리 통신 리서치

아이폰 근거리 통신 리서치(Bluetooth, GameKit, Bon-

jour)A 팀 클라이언트 김정현

Page 2: 아이폰 근거리 통신 리서치

리서치 시작 동기 및 목표• 나도 모르는 사이에 시공 ( 時空 ) 을 공유

하고 있는 누군가와 교류를 하면 재미있을 것 같다 .

• 근거리 내의 유저끼리 스쳐지나갈 정도의 짧은 시간동안 상호 캐릭터 정보를 교환할 수 있게 하고 싶다 .

Page 3: 아이폰 근거리 통신 리서치

결 론

• Only Bluetooth : GameKit API

• Bluetooth + Internet Connect(Include Wi-Fi Direct) : Bonjour

Page 4: 아이폰 근거리 통신 리서치

왜 ?

• GameKit ⊃ Bluetooth• GameKit ⊅ Internet Connection • Bonjour ⊃ GameKit • Bonjour ⊃ Internet Connection

• GameKit 은 결국 Bonjour 를 쓰기 편하게 만들어 놓은 Wrapper 인 것이다 .

Page 5: 아이폰 근거리 통신 리서치

그렇다면 ?

• GameKit 은 뭔가요 ? Bonjour 는 뭔가요 ? 먹는건가요 ? 아이스크림 이름인가… .

Page 6: 아이폰 근거리 통신 리서치

Game Kit 이란 ?

• The Game Kit framework provides Objective C classes that help you to create great social games.

Page 7: 아이폰 근거리 통신 리서치

GameKit 의 기능• Authentication ( 인증 )• Leaderboards ( 온라인 하이스코어

게시판 )• Achievements ( 게임 미션 )• Multiplayer ( 로비 시스템 )• Peer-to-peer networking ( 데이터 ,

음성 정보 교환 )• http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conc

eptual/GameKit_Guide/GameKitConcepts/GameKitConcepts.html#//apple_ref/doc/uid/TP40008304-CH100-SW1

Page 8: 아이폰 근거리 통신 리서치

GameKit 을 이용한 Bluetooth 통신

• http://blog.naver.com/PostView.nhn?blogId=vfturtle&logNo=70104971899 ( 한국 )

• http://ip7.biz/wordpress/?p=260 ( 일본 )

• http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/GameKit_Guide/GameCenterOverview/GameCenterOverview.html#//apple_ref/doc/uid/TP40008304-CH5-SW7 ( 애플 )

Page 9: 아이폰 근거리 통신 리서치

The Peer Picker

Page 10: 아이폰 근거리 통신 리서치

Bluetooth 장치 탐색

Page 11: 아이폰 근거리 통신 리서치

BlueTooth 상호 인증 과정• connectionTypesMask = GKPeerPickerConnection-

TypeNearby|GKPeerPickerConnectionTypeOnline;

Page 12: 아이폰 근거리 통신 리서치

The Peer Picker• 우린 더 복잡한 건 안해줘요 코드

• - (void)peerPickerController:(GKPeerPickerController *)picker didSelectConnectionType:(GKPeerPickerConnectionType)type {

if (type == GKPeerPickerConnectionTypeOnline) { picker.delegate = nil; [picker dismiss]; [picker autorelease]; // Implement your own internet user interface here. }

Page 13: 아이폰 근거리 통신 리서치

BlueTooth 상호 인증 과정

Page 14: 아이폰 근거리 통신 리서치

GameKit 없이 블루투스 쓰고 싶어요 !

• If Bluetooth is enabled, on a new-enough device (3G and above, or iPod equivalent, or iPad) and a new-enough OS (3.1 apparently), Bonjour will automatically work over Bluetooth using link-local addresses (168.254.*). Then you just use TCP/UDP normally.

• (Under the hood, I'm pretty sure GameKit uses Bonjour-over-IP-over-Bluetooth.)

• Supposedly the publishing/browsing is done at the Bluetooth layer, but if one publishes a Bonjour service and the other browses for it, an automatic IP-over-Bluetooth connection is established.

• Any Bonjour examples should automatically work.• 한마디로 봉주르 쓰면 아이피 잡힌거 처럼 동작하면서 블루투스 될꺼라는 말 .• http://stackoverflow.com/questions/3844189/bonjour-over-bluetooth-without

-gamekit

Page 15: 아이폰 근거리 통신 리서치

GameKit 없이 블루투스 쓰고 싶어요 <2>

• http://stackoverflow.com/questions/1049393/gamekit-in-iphone-sdk-3-0

• 질문 요약 : Peer Picker 안쓰고 블루투스 쓸 수 없을까요 ?

• 답변 요약 : GameKit API 를 쓰든가 아예 Bonjour 를 써라

Page 16: 아이폰 근거리 통신 리서치

GameKit 없이 블루투스 쓰고 싶어요 <3>

• The second way to do it is to use standard Bon-jour service selection mechanisms. GameKit is implemented on top of Bonjour (but over Blue-tooth instead of WiFi) so once the two sides have gone through network reachability with each other and connected they are registered under Bonjour and act like any Bonjour service would. The GameKit way is probably a little easier, but if you already have code for WiFi it can be reused for Bluetooth as well.

• http://stackoverflow.com/questions/1049393/gamekit-in-iphone-sdk-3-0

Page 17: 아이폰 근거리 통신 리서치

대체 Bonjour 가 머길래 ?

• zero-configuration networking architecture• addressing (allocating IP addresses to hosts)• naming (using names to refer to hosts instead of

IP addresses)• service discovery (finding services on the network

automatically)• 즉 , 아무것도 설정 안하고 기기를 사용 가능하게 함• 네트워크 프린터 IP 설정 따위 개나 줘버려• 일종의 Network Plug and Play• 기본적으로 TCP/IP 기반• 이거 쓰면 Bluetooth, Through Internet 다 된데요 .

Page 18: 아이폰 근거리 통신 리서치

졸려서 여기까지만 했어요 !

• 그냥 책을 한권 다운로드 받았어요 .• 봉쥬르는 9 장보면 다 있어요 !