HYPInstance
@interface HYPInstance
Instances map to devices participating on the network. Instances are
advertised on the network and, when found, a notification is issued
indicating that the instance is available for communication purposes.
Usually, there’s no need to instantiate objects of this type at all,
as the framework handles that automatically. Instance identifiers are
unique for each device, and are devided in three parts: an app identifier,
a device identifier, and a user identifier. The app identifier is always
the same, as Hype fragments the network using that, so the app never needs
to deal with instances from different vendors. Device identifiers are
automatically assigned by the SDK. The user identifier is a custom optional
setting, and can be used to help identify the user running an unresolved
instance, although that consists of a 31bit (not 32!) that can be used
for any purpose the app may need. Collectively, the three identifiers
form what is called a global identifier
, which can be queried with
the - identifier
property. Such identifiers are between 6 and 12 bytes
long and uniquely identify each device on the network.
-
This property indicates the app identifier the instance is participating in. This identifier is exclusive to this app, as the framework handles devices with different identifiers transparently and never propagates them to the app. All found instances have the same identifier, one that is equal to that of the host device. App identifiers are always 2 or 4 bytes long and may never be null.
Declaration
Objective-C
@property (readonly, atomic) int *appIdentifier;
Swift
var appIdentifier: UnsafeMutablePointer<Int32>! { get }
-
This property yields the instance’s app identifier using an hexadecimal encoding.
Declaration
Objective-C
@property (atomic, copy) NSString * appStringIdentifier
Swift
var appStringIdentifier: UnsafeMutablePointer<Int32>! { get set }
-
User identifiers are custom properties set by the app that identify the user running it. This field gives the value set for the user on the app matching to this instance.
Declaration
Objective-C
@property (readonly, atomic) int userIdentifier;
Swift
var userIdentifier: Int32 { get }
-
This property yields an identifier that is unique for each instance on the network.
Declaration
Objective-C
@property (readonly, atomic) int *identifier;
Swift
var identifier: UnsafeMutablePointer<Int32>! { get }
-
This property yields the instance’s identifier in string form. The string is the data object written using hexadecimal notation.
Declaration
Objective-C
@property (atomic, copy) NSString * stringIdentifier
Swift
var stringIdentifier: UnsafeMutablePointer<Int32>! { get set }
-
Announcements circulate on the network to help the app identify participating devices. This is similar to a
userIdentifier
, and it can be considered as an extra space for identification purposes. The main difference is that user identifiers are present even before the instance is resolved, while announcements are not. The SDK optimizes the flooding of announcements on the network by caching it on router devices.Declaration
Objective-C
@property (readonly, atomic) int *announcement;
Swift
var announcement: UnsafeMutablePointer<Int32>! { get }
-
Indicates whether the instance has already been resolved. If not, communicating with it is not possible. Such instances must be resolved before iniciating a conversation.
Declaration
Objective-C
@property (assign, readwrite, atomic) int isResolved;
Swift
var isResolved: Int32 { get set }
-
Initializes an instance object with a given identifier and announcement. There’s no reason to use this method and manually instantiate this class. The SDK handles that automatically.
Declaration
Objective-C
- (instancetype)initWithIdentifier:(id)identifier announcement:(id)announcement isResolved:(id)isResolved;
Swift
init!(identifier: Any!, announcement: Any!, isResolved: Any!)
Parameters
identifier
Instance identifier.
announcement
The instance’s announcement. @returns The initialized instance.