1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-04 09:17:29 +01:00

Fixed notification time stamp on Casio GDB-200

This commit is contained in:
foxstidious 2023-09-30 09:37:34 -04:00 committed by José Rebelo
parent d9d6a8dc29
commit a1b59774d4

View File

@ -27,6 +27,7 @@ import android.widget.Toast;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.threeten.bp.ZoneId;
import org.threeten.bp.ZonedDateTime; import org.threeten.bp.ZonedDateTime;
import java.io.IOException; import java.io.IOException;
@ -279,23 +280,34 @@ public class CasioGBX100DeviceSupport extends Casio2C2DSupport implements Shared
arr[4] = delete ? (byte) 0x02 : (byte) 0x00; arr[4] = delete ? (byte) 0x02 : (byte) 0x00;
arr[5] = (byte) 0x01; // Set to 0x00 to not vibrate/ring for this notification arr[5] = (byte) 0x01; // Set to 0x00 to not vibrate/ring for this notification
arr[6] = icon; arr[6] = icon;
// These bytes contain a timestamp, not yet decoded / implemented
// ASCII Codes: // Unknonwn what these bytes are for
/*arr[7] = (byte) 0x32; // 2 arr[7] = (byte) 0x00;
arr[8] = (byte) 0x30; // 0 arr[8] = (byte) 0x00;
arr[9] = (byte) 0x32; // 2 arr[9] = (byte) 0x00;
arr[10] = (byte) 0x30; // 0 arr[10] = (byte) 0x00;
arr[11] = (byte) 0x31; // 1
arr[12] = (byte) 0x31; // 1 ZonedDateTime timestamp = ZonedDateTime.now();
arr[13] = (byte) 0x31; // 1 // Bytes 11 - 19 are timestamp
arr[14] = (byte) 0x33; // 3 // Encode the timestamp of the notification
arr[15] = (byte) 0x54; // T // Month
arr[16] = (byte) 0x30; // 0 arr[11] = (byte) (timestamp.getMonthValue() / 10 + 3); // Tens digit, but offset by 3 for some reason
arr[17] = (byte) 0x39; // 9 arr[12] = (byte) (timestamp.getMonthValue() % 10);
arr[18] = (byte) 0x33; // 3 // Day
arr[19] = (byte) 0x31; // 1 arr[13] = (byte) (timestamp.getDayOfMonth() / 10 + 3); // Tens digit, but offset by 3 for some reason
arr[20] = (byte) 0x35; // 5 arr[14] = (byte) (timestamp.getDayOfMonth() % 10);
arr[21] = (byte) 0x33;*/// 3 // ??
arr[15] = (byte) 0; // Not sure what this byte is for?
// Hour
arr[16] = (byte) (timestamp.getHour() / 10 + 3); // Tens digit, but offset by 3 for some reason
arr[17] = (byte) (timestamp.getHour() % 10);
// Minute
arr[18] = (byte) (timestamp.getMinute() / 10 + 3);// Tens digit, but offset by 3 for some reason
arr[19] = (byte) (timestamp.getMinute() % 10);
arr[20] = (byte) 0x00;
arr[21] = (byte) 0x00;
byte[] copy = Arrays.copyOf(arr, arr.length + 2); byte[] copy = Arrays.copyOf(arr, arr.length + 2);
copy[copy.length-2] = 0; copy[copy.length-2] = 0;
copy[copy.length-1] = 0; copy[copy.length-1] = 0;