stpihkal
stpihkal copied to clipboard
Document Theragun protocol
BLE Names:
ID | Name | OldID | Gen | Type | MinFirmware | MinSpeed | MaxSpeed | Speeds |
---|---|---|---|---|---|---|---|---|
pro | Pro | 4 | Theragun | 2.1.6 | 0 | 0 | 3616 | |
elite | Elite | 4 | Theragun | 2.1.6 | 0 | 0 | 3616 | |
prime | Prime | liv2 | 4 | Theragun | 2.0.4 | 0 | 0 | 3584 |
fr01 | Wave Roller | 4 | Roller | 1.0.5 | 1 | 5 | 150,275,350,415,470 | |
WaveSolo | Wave Solo | 4 | Roller | 1 | 3 | 1920,2520,3120 | ||
WaveDuo | Wave Duo | 4 | Roller | 1 | 5 | 30,45,65,80,100 |
UUIDs: Service: 0xffe0 Rx: 0xffe1 Tx: 0xffe2
public final byte checksum(byte[] a, int offset, int length) {
int sum = 0;
for (int i = 0; i < length; i++) {
sum += bArr[i + offset];
}
return sum & 255;
}
# write with response
private final byte[] setSpeed(int mode, int rpm) {
int length = 7;
byte[] arr = new byte[7];
bArr[0] = -86;
bArr[2] = 1;
if (mode != 1) {
length = 4;
} else {
bArr[4] = (byte) ((65280 & rpm) >> 8);
bArr[5] = (byte) (rpm & 255);
bArr[6] = (byte) 3;
}
bArr[3] = 3;
bArr[1] = checksum(arr, 2, length - 2);
return arr;
}
# write without response
private final byte[] requestVersion() {
return new byte[]{-86, 32, 32, 0};
}
# write with response
private final byte[] requestStatus() {
byte[] arr = new byte[4];
bArr[0] = -86;
bArr[2] = 16;
bArr[3] = 0;
bArr[1] = checksum(arr, 2, 2);
return arr;
}
public final void parseNotification(byte[] arr) {
if (arr[0] == 187 && checksum(arr, 2, arr.length - 2) == arr[1]) {
if (arr[2]== 16) {
int running = arr[4];
int speed = arr[13] << 8 | arr[14]);
int force = arr[7] << 8 | arr[8];
int battery = arr[19];
} else if (arr[2]== 32) {
int version = arr[12] << 8 | arr[13];
int major = version / 100;
int minor = (version % 100) / 10;
int patch= version % 10;
}
}
}