Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ServiceApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ android {

sitl {
signingConfig signingConfigs.debug
versionNameSuffix generateVersionNameSuffix(versionBuild, "sitl")
buildConfigField "boolean", "SITL_DEBUG", "true"
buildConfigField "boolean", "WRITE_LOG_FILE", "true"
debuggable true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.o3dr.services.android.lib.drone.companion.solo.tlv.TLVPacket;
import com.o3dr.services.android.lib.model.ICommandListener;

import org.droidplanner.services.android.BuildConfig;
import org.droidplanner.services.android.core.drone.companion.CompComp;
import org.droidplanner.services.android.core.drone.companion.solo.controller.ControllerLinkListener;
import org.droidplanner.services.android.core.drone.companion.solo.controller.ControllerLinkManager;
Expand Down Expand Up @@ -98,6 +99,9 @@ public SoloGoproState getGoproState() {
}

public boolean hasStreamingPermission(){
if(BuildConfig.SITL_DEBUG)
return true;

return controllerLinkManager.hasStreamingPermission();
}

Expand All @@ -115,18 +119,26 @@ public void start() {
return;
}

controllerLinkManager.start(this);
if(!BuildConfig.SITL_DEBUG) {
controllerLinkManager.start(this);
}

soloLinkMgr.start(this);
}

public void stop() {
controllerLinkManager.stop();
if(!BuildConfig.SITL_DEBUG) {
controllerLinkManager.stop();
}

soloLinkMgr.stop();
}

public void refreshState() {
soloLinkMgr.refreshState();
controllerLinkManager.refreshState();

if(!BuildConfig.SITL_DEBUG)
controllerLinkManager.refreshState();
}

/**
Expand Down Expand Up @@ -201,7 +213,7 @@ public void onLinkConnected() {
if (compListener != null)
compListener.onConnected();
} else {
if (!controllerLinkManager.isLinkConnected())
if (!controllerLinkManager.isLinkConnected() && !BuildConfig.SITL_DEBUG)
controllerLinkManager.start(this);

if (!soloLinkMgr.isLinkConnected())
Expand All @@ -214,7 +226,10 @@ public void onLinkDisconnected() {
if (compListener != null)
compListener.onDisconnected();

controllerLinkManager.stop();
if(!BuildConfig.SITL_DEBUG) {
controllerLinkManager.stop();
}

soloLinkMgr.stop();
}

Expand All @@ -234,6 +249,9 @@ public void onMacAddressUpdated() {
}

public boolean isConnected() {
if(BuildConfig.SITL_DEBUG)
return soloLinkMgr.isLinkConnected();

return controllerLinkManager.isLinkConnected() && soloLinkMgr.isLinkConnected();
}

Expand All @@ -247,7 +265,9 @@ public boolean isEUTxPowerCompliant() {

public void refreshSoloVersions() {
soloLinkMgr.refreshSoloLinkVersions();
controllerLinkManager.refreshControllerVersions();

if(!BuildConfig.SITL_DEBUG)
controllerLinkManager.refreshControllerVersions();
}

public String getControllerVersion() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import java.nio.ByteBuffer;

import timber.log.Timber;

/**
* Created by Fredia Huya-Kouadio on 6/1/15.
*/
Expand Down Expand Up @@ -65,7 +67,7 @@ NALUChunk assembleNALUChunk(byte[] buffer, int bufferLength) {
final byte nalHeaderByte = buffer[12];
final int forbiddenBit = (nalHeaderByte & 0x80) >> 7;
if (forbiddenBit != 0) {
Log.w(TAG, "Forbidden bit is set, indicating possible errors.");
Timber.w("Forbidden bit is set, indicating possible errors.");
return null;
}

Expand All @@ -78,7 +80,7 @@ NALUChunk assembleNALUChunk(byte[] buffer, int bufferLength) {
final int sequenceNumber = ((buffer[2] & 0xff) << 8) | (buffer[3] & 0xff);
final int nalType = nalHeaderByte & 0x1f;
if (nalType <= 0) {
Log.d(TAG, "Undefined nal type: " + nalType);
Timber.d("Undefined nal type: " + nalType);
return null;
}

Expand Down