public async Task <bool> FindCloudletHelper(MobiledgeXIntegration mxi) { bool foundCloudlet = await mxi.FindCloudlet(); await Task.Delay(TimeSpan.FromMilliseconds(1000)); return(foundCloudlet); }
/// <summary> /// Performs register client to the DME confirm wether ther user provided the right fields or not /// </summary> /// <returns>boolean value</returns> public async Task <bool> CheckCredentials() { MobiledgeXIntegration integration = new MobiledgeXIntegration(); bool checkResult = false; integration.UseWifiOnly(true); try { // Register and find cloudlet: clog("Registering to DME ...", ""); checkResult = await integration.Register(); bool foundCloudlet = await integration.FindCloudlet(); if (!foundCloudlet) { Debug.LogError("MobiledgeX: Couldn't Find findCloudletReply, Make Sure you created App Instances for your Application and they are deployed in the correct region."); throw new FindCloudletException("No findCloudletReply"); } return(checkResult); } catch (HttpRequestException httpre) { clog("MobiledgeX: RegisterClient HttpRequest Exception", httpre.Message + "\nStack Trace: " + httpre.StackTrace, true); return(false); } catch (RegisterClientException rce) { clog("MobiledgeX: RegisterClientException", rce.Message, true); return(false); } catch (FindCloudletException fce) { clog("MobiledgeX: Couldn't Find findCloudletReply, Make Sure you created App Instances for your Application and they are deployed in the correct region.", fce.Message + "\nStack Trace: " + fce.StackTrace, true); return(false); } catch (Exception e) { clog("Unexpected Exception ", e.StackTrace, true); return(false); } }