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
21 self.rawPeerInfo = CFRetainSafe(peerInfo);
22 self.applicantUIState = ApplicantWaiting;
29 return (__bridge NSString *)(SOSPeerInfoGetPeerID(self.rawPeerInfo));
34 return (__bridge NSString *)(SOSPeerInfoGetPeerName(self.rawPeerInfo));
39 if (self->_rawPeerInfo) {
40 CFRelease(self->_rawPeerInfo);
44 -(NSString *)description
46 return [NSString stringWithFormat:@"%@=%@", self.rawPeerInfo, self.applicantUIStateName];
49 -(NSString *)deviceType
51 return (__bridge NSString *)(SOSPeerInfoGetPeerDeviceType(self.rawPeerInfo));
54 -(NSString *)applicantUIStateName
56 switch (self.applicantUIState) {
57 case ApplicantWaiting:
60 case ApplicantOnScreen:
63 case ApplicantRejected:
66 case ApplicantAccepted:
70 return [NSString stringWithFormat:@"UnknownState#%d", self.applicantUIState];