Skip to content

Commit

Permalink
Staging 2.4.1 (#124)
Browse files Browse the repository at this point in the history
v2.4.1
* Location Service Exception thrown when user rejects location permissions
* Capture SDK Version only on DeviceInfo if the device is Oculus
* Don't depened on the device name and use XRSettings.enabled for now
* Removing Warning variable not used, removing excessive debugging
* Commenting out any debugging that is not needed, Converting some Debug.Log to Debug.LogWarning, Adding and Updating Licenses, Surpressing some warnings and Removing GetDeviceInfo from TestDeviceInfo Class
* Logging Option in MobiledgeX Settings
* check for oculus only instead of XRSettings.enabled
* Input.location.Stop() after timeout
* Class NameChange, default log type is Errors&Warnings & Fixed TestDeviceInfo class
* EdgeMultiplay Downloader
* EdgeMultiplay Package link
* EDGECLOUD-4350: Prevent IOS Permission popup with an extra
UseEnhancedLocationServices guard on local network interfaces.
* Fix RegisterClient Exception being too vague in case of initial connection failure
* New Constructor for MobiledgeXIntegration with app defs & Removing Static variables
* Runtime Tests
* mxi instead mix, remove extra logs, proper long lat, better check for GetUrl
* revert to old switch statement to support older unity versions
* default as final fallback in proto switch statement
* ChangeLog Updated, Readme Updated, EditorWindow EdgeMultiplay Downloader small fix, MobiledgeXIntegrationHelper -> Debug to Logger, sdk version bumped
* Update DLL
* Readme updated, ExampleRest Exception updates, More logging in MobiledgeXIntegrationHelper.cs
* print inner exceptions
* Removing HTTP proto
* Removing DMEDNS Exception
* Readme urls updated

Co-authored-by: Ahmed Schrute <[email protected]>
  • Loading branch information
lgarner and Ahmed Schrute authored Mar 10, 2021
1 parent e655a68 commit f770258
Show file tree
Hide file tree
Showing 25 changed files with 699 additions and 391 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Changelog
All notable changes to this package will be documented in this file.

## [2.4.1] - 2021-03-02

### Fix & Improvements.
- Location Exception added, Location Exception is thrown if the user rejected location permission.
- Added support for Oculus Devices.
- New MobiledgeXIntegration Constructor added using your MobiledgeX App Definitions, you can connect to multiple apps from a single Unity project.
- Local Network permission on iOS is removed by default, this might degrade some edge features, to fix this set matchingEngine.EnableEnhancedLocationServices to true.
### MobiledgeX Settings
- log type is added to MobiledgeX Settings to switch between development and production.

## [2.4.0] - 2020-12-10

### Fix & Improvements.
Expand Down
42 changes: 34 additions & 8 deletions Editor/MobiledgeXEditorWindow.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2018-2020 MobiledgeX, Inc. All rights and licenses reserved.
* Copyright 2018-2021 MobiledgeX, Inc. All rights and licenses reserved.
* MobiledgeX, Inc. 156 2nd Street #408, San Francisco, CA 94105
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -17,6 +17,7 @@

using System;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Collections.Generic;
Expand Down Expand Up @@ -101,8 +102,8 @@ public static void OpenDocumentationURL()
[MenuItem("MobiledgeX/Examples/EdgeMultiplay", false, 20)]
public static void ImportEdgeMultiplayExample()
{
string sdkPath = Path.GetFullPath("Packages/com.mobiledgex.sdk");
AssetDatabase.ImportPackage(Path.Combine(sdkPath, "Resources/Examples/EdgeMultiplay.unitypackage"), true);
DownloadFile("https://github.com/mobiledgex/edge-multiplay-unity-client/raw/main/EdgeMultiplay.unitypackage",
Path.Combine(Application.dataPath,"EdgeMultiplay.unitypackage"));
Enhancement.EdgeMultiplayImported(getId());
}

Expand Down Expand Up @@ -200,6 +201,12 @@ void OnGUI()
}
GUILayout.Label(sdkVersion, sdkVersionStyle);
}

void OnInspectorUpdate()
{
Repaint();
}

#endregion


Expand Down Expand Up @@ -283,10 +290,6 @@ private async void SetupWindow()
EditorGUILayout.EndVertical();
if (GUILayout.Button("Setup"))
{
MobiledgeXIntegration.orgName = settings.orgName;
MobiledgeXIntegration.appName = settings.appName;
MobiledgeXIntegration.appVers = settings.appVers;
MobiledgeXIntegration.developerAuthToken = settings.authPublicKey;
progressText = "";
if (await CheckCredentials())
{
Expand All @@ -309,7 +312,7 @@ private async void SetupWindow()
private void LicenseWindow()
{
EditorGUILayout.BeginHorizontal();
string licenseText = "Copyright 2020 MobiledgeX, Inc.All rights and licenses reserved.\n MobiledgeX, Inc. 156 2nd Street #408, San Francisco, CA 94105" +
string licenseText = "Copyright 2018-2021 MobiledgeX, Inc.All rights and licenses reserved.\n MobiledgeX, Inc. 156 2nd Street #408, San Francisco, CA 94105" +
"Licensed under the Apache License, Version 2.0 (the \"License\") \n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at" +
"\n \n http://www.apache.org/licenses/LICENSE-2.0 \n \n Unless required by applicable law or agreed to in writing, software \n distributed under the License is distributed on an \"AS IS- BASIS\" \n" +
"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \n See the License for the specific language governing permissions and\n limitations under the License.";
Expand Down Expand Up @@ -492,6 +495,29 @@ static string getId()
return id;
}

static void DownloadFile(string fileUrl, string filePath)
{
using (WebClient wc = new WebClient())
{
wc.DownloadProgressChanged += wc_DownloadProgressChanged;
wc.DownloadFileAsync(new Uri(fileUrl), filePath);
}
}

static void wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
if (e.ProgressPercentage < 100)
EditorUtility.DisplayProgressBar("Downloading", "Download in progress ...", e.ProgressPercentage);
else
{
if (e.ProgressPercentage == 100)
{
EditorUtility.ClearProgressBar();
AssetDatabase.ImportPackage(Application.dataPath + "/EdgeMultiplay.unitypackage", true);
}
}
}

#endregion
}
}
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2018-2020 MobiledgeX, Inc. All rights and licenses reserved.
Copyright 2018-2021 MobiledgeX, Inc. All rights and licenses reserved.
MobiledgeX, Inc. 156 2nd Street #408, San Francisco, CA 94105

Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
42 changes: 31 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ Once that setup has been completed, you can very easily call all the necessary A

**Getting Edge Connection Url**

MobiledgeX SDK uses the device Location and [the device's MCC-MNC ID (if avaliable)](https://developers.mobiledgex.com/getting-started/connecting-client-app#distributed-matching-engine) to connect you to the closest Edge cloudlet where you application instance is deployed.
MobiledgeX SDK uses the device Location and [the device's MCC-MNC ID (if avaliable)](https://developers.mobiledgex.com/sdks/overview#distributed-matching-engine) to connect you to the closest Edge cloudlet where you application instance is deployed.

If your carrier is not supported yet by MobiledgeX the SDK will throw a DmeDnsException. You can catch this exception and instead use WifiOnly(true) to connect to [the wifi dme](https://developers.mobiledgex.com/getting-started/connecting-client-app#distributed-matching-engine) which will connect you to the closest [regional DME](https://developers.mobiledgex.com/getting-started/connecting-client-app#distributed-matching-engine).
If your carrier is not supported yet by MobiledgeX the SDK will throw a RegisterClient Exception. You can catch this exception and instead use WifiOnly(true) to connect to [the wifi dme](https://developers.mobiledgex.com/sdks/overview#distributed-matching-engine) which will connect you to the closest [regional DME](https://developers.mobiledgex.com/sdks/overview#distributed-matching-engine).

```csharp
using MobiledgeX;
Expand All @@ -108,20 +108,37 @@ public class YourClassName : MonoBehaviour
yield return StartCoroutine(MobiledgeX.LocationService.EnsureLocation()); // Location is needed to connect you to the closet edge
GetEdgeConnection();
}
async void GetEdgeConnection()

async void GetEdgeConnection()
{
MobiledgeXIntegration mxi = new MobiledgeXIntegration();
// you can use new MobiledgeXIntegration("orgName","appName","appVers");
try
{
await mxi.RegisterAndFindCloudlet();
}
catch(DmeDnsException)
catch (RegisterClientException rce)
{
mxi.UseWifiOnly(true); // if you carrier is not supported yet, WifiOnly will connect you to wifi.dme
Debug.Log("RegisterClientException: " + rce.Message + "Inner Exception: " + rce.InnerException);
mxi.UseWifiOnly(true); // use location only to find the app instance
await mxi.RegisterAndFindCloudlet();
}

mxi.GetAppPort(LProto.L_PROTO_HTTP); // Get the port of the desired protocol
//FindCloudletException is thrown if there is no app instance in the user region
catch (FindCloudletException fce)
{
Debug.Log("FindCloudletException: " + fce.Message + "Inner Exception: " + fce.InnerException);
// your fallback logic here
}
// LocationException is thrown if the app user rejected location permission
catch (LocationException locException)
{
print("Location Exception: " + locException.Message);
mxi.useFallbackLocation = true;
mxi.SetFallbackLocation(-122.4194, 37.7749); //Example only (SF location),In Production you can optionally use: MobiledgeXIntegration.LocationFromIPAddress location = await MobiledgeXIntegration.GetLocationFromIP();
await mxi.RegisterAndFindCloudlet();
}

mxi.GetAppPort(LProto.L_PROTO_TCP); // Get the port of the desired protocol
string url = mxi.GetUrl("http"); // Get the url of the desired protocol
}

Expand Down Expand Up @@ -166,7 +183,7 @@ For full example code, Please check [RunTime/Scripts/ExampleRest.cs](https://git
MobiledgeXIntegration mxi = new MobiledgeXIntegration();
await mxi.RegisterAndFindCloudlet();

mxi.GetAppPort(LProto.L_PROTO_HTTP); // Get the port of the desired protocol
mxi.GetAppPort(LProto.L_PROTO_TCP); // Get the port of the desired protocol
string url = mxi.GetUrl("http"); // Get the url of the desired protocol
StartCoroutine(RestExample(url)); // using UnityWebRequest
RestExampleHttpClient(url); // using HttpClient
Expand Down Expand Up @@ -320,6 +337,9 @@ The SDK comes with an easy to integrate Location Service Solution (LocationServi
You can find LocationService in the Unity Editor Inspector.
Select AddComponent then select (MobiledgeX/LocationService)
![](https://developers.mobiledgex.com/assets/unity-sdk/mobiledgex-unity-location-service.png)

If the user rejects Location permission, Location Exception will be thrown. Check ExampleRest.cs for handling location exception example.

Different way to get the device's location :

```csharp
Expand All @@ -345,8 +365,8 @@ If you recieve the following error and cannot compile your Unity project, restar


### Where to Go from Here
* Click [here](https://api.mobiledgex.net/#section/Edge-SDK-Unity) to view and familiarize with the Unity C# SDK APIs to start your MobiledgeX integration.
* Click [here](https://mobiledgex.github.io/unity-samples/) to view and familiarize with the Unity C# SDK APIs to start your MobiledgeX integration.

* To learn how to use Docker to upload your application server, see this [tutorial](https://developers.mobiledgex.com/guides-and-tutorials/hello-world).
* To learn how to use Docker to upload your application server, see this [tutorial](https://developers.mobiledgex.com/deployments/application-deployment-guides/hello-world).

* For sample Unity code, please refer to our [Ping Pong tutorial](https://developers.mobiledgex.com/guides-and-tutorials/how-to-workshop-adding-mobiledgex-matchingengine-sdk-to-unity-ping-pong-demo-app).
* For sample Unity code, please refer to our [Ping Pong tutorial](https://developers.mobiledgex.com/sdks/unity-sdk/unity-sdk-sample).
5 changes: 3 additions & 2 deletions Resources/MobiledgeXSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: e396521cb32fc4dc59768094dc265479, type: 3}
m_Name: MobiledgeXSettings
m_EditorClassIdentifier:
sdkVersion:
sdkVersion:
orgName:
appName:
appName:
appVers:
authPublicKey:
region:
logType:
Binary file modified Runtime/Plugins/MatchingEngineSDKRestLibrary.dll
Binary file not shown.
Loading

0 comments on commit f770258

Please sign in to comment.