Swift Rest SDK Documentation Beta

Class Mobiledge​XiOSLibrary.​Matching​Engine

public class MatchingEngine

MatchingEngine class MobiledgeX MatchingEngine APIs

Member Of

MobiledgeXiOSLibrary

Swift MobiledgeX SDK namespace Used for "namespacing" purposes to prevent naming conflicts from common names (Util, NetworkInterface, etc.)

Nested Types

MobiledgeXiOSLibrary.MatchingEngine.DynamicLocGroupRequest
MobiledgeXiOSLibrary.MatchingEngine.DynamicLocGroupReply
MobiledgeXiOSLibrary.MatchingEngine.AppInstListRequest

AppInstListRequest struct Request object sent via GetAppInstList from client side to DME Request requires session_cookie from RegisterClientReply, gps_location, and carrier_name

MobiledgeXiOSLibrary.MatchingEngine.AppInstListReply

AppInstListReply struct Reply object received via GetAppInstList If an application instance exists, this will return AI_SUCCESS. Will provide information about all application instances deployed on specified carrier network

MobiledgeXiOSLibrary.MatchingEngine.CloudletLocation

Object returned in AppInstListReply cloudlets field The geo-location of Cloudlets (resources) within the Operator's Telco infrastructure, where Developers can create and deploy application instances to the available Cloudlets.

MobiledgeXiOSLibrary.MatchingEngine.Appinstance

Object returned in CloudletLocation appinstances field Information about specific app instances

MobiledgeXiOSLibrary.MatchingEngine.FindCloudletRequest

FindCloudletRequest struct Request object sent via FindCloudlet from client side to DME Request requires session_cookie from RegisterClientReply, gps_location, and carrier_name

MobiledgeXiOSLibrary.MatchingEngine.FindCloudletReply

FindCloudletReply struct Reply object received via FindCloudlet If application instance exists, this will return FIND_FOUND and contain information about the application instance.

MobiledgeXiOSLibrary.MatchingEngine.FindCloudletMode

Two modes to call FindCloudlet. First is Proximity (default) which finds the nearest cloudlet based on gps location with application instance Second is Performance. This mode will test all cloudlets with application instance deployed to find cloudlet with lowest latency. This mode takes longer to finish because of latency test.

MobiledgeXiOSLibrary.MatchingEngine.GetConnectionError

Errors on GetConnection

MobiledgeXiOSLibrary.MatchingEngine.EdgeError

Errors related to trying to get a telco edge connection

MobiledgeXiOSLibrary.MatchingEngine.GetConnectionProtocol

L4 and L7 protocols supported by MobiledgeX iOS GetConnection

MobiledgeXiOSLibrary.MatchingEngine.APIPaths
MobiledgeXiOSLibrary.MatchingEngine.DMEConstants
MobiledgeXiOSLibrary.MatchingEngine.MatchingEngineError

MatchingEngine API errors

MobiledgeXiOSLibrary.MatchingEngine.InvalidTokenServerTokenError

Occurs when VerifyLocation API is unable to communicate with token server

MobiledgeXiOSLibrary.MatchingEngine.UrlSessionError

Occurs on bad HTTP requests

MobiledgeXiOSLibrary.MatchingEngine.IDTypes

IDTypes used for unique_id_type in RegisterClientRequest??

MobiledgeXiOSLibrary.MatchingEngine.ReplyStatus

Values for RegisterClientReply, DynamicLocGroupReply, and QosPositionKpiReply status field

MobiledgeXiOSLibrary.MatchingEngine.AppPort

Object returned in ports of several API replies

MobiledgeXiOSLibrary.MatchingEngine.LProto

Values for AppPort proto field

MobiledgeXiOSLibrary.MatchingEngine.Timestamp

Object used in timestamp field of Loc

MobiledgeXiOSLibrary.MatchingEngine.Loc

Object used and returned in gps_location field of serveral API requests and replies

MobiledgeXiOSLibrary.MatchingEngine.QosPositionRequest

QosPositionKpiRequest struct Request object sent via GetQosPositionKpi from client side to DME Request requires session_cookie from RegisterClientReply and an array of QosPositions

MobiledgeXiOSLibrary.MatchingEngine.QosPosition

Object in positions field in QosPositionRequest Object that contains gps location and id for that gps location

MobiledgeXiOSLibrary.MatchingEngine.BandSelection

Object in QosPositionRequest band_selection field Each field's value is an array of Strings Supported band values

MobiledgeXiOSLibrary.MatchingEngine.QosPositionKpiReply

QosPositionKpiReply struct Reply object received via GetQosPositionKpi If an application instance exists, this will return RS_SUCCESS. Will provide quality of service information for gps locations specified

MobiledgeXiOSLibrary.MatchingEngine.QosPositionKpiResult

Object returned in position_results field of QosPositionKpiReply Qos results for specific location

MobiledgeXiOSLibrary.MatchingEngine.RegisterClientRequest

RegisterClientRequest struct Request object sent via RegisterClient from client side to DME Request requires org_name, app_name, and app_vers

MobiledgeXiOSLibrary.MatchingEngine.RegisterClientReply

RegisterClientReply struct Reply object received via RegisterClient If application exists, this will return RS_SUCCESS and contain a session cookie to be used in other DME APIs

MobiledgeXiOSLibrary.MatchingEngine.VerifyLocationRequest

VerifyLocationRequest struct Request object sent via VerifyLocation from client side to DME

MobiledgeXiOSLibrary.MatchingEngine.VerifyLocationReply

VerifyLocationReply struct Reply object received via VerifyLocation If verified, will return LOC_VERIFIED and CONNECTED_TO_SPECIFIED_TOWER Also contains information about accuracy of provided gps location

Initializers

init()

public init()

MatchingEngine constructor

Properties

state

var state: MatchingEngineState

Methods

create​Get​App​Inst​List​Request(gps​Location:​carrier​Name:​cell​ID:​tags:​)

public func createGetAppInstListRequest(gpsLocation: Loc, carrierName: String?, cellID: uint? = nil, tags: [String: String]? = nil) throws -> AppInstListRequest

createGetAppInstListRequest Creates the AppInstListRequest object that will be used in GetAppInstList

Parameters

gpslocation

A dictionary with at least longitude and latitude key values.

carrier​Name String?

Carrier name. This value can change depending on cell tower.

cell​ID uint?

Optional cellID

tags [String:​ String]?

Optional dict

Returns

AppInstListRequest

get​App​Inst​List(request:​)

public func getAppInstList(request: AppInstListRequest) -> Promise<AppInstListReply>

API getAppInstList Returns a list of the developer's backend instances deployed on the specified carrier's network. If carrier was "", returns all backend instances regardless of carrier network. This is used internally in FindCloudlet Performance mode to grab the list of cloudlets to test.

Parameters

request App​Inst​List​Request

AppInstListRequest from createGetAppInstListRequest

Returns

Promise

get​App​Inst​List(host:​port:​request:​)

public func getAppInstList(host: String, port: UInt16, request: AppInstListRequest) -> Promise<AppInstListReply>

GetAppInstList overload with hardcoded DME host and port. Only use for testing.

create​Find​Cloudlet​Request(gps​Location:​carrier​Name:​cell​ID:​tags:​)

public func createFindCloudletRequest(gpsLocation: Loc, carrierName: String? = "", cellID: uint? = nil, tags: [String: String]? = nil) throws -> FindCloudletRequest

createFindCloudletRequest Creates the FindCloudletRequest object that will be used in the FindCloudlet function. The FindCloudletRequest object wraps the parameters that have been provided to this function.

Parameters

carrier​Name String?

carrierName

gpslocation

gpslocation

Returns

FindCloudletRequest

find​Cloudlet(request:​mode:​)

@available(iOS 13.0, *) public func findCloudlet(request: FindCloudletRequest, mode: FindCloudletMode = FindCloudletMode.PROXIMITY) -> Promise<FindCloudletReply>

API findCloudlet FindCloudlet returns information needed for the client app to connect to an application backend deployed through MobiledgeX. If there is an application backend instance found, FindCloudetReply will contain the fqdn of the application backend and an array of AppPorts (with information specific to each application backend endpoint)

Takes a FindCloudlet request, and contacts the specified Distributed MatchingEngine host and port for the current carrier, if any.

Parameters

request Find​Cloudlet​Request

FindCloudletRequest from createFindCloudletRequest.

Returns

Promise

find​Cloudlet(host:​port:​request:​mode:​)

@available(iOS 13.0, *) public func findCloudlet(host: String, port: UInt16, request: FindCloudletRequest, mode: FindCloudletMode = FindCloudletMode.PROXIMITY) -> Promise<FindCloudletReply>

FindCloudlet overload with hardcoded DME host and port. Only use for testing.

get​TCPConnection(find​Cloudlet​Reply:​app​Port:​desired​Port:​timeout:​)

public func getTCPConnection(findCloudletReply: FindCloudletReply, appPort: AppPort, desiredPort: Int = 0, timeout: Double = 10000) -> Promise<CFSocket>

getTCPConnection Get a TCP socket bound to the local cellular interface and connected to the application's backend server. If no exceptions thrown and object is not null, the socket is ready to send application data to backend.

  • Parameters

    • findCloudletReply: FindCloudletReply from findCloudlet
    • appPort: Specific AppPort wanted from FindCloudletReply
    • desiredPort: Optional desired port. If none specified, will use public port in given appPort
    • timeout: Optional timeout. Default is 10 seconds

Returns

Promse

get​BSDTCPConnection(find​Cloudlet​Reply:​app​Port:​desired​Port:​timeout:​)

public func getBSDTCPConnection(findCloudletReply: FindCloudletReply, appPort: AppPort, desiredPort: Int = 0, timeout: Double = 10000) -> Promise<MobiledgeXiOSLibrary.Socket>

getBSDTCPConnection Gets a BSD TCP socket bound to the local cellular interface and connected to the application's backend server. If no exceptions thrown and object is not null, the socket is ready to send application data to backend.

  • Parameters

    • findCloudletReply: FindCloudletReply from findCloudlet
    • appPort: Specific AppPort wanted from FindCloudletReply
    • desiredPort: Optional desired port. If none specified, will use public port in given appPort
    • timeout: Optional timeout. Default is 10 seconds

Returns

Promse<MobiledgeXiOSLibrary.Socket>

get​TCPTLSConnection(find​Cloudlet​Reply:​app​Port:​desired​Port:​timeout:​)

@available(iOS 13.0, *) public func getTCPTLSConnection(findCloudletReply: FindCloudletReply, appPort: AppPort, desiredPort: Int = 0, timeout: Double = 10000) -> Promise<NWConnection>

getTCPTLSConnection Gets a TCP socket that is tls configured bound to the local cellular interface and connected to the application's backend server. If no exceptions thrown and object is not null, the socket is ready to send application data to backend.

  • Parameters

    • findCloudletReply: FindCloudletReply from findCloudlet
    • appPort: Specific AppPort wanted from FindCloudletReply
    • desiredPort: Optional desired port. If none specified, will use public port in given appPort
    • timeout: Optional timeout. Default is 10 seconds

Returns

Promse

get​UDPConnection(find​Cloudlet​Reply:​app​Port:​desired​Port:​timeout:​)

public func getUDPConnection(findCloudletReply: FindCloudletReply, appPort: AppPort, desiredPort: Int = 0, timeout: Double = 10000) -> Promise<CFSocket>

getUDPConnection Get a UDP socket bound to the local cellular interface and connected to the application's backend server. If no exceptions thrown and object is not null, the socket is ready to send application data to backend.

  • Parameters

    • findCloudletReply: FindCloudletReply from findCloudlet
    • appPort: Specific AppPort wanted from FindCloudletReply
    • desiredPort: Optional desired port. If none specified, will use public port in given appPort
    • timeout: Optional timeout. Default is 10 seconds

Returns

Promse

get​BSDUDPConnection(find​Cloudlet​Reply:​app​Port:​desired​Port:​timeout:​)

public func getBSDUDPConnection(findCloudletReply: FindCloudletReply, appPort: AppPort, desiredPort: Int = 0, timeout: Double = 10000) -> Promise<MobiledgeXiOSLibrary.Socket>

getBSDUDPConnection Get a BSD UDP socket bound to the local cellular interface and connected to the application's backend server. If no exceptions thrown and object is not null, the socket is ready to send application data to backend.

  • Parameters

    • findCloudletReply: FindCloudletReply from findCloudlet
    • appPort: Specific AppPort wanted from FindCloudletReply
    • desiredPort: Optional desired port. If none specified, will use public port in given appPort
    • timeout: Optional timeout. Default is 10 seconds

Returns

Promse<MobiledgeXiOSLibrary.Socket>

get​UDPDTLSConnection(find​Cloudlet​Reply:​app​Port:​desired​Port:​timeout:​)

@available(iOS 13.0, *) public func getUDPDTLSConnection(findCloudletReply: FindCloudletReply, appPort: AppPort, desiredPort: Int = 0, timeout: Double = 10000) -> Promise<NWConnection>

getUDPDTLSConnection Get a UDP socket with DTLS configured bound to the local cellular interface and connected to the application's backend server. If no exceptions thrown and object is not null, the socket is ready to send application data to backend.

  • Parameters

    • findCloudletReply: FindCloudletReply from findCloudlet
    • appPort: Specific AppPort wanted from FindCloudletReply
    • desiredPort: Optional desired port. If none specified, will use public port in given appPort
    • timeout: Optional timeout. Default is 10 seconds

Returns

Promse

get​HTTPClient(find​Cloudlet​Reply:​app​Port:​desired​Port:​timeout:​)

public func getHTTPClient(findCloudletReply: FindCloudletReply, appPort: AppPort, desiredPort: Int = 0, timeout: Double = 10000) -> Promise<URLRequest>

getHTTPClient Gets an HTTPClient (URLRequest) object that is edgeEnabled. If the device is not telco edge enabled (ie. not using cellular data path), error will be returned. If no exceptions thrown and object is not null, the Client is ready to send application data to backend.

  • Parameters

    • findCloudletReply: FindCloudletReply from findCloudlet
    • appPort: Specific AppPort wanted from FindCloudletReply
    • desiredPort: Optional desired port. If none specified, will use public port in given appPort
    • timeout: Optional timeout. Default is 10 seconds

Returns

Promse

get​HTTPSClient(find​Cloudlet​Reply:​app​Port:​desired​Port:​timeout:​)

public func getHTTPSClient(findCloudletReply: FindCloudletReply, appPort: AppPort, desiredPort: Int = 0, timeout: Double = 10000) -> Promise<URLRequest>

getHTTPSClient Gets an HTTPSClient (URLRequest) object that is tls configured that is edgeEnabled. If the device is not telco edge enabled (ie. not using cellular data path), error will be returned. If no exceptions thrown and object is not null, the Client is ready to send application data to backend.

  • Parameters

    • findCloudletReply: FindCloudletReply from findCloudlet
    • appPort: Specific AppPort wanted from FindCloudletReply
    • desiredPort: Optional desired port. If none specified, will use public port in given appPort
    • timeout: Optional timeout. Default is 10 seconds

Returns

Promse

get​Websocket​Connection(find​Cloudlet​Reply:​app​Port:​desired​Port:​timeout:​)

public func getWebsocketConnection(findCloudletReply: FindCloudletReply, appPort: AppPort, desiredPort: Int = 0, timeout: Double = 10000) -> Promise<SocketManager>

getWebsocketConnection Gets a websocket client that is edgeEnabled. If the device is not telco edge enabled (ie. not using cellular data path), error will be returned. If no exceptions thrown and object is not null, the Client is ready to send application data to backend.

  • Parameters

    • findCloudletReply: FindCloudletReply from findCloudlet
    • appPort: Specific AppPort wanted from FindCloudletReply
    • desiredPort: Optional desired port. If none specified, will use public port in given appPort
    • timeout: Optional timeout. Default is 10 seconds

Returns

Promse

get​Secure​Websocket​Connection(find​Cloudlet​Reply:​app​Port:​desired​Port:​timeout:​)

public func getSecureWebsocketConnection(findCloudletReply: FindCloudletReply, appPort: AppPort, desiredPort: Int = 0, timeout: Double = 10000) -> Promise<SocketManager>

getSecureWebsocketConnection Gets a websocket client that is tls configured that is edgeEnabled. If the device is not telco edge enabled (ie. not using cellular data path), error will be returned. If no exceptions thrown and object is not null, the Client is ready to send application data to backend.

  • Parameters

    • findCloudletReply: FindCloudletReply from findCloudlet
    • appPort: Specific AppPort wanted from FindCloudletReply
    • desiredPort: Optional desired port. If none specified, will use public port in given appPort
    • timeout: Optional timeout. Default is 10 seconds

Returns

Promse

is​Edge​Enabled(proto:​)

public func isEdgeEnabled(proto: GetConnectionProtocol) -> EdgeError?

Checks whether device will use cellular data path If using L4 getConnection protocol, GetConnection functions will bind local socket to cellular network interface. So as long as the device has a cellular interface up, it is edgeEnabled If using L7 getConnection protocol (where we cannot control the network interface), we must check to make sure the device will not default to wifi

get​Host(find​Cloudlet​Reply:​app​Port:​)

public func getHost(findCloudletReply: FindCloudletReply, appPort: AppPort) throws -> String

Returns the host of the developers app backend based on the findCloudletReply and appPort provided. This function is called by L4 GetConnection functions, but can be called by developers if they are using their own communication client (use GetPort as well)

get​Port(app​Port:​desired​Port:​)

public func getPort(appPort: AppPort, desiredPort: Int = 0) throws -> UInt16

Returns the port of the developers app backend service based on the appPort provided. An optional desiredPort parameter is provided if the developer wants a specific port within their appPort port range (if none provided, the function will default to the public_port field in the AppPort). This function is called by L4 GetConnection functions, but can be called by developers if they are using their own communication client (use GetHost as well).

create​Url(find​Cloudlet​Reply:​app​Port:​proto:​desired​Port:​path:​)

public func createUrl(findCloudletReply: FindCloudletReply, appPort: AppPort, proto: String, desiredPort: Int = 0, path: String = "") throws -> String

Returns the L7 path of the developers app backend based on the the findCloudletReply and appPort provided. The desired port number must be specified by the developer (use -1 if you want the SDK to choose a port number). An L7 protocol must also be provided (eg. http, https, ws, wss). The path variable is optional and will be appended to the end of the url. This function is called by L7 GetConnection functions, but can be called by developers if they are using their own communication client. Example return value: https://example.com:8888

allow​Self​Signed​Certs()

public func allowSelfSignedCerts()

disable​Self​Signed​Certs()

public func disableSelfSignedCerts()

get​App​Ports​ByProtocol(find​Cloudlet​Reply:​proto:​)

public func getAppPortsByProtocol(findCloudletReply: FindCloudletReply, proto: LProto) throws -> [UInt16: AppPort]?

Returns dictionary: key -> internal port, value -> AppPort

get​TCPApp​Ports(find​Cloudlet​Reply:​)

public func getTCPAppPorts(findCloudletReply: FindCloudletReply) throws -> [UInt16: AppPort]?

Return dictionary of TCP AppPorts given in findCloudletReply

get​UDPApp​Ports(find​Cloudlet​Reply:​)

public func getUDPAppPorts(findCloudletReply: FindCloudletReply) throws -> [UInt16: AppPort]?

Return dictionary of UDP AppPorts given in findCloudletReply

post​Request(uri:​request:​type:​)

public func postRequest<Request: Encodable, Reply: Decodable>(uri: String, request: Request, type: Reply.Type) -> Promise<Reply>

validate​Gps​Location(gps​Location:​)

public func validateGpsLocation(gpsLocation: Loc) throws -> Bool

get​Carrier​Name()

public func getCarrierName() -> String

Retrieve the carrier name of the cellular network interface (MCC and MNC) Returns the carrier's mcc+mnc which is mapped to a carrier in the backend (ie. 26201 -> TDG). MCC stands for Mobile Country Code and MNC stands for Mobile Network Code. If useWifiOnly or cellular is off + wifi is up, this will return "". Empty string carrierName is the alias for any, which will search all carriers for application instances.

generate​Dme​Host​Address()

public func generateDmeHostAddress() throws -> String

This will generate the dme host name based on GetMccMnc() -> "mcc-mnc.dme.mobiledgex.net". If getMccMnc fails or returns null, this will return a fallback dme host: "wifi.dme.mobiledgex.net"(this is the EU + TDG DME). This function is used by any DME APIs calls where no host and port overloads are provided.

generate​Fallback​Dme​Host(carrier​Name:​)

public func generateFallbackDmeHost(carrierName: String?) -> String

verify​Dme​Host(host:​)

public func verifyDmeHost(host: String) throws

Makes sure host generated in generateDmeHostAddress is valid DNS Lookup

generate​Base​Uri(carrier​Name:​port:​)

public func generateBaseUri(carrierName: String, port: UInt16) throws -> String

generate​Base​Uri(host:​port:​)

public func generateBaseUri(host: String, port: UInt16) -> String

get​Device​Info()

public func getDeviceInfo() -> [String: String]

Device info will be sent as tags parameter in RegisterClient

get​Network​Data​Type()

public func getNetworkDataType() -> String?

NetworkDataType is sent along with latency information when sending samples to DME

create​Qos​KPIRequest(requests:​lte​Category:​band​Selection:​cell​ID:​tags:​)

public func createQosKPIRequest(requests: [QosPosition], lteCategory: Int32? = nil, bandSelection: BandSelection? = nil, cellID: uint? = nil, tags: [String: String]? = nil) throws -> QosPositionRequest

createQosKPIRequest Creates the QosPositionRequest object that will be used in CreateQosPositionRequest

Parameters

requests [Qos​Position]

QosPositions (Dict: id -> gps location)

lte​Category Int32?

Optional lteCategory

band​Selection Band​Selection?

Optional BandSelection

cell​ID uint?

Optional cellID

tags [String:​ String]?

Optional dict

Returns

QosPositionRequest

post​Qos​Position​Request(uri:​request:​)

public func postQosPositionRequest(uri: String, request: QosPositionRequest) -> Promise<QosPositionKpiReply>

get​Qos​KPIPosition(request:​)

public func getQosKPIPosition(request: QosPositionRequest) -> Promise<QosPositionKpiReply>

API getQosKPIPosition Returns quality of service metrics for each location provided in qos position request

Takes a QosKPIRequest request, and contacts the Distributed MatchingEngine host for quality of service at specified locations

Parameters

request Qos​Position​Request

QosKPIRequest struct from createQosKPIRequest.

Returns

Promise

get​Qos​KPIPosition(host:​port:​request:​)

public func getQosKPIPosition(host: String, port: UInt16, request: QosPositionRequest) -> Promise<QosPositionKpiReply>

API getQosKPIPosition GetQosPositionKpi overload with hardcoded DME host and port. Only use for testing.

Parameters

host String

host override of the dme host server. DME must be reachable from current carrier.

port UInt16

port override of the dme server port

request Qos​Position​Request

QosKPIRequest dictionary, from createQosKPIRequest.

Returns

Promise

register​And​Find​Cloudlet(org​Name:​app​Name:​app​Vers:​gps​Location:​carrier​Name:​auth​Token:​cell​ID:​tags:​mode:​)

@available(iOS 13.0, *) public func registerAndFindCloudlet(orgName: String, appName: String?, appVers: String?, gpsLocation: Loc, carrierName: String? = "", authToken: String? = nil, cellID: UInt32? = nil, tags: [String: String]? = nil, mode: FindCloudletMode = FindCloudletMode.PROXIMITY) -> Promise<FindCloudletReply>

registerAndFIndCloudlet FindCloudlet returns information needed for the client app to connect to an application backend deployed through MobiledgeX. If there is an application backend instance found, FindCloudetReply will contain the fqdn of the application backend and an array of AppPorts (with information specific to each application backend endpoint)

Takes a FindCloudlet request, and contacts the specified Distributed MatchingEngine host and port for the current carrier, if any.

Parameters

org​Name String

orgName

app​Name String?

appName

app​Vers String?

appVers

gps​Location Loc

Loc

carrier​Name String?

Optional carrierName

auth​Token String?

Optional authToken

cell​ID UInt32?

Optional cellID

tags [String:​ String]?

Optional dict

mode Find​Cloudlet​Mode

Optional FindCloudletMode (default to Proximity)

Returns

Promise

register​And​Find​Cloudlet(host:​port:​org​Name:​app​Name:​app​Vers:​gps​Location:​carrier​Name:​auth​Token:​cell​ID:​tags:​mode:​)

@available(iOS 13.0, *) public func registerAndFindCloudlet(host: String, port: UInt16, orgName: String, appName: String?, appVers: String?, gpsLocation: Loc, carrierName: String? = "", authToken: String? = nil, cellID: UInt32? = nil, tags: [String: String]? = nil, mode: FindCloudletMode = FindCloudletMode.PROXIMITY) -> Promise<FindCloudletReply>

registerAndFindCloudlet overload with hardcoded DME host and port. Only use for testing. This API cannot be used for Non-Platform APPs.

create​Register​Client​Request(org​Name:​app​Name:​app​Vers:​auth​Token:​cell​ID:​tags:​)

public func createRegisterClientRequest(orgName: String, appName: String?, appVers: String?, authToken: String? = nil, cellID: UInt32? = nil, tags: [String: String]? = nil) -> RegisterClientRequest

API createRegisterClientRequest Creates the RegisterClientRequest object that will be used in the RegisterClient function.The RegisterClientRequest object wraps the parameters that have been provided to this function.

Parameters

org​Name String

Name of the developer

app​Name String?

Name of the application

app​Vers String?

Version of the application.

auth​Token String?

An optional opaque string to authenticate the client.

Returns

RegisterClientRequest

register​Client(request:​)

public func registerClient(request: RegisterClientRequest) -> Promise<RegisterClientReply>

API registerClient First DME API called. This will register the client with the MobiledgeX backend and check to make sure that the app that the user is running exists. (ie. This confirms that CreateApp in Console/Mcctl has been run successfully). RegisterClientReply contains a session cookie that will be used (automatically) in later API calls. It also contains a uri that will be used to get the verifyLocToken used in VerifyLocation.

Takes a RegisterClient request, and contacts the Distributed MatchingEngine host for the current carrier, if any.

Parameters

request Register​Client​Request

RegisterClientRequest struct, from createRegisterClientReqwuest.

Returns

Promise

register​Client(host:​port:​request:​)

public func registerClient(host: String, port: UInt16, request: RegisterClientRequest) -> Promise<RegisterClientReply>

API registerClient RegisterClient overload with hardcoded DME host and port. Only use for testing.

Takes a RegisterClient request, and contacts the specified Distributed MatchingEngine host and port for the current carrier, if any.

Parameters

host String

host override of the dme host server. DME must be reachable from current carrier.

port UInt16

port override of the dme server port

request Register​Client​Request

RegisterClientRequest struct, from createRegisterClientReqwuest.

Returns

Promise

create​Verify​Location​Request(gps​Location:​carrier​Name:​cell​ID:​tags:​)

public func createVerifyLocationRequest(gpsLocation: Loc, carrierName: String?, cellID: uint? = nil, tags: [String: String]? = nil) throws -> VerifyLocationRequest

createVerifyLocationRequest Creates the VerifyLocationRequest object that will be used in VerifyLocation

  • gpsLocation; Loc

Parameters

carrier​Name String?

carrierName

cell​ID uint?

Optional cellID

tags [String:​ String]?

Optional dict

Returns

VerifyLocationRequest

verify​Location(request:​)

public func verifyLocation(request: VerifyLocationRequest) -> Promise<VerifyLocationReply>

API: VerifyLocation Makes sure that the user's location is not spoofed based on cellID and gps location. Returns the Cell Tower status (CONNECTED_TO_SPECIFIED_TOWER if successful) and Gps Location status (LOC_VERIFIED if successful). Also provides the distance between where the user claims to be and where carrier believes user to be (via gps and cell id) in km.

Parameters

request Verify​Location​Request

VerifyLocationRequest from createVerifyLocation

Returns

Promise

verify​Location(host:​port:​request:​)

public func verifyLocation(host: String, port: UInt16, request: VerifyLocationRequest) -> Promise<VerifyLocationReply>

VerifyLocation overload with hardcoded DME host and port. Only use for testing.