Skip to content

Commit

Permalink
EDGECLOUD-2855 EDGECLOUD-2974 EDGECLOUD-3064 HA and more (#210)
Browse files Browse the repository at this point in the history
* EDGECLOUD-2855 EDGECLOUD-2974 EDGECLOUD-3064 HA and more

* Latest lib versions

* Added Auto Failover preference, and fixed a few bugs
  • Loading branch information
brucearmstrong authored Jun 25, 2020
1 parent 94d0f58 commit d8e75f6
Show file tree
Hide file tree
Showing 27 changed files with 1,122 additions and 209 deletions.
4 changes: 2 additions & 2 deletions android/MobiledgeXSDKDemo/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "com.mobiledgex.sdkdemo"
minSdkVersion 24
targetSdkVersion 28
versionCode 56
versionName "1.1.7"
versionCode 57
versionName "1.1.8"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

manifestPlaceholders = [GOOGLE_MAPS_API_KEY: "${googleMapsApiKey}"]
Expand Down
21 changes: 20 additions & 1 deletion android/MobiledgeXSDKDemo/app/release/output.json
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":55,"versionName":"1.1.6","enabled":true,"outputFile":"MobiledgeXSDKDemo-release.apk","fullName":"release","baseName":"release","dirName":""},"path":"MobiledgeXSDKDemo-release.apk","properties":{}}]
{
"version": 1,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.mobiledgex.sdkdemo",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"properties": [],
"versionCode": 56,
"versionName": "56",
"enabled": true,
"outputFile": "MobiledgeXSDKDemo-release.apk"
}
]
}
24 changes: 16 additions & 8 deletions android/MobiledgeXSDKDemo/app/src/main/assets/about_dialog.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
<p>Version: ${appVersion}</p>
<p>Version: ${androidAppVersion}</p>
<p>This app uses the MobiledgeX Matching Engine SDK to find and display on a map all of the
Cloudlets running the backend app that provides the speed test and computer vision services
needed by this app. It uses the following information for the SDK API calls:</p>
Cloudlets running the backend app that provides the speed test and computer vision services
needed by this app. It uses the following information for the SDK API calls:</p>
<table border="2">
<tbody>
<tr>
<td><strong>appName</strong></td>
<td>MobiledgeX SDK Demo</td>
<td>${appName}</td>
</tr>
<tr>
<td><strong>devName</strong></td>
<td>MobiledgeX</td>
<td><strong>orgName</strong></td>
<td>${orgName}</td>
</tr>
<tr>
<td><strong>appVer</strong></td>
<td>2.0</td>
<td>${appVersion}</td>
</tr>
<tr>
<td><strong>Operator</strong></td>
<td>${operator}</td>
</tr>
<tr>
<td><strong>Region</strong></td>
<td>${region}</td>
</tr>
</tbody>
</table>
<p>The Operator name and Region selection values can be changed in the General Settings of the app.</p>
<p>These values can be changed in the General Settings of the app.</p>
<p>To learn more about the MobiledgeX SDK, see <a href="https://developers.mobiledgex.com/">developers.mobiledgex.com</a> for documentation and a Getting Started guide.</p>
<p>Source code for this app is available on <a href="https://github.com/mobiledgex/edge-cloud-sampleapps/tree/master/android/MobiledgeXSDKDemo">Github</a>.</p>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public static class LocationSettingsFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.location_preferences);
addPreferencesFromResource(R.xml.pref_matching_engine);
setHasOptionsMenu(true);
}

Expand Down Expand Up @@ -233,6 +233,10 @@ public static class GeneralSettingsFragment extends PreferenceFragment implement
String prefKeyOperatorName;
String prefKeyDefaultDmeHostname;
String prefKeyDefaultOperatorName;
String prefKeyDefaultAppInfo;
String prefKeyAppName;
String prefKeyAppVersion;
String prefKeyOrgName;

@Override
public void onCreate(Bundle savedInstanceState) {
Expand All @@ -245,15 +249,24 @@ public void onCreate(Bundle savedInstanceState) {
prefKeyDefaultDmeHostname = getResources().getString(R.string.pref_default_dme_hostname);
prefKeyOperatorName = getResources().getString(R.string.pref_operator_name);
prefKeyDmeHostname = getResources().getString(R.string.pref_dme_hostname);
prefKeyDefaultAppInfo = getResources().getString(R.string.pref_default_app_definition);
prefKeyAppName = getResources().getString(R.string.pref_app_name);
prefKeyAppVersion = getResources().getString(R.string.pref_app_version);
prefKeyOrgName = getResources().getString(R.string.pref_org_name);

// Initialize summary values for these keys.
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
onSharedPreferenceChanged(prefs, prefKeyDefaultOperatorName);
onSharedPreferenceChanged(prefs, prefKeyDefaultDmeHostname);
onSharedPreferenceChanged(prefs, prefKeyOperatorName);
onSharedPreferenceChanged(prefs, prefKeyDefaultAppInfo);
// prefKeyDmeHostname does not need initialized here, because it is initialized with
// the results of the dme-list.html call below.

bindPreferenceSummaryToValue(findPreference(prefKeyAppName));
bindPreferenceSummaryToValue(findPreference(prefKeyAppVersion));
bindPreferenceSummaryToValue(findPreference(prefKeyOrgName));

// Instantiate the RequestQueue.
RequestQueue queue = Volley.newRequestQueue(getActivity());
String url = "http://dme-inventory.mobiledgex.net/dme-list.html";
Expand Down Expand Up @@ -344,6 +357,9 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, Strin
String summary = getResources().getString(R.string.pref_summary_default_operator_name);
String prefKeyValueDefaultOperatorName = getResources().getString(R.string.pref_value_default_operator_name);
String operatorName = sharedPreferences.getString(prefKeyValueDefaultOperatorName, DEFAULT_CARRIER_NAME);
if (operatorName.isEmpty()) {
operatorName = "<blank>";
}
summary = summary + ": " + operatorName;
pref.setSummary(summary);
}
Expand All @@ -357,6 +373,17 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, Strin
String summary = getResources().getString(R.string.pref_summary_operator_name);
pref.setSummary(summary + ": " + ((EditTextPreference)pref).getText());
}

if (key.equals(prefKeyDefaultAppInfo)) {
String summary = getResources().getString(R.string.pref_summary_default_app_definition);
String appName = getResources().getString(R.string.app_name);
String appVersion = getResources().getString(R.string.app_version);
String orgName = getResources().getString(R.string.org_name);
summary = summary + "\n Name=" + appName + "\n Version=" + appVersion + "\n Org=" + orgName;
pref.setSummary(summary);
}


}
}

Expand All @@ -381,6 +408,14 @@ public void onCreate(Bundle savedInstanceState) {
setHasOptionsMenu(true);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
prefs.registerOnSharedPreferenceChangeListener(this);

String prefKeyHostCloud = getResources().getString(com.mobiledgex.computervision.R.string.preference_fd_host_cloud);
String prefKeyHostEdge = getResources().getString(com.mobiledgex.computervision.R.string.preference_fd_host_edge);
String prefKeyOpenPoseHostEdge = getResources().getString(com.mobiledgex.computervision.R.string.preference_openpose_host_edge);

bindPreferenceSummaryToValue(findPreference(prefKeyHostCloud));
bindPreferenceSummaryToValue(findPreference(prefKeyHostEdge));
bindPreferenceSummaryToValue(findPreference(prefKeyOpenPoseHostEdge));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ protected void onCreate(Bundle savedInstanceState) {
}

View mapView = findViewById(R.id.map);
mMatchingEngineHelper = new MatchingEngineHelper(this, mHostname, carrierName, mapView);
mMatchingEngineHelper = new MatchingEngineHelper(this, mapView);
mMatchingEngineHelper.registerClientInBackground();

// Build Legend Table View programmatically, based on colors and speed description values.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
android:id="@+id/nav_google_signout"
android:icon="@drawable/googleg_color"
android:title="@string/menu_sign_out" />
<item
android:id="@+id/nav_face_recognition"
android:icon="@drawable/ic_menu_camera"
android:title="@string/title_activity_face_recognition" />
<item
android:id="@+id/nav_face_detection"
android:icon="@drawable/ic_menu_camera"
android:title="@string/title_activity_face_detection" />
<item
android:id="@+id/nav_face_recognition"
android:icon="@drawable/ic_menu_camera"
android:title="@string/title_activity_face_recognition" />
<item
android:id="@+id/nav_object_detection"
android:icon="@drawable/ic_menu_camera"
Expand Down
27 changes: 26 additions & 1 deletion android/MobiledgeXSDKDemo/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<resources>
<string name="app_name">MobiledgeX SDK Demo</string>
<string name="app_version">2.0</string>
<string name="org_name">MobiledgeX</string>

<string name="yes">Yes</string>
<string name="no">No</string>
Expand All @@ -17,7 +19,7 @@
<string name="enhanced_location_permission">This application uses enhanced features of carrier networks to validate your device location. Please enable in app settings.</string>
<string name="preference_matching_engine_location_verification">location_verification</string>
<string name="preference_matching_engine_location_verification_title">Location Verification</string>
<string name="preference_matching_engine_location_verification_summary">Enhanced Network Location Services</string>
<string name="preference_matching_engine_location_verification_summary">Matching Engine Settings</string>
<string name="preference_net_switching_allowed">net_switching_allowed</string>
<string name="preference_net_switching_allowed_title">Network Switching Enabled</string>
<string name="preference_net_switching_allowed_summary">Wifi to Cell network switching</string>
Expand Down Expand Up @@ -107,10 +109,33 @@
<item>socket</item>
</string-array>

<string name="pref_find_cloudlet_mode">find_cloudlet_mode</string>
<string name="pref_find_cloudlet_title">FindCloudlet Mode</string>
<string name="pref_find_cloudlet_summary">%s</string>
<string-array name="pref_find_cloudlet_method_titles">
<item>Proximity</item>
<item>Performance</item>
</string-array>
<string-array name="pref_find_cloudlet_method_values">
<item>PROXIMITY</item>
<item>PERFORMANCE</item>
</string-array>

<string name="pref_latency_autostart">latency_autostart</string>
<string name="pref_latency_autostart_title">Latency Test Auto-Start</string>
<string name="pref_latency_autostart_summary">Automatically start latency test when cloudlet is discovered.</string>

<string name="pref_default_app_definition">pref_default_app_definition</string>
<string name="pref_value_default_app_definition">pref_value_default_app_definition</string>
<string name="pref_title_default_app_definition">Use Default App Definition</string>
<string name="pref_summary_default_app_definition">These values may be overridden to show a different set of app instances.</string>
<string name="pref_app_name">pref_app_name</string>
<string name="pref_title_app_name">App Name</string>
<string name="pref_app_version">pref_app_version</string>
<string name="pref_title_app_version">App Version</string>
<string name="pref_org_name">pref_org_name</string>
<string name="pref_title_org_name">Organization Name</string>

<string name="pref_operator_name">pref_operator</string>
<string name="pref_title_operator_name">Operator</string>
<string name="pref_summary_operator_name">The operator or carrier name</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/matching_engine_general_preference_screen">
android:id="@+id/matching_engine_preference_screen">

<SwitchPreference
android:id="@+id/preference_matching_engine_location_verification"
Expand All @@ -20,4 +20,12 @@
android:summary="@string/preference_net_switching_allowed_summary"
android:defaultValue="false" />

<ListPreference
android:defaultValue="PROXIMITY"
android:entries="@array/pref_find_cloudlet_method_titles"
android:entryValues="@array/pref_find_cloudlet_method_values"
android:key="@string/pref_find_cloudlet_mode"
android:summary="@string/pref_find_cloudlet_summary"
android:title="@string/pref_find_cloudlet_title" />

</PreferenceScreen>
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
android:defaultValue="ping"
android:entries="@array/pref_latency_test_method_titles"
android:entryValues="@array/pref_latency_test_method_values"
android:key="@string/latency_method"
android:key="@string/pref_latency_method"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:summary="@string/pref_summary_latency_method"
android:title="@string/pref_title_latency_method" />
android:summary="@string/pref_latency_method_summary"
android:title="@string/pref_latency_method_title" />

<SwitchPreference
android:key="@string/pref_latency_autostart"
Expand Down
6 changes: 3 additions & 3 deletions android/MobiledgeXSDKDemo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

project.ext.matchingengineVersion = "2.0.8"
project.ext.melVersion = "1.0.8"
project.ext.matchingengineVersion = "2.1.0"
project.ext.melVersion = "1.0.11"
project.ext.grpcVersion = '1.20.0'

//
Expand Down Expand Up @@ -44,7 +44,7 @@ allprojects {
username artifactory_user
password artifactory_password
}
url "https://artifactory.mobiledgex.net/artifactory/maven-development/"
url "https://artifactory.mobiledgex.net/artifactory/maven-releases/"
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion android/MobiledgeXSDKDemo/computervision/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.1.1"
versionName "1.1.2"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand All @@ -24,6 +24,7 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.recyclerview:recyclerview:1.1.0'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.mobiledgex.computervision;

import android.text.format.DateFormat;

import java.util.Calendar;
import java.util.TimeZone;

/**
* An Activity item.
*/
public class EventItem {
public final long timestamp;
public final String timestampText;
public final String id;
public final String content;
public enum EventType {
DEBUG,
INFO,
WARN,
ERROR
}
public EventType eventType;

public EventItem(EventType type, String content) {
eventType = type;
timestamp = System.currentTimeMillis();
Calendar cal = Calendar.getInstance(TimeZone.getDefault());
cal.setTimeInMillis(timestamp);
// TODO: Update to use device's configured date and time format.
// this.timestampText = DateFormat.format("MM-dd-yyyy HH:mm:ss", cal).toString();
timestampText = DateFormat.format("HH:mm:ss", cal).toString();
id = ""+timestamp;
this.content = content;
}

@Override
public String toString() {
return timestamp + " " + content;
}
}
Loading

0 comments on commit d8e75f6

Please sign in to comment.