Skip to content

Commit

Permalink
Rebase on current main
Browse files Browse the repository at this point in the history
  • Loading branch information
muthenberg committed Aug 11, 2023
1 parent 313bec1 commit 4fc676a
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 198 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import androidx.navigation.ui.setupActionBarWithNavController
import androidx.navigation.ui.setupWithNavController
import de.cyface.app.digural.auth.LoginActivity
import de.cyface.app.digural.button.ExternalCameraController
import de.cyface.app.digural.capturing.settings.CustomPreferences
import de.cyface.app.digural.databinding.ActivityMainBinding
import de.cyface.app.digural.notification.CameraEventHandler
import de.cyface.app.digural.notification.DataCapturingEventHandler
Expand Down Expand Up @@ -164,7 +165,6 @@ class MainActivity : AppCompatActivity(), ServiceProvider, CameraServiceProvider
override fun onCreate(savedInstanceState: Bundle?) {
preferences = AppPreferences(this)
cameraPreferences = CameraPreferences(this)
val diguralPreferences = DiGuRaLPreferences(this)

// Location permissions are requested by MainFragment which needs to react to results

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import kotlinx.parcelize.Parcelize
import java.net.HttpURLConnection
import java.net.URL
import java.nio.charset.Charset
import kotlin.concurrent.thread

/**
* Calls the API that triggers external cameras to trigger in sync with this smartphones camera.
Expand Down Expand Up @@ -62,7 +66,8 @@ class ExternalCameraController(private val deviceId: String) : ParcelableCapturi
override fun onRecordingStopped() {}
override fun onCameraError(reason: String) {}
override fun onAboutToCapture(measurementId: Long, location: Location?) {
if(location == null) {
Log.d(TAG, "On About to Capture $location")
if (location == null) {
return
}

Expand All @@ -74,12 +79,40 @@ class ExternalCameraController(private val deviceId: String) : ParcelableCapturi
location.time
)

runBlocking {
/* Begin Retrofit Variant */
/*runBlocking {
withContext(Dispatchers.IO) {
Log.d(TAG, "###########Sending Payload $payload to ${DiguralApi.baseUrl}")
DiguralApi.diguralService.trigger(payload)
}
}*/
/* End Retrofit Variant */

/* Begin Classic Variant */
thread {
Log.d(TAG, "Sending Payload ${payload.toJson()}")
with(URL("http://192.168.113.154:5000/PanAiCam/Trigger").openConnection() as HttpURLConnection) {
try {
requestMethod = "POST"
setRequestProperty("Accept", "*/*")
setRequestProperty("Content-Type", "application/json")
doOutput = true

outputStream.use { os ->
val input: ByteArray =
payload.toJson().toByteArray(Charset.defaultCharset())
os.write(input, 0, input.size)
}
outputStream.flush()
outputStream.close()

Log.d(TAG, "$responseCode")
} finally {
disconnect()
}
}
}
/* End Classic Variant */
}

override fun shallStop() {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,7 @@ class SettingsFragment : Fragment() {
final boolean bluetoothIsConfigured = preferences.getString(BLUETOOTHLE_DEVICE_MAC_KEY, null) != null
&& preferences.getFloat(BLUETOOTHLE_WHEEL_CIRCUMFERENCE, 0.0F) > 0.0F;
connectToExternalSpeedSensorToggle.setChecked(bluetoothIsConfigured);
*/

// connectToExternalSpeedSensorToggle.setOnClickListener(new ConnectToExternalSpeedSensorToggleListener());

Expand Down
10 changes: 0 additions & 10 deletions ui/digural/src/main/res/layout/fragment_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -614,15 +614,5 @@

</LinearLayout>

<EditText
android:id="@+id/diguralServerAddress"
android:layout_width="378dp"
android:layout_height="52dp"
android:ems="10"
android:inputType="text"
android:text="http://localhost:33553"
app:layout_constraintTop_toBottomOf="@+id/sensor_frequency_wrapper"
tools:layout_editor_absoluteX="0dp" />

</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

0 comments on commit 4fc676a

Please sign in to comment.