diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e2bf7c7..d5e3551 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -31,7 +31,8 @@ android:targetSdkVersion="18" /> - + + getSupportedGattServices() { return mBluetoothGatt.getServices(); } + + FileOutputStream logFile; + + public void openLogFile(String path) throws IOException { + logFile = new FileOutputStream(path, true); + Time now = new Time(); + now.setToNow(); + String endMessage = "=== Start logging " + now.toString() + "===\n"; + logFile.write(endMessage.getBytes("UTF-8")); + broadcastUpdate(ACTION_LOGGING_ENABLED); + } + + public void closeLogFile() { + if(logFile != null) { + try { + Time now = new Time(); + now.setToNow(); + String endMessage = "=== Finished logging " + now.toString() + "===\n"; + logFile.write(endMessage.getBytes("UTF-8")); + logFile.close(); + } + catch(IOException e) { + } + logFile = null; + broadcastUpdate(ACTION_LOGGING_DISABLED); + } + } + + public boolean isLogging() { + return logFile != null; + } } diff --git a/app/src/main/res/menu/main_menu.xml b/app/src/main/res/menu/main_menu.xml new file mode 100644 index 0000000..7964730 --- /dev/null +++ b/app/src/main/res/menu/main_menu.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d5e67fb..422db8c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -69,5 +69,7 @@ Bluetooth Low Energy not supported Scan Cancel - + Log to file + Clear log + Mail log