j-kaltes / Juggluco

Android app for Freestyle Libre 1,2 and 3 and Chinese Sibionics sensors
GNU General Public License v3.0
226 stars 59 forks source link

Problem Sibionics reading on app update #157

Open yiyoMX opened 6 months ago

yiyoMX commented 6 months ago

Hi, first of all thanks for your work on this app. I've been using juggluco with Sibionics sensor and it was working great, until I updated the app. I was like 4 builds behind. I had a working sensor already when I updated, I had 115mg/dl but when I made the update it jumped to 1245 or something crazy like that, then it dropped to 250 and it settled somewhere around that number. I checked with a glucometer and I was 106. What can I do? Sensor is like 20days old.

Geniy83 commented 3 weeks ago

trace.log

Geniy83 commented 3 weeks ago

I need to go away on business. I can help you in 2 hours

woter86 commented 3 weeks ago

Do you call methods for hematonix from native?

j-kaltes commented 3 weeks ago

A new attempt:

EDIT: https://drive.google.com/file/d/1zOlVKff0PXCswjWsAmhvkHTSpU-GcfSi/view

Geniy83 commented 3 weeks ago

not successful ( trace.log ((

Geniy83 commented 3 weeks ago

Jaap, would you like https://github.com/woter86 to help you? He edited your code. You have a lot of native. Can you push your code for viewing?

j-kaltes commented 3 weeks ago

New version: https://drive.google.com/file/d/1B5DEyJEQsQWyziv-RY9OA1QNPosfuI_C/view?usp=drive_link

Someone said he was going to send me some EU Sibionics sensors, then I can test it myself.

Geniy83 commented 3 weeks ago

I offered to send you a Himatonix sensor, but you remained silent and did not answer. I tested this version - it didn’t work ((( trace.log

Geniy83 commented 3 weeks ago

woter86 knows what commands to send to the sensor, there are 4 of them

j-kaltes commented 3 weeks ago

Yes, I had already used a Dexcom g7 sensor and thought that I could better finish that before beginning with something new. But now I decided to do EU Sibionics sensors first. If I really receive that EU Sibionics sensor, the sensor from you is probably not needed anymore.

All four commands are present in the last log you send me: siAuthBytes siAsknewdata getActivation V120IsecUpdate

EDIT: I forgot something: https://drive.google.com/file/d/1e3z6pVtPCs0tHCWimZhuWQqVyhVLHK_7/view?usp=drive_link

Geniy83 commented 3 weeks ago

didn't go well ((( I currently have a Sibionics EU sensor installed, not Himatonix trace.log

Geniy83 commented 3 weeks ago

image

j-kaltes commented 3 weeks ago

You can't expect it to work immediately: New version: https://drive.google.com/file/d/1vbeEx4EZzvsIatLbOTWzLrok0rSguuV3/view

Geniy83 commented 3 weeks ago

I waited 5 minutes. then I tried to scan again. Now I'll try the new version again

Geniy83 commented 3 weeks ago

Didn't work trace.log

j-kaltes commented 3 weeks ago

I have little hope that this way, it will start to work. All commands are executed, after the last nothing comes in:

grep -E 'onConnect|getActivation|V120IsecUpdate|siAsknewdata|siAuthBytes' trace7.log.out
2024-11-02-20:12:28 2817 I/SiGattCallback 1NTK237GAA2 onConnectionStateChange, status:0, state: CONNECTED
2024-11-02-20:12:29 2817 siAuthBytes: 3E F6 6F 9D 5C F2 C1 71 75 81 86 03 0F B7 06 8C 82 B3 E4 4C 22 84 61 B6 7E B5
2024-11-02-20:12:29 2817 siAsknewdata(index=1)=21FF6ED90873A9
2024-11-02-20:12:29 2817 getActivation: 2D F0 F2 A0 2E 14 8A D8 BD 81 F0
2024-11-02-20:12:29 2817 V120IsecUpdate: 21 F4 F2 A0 2E 14 0C
2024-11-02-20:12:29 2817 siAsknewdata(index=1)=21FF6ED90873A9
2024-11-02-20:12:58 2817 I/SiGattCallback 1NTK237GAA2 onConnectionStateChange, status:19, state: DISCONNECTED

The only strange thing is two times siAsknewdata, the following version tries to remove the first one: https://drive.google.com/file/d/1PNTLzdPb6uvaTCKXidJ0AklSvptw-LL3/view If it doesn't work, I wait for the sensor to arrive.

Geniy83 commented 3 weeks ago

It didn't work out. Don't you want to make a push? We looked at the code, maybe we saw something trace.log

j-kaltes commented 3 weeks ago

Can't you add the following to Juggloco(Hematonix).apk:

public final void onCharacteristicChanged(BluetoothGatt bluetoothGatt, BluetoothGattCharacteristic bluetoothGattCharacteristic) {
    showCharacter("onCharacteristicChanged", bluetoothGattCharacteristic); //ADDED

if (CGMDataHandle130.V120SpiltData(0, value, iArr, bArr, false, bArr2, value.length) <= 0) {
    CGMDataHandle130.V120SpiltData(0, value, iArr, bArr, true, bArr2, value.length);
    }
Log.showbytes("V120SpiltData iArr[0]="+iArr[0]+ " iArr[1]="+iArr[1],bArr); //ADDED

var now =System.currentTimeMillis() / 1000; //ADDED
int V120Activation = CGMDataHandle130.V120Activation(0, true, new byte[2], now, 1234, bArr3, 1024);
byte[] bArr4 = new byte[V120Activation];
System.arraycopy(bArr3, 0, bArr4, 0, V120Activation);
showbytes("V120Activation "+now,bArr4); //ADDED

var now=System.currentTimeMillis() / 1000; //ADDED
int V120IsecUpdate = CGMDataHandle130.V120IsecUpdate(0, true, new byte[2], , bArr5, 1024);
byte[] bArr6 = new byte[V120IsecUpdate];
System.arraycopy(bArr5, 0, bArr6, 0, V120IsecUpdate);
showbytes("V120IsecUpdate "+now,bArr6); //ADDED

T = Natives.getSIindex(this.e);
Log.e("SiGattCallback", "current index after " + T);
int V120RawData = CGMDataHandle130.V120RawData(0, true, new byte[2], (long) T, 0, bArr7, 30);
byte[] bArr8 = new byte[V120RawData];
System.arraycopy(bArr7, 0, bArr8, 0, V120RawData);
this.S.setValue(bArr8);
showbytes("V120RawData "+T,bArr8); //ADDED

int V120ApplyAuthentication = CGMDataHandle130.V120ApplyAuthentication(1, true, 0, bArr, bArr2, 1024);
byte[] bArr3 = new byte[V120ApplyAuthentication];
System.arraycopy(bArr2, 0, bArr3, 0, V120ApplyAuthentication);
this.S.setValue(bArr3);
Log.showbytes("V120ApplyAuthentication input",bArr); //ADDED
Log.showbytes("V120ApplyAuthentication output",bArr3);//ADDED

static void showCharacter(String label, BluetoothGattCharacteristic characteristic) {
    if(doLog) {
        byte[] value = characteristic.getValue();
         Log.showbytes(label + " UUID: " + characteristic.getUuid().toString(), value);
         }
     }

Additions are marked with "ADDED" and run a logging version of Juggluco (Debug or Log builds) and send trace.log to me?

Geniy83 commented 3 weeks ago

Maybe in Juggluco (Sibionics EU)? I'm currently using Juggluco(Sibionics EU).apk

j-kaltes commented 3 weeks ago

They are exactly the same except for one line:

<      byte[] bytes = "60B05FEB7C0A148DEED2B3375A8754D9D0E6A5751BCE02D9132489C0BFDFC99F0CAC670E8DA7115CEACF87B7DE8FD4612E1B7638C2".getBytes();
>      byte[] bytes = "56CE249349040C94F8B4B2375A8752D5CBE7A17814B502D9132489C0BFDFC99F0CAC670E8CBB085AF1C780B3D282E3".getBytes();
woter86 commented 3 weeks ago

each command must be passed in response to the previous one. do you do that?

j-kaltes commented 3 weeks ago

You can see that in trace.log. What do you have with your patches?

grep -E 'onConnect|onChar|getActivation|V120IsecUpdate|siAsknewdata|siAuthBytes' trace.log.out
2024-11-03-07:38:20 9459 I/SiGattCallback 1NTK237GAA2 onConnectionStateChange, status:0, state: CONNECTED
2024-11-03-07:38:21 9459 siAuthBytes: 3E F6 6F 9D 5C F2 C1 71 75 81 86 03 0F B7 06 8C 82 B3 E4 4C 22 84 61 B6 7E B5
2024-11-03-07:38:21 9459 D/SiGattCallback C8:AD:99:81:54:44 onCharacteristicWrite, status:0 UUID:0000ff32-0000-1000-8000-00805f9b34fb
2024-11-03-07:38:21 9459 onCharacteristicChanged UUID: 0000ff31-0000-1000-8000-00805f9b34fb 23 F6 6F DA F0
2024-11-03-07:38:21 9459 getActivation: 2D F0 32 C3 2F 14 8A D8 BD 81 92
2024-11-03-07:38:21 9459 D/SiGattCallback C8:AD:99:81:54:44 onCharacteristicWrite, status:0 UUID:0000ff32-0000-1000-8000-00805f9b34fb
2024-11-03-07:38:21 9459 onCharacteristicChanged UUID: 0000ff31-0000-1000-8000-00805f9b34fb 23 F0 6F DA FA
2024-11-03-07:38:21 9459 V120IsecUpdate: 21 F4 32 C3 2F 14 AA
2024-11-03-07:38:21 9459 D/SiGattCallback C8:AD:99:81:54:44 onCharacteristicWrite, status:0 UUID:0000ff32-0000-1000-8000-00805f9b34fb
2024-11-03-07:38:21 9459 onCharacteristicChanged UUID: 0000ff31-0000-1000-8000-00805f9b34fb 23 F4 6F DA FE
2024-11-03-07:38:21 9459 siAsknewdata(index=1)=21FF6ED90873A9
2024-11-03-07:38:21 9459 D/SiGattCallback C8:AD:99:81:54:44 onCharacteristicWrite, status:0 UUID:0000ff32-0000-1000-8000-00805f9b34fb
2024-11-03-07:38:22 9459 onCharacteristicChanged UUID: 0000ff31-0000-1000-8000-00805f9b34fb 23 FF 6F DA F9
2024-11-03-07:38:51 8663 I/SiGattCallback 1NTK237GAA2 onConnectionStateChange, status:19, state: DISCONNECTED
woter86 commented 3 weeks ago

Can you log response? Do you analyze u16reply_ack_type?

j-kaltes commented 3 weeks ago

Look in trace.log and you see it.

Geniy83 commented 3 weeks ago

Are you currently using this key in the versions Juggluco you send me? byte[] bytes = "56CE249349040C94F8B4B2375A8752D5CBE7A17814B502D9132489C0BFDFC99F0CAC670E8CBB085AF1C780B3D282E3".getBytes();

Geniy83 commented 3 weeks ago

If you use Telegram, we can speed up communication there @VENVeV

j-kaltes commented 3 weeks ago

Instead of

Log.showbytes("V120SpiltData iArr[0]="+iArr[0]+ " iArr[1]="+iArr[1],bArr); 

You can better add:

Log.i(LOG_ID,"V120SpiltData iArr[0]="+iArr[0]+ " iArr[1]="+iArr[1]);
Log.i(LOG_ID,new String(bArr));

I am very interested.

woter86 commented 3 weeks ago

image I think I forgot to tell you this, sorry

Geniy83 commented 3 weeks ago

Hi Jaap. Don't think bad things about me and woter86. We really want to help you! woter86 has the code and he will add the logs, and I will test it in the evening and send you these logs. woter86 and I are now working on the POCTech sensor. We want to connect it directly to xDrip. And by the way, we corrected your build.gradle and now it’s easy to build in Windows, we’ll also send this to you

j-kaltes commented 3 weeks ago

I already changed Juggluco so it can be build under Windows two month ago according to the github:

https://github.com/j-kaltes/Juggluco/commit/52f1a7059b92bbfc49208f2f7d3cc12f3ffdc26d

https://github.com/j-kaltes/Juggluco/blob/f224bae7d75a6d9d04bf0f48ca133bdacdc991b0/Common/build.gradle#L89

https://github.com/j-kaltes/Juggluco/blob/primary/Common/src/main/cpp/config.h#L26

Geniy83 commented 3 weeks ago

Sorry, didn't pay attention. We forked 3 months ago

gazbigit commented 3 weeks ago

I have little hope that this way, it will start to work. All commands are executed, after the last nothing comes in:

grep -E 'onConnect|getActivation|V120IsecUpdate|siAsknewdata|siAuthBytes' trace7.log.out
2024-11-02-20:12:28 2817 I/SiGattCallback 1NTK237GAA2 onConnectionStateChange, status:0, state: CONNECTED
2024-11-02-20:12:29 2817 siAuthBytes: 3E F6 6F 9D 5C F2 C1 71 75 81 86 03 0F B7 06 8C 82 B3 E4 4C 22 84 61 B6 7E B5
2024-11-02-20:12:29 2817 siAsknewdata(index=1)=21FF6ED90873A9
2024-11-02-20:12:29 2817 getActivation: 2D F0 F2 A0 2E 14 8A D8 BD 81 F0
2024-11-02-20:12:29 2817 V120IsecUpdate: 21 F4 F2 A0 2E 14 0C
2024-11-02-20:12:29 2817 siAsknewdata(index=1)=21FF6ED90873A9
2024-11-02-20:12:58 2817 I/SiGattCallback 1NTK237GAA2 onConnectionStateChange, status:19, state: DISCONNECTED

The only strange thing is two times siAsknewdata, the following version tries to remove the first one: https://drive.google.com/file/d/1PNTLzdPb6uvaTCKXidJ0AklSvptw-LL3/view If it doesn't work, I wait for the sensor to arrive.

Hi! I test this version on Hematonix GS1 RU sensor, log attached. I am often in touch, if you have time I could help with debugging and finalizing the application for the hematonix sensor.

hematonix.log

Geniy83 commented 3 weeks ago

Hi! I test this version on Hematonix GS1 RU sensor, log attached. I am often in touch, if you have time I could help with debugging and finalizing the application for the hematonix sensor.

hematonix.log

Сейчас главное Jaap не запутать где Sibionix EU и где Hematonix, ключи там разные. Сейчас логи сниму, что он просил по Sibionix EU. Хотя почему-то написал он про Hematonix, когда я ему писал что у меня сейчас установлен Sibionix EU

woter86 commented 3 weeks ago

sorry

@j-kaltes have you tried this?

woter86 commented 1 week ago

How are you?)

khan7728 commented 3 days ago

you guys are amazing! waiting for this to work