Browse Source

IP-Adresse etc. in der app

master
Baran Yasar 1 year ago
parent
commit
ff7cc62f6a

+ 17
- 0
MobileApp/.idea/deploymentTargetDropDown.xml View File

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\baran\.android\avd\Nexus_5_API_R.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-01-11T18:53:15.217760700Z" />
</component>
</project>

+ 1
- 0
MobileApp/.idea/misc.xml View File

<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/activity_main.xml" value="0.16666666666666666" /> <entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/activity_main.xml" value="0.16666666666666666" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/fragment_automatik.xml" value="0.3333333333333333" /> <entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/fragment_automatik.xml" value="0.3333333333333333" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/fragment_dashboard.xml" value="0.14666666666666667" /> <entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/fragment_dashboard.xml" value="0.14666666666666667" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/fragment_einstellungen.xml" value="0.25" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/fragment_home.xml" value="0.16666666666666666" /> <entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/fragment_home.xml" value="0.16666666666666666" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/fragment_manuell.xml" value="0.22" /> <entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/fragment_manuell.xml" value="0.22" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/fragment_notifications.xml" value="0.16666666666666666" /> <entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/fragment_notifications.xml" value="0.16666666666666666" />

+ 5
- 0
MobileApp/app/src/main/AndroidManifest.xml View File

xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="com.example.lfrmobileapp"> package="com.example.lfrmobileapp">


<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />

<application <application
android:allowBackup="true" android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules" android:dataExtractionRules="@xml/data_extraction_rules"
</activity> </activity>
</application> </application>




</manifest> </manifest>

+ 22
- 2
MobileApp/app/src/main/java/com/example/lfrmobileapp/Communication.java View File

package com.example.lfrmobileapp;public class Communication {
}
package com.example.lfrmobileapp;

import android.accounts.NetworkErrorException;

import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;

public class Communication {
public boolean sendData(String data) {
try {
Socket socket = new Socket("192.168.0.1", 1755);
DataOutputStream DOS = new DataOutputStream(socket.getOutputStream());
DOS.writeUTF(data);
socket.close();
} catch (Exception e) {
e.printStackTrace();
}
return true;
}

}

+ 1
- 0
MobileApp/app/src/main/java/com/example/lfrmobileapp/MainActivity.java View File

NavigationUI.setupWithNavController(binding.navView, navController); NavigationUI.setupWithNavController(binding.navView, navController);
} }



} }

+ 3
- 0
MobileApp/app/src/main/java/com/example/lfrmobileapp/ui/home/HomeFragment.java View File

import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;


import com.example.lfrmobileapp.Communication;
import com.example.lfrmobileapp.databinding.FragmentManuellBinding; import com.example.lfrmobileapp.databinding.FragmentManuellBinding;


import io.github.controlwear.virtual.joystick.android.JoystickView; import io.github.controlwear.virtual.joystick.android.JoystickView;
homeViewModel.getText().observe(getViewLifecycleOwner(), textView::setText); homeViewModel.getText().observe(getViewLifecycleOwner(), textView::setText);


JoystickView joystick = (JoystickView) binding.joystick; JoystickView joystick = (JoystickView) binding.joystick;
Communication com = new Communication();
joystick.setOnMoveListener(new JoystickView.OnMoveListener() { joystick.setOnMoveListener(new JoystickView.OnMoveListener() {
@Override @Override
public void onMove(int angle, int strength) { public void onMove(int angle, int strength) {
homeViewModel.setText(Integer.toString(angle), Integer.toString(strength)); homeViewModel.setText(Integer.toString(angle), Integer.toString(strength));
com.sendData("Vanessa stinkt, Baran nicht");
} }
}); });



+ 0
- 2
MobileApp/app/src/main/java/com/example/lfrmobileapp/ui/notifications/NotificationsFragment.java View File

binding = FragmentEinstellungenBinding.inflate(inflater, container, false); binding = FragmentEinstellungenBinding.inflate(inflater, container, false);
View root = binding.getRoot(); View root = binding.getRoot();


final TextView textView = binding.textNotifications;
notificationsViewModel.getText().observe(getViewLifecycleOwner(), textView::setText);
return root; return root;
} }



+ 1
- 1
MobileApp/app/src/main/res/layout/fragment_automatik.xml View File

android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:checked="false" android:checked="false"
android:fontFamily="sans-serif-medium" android:fontFamily="sans-serif-medium"
android:text="Roboter aktivieren "
android:text="Roboter losfahren "
android:textSize="16sp" android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

+ 22
- 10
MobileApp/app/src/main/res/layout/fragment_einstellungen.xml View File

android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ui.notifications.NotificationsFragment"> tools:context=".ui.notifications.NotificationsFragment">


<TextView
android:id="@+id/text_notifications"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
<EditText
android:id="@+id/ipAdress"
android:layout_width="269dp"
android:layout_height="38dp"
android:layout_marginTop="64dp"
android:hint="IP-Adresse"
android:digits="0123456789."
android:textColor="#000000"
android:inputType="number|numberDecimal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<EditText
android:id="@+id/port"
android:layout_width="269dp"
android:layout_height="38dp"
android:layout_marginTop="120dp"
android:hint="Port"
android:digits="0123456789"
android:textColor="#000000"
android:inputType="number|numberDecimal"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />

+ 6
- 8
MobileApp/app/src/main/res/layout/fragment_manuell.xml View File



<io.github.controlwear.virtual.joystick.android.JoystickView <io.github.controlwear.virtual.joystick.android.JoystickView
android:id="@+id/joystick" android:id="@+id/joystick"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:JV_backgroundColor="@color/THblue"
app:JV_borderColor="#000000"
app:JV_borderWidth="2dp"
android:layout_width="308dp"
android:layout_height="317dp"
android:layout_marginTop="12dp"
android:background="@mipmap/kreis"
app:JV_buttonColor="#FFFFFF" app:JV_buttonColor="#FFFFFF"
app:JV_buttonSizeRatio="13%"
app:JV_buttonSizeRatio="11%"
app:JV_fixedCenter="false" app:JV_fixedCenter="false"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintHorizontal_bias="0.481"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />


android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:textAlignment="center" android:textAlignment="center"
android:textSize="15sp" android:textSize="15sp"

BIN
MobileApp/app/src/main/res/layout/fragment_manuell.xml~ View File


Loading…
Cancel
Save