changed the XML up and download to the IO interface as it involves communicating with the raspberry
This commit is contained in:
parent
ce240ef176
commit
d03b7906f7
1
APED/.idea/vcs.xml
generated
1
APED/.idea/vcs.xml
generated
@ -2,5 +2,6 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/app/src/main/assets/XML" vcs="Git" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -106,13 +106,13 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.action_download_xml:
|
case R.id.action_download_xml:
|
||||||
if (xml.download() == 0) {
|
if (uebergabe.downloadXML() == 0) {
|
||||||
Toast.makeText(this, "Download .xml",
|
Toast.makeText(this, "Downloaded .xml",
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.action_upload_xml:
|
case R.id.action_upload_xml:
|
||||||
if (xml.upload() == 0) {
|
if (uebergabe.uploadXML(new File("")) == 0) {
|
||||||
Toast.makeText(this, "Upload .xml",
|
Toast.makeText(this, "Upload .xml",
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.example.aped.communication;
|
package com.example.aped.communication;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
public interface IIO
|
public interface IIO
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -16,4 +18,17 @@ public interface IIO
|
|||||||
* @return the value written
|
* @return the value written
|
||||||
*/
|
*/
|
||||||
String write(String deviceName, String value);
|
String write(String deviceName, String value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uploads the config.xml to the raspberry
|
||||||
|
* @param xmlFile the config.xml
|
||||||
|
* @return 0 if everything worked
|
||||||
|
*/
|
||||||
|
int uploadXML(File xmlFile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* downloads the current config.xml from the raspberry
|
||||||
|
* @return 0 if everything worked
|
||||||
|
*/
|
||||||
|
int downloadXML();
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import com.example.aped.R;
|
import com.example.aped.R;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
public class TestIO implements IIO {
|
public class TestIO implements IIO {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -27,4 +29,15 @@ public class TestIO implements IIO {
|
|||||||
public String write(String deviceName, String value) {
|
public String write(String deviceName, String value) {
|
||||||
return "TRUE";//Wenn erfolgreich gesendet
|
return "TRUE";//Wenn erfolgreich gesendet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int uploadXML(File xmlFile) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int downloadXML() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,17 +4,6 @@ import java.util.Dictionary;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface IXML {
|
public interface IXML {
|
||||||
/**
|
|
||||||
* downloads the XML from the raspberry to the local folder
|
|
||||||
* @return 0 for no errors
|
|
||||||
*/
|
|
||||||
int download();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* uploads the local XML to the raspberry
|
|
||||||
* @return 0 for no errors
|
|
||||||
*/
|
|
||||||
int upload();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* reads the list of available devices from the XML
|
* reads the list of available devices from the XML
|
||||||
|
@ -7,16 +7,6 @@ import java.util.Hashtable;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TestXML implements IXML {
|
public class TestXML implements IXML {
|
||||||
/** Test Klasse.*/
|
|
||||||
@Override
|
|
||||||
public int download() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/** Test Klasse.*/
|
|
||||||
@Override
|
|
||||||
public int upload() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getDeviceNames() {
|
public List<String> getDeviceNames() {
|
||||||
|
@ -46,16 +46,6 @@ public class XMLHandler implements IXML {
|
|||||||
root = builder.parse(xmlFile);
|
root = builder.parse(xmlFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int download() {
|
|
||||||
throw new NotImplementedError();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int upload() {
|
|
||||||
throw new NotImplementedError();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* reads the device names from the XML file.
|
* reads the device names from the XML file.
|
||||||
* @return the device names as a list of strings
|
* @return the device names as a list of strings
|
||||||
|
Loading…
x
Reference in New Issue
Block a user