DanielBlomberg1 / mimir

Android app for logging various sensors data in smart devices.
Apache License 2.0
0 stars 0 forks source link

Figuring out how to send watch data to phone #1

Closed juhotuho10 closed 3 weeks ago

juhotuho10 commented 1 month ago

Generally documenting all the findings and things done with getting sensor data from watch to the phone The branch I'm working on is watch_datasharing

juhotuho10 commented 1 month ago

Sending watch data to phone

There already was an activity for sending the data, but no way to get to it, so i hooked up the UI the actually be able to get to the SendSurveyActivity and be able to send data to the phone, which works

the data goes to /storage/emulated/0/Download on the phone

the only data sent is the header comment

# log_watch_01011970_061538885.csv
#
# Header Description:
#
# Version: 1 Platform: 13 Manufacturer: unknown Model: sdk_gwear_x86_64
#

which corresponds to this part of the code in SendSurveyActivity:

fun writeLine(line: String) {
    outputStream.write("$line\n".toByteArray())
}

val dateTime: String = SimpleDateFormat("ddMMyyyy_hhmmssSSS").format(startTime)
writeLine("$COMMENT_START log_watch_$dateTime.csv")
writeLine(COMMENT_START)
writeLine("$COMMENT_START Header Description:")
writeLine(COMMENT_START)
writeLine("$COMMENT_START Version: ${BuildConfig.VERSION_CODE} Platform: ${Build.VERSION.RELEASE} Manufacturer: ${Build.MANUFACTURER} Model: ${Build.MODEL}")
writeLine(COMMENT_START)

figured out that no other data is sent because the file locations for WatchActivityHandler is empty, but don't know why it's empty, so currently figuring that out

juhotuho10 commented 1 month ago

Took me a while to figure out how the file saving is handled from the LoggingActivity on watchlogger Call graph

Essentially LoggingActivity has a LoggingService class, and LoggingService calls on SensorsHandler and SensorsHandler calls on FileHandler in order to save files

juhotuho10 commented 1 month ago

checked if the files would be sent if i manually add the file to WatchActivityHandler, and it seemed to work

var newPath = "/data/data/com.mobilewizards.logging_app/files/log_mimir_20241020115122.txt"
WatchActivityHandler.addFilePath(newPath);

sent file

So the file sending works if we get the file paths to the files, it's probably fine to move to making a prototype UI that lists the file names and then sends the individual files from there

juhotuho10 commented 1 month ago

log listing Figured out a way fetch all the files list them as a list in the UI using a RecyclerView, there is probably a way to attach functionality to the listing.

juhotuho10 commented 1 month ago

functional buttons Managed to figure out how to add functional items to the list instead of just placeholder text

Now it is a functional list of tems along with a button that can do anything with the file that is attached to the list item

Currently there is just a placeholder alert that says the item file name

juhotuho10 commented 3 weeks ago

Made a lot of improvements to the UI and made the item list thin enough to be seen on circular display watches

Added a confirmation screen for sending the file to the phone and for deleting the file off the watch

Added a way to delete files from inside of the watch

Demonstration about uploading files and deleting them off the watch Watch upload and deletion

juhotuho10 commented 3 weeks ago

branch merged with pullreguest #9