GatewayAPI

Undocumented

  • Login to the Gateway. Local authentication for the Gateway access. Required prior to call other APIs access to the gateway.

    Parameter

    Parameter username: Username of the Gateway.

    Parameter

    Parameter password: Password of the Gateway.

    Parameter

    Parameter completionHandler: A closure to be executed once finished. The closure takes 1 argument: an instance of ThingIFError when failed.

    Declaration

    Swift

    public func login(
            username: String,
            password: String,
            completionHandler: (ThingIFError?)-> Void
            )
  • Let the Gateway Onboard.

    Parameter

    Parameter completionHandler: A closure to be executed once finished. The closure takes 2 arguments: 1st one is Gateway instance that has thingID asigned by Kii Cloud and 2nd one is an instance of ThingIFError when failed.

    Declaration

    Swift

    public func onboardGateway(
            completionHandler: (Gateway?, ThingIFError?)-> Void
            )
  • Get Gateway ID

    Parameter

    Parameter completionHandler: A closure to be executed once get id has finished. The closure takes 2 arguments: 1st one is Gateway ID and 2nd one is an instance of ThingIFError when failed.

    Declaration

    Swift

    public func getGatewayID(
            completionHandler: (String?, ThingIFError?)-> Void
            )
  • List connected end nodes which has been onboarded.

    Parameter

    Parameter completionHandler: A closure to be executed once get id has finished. The closure takes 2 arguments: 1st one is list of end nodes and 2nd one is an instance of ThingIFError when failed.

    Declaration

    Swift

    public func listOnboardedEndNodes(
            completionHandler: ([EndNode]?, ThingIFError?)-> Void
            )
  • List connected end nodes which has not been onboarded.

    Parameter

    Parameter completionHandler: A closure to be executed once get id has finished. The closure takes 2 arguments: 1st one is list of end nodes connected to the gateway but waiting for onboarding and 2nd one is an instance of ThingIFError when failed.

    Declaration

    Swift

    public func listPendingEndNodes(
            completionHandler: ([PendingEndNode]?, ThingIFError?)-> Void
            )
  • Notify Onboarding completion Call this api when the End Node onboarding is done. After the call succeeded, End Node will be fully connected to Kii Cloud through the Gateway.

    Parameter

    Parameter endNode: Onboarded EndNode

    Parameter

    Parameter completionHandler: A closure to be executed once finished. The closure takes 1 argument: an instance of ThingIFError when failed.

    Declaration

    Swift

    public func notifyOnboardingCompletion(
            endNode: EndNode,
            completionHandler: (ThingIFError?)-> Void
            )
  • Restore the Gateway. This API can be used only for the Gateway App.

    Parameter

    Parameter completionHandler: A closure to be executed once finished. The closure takes 1 argument: an instance of ThingIFError when failed.

    Declaration

    Swift

    public func restore(
            completionHandler: (ThingIFError?)-> Void
            )
  • Replace end-node by new vendorThingID for end node thingID.

    Parameter

    Parameter endNodeThingID: ID of the end-node assigned by Kii Cloud.

    Parameter

    Parameter endNodeVendorThingID: ID of the end-node assigned by End Node vendor.

    Parameter

    Parameter completionHandler: A closure to be executed once finished. The closure takes 1 argument: an instance of ThingIFError when failed.

    Declaration

    Swift

    public func replaceEndNode(
            endNodeThingID: String,
            endNodeVendorThingID: String,
            completionHandler: (ThingIFError?)-> Void
            )
  • Get information of the Gateway. When the end user replaces the Gateway, Gateway App/End Node App need to obtain the new Gateway’s vendorThingID.

    Parameter

    Parameter completionHandler: A closure to be executed once get id has finished. The closure takes 2 arguments: 1st one is information of the Gateway and 2nd one is an instance of ThingIFError when failed.

    Declaration

    Swift

    public func getGatewayInformation(
            completionHandler: (GatewayInformation?, ThingIFError?)-> Void
            )
  • Check if user is logged in to the Gateway.

    Returns

    true if user is logged in, false otherwise.

    Declaration

    Swift

    public func isLoggedIn() -> Bool
  • Get Access Token

    Returns

    Access token

    Declaration

    Swift

    public func getAccessToken() -> String?
  • Try to load the instance of GatewayAPI using stored serialized instance.

    Parameter

    Parameter tag: tag of the GatewayAPI instance

    Returns

    GatewayIFAPI instance.

    Declaration

    Swift

    public static func loadWithStoredInstance(tag : String? = nil) throws -> GatewayAPI?
  • Clear all saved instances in the NSUserDefaults.

    Declaration

    Swift

    public static func removeAllStoredInstances()
  • Remove saved specified instance in the NSUserDefaults.

    Parameter

    Parameter tag: tag of the GatewayAPI instance or nil for default tag

    Declaration

    Swift

    public static func removeStoredInstances(tag : String?=nil)
  • Save this instance This method use NSUserDefaults. Should not use the key GatewayAPI_INSTANCE, this key is reserved.

    Declaration

    Swift

    public func saveInstance()