Skip to content

SDK unusable because of required updater calls #14

@ir-fuel

Description

@ir-fuel

It seems we need to instantiate the SDK using:

public static func shared(token: String? = nil,
                              onUpdateStartCallback: StartClosureSignature? = nil,
                              onUpdateAvailableCallback: UpdateAvailableClosureSignature? = nil,
                              onUpdateProgressCallback: ProgressClosureSignature? = nil,
                              onUpdateSuccessCallback: SuccessClosureSignature? = nil,
                              onUpdateFailureCallback: FailureClosureSignature? = nil) throws -> ActiveLookSDK

Which for normal development purposes is useless, as we can leave the entire update responsibility to the ActiveLook app.

Because a normal developer does not have the token nor the possibility to download firmware updates, the only solution is to pass bogus parameters and return false in onUpdateAvailableCallback. This however stops the SDK from functioning returning:

                        discoveredGlasses.connectionErrorCallback?(ActiveLookError.sdkUpdateFailed)
                        self.updateParameters.notify(.updateFailed)

The error originates in:

            guard httpResponse.statusCode != 403 else {
                self.failed(with: GlassesUpdateError.invalidToken)
                return
            }

which makes sense since we don't have the right token to check for updates.

I forked the repo and I fixed it by putting this in the code:

                glasses.fixInDeviceCmdStack {
                    glasses.cfgSet(name: "ALooK")
//                    parent.updateInitializedGlasses(glasses) --> this is not needed for 3rd party devs!
                    discoveredGlasses.connectionCallback?(glasses)
                }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions