EEC-492/693/793 iPhone Application Development

Slides:



Advertisements
Similar presentations
Lecture 3 - Writing Initializers A correct initializer must comply with the following: The initializer name should begin with init The initializer returns.
Advertisements

Cisco Confidential © 2012 Cisco and/or its affiliates. All rights reserved. 1 StadiumVision Mobile SDK Overview For App Developers Cisco Sports and Entertainment.
 2002 Prentice Hall. All rights reserved. Chapter 9: Servlets Outline 9.1 Introduction 9.2 Servlet Overview and Architecture Interface Servlet and.
CCNA – Network Fundamentals
Chapter 7: Transport Layer
© 2008 Cisco Systems, Inc. All rights reserved.Cisco ConfidentialPresentation_ID 1 Chapter 7: Transport Layer Introduction to Networking.
© 2008 Cisco Systems, Inc. All rights reserved.Cisco ConfidentialPresentation_ID 1 Chapter 7: Transport Layer Introduction to Networking.
© 2008 Cisco Systems, Inc. All rights reserved.Cisco ConfidentialPresentation_ID 1 Chapter 7: Transport Layer Introduction to Networking Assist. Prof.
Lecture 7 Transport Layer
V Business and Technology Consulting. What is BI in the Sky? Relational database-as-a-service Highly scalable Always-on with geo-replication Self-managed.
Developers: Alexey Rastvortsev, Ilya Kolchinsky Supervisors: Roy Friedman, Alex Kogan.
Scuola Superiore Sant’Anna Project Assignments Operating Systems.
PPP (Point to Point protocol).  On WAN connection, the protocol depends on the WAN technology and communicating equipment:  Examples:  HDLC –  The.
© Lethbridge/Laganière 2001 Chap. 3: Basing Development on Reusable Technology 1 Let’s get started. Let’s start by selecting an architecture from among.
Creating a deployment package Importing a package with IIS Manager Exporting from IIS Manager.
CS378 - Mobile Computing Connecting Devices. How to pass data between devices? – Chat – Games – Driving Options: – Use the cloud and a service such as.
© 2008 Cisco Systems, Inc. All rights reserved.Cisco ConfidentialPresentation_ID 1 Chapter 7: Transport Layer Introduction to Networking.
Chapter 6-2 the TCP/IP Layers. The four layers of the TCP/IP model are listed in Table 6-2. The layers are The four layers of the TCP/IP model are listed.
Mobile Broadband Driver Development for Windows 7
Introduction to Biometrics Dr. Bhavani Thuraisingham The University of Texas at Dallas Lecture #23 Biometrics Standards - II November 14, 2005.
7. CBM collaboration meetingXDAQ evaluation - J.Adamczewski1.
IEEE MEDIA INDEPENDENT HANDOVER DCN: MISU Title: Proposal on new MIH service for Proximity Service Communications Date Submitted:
 Facebook Integration on iOS Phan Thanh Phat Huynh Thanh Van.
CSCI 6962: Server-side Design and Programming Java Server Faces Scoping and Session Handling.
FTP Server API Implementing the FTP Server Registering FTP Command Callbacks Data and Control Port Close Callbacks Other Server Calls.
INTEGRATION OF BACKBONE.JS WITH SPRING 3.1. Agenda New Features and Enhancements in Spring 3.1 What is Backbone.js and why I should use it Spring 3.1.
Chat Room App Logan Linn Network Application Design Fall 2010.
Don’t Disconnect Me! The challenges of building offline-enabled web apps Matthias Oßwald,
GPRS functionality overview in Horner OCS. GPRS functionality – Peer to Peer communication over GPRS – CSCAPE connectivity over GPRS – Data exchange using.
Persistence CS 344 Mobile App Development Robert Muller.
Cosc 4735 Primer: Marshmallow Changes and new APIs in android 6.0 (api 23)
2/20/2016 EEC492/693/793 - iPhone Application Development 12/20/2016 EEC492/693/793 - iPhone Application Development 1 EEC-492/693/793 iPhone Application.
IEEE MEDIA INDEPENDENT HANDOVER DCN: Title: ID Definition Date Submitted: July 14, 2006 Presented at IEEE session in San.
INTRO TO NETWORKING. OVERVIEW Transmitting data Across a physical media Ethernet Wi-fi Bluetooth Etc. Cross-platform (usually) Challenges Varying network.
Wireless Mesh Networking or Peer to Peer Technology Andre Lukito – Johnsonsu – Wednesday, 9.
The Alfresco iOS SDK Gi Lee (Zia Consulting) Peter Schmidt (Alfresco)
Lec 12 Pickers CS 3800 Introduction to IOS programming Lecture 12 Summer 2011.
REDCap Mobile Application
Chapter 7: Transport Layer
UDP Socket Programming
Chapter 9: Transport Layer
Module 8: Networking Services
Instructor: Mazhar Hussain
Principles of Network Applications
Radius, LDAP, Radius used in Authenticating Users
Beyond HTTP Up to this point we have been dealing with software tools that run on browsers and communicate to a server that generates files that can be.
IPSec VPN Chapter 13 of Malik.
Reactive Android Development
File Transfer and access
Project Rome: Activity API & Pick Up Where I Left Off
Video and Sensor Network Architecture and Displays
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
AirDrop Not working issue on MacBook Pro, iMac & iOS 11
intro to notifications in iOS 10
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
TA: Donghyun (David) Kim
Intro to Bluetooth Background Communication
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
Peer-to-Peer Information Systems Week 6: Assignment #4
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
[Based in part on SWE 432 and SWE 632 materials by Jeff Offutt, GMU]
Peer-to-Peer Information Systems Week 6: Assignment #4
Presentation transcript:

EEC-492/693/793 iPhone Application Development Lecture 15 Wenbing Zhao & Nigamanth Sridhar 2/16/2019 EEC492/693/793 - iPhone Application Development

Outline Peer-to-Peer Communication with GameKit Demo Assignment: GKPeerPickerController & GKPeerPickerControllerDelegate GKSession & GKSessionDelegate Objects  NSData Demo Assignment: Build the chat app using the GameKit Challenge: enable 3 or more peers to chat together Documentation on GameKit: http://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/GameKit_Guide/GameKit_Guide.pdf 2/16/2019 2/16/2019 EEC492/693/793 - iPhone Application Development EEC492/693/793 - iPhone Application Development 2

EEC492/693/793 - iPhone Application Development Game Kit Introduced in iOS 3.0 to enable the development of social games Game Kit consists of three technologies: Game center: centralized network service (supported in iOS 4.1 and later) Peer-to-peer networking (supported in iOS 3.0 and later) In-game voice chat (supported in iOS 3.0 and later) 2/16/2019 EEC492/693/793 - iPhone Application Development

Peer-to-Peer Connectivity Abstracts away Bonjour and Stream creation Nearby (Bluetooth) & Online (Wifi) support 2/16/2019 EEC492/693/793 - iPhone Application Development

Peer-to-Peer Connectivity Peer discovery: GKPeerPickerController The GKPeerPickerController presents the UI and responds to the user’s actions Resulting in a fully configured GKSession that connects two peers Peer communication: GKSession 2/16/2019 EEC492/693/793 - iPhone Application Development

GKPeerPickerController Provides UI to connect to peer Allows user to pick between “Nearby” and “Online” Nearby Bluetooth communication Most of the work is handled for you under-the-hood Online Hands off responsibility to the application App builds or connects to server Associates users in server App is responsible for handling communication 2/16/2019 EEC492/693/793 - iPhone Application Development

Initiating a Connection // Allocate the PeerPickerController GKPeerPickerController *peerPicker; peerPicker = [[GKPeerPickerController alloc] init]; // Set up delegate to receive callbacks peerPicker.delegate = self; peerPicker.connectionMask = GKPeerPickerConnectionTypeOnline | GKPeerPickerConnectionTypeNearby; // Display the Peer Picker [peerPicker show]; 2/16/2019 EEC492/693/793 - iPhone Application Development

Establishing a Connection Return a session for the requested type (by the GKPeerPickerControllerDelegate) (called when you chose “Nearby”) - (GKSession *)peerPickerController: (GKPeerPickerController *)picker sessionForConnectionType: (GKPeerPickerConnectionType)type { GKSession *session = [[GKSession alloc] initWithSessionID:nil displayName:localName sessionMode:GKSessionModePeer]; return [session autorelease]; } Accept connection request from the remote peer (by the GKSession delegate) - (void)session:(GKSession *)session didReceiveConnectionRequestFromPeer:(NSString *)peerID { [session acceptConnectionFromPeer:peerID error:nil]; 2/16/2019 EEC492/693/793 - iPhone Application Development

Establishing a Connection Notification to the requesting peer on the establishment of the connection - (void) peerPickerController:(GKPeerPickerController *)picker didConnectPeer:(NSString *)peerID toSession:(GKSession *)session { session.delegate = self; [session setDataReceiveHandler:self withContext:nil]; self.gameSession = session; … // Done with the Peer Picker so dismiss it [picker dismiss]; [picker autorelease]; } 2/16/2019 EEC492/693/793 - iPhone Application Development

Other GKPeerPickerControllerDelegate Methods - (void) peerPickerController:(GKPeerPickerController *)picker didSelectConnectionType:(GKPeerPickerConnectionType)type Should dismiss picker if the type is GKPeerPickerConnectionTypeOnline, and provide your own UI - (void) peerPickerControllerDidCancel:(GKPeerPickerController *)picker Do some cleaning up, if necessary 2/16/2019 EEC492/693/793 - iPhone Application Development

EEC492/693/793 - iPhone Application Development GKSession Creating a GKSession GKSession *session = [[GKSession alloc] initWithSessionID:… - (id)initWithSessionID:(NSString *)sessionID displayName:(NSString *)name sessionMode:(GKSessionMode)mode typedef enum { GKSessionModeServer, GKSessionModeClient, GKSessionModePeer } GKSessionMode; 2/16/2019 EEC492/693/793 - iPhone Application Development

EEC492/693/793 - iPhone Application Development GKSession Properties include: displayName - Your name, as seen by your peers peerID - unique ID, identifying your Session to your peers sessionID - String used by your Application to filter peers available – determines whether or not the session wants to connect to new peers Delegate methods: Notifies of state change of a peer’s session Notifies of connection requests Notifies of errors with sessions or connections 2/16/2019 EEC492/693/793 - iPhone Application Development

GKSession - Sending & Receiving Data Send data to specific peers - (BOOL) sendData:(NSData *)data toPeers:(NSArray *)peers withDataMode:(GKSendDataMode)mode error:(NSError **)error; Data transmission mode: GKSendDataReliable, GKSendDataUnreliable Send data to ALL connected peers - (BOOL) sendDataToAllPeers:(NSData *)data withDataMode: (GKSendDataMode)mode error:(NSError **)error; Data handler method to receive data: - (void) receiveData:(NSData *)data fromPeer:(NSString *)peer inSession:(GKSession *)session context:(void *)context; 2/16/2019 EEC492/693/793 - iPhone Application Development

How to Pack Data into NSData From NSString to NSData NSData *data = [msgToSend.text dataUsingEncoding:NSUTF8StringEncoding]; From NSData to NSString NSString *recvStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; For more complicated data, can use Archiver // Objects to NSData NSMutableArray *touchesForUser = …; NSData *data = [NSKeyedArchiver archivedDataWithRootObject:touchesForUser]; // NSData to objects NSMutableArray *touchValues = [[NSKeyedUnarchiver unarchiveObjectWithData:data] mutableCopy]; 2/16/2019 EEC492/693/793 - iPhone Application Development