Skip to content

Commit

Permalink
Merge branch 'lite' into update-to-5.2-lite
Browse files Browse the repository at this point in the history
# Conflicts:
#	library/build.gradle
#	library/src/main/java/com/qualcomm/ftccommon/FtcEventLoopBase.java
#	library/src/main/java/com/qualcomm/ftccommon/FtcRobotControllerService.java
#	library/src/main/java/org/firstinspires/ftc/ftccommon/internal/ProgramAndManageActivity.java
#	library/src/main/res/layout/activity_program_and_manage.xml
  • Loading branch information
iamwood committed Sep 26, 2019
2 parents b2abae5 + 4f214eb commit f4ed535
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 644 deletions.
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

versionCode 46
versionName "$ftc_version.0"
versionName "$ftc_version.0-lite"

ndk {
abiFilters "armeabi-v7a"
Expand All @@ -28,10 +28,10 @@ version = android.defaultConfig.versionName
project.archivesBaseName = 'ftc-common-repackaged'

dependencies {
implementation "com.github.modular-ftc:robotcore-repackaged:$ftc_version.0-lite"
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.google.code.gson:gson:2.8.5'

implementation "com.github.modular-ftc:robotcore-repackaged:$ftc_version.0"
implementation "org.first.ftc:hardware:$ftc_version"
implementation "org.first.ftc:inspection:$ftc_version"
implementation "org.first.ftc:robotserver:$ftc_version"
Expand Down
4 changes: 3 additions & 1 deletion library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- FtcCommon manifest -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.qualcomm.ftccommon"
android:versionCode="64"
android:versionName="11.6" >

<uses-sdk
android:targetSdkVersion="26" />
android:targetSdkVersion="26"
tools:ignore="GradleOverrides,OldTargetApi" />

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ are permitted (subject to the limitations in the disclaimer below) provided that
import com.qualcomm.robotcore.util.RobotLog;
import com.qualcomm.robotcore.util.SerialNumber;
import com.qualcomm.robotcore.util.ThreadPool;
import com.qualcomm.robotcore.util.WebServer;

import org.firstinspires.ftc.robotcore.external.Consumer;
import org.firstinspires.ftc.robotcore.external.function.Supplier;
Expand All @@ -143,7 +142,6 @@ are permitted (subject to the limitations in the disclaimer below) provided that
import org.firstinspires.ftc.robotcore.internal.network.WifiDirectAgent;
import org.firstinspires.ftc.robotcore.internal.network.WifiDirectGroupName;
import org.firstinspires.ftc.robotcore.internal.network.WifiDirectPersistentGroupManager;
import org.firstinspires.ftc.robotcore.internal.opmode.OnBotJavaBuildLocker;
import org.firstinspires.ftc.robotcore.internal.opmode.RegisteredOpModes;
import org.firstinspires.ftc.robotcore.internal.stellaris.FlashLoaderManager;
import org.firstinspires.ftc.robotcore.internal.stellaris.FlashLoaderProtocolException;
Expand Down Expand Up @@ -368,10 +366,6 @@ else if (name.equals(CommandList.CmdVisuallyIdentify.Command))
{
result = handleCommandVisuallyIdentify(command);
}
else if (name.equals(CommandList.CMD_VISUALLY_CONFIRM_WIFI_RESET))
{
result = handleCommandVisuallyConfirmWifiReset();
}
else
{
result = CallbackResult.NOT_HANDLED;
Expand Down Expand Up @@ -409,19 +403,6 @@ protected void sendUIState()

protected void checkForChangedOpModes()
{
if (registeredOpModes.getOnBotJavaChanged())
{
OnBotJavaBuildLocker.lockBuildExclusiveWhile(new Runnable()
{
@Override public void run()
{
registeredOpModes.clearOnBotJavaChanged();
registeredOpModes.registerOnBotJavaOpModes();
}
});
sendUIState();
}

if (registeredOpModes.getBlocksOpModesChanged())
{
registeredOpModes.clearBlocksOpModesChanged(); // clear first so we err on side of registerring too often rather than too infrequently
Expand Down Expand Up @@ -1096,15 +1077,7 @@ protected void handleCommandStartProgrammingMode()
protected void handleCommandStartDriverStationProgramAndManage()
{
EventLoopManager eventLoopManager = ftcEventLoopHandler.getEventLoopManager();
if (eventLoopManager != null)
{
WebServer webServer = eventLoopManager.getWebServer();
String extra = webServer.getConnectionInformation().toJson();
RobotLog.vv(TAG, "sending p&m resp: %s", extra);
networkConnectionHandler.sendCommand(new Command(CommandList.CMD_START_DS_PROGRAM_AND_MANAGE_RESP, extra));
}
else
{
if (eventLoopManager == null) {
RobotLog.vv(TAG, "handleCommandStartDriverStationProgramAndManage() with null EventLoopManager; ignored");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
import com.qualcomm.robotcore.util.Intents;
import com.qualcomm.robotcore.util.RobotLog;
import com.qualcomm.robotcore.util.ThreadPool;
import com.qualcomm.robotcore.util.WebServer;
import com.qualcomm.robotcore.wifi.NetworkConnection;
import com.qualcomm.robotcore.wifi.NetworkConnectionFactory;
import com.qualcomm.robotcore.wifi.NetworkType;
Expand Down Expand Up @@ -113,8 +112,6 @@ public class FtcRobotControllerService extends Service implements NetworkConnect
private WifiDirectAgent wifiDirectAgent = WifiDirectAgent.getInstance();
private final Object wifiDirectCallbackLock = new Object();

private WebServer webServer;

//----------------------------------------------------------------------------------------------
// Initialization
//----------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -260,7 +257,6 @@ void waitForNetwork() throws InterruptedException {
}
// Wait until we're free and clear to go
waitForNetworkConnection();
webServer.start();
}

void startRobot() throws RobotCoreException {
Expand Down Expand Up @@ -342,10 +338,6 @@ public Robot getRobot() {
return this.robot;
}

public @NonNull WebServer getWebServer() {
return this.webServer;
}

@Override public void onCreate() {
super.onCreate();
RobotLog.vv(TAG, "onCreate()");
Expand Down Expand Up @@ -373,7 +365,6 @@ public IBinder onBind(Intent intent) {
FtcLynxFirmwareUpdateActivity.initializeDirectories();

NetworkType networkType = (NetworkType) intent.getSerializableExtra(NetworkConnectionFactory.NETWORK_CONNECTION_TYPE);
webServer = new CoreRobotWebServer(networkType);

networkConnection = NetworkConnectionFactory.getNetworkConnection(networkType, getBaseContext());
networkConnection.setCallback(this);
Expand Down Expand Up @@ -401,7 +392,6 @@ public boolean onUnbind(Intent intent) {
@Override public void onDestroy() {
super.onDestroy();
RobotLog.vv(TAG, "onDestroy()");
webServer.stop();
stopLEDS();
wifiDirectAgent.unregisterCallback(this);
}
Expand Down Expand Up @@ -509,11 +499,6 @@ public CallbackResult onNetworkConnectionEvent(NetworkConnection.NetworkEvent ev
break;
case CONNECTION_INFO_AVAILABLE:
RobotLog.ii(TAG, "Network Connection Passphrase: " + networkConnection.getPassphrase());
// Handling the case where we are changing networks and the web server has already been started.
if (webServer.wasStarted()) {
webServer.stop();
}
webServer.start();
break;
case ERROR:
RobotLog.ee(TAG, "Network Connection Error: " + networkConnection.getFailureReason());
Expand Down
Loading

0 comments on commit f4ed535

Please sign in to comment.