Classes
The following classes are available globally.
-
This class is the main entry point for the Hype SDK. It provides facade access to the Hype service running on the background. This class wraps the instance created for the host device. Each app can only create a single instance, which is why class is a singleton and uses class methods. This class allows users of the SDK to listen to events on the created instance by subscribing observers, as well as starting and stopping the Hype services.
See moreDeclaration
Objective-C
@interface HYP
Swift
class HYP
-
This class works as a container for error information. This class is extensively used by the SDK, especially in delegates. It holds four main properties: a code, a description, a reason for the error, and a recovery suggestion. Error codes are listed under
See moreHYPErrorCode
, along with their meaning. The description indicates what went wrong, such asCouldn’t send a message
. The reason indicates the cause, such asBluetooth is not turned on
. Continuing on the same example, the recovery suggestion indicates a possible recovery from the error, such asTry turning Bluetooth on
.Declaration
Objective-C
@interface HYPError
Swift
class HYPError
-
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
See moreglobal 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.Declaration
Objective-C
@interface HYPInstance
Swift
class HYPInstance
-
Messages are abstract entities that help keeping track of data as it is sent over the network, by holding a unique identifier. The identifier is actually held by the underlying
See moreHYPMessageInfo
instance (-info
), but theHYPMessage
class provides dynamic access to that attribute. This is mostly motivated by the fact that Hype does not keep messages for memory purposes. As such, it’s up to the developer to hold or discard the data as needed. Instead,HYPMessageInfo
instances are used to keep track of the state of any given HYPMessage.Declaration
Objective-C
@interface HYPMessage
Swift
class HYPMessage
-
This class is used to hold message metadata. At this point, it only includes the message identifier, but this will change with future releases. It’s mostly useful to associate messages with the metadata, as Hype notifications usually use instances of this class and not
See moreHYPMessage
. This is motivated by the fact thatHYPMessage
holds the message’s payload, which would consume more memory.Declaration
Objective-C
@interface HYPMessageInfo
Swift
class HYPMessageInfo