Wedge

SDK introduces WedgeService for automatic wedge associations.

Fetch

Use the API to retrieve the array of associated wedges to a user. Returns associated wedges with callback.

Required Information:

*Identity: In order to retrieve associated wedges, the host app must have a valid user (represented by the Identity).

Concrete Example

To fetch the wedge details, one can use the following snippet

let service = WedgeService(identity: identity)
service.fetchWedges(then: { result in
    switch result {
    case: .success(_)
        // successfully retrieved
    case: .failure(_)
        // failure error
    }
})

Associate

Use the API to associate the wedge to a user. Returns an associated wedge with callback.

Required Information:

*Identity: In order to associate wedge, the application must have a valid user (represented by the Identity).

Parameters:

  • name: Wedge name

  • deviceId: Wedge unique identifier

  • vehicleId: Vehicle id

  • battery: Wedge battery level

  • firmware: Wedge firmware version

Concrete Example

To associate the wedge details, one can use the following snippet

let service = WedgeService(identity: identity)
service.associateWedge(name: String,
                       deviceId: String,
                       vehicleId: String,
                       battery: Int,
                       firmware: String) { result in
    switch result {
    case: .success(_)
        // successfully updated
    case: .failure(_)
        // failure error
    }
}

Delete

Use this api to delete the associated wedge.

Required Information:

*Identity: In order to delete associated wedge, the host app must have a valid user (represented by the Identity).

Parameters:

  • deviceAssociationId: Association id which associates wedge to a user

To delete the associated wedge, first host app needs to retrieve the deviceAssociatioId provided when the fetch API call is made and need to provide the retrieved deviceAssociatioId as an argument to deleteWedge API

Concrete Example

To delete the associated wedge, one can use the following snippet

let service = WedgeService(identity: identity)
service.deleteWedge(for deviceAssociatioId: String) { result in
    switch result {
    case: .success(_)
        // successfully updated
    case: .failure(_)
        // failure error
    }
})

Update

Use the API to update the wedge's battery and firmware. Returns the updated wedge with callback.

Required Information:

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

Parameters:

  • deviceAssociationId: Association id which associates wedge to a user

  • battery: Updated battery level

  • firmware: Updated firmware version

To update the wedge details, first host app needs to retrieve the deviceAssociatioId provided when the fetch API call is made and need to provide the retrieved deviceAssociatioId as an argument to updateWedge API

Concrete Example

To update the wedge details, one can use the following snippet

let service = WedgeService(identity: identity)
service.updateWedge(for deviceAssociatioId: String, battery: Int, firmware: String) { result in
    switch result {
    case: .success(_)
        // successfully updated
    case: .failure(_)
        // failure error
    }
})

Last updated