OpenSeizureDetector / Android_Pebble_SD

The main OpenSeizureDetector Android App, that is published on the Android Play Store.
http://openseizuredetector.org.uk
GNU General Public License v3.0
9 stars 11 forks source link

Dangerous pre assumption of event timestamp being time unit xxx #119

Open AroonPro opened 10 months ago

AroonPro commented 10 months ago

Events of sd phone and sd wear use the value format nanoseconds passed as of Unix Epoch (1970-01-01) Old versions built have range of 10e3 till 10e6 assumed as time between analysis

As of now every version has to be checked.

jones139 commented 10 months ago

Thanks for reporting this - I am a bit confused about what the issue is though - please will you explain more? I am not sure if it is a problem with the current V4.1.x version or V4.2.x? Note that I will need to do an update to V4.1.x this week to increase the targetSDK to keep Google Play Store happy, so I have the opportunity to fix it if it is a problem.

Thanks

Graham.

On Thu, 17 Aug 2023 at 22:21, AroonPro @.***> wrote:

Events of sd phone and sd wear use the value format nanoseconds passed as of Unix Epoch (1970-01-01) Old versions built have range of 10e3 till 10e6 assumed as time between analysis

As of now every version has to be checked.

— Reply to this email directly, view it on GitHub https://github.com/OpenSeizureDetector/Android_Pebble_SD/issues/119, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACLSYZHKZIMHG3XE4L6OFTXV2DNZANCNFSM6AAAAAA3UUXQQQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Graham Jones http://google.com/+GrahamJones Hartlepool, UK.

AroonPro commented 10 months ago

https://github.com/OpenSeizureDetector/Android_Pebble_SD/blob/master/app/src/main/java/uk/org/openseizuredetector/SdDataSourcePhone.java#L110

Has line mStartTs = event.timestamp;

Timestamp has a long value of passed nanoseconds.

mSdData has a time value of double with result of subtraction end - startTs. Both in nanoseconds.

mSdData.analiysisPeriod has seconds passed. System time in milis is also used on various locations.

That I see is correct in v4.1.10 double dT = 1e-9*(event.timestamp - mStartTs); https://github.com/OpenSeizureDetector/Android_Pebble_SD/blob/master/app/src/main/java/uk/org/openseizuredetector/SdDataSourcePhone.java#L117

I have to better trace the usage. Also in sdWear/AWSdService.java

To be continued

Avoiding magic numbers is possible, using my new osdutil.timeConversion in V4.2.x_Upstream which will be soon uploaded. This has the value format of double and input as double, followed by for Example TimeUnit.MINUTES, TimeUnit.SECONDS

Op vr 18 aug. 2023 22:14 schreef Graham Jones @.***>:

Thanks for reporting this - I am a bit confused about what the issue is though - please will you explain more? I am not sure if it is a problem with the current V4.1.x version or V4.2.x? Note that I will need to do an update to V4.1.x this week to increase the targetSDK to keep Google Play Store happy, so I have the opportunity to fix it if it is a problem.

Thanks

Graham.

On Thu, 17 Aug 2023 at 22:21, AroonPro @.***> wrote:

Events of sd phone and sd wear use the value format nanoseconds passed as of Unix Epoch (1970-01-01) Old versions built have range of 10e3 till 10e6 assumed as time between analysis

As of now every version has to be checked.

— Reply to this email directly, view it on GitHub https://github.com/OpenSeizureDetector/Android_Pebble_SD/issues/119, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AACLSYZHKZIMHG3XE4L6OFTXV2DNZANCNFSM6AAAAAA3UUXQQQ>

. You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Graham Jones http://google.com/+GrahamJones Hartlepool, UK.

— Reply to this email directly, view it on GitHub https://github.com/OpenSeizureDetector/Android_Pebble_SD/issues/119#issuecomment-1684390627, or unsubscribe https://github.com/notifications/unsubscribe-auth/AV6J743ZL3VNVFFPA5CCZMTXV7EJZANCNFSM6AAAAAA3UUXQQQ . You are receiving this because you authored the thread.Message ID: @.***>

AroonPro commented 8 months ago

Added to Osdutil: Double convertMetresPerSecondSqared(double value) This is to get miligalileo needed for SeizureDetector.

To display value:

Do displayvalue=value / convertMetresPerSecondSqared(1) Or displayvalue=value / ( convertMetresPerSecondSqared(1) * SensorManager.GRAVITY_EARTH)