Device

Handles Device related requests with IMS web services. Unless otherwise specified, requests performed by this service are on the current Device.

Activate

Required information

*Identity: In order to activate device, the application must have a valid user (represented by the Identity). That user must be active.

Concrete Example

To activate the current device for data collection, one can use following snippet.

let service = DeviceService(identity: identity)
service.activate(then: { result in
    switch result {
    case: .success(_)
        // activation successful
    case: .failure(_)
        // failure error
    }
})

Deactivate

Deactivate the current device for data collection. It may be desirable to deactivate a device if the host application's user logs out, or if the user becomes inactive.

Required information

*Identity: In order to deactivate device, the application must have a valid user (represented by the Identity). That user must be active.

Concrete Example

To deactivate the current device for data collection, one can use following snippet.

let service = DeviceService(identity: identity)
service.deactivate(then: { result in
    switch result {
    case: .success(_)
        // deactivation successful
    case: .failure(_)
        // failure error
    }
})

Fetch

Required information

*Identity: In order to fetch device, the application must have a valid user (represented by the Identity). That user must be active.

Concrete Example

To fetch the current Device's model., one can use following snippet.

let service = DeviceService(identity: identity)
service.fetch(then: { result in
    guard !result.value.isEmpty else {
        // error
        return
    }
    completionHandler(.success(result.value))
})

Last updated