5 // Created by J Osborne on 3/7/13.
6 // Copyright (c) 2013 Apple Inc. All Rights Reserved.
10 #include <utilities/SecCFRelease.h>
12 @implementation Applicant
14 -(id)initWithPeerInfo:(SOSPeerInfoRef)peerInfo
16 if ((self = [super init])) {
17 self.rawPeerInfo = CFRetainSafe(peerInfo);
18 self.applicantUIState = ApplicantWaiting;
25 return (__bridge NSString *)(SOSPeerInfoGetPeerID(self.rawPeerInfo));
30 return (__bridge NSString *)(SOSPeerInfoGetPeerName(self.rawPeerInfo));
35 if (self->_rawPeerInfo) {
36 CFRelease(self->_rawPeerInfo);
40 -(NSString *)description
42 return [NSString stringWithFormat:@"%@=%@", self.rawPeerInfo, self.applicantUIStateName];
45 -(NSString *)deviceType
47 return (__bridge NSString *)(SOSPeerInfoGetPeerDeviceType(self.rawPeerInfo));
50 -(NSString *)applicantUIStateName
52 switch (self.applicantUIState) {
53 case ApplicantWaiting:
56 case ApplicantOnScreen:
59 case ApplicantRejected:
62 case ApplicantAccepted:
66 return [NSString stringWithFormat:@"UnknownState#%d", self.applicantUIState];