IoTDeviceManager
@objc
public class IoTDeviceManager : NSObject
A singleton class for performing all the workflows related to IoT devices.
-
Associate an IoT device to the current user.
Declaration
Swift
@objc public static func addIoTDevice(device: IoTDevice, completion: @escaping (NSError?) -> Void)
Parameters
device
The IoT device model which contains the information.
completion
Block that will be called once sending is completed. The block will provide an error object if something went wrong.
-
Deassociate an IoT device from the current user.
Declaration
Swift
@objc public static func removeIoTDevice(device: IoTDevice, completion: @escaping (NSError?) -> Void)
Parameters
device
The IoT device model which contains the information.
completion
Block that will be called once sending is completed. The block will provide an error object if something went wrong.
-
Update the IoT device information for the current user.
Declaration
Swift
@objc public static func updateIoTDevice(device: IoTDevice, completion: @escaping (NSError?) -> Void)
Parameters
device
The IoT device model which contains the information.
completion
Block that will be called once sending is completed. The block will provide an error object if something went wrong.
-
Retrieve the list of IoT devices associated with the current user.
Declaration
Swift
@objc public static func getIoTDeviceList(completion: @escaping ([IoTDevice], NSError?) -> Void)
Parameters
completion
Block that will be called once sending is completed. The block will provide an error object if something went wrong.
-
Send invitation to a secondary user to have access to an IoT device.
Declaration
Swift
@objc public static func sendInvite(recipient: String, iotId: String, iotType: IOTType = .internalVIN, content: [String: String], completion: @escaping (NSError?) -> Void)
Parameters
recipient
Recipient ID.
iotId
IoTDevice ID.
iotType
IoTDevice type. Default is
.vehicle
.content
the content sent with the invitation.
completion
Block that will be called once sending is completed. The block will provide an error object if something went wrong.
-
Request to have access to an IoT device.
Declaration
Swift
@available(*, deprecated, message: "API Endpoint no longer exists.") @objc public static func requestAccess(iotId: String, completion: @escaping (NSError?) -> Void)
Parameters
iotId
IoTDevice ID.
completion
Block that will be called once request is completed. The block will provide an error object if something went wrong.
-
Fetch all invitation or request messages from servers.
Declaration
Swift
@objc public static func getMessages(purpose: MessagePurpose, status: MessageStatus = .any, type: MessageType, iotId: String, iotType: IOTType = .internalVIN, completion: @escaping ([Message]?, NSError?) -> Void)
Parameters
purpose
The purpose of the messages (see
MessagePurpose
).status
The status of the message. Default is
.pending
.type
Message Type.
iotId
IoTDevice ID.
iotType
IoTDevice type. Default is
.vehicle
.completion
Block that will be called once fetch is completed. The block will provide list of message if successful or an error object if something went wrong.
-
Approve a secondary user to have access to an IoT device.
Declaration
Swift
@available(*, deprecated, message: "API Endpoint no longer exists.") @objc public static func approveAccess(messageId: String, completion: @escaping (NSError?) -> Void)
Parameters
messageId
Message ID to approve request.
completion
Block that will be called once approval is completed. The block will provide an error object if something went wrong.
-
Delete an invitation/access message.
Declaration
Swift
@objc public static func deleteMessage(messageId: String, completion: @escaping (NSError?) -> Void)
Parameters
messageId
ID of the message.
completion
Block that will be called once deletion is completed. The block will provide an error object if something went wrong.
-
Transfer ownership of an IoT device to a secondary user.
Declaration
Swift
@available(*, deprecated, message: "API Endpoint no longer exists.") @objc public static func transferOwnership(iotId: String, iotType: IOTType = .vehicle, transferTo: String, completion: @escaping (NSError?) -> Void)
Parameters
iotId
IoTDevice ID.
iotType
IoTDevice type. Default is
.vehicle
.transferTo
The ID of the secondary user.
completion
Block that will be called once transfer is completed. The block will provide an error object if something went wrong.
-
Revoke the secondary user’s access to an IoT device.
Declaration
Swift
@available(*, deprecated, message: "API Endpoint no longer exists.") @objc public static func revokeSecondaryUser(iotId: String, iotType: IOTType = .vehicle, revokeFrom: String, completion: @escaping (NSError?) -> Void)
Parameters
iotId
IoTDevice ID.
iotType
IoTDevice type. Default is
.vehicle
.revokeFrom
ID of the secondary user.
completion
Block that will be called once revoke action is completed. The block will provide an error object if something went wrong.
-
Deassociate a IoT Device from the current user.
Declaration
Swift
@available(*, deprecated, message: "API Endpoint no longer exists.") @objc public static func disconnectIoTDevice(_ device: IoTDevice, completion: @escaping (NSError?) -> Void)
Parameters
device
The device to be disconnected.
completion
Block that will be called once disconnecting is completed. The block will provide an error object if something went wrong.
-
Accept an invite to be secondary user for an IoT device.
Declaration
Swift
@objc public static func acceptInvite(invitationCode: String, _ completion: ((NSError?) -> Void)?)
Parameters
invitationCode
The code received as part of the
Message
object.completion
The block that will be called when the accept invitation workflow finishes.
-
Reject an invite to be secondary user for an IoT device.
Declaration
Swift
@objc public static func rejectInvite(invitationCode: String, _ completion: ((NSError?) -> Void)?)
Parameters
invitationCode
The code received as part of the
Message
object.completion
The block that will be called when the reject invitation workflow finishes.