Intent
public struct Intent
Basic Data Structure used for sending BLE communication’s to a Vuzix device.
Modeled after an Android Intent and very similar in practice to broadcasting and receiving.
Reference: Android Intent
-
package who sent this intent.
This value will be in the extras. This property is for convinence.
Declaration
Swift
public var sendingPackage: String? { get }
Return Value
if the intent comes from the Blade it will have a value, otherwise it will be nil.
-
The general action to be performed.
Declaration
Swift
public var action: String
-
Add a new category to the intent.
Declaration
Swift
public var category: String?
-
Add additional flags to the intent.
Standard Android Flags, see Android Intent
Declaration
Swift
public var flags: Int?
-
Add extended data to the intent.
Declaration
Swift
public var extras: BundleContainer?
-
Set an explicit application package name that limits the components this Intent will be sent to.
If nil then it gets sent to all apps on recieving end.
Declaration
Swift
public var package: String?
-
Create an intent.
Note
dictionary keys supported: action, flags, extras, package
var intent = Intent(dictionary: ["action": "com.3rdparty.login", "package": "com.3rdparty.bladeApp"]) intent.addExtra("username", "joe@3rdparty.com") intent.broadcast()
Declaration
Swift
public init?(dictionary: [String : Any])
Parameters
dictionary
Dictionary contain key/value pairs to create an intent from.
-
Create an intent.
Example: creates Intent, adds package, adds extra data, broadcasts it to the device.
var intent = Intent(action: "com.3rdparty.login") intent.package = "com.3rdparty.bladeApp" intent.addExtra("username", "joe@3rdparty.com") intent.broadcast()
Declaration
Swift
public init(action: String)
Parameters
action
the intent’s action.
-
Convinence method to add a simple key/value pair as an extra to the intent
Declaration
Swift
public mutating func addExtra(key: String, value: Any)