IamUtil.getDeviceDetails()

DESCRIPTION

Retrieve device information that typically does not need a paired user.

DECLARATION

    static public func getDeviceDetails(connection: Connection) throws -> DeviceDetails 

PARAMETERS

connection:
An established connection to the device

ERRORS

Throws the following errors:

BLOCKED_BY_DEVICE_CONFIGURATION:
if the device configuration does not allow retrieving this list (the `IAM:GetPairing` action is not set for the Unpaired role)
IAM_NOT_SUPPORTED:
if Nabto Edge IAM is not supported by the device

RETURN VALUES

None.

EXAMPLES

    func invoke() throws {
        let client = NabtoEdgeClient.Client()
        client.enableNsLogLogging()
        try client.setLogLevel(level: "trace")
        let connection = try client.createConnection()
        let privateKey = try client.createPrivateKey()
        try connection.setPrivateKey(key: privateKey)
        try connection.setProductId(id: "pr-fatqcwj9")
        try connection.setDeviceId(id: "de-ijrdq47i")
        try connection.setServerKey(key: "sk-9c826d2ebb4343a789b280fe22b98305")
        try connection.setServerConnectToken(sct: "WzwjoTabnvux")
        try connection.connect()
        let details: NabtoEdgeClient.DeviceDetails = try NabtoEdgeClient.IamUtil.getDeviceDetails(connection: connection)
        DispatchQueue.main.async {
            self.spinner.stopAnimating()
            self.label.text = "Device SDK Version: \(details.NabtoVersion)"
        }
    }