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

Merge branch 'master' into background-javascript

This commit is contained in:
Andreas Shimokawa 2017-08-29 22:53:38 +02:00
commit c627d690c7
30 changed files with 62 additions and 74 deletions

View File

@ -21,4 +21,7 @@ import java.util.UUID;
public class AmazfitBipService {
public static final UUID UUID_CHARACTERISTIC_WEATHER = UUID.fromString("0000000e-0000-3512-2118-0009af100700");
// goes to UUID_CHARACTERISTIC_3_CONFIGURATION, TODO: validate this for Mi Band 2, it maybe triggers more than only GPS version...
public static final byte[] COMMAND_REQUEST_GPS_VERSION = new byte[]{0x0e};
}

View File

@ -47,6 +47,12 @@ public class AppNotificationType extends HashMap<String, NotificationType> {
// Generic Calendar
put("com.android.calendar", NotificationType.GENERIC_CALENDAR);
// Google
put("com.google.android.gm", NotificationType.GMAIL);
put("com.google.android.apps.inbox", NotificationType.GOOGLE_INBOX);
put("com.google.android.calendar", NotificationType.GENERIC_CALENDAR);
put("com.google.android.apps.messaging", NotificationType.GOOGLE_MESSENGER);
// Conversations
put("eu.siacs.conversations", NotificationType.CONVERSATIONS);

View File

@ -30,6 +30,9 @@ public enum NotificationType {
GENERIC_NAVIGATION(PebbleIconID.LOCATION, PebbleColor.Orange),
GENERIC_SMS(PebbleIconID.GENERIC_SMS, PebbleColor.VividViolet),
GENERIC_CALENDAR(PebbleIconID.TIMELINE_CALENDAR, PebbleColor.Blue),
GMAIL(PebbleIconID.NOTIFICATION_GMAIL, PebbleColor.Red),
GOOGLE_INBOX(PebbleIconID.NOTIFICATION_GOOGLE_INBOX, PebbleColor.Blue),
GOOGLE_MESSENGER(PebbleIconID.NOTIFICATION_GOOGLE_MESSENGER, PebbleColor.Blue),
FACEBOOK(PebbleIconID.NOTIFICATION_FACEBOOK, PebbleColor.Liberty),
FACEBOOK_MESSENGER(PebbleIconID.NOTIFICATION_FACEBOOK_MESSENGER, PebbleColor.VeryLightBlue),
RIOT(PebbleIconID.NOTIFICATION_HIPCHAT, PebbleColor.LavenderIndigo),
@ -73,7 +76,11 @@ public enum NotificationType {
case SIGNAL:
case TELEGRAM:
case WHATSAPP:
case GOOGLE_MESSENGER:
return "generic_chat";
case GMAIL:
case GOOGLE_INBOX:
return "generic_email";
case UNKNOWN:
default:
return "generic";

View File

@ -50,7 +50,7 @@ public class AmazfitBipFirmwareInfo extends Mi2FirmwareInfo {
crcToVersion.put(12586, "RES 0.0.8.74");
// gps
crcToVersion.put(61520, "GPS 0.0.8.xx");
crcToVersion.put(61520, "GPS 9367,8f79a91,0,0,");
}
public AmazfitBipFirmwareInfo(byte[] bytes) {

View File

@ -16,6 +16,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.service.devices.amazfitbip;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCharacteristic;
import android.net.Uri;
import android.widget.Toast;
@ -26,11 +28,13 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.SimpleTimeZone;
import java.util.UUID;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventCallControl;
import nodomain.freeyourgadget.gadgetbridge.devices.amazfitbip.AmazfitBipIcon;
import nodomain.freeyourgadget.gadgetbridge.devices.amazfitbip.AmazfitBipService;
import nodomain.freeyourgadget.gadgetbridge.devices.amazfitbip.AmazfitBipWeatherConditions;
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBand2Service;
import nodomain.freeyourgadget.gadgetbridge.model.CallSpec;
import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec;
import nodomain.freeyourgadget.gadgetbridge.model.NotificationType;
@ -181,4 +185,44 @@ public class AmazfitBipSupport extends MiBand2Support {
} catch (IOException ignore) {
}
}
@Override
public boolean onCharacteristicChanged(BluetoothGatt gatt,
BluetoothGattCharacteristic characteristic) {
boolean handled = super.onCharacteristicChanged(gatt, characteristic);
if (!handled) {
UUID characteristicUUID = characteristic.getUuid();
if (MiBand2Service.UUID_CHARACTERISTIC_3_CONFIGURATION.equals(characteristicUUID)) {
return handleConfigurationInfo(characteristic.getValue());
}
}
return false;
}
private boolean handleConfigurationInfo(byte[] value) {
if (value == null || value.length < 4) {
return false;
}
if (value[0] == 0x10 && value[1] == 0x0e && value[2] == 0x01) {
String gpsVersion = new String(value, 3, value.length - 3);
LOG.info("got gps version = " + gpsVersion);
gbDevice.setFirmwareVersion2(gpsVersion);
return true;
}
return false;
}
// this probably does more than only getting the GPS version...
private AmazfitBipSupport requestGPSVersion(TransactionBuilder builder) {
LOG.info("Requesting GPS version");
builder.write(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_3_CONFIGURATION), AmazfitBipService.COMMAND_REQUEST_GPS_VERSION);
return this;
}
@Override
public void phase2Initialize(TransactionBuilder builder) {
super.phase2Initialize(builder);
LOG.info("phase2Initialize...");
requestGPSVersion(builder);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 958 B

View File

@ -1,8 +0,0 @@
<!-- drawable/information-outline.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#000" android:pathData="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z" />
</vector>

View File

@ -1,16 +0,0 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="nodomain.freeyourgadget.gadgetbridge.activities.charts.ChartsActivity$PlaceholderFragment">
<TextView
android:id="@+id/section_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>

View File

@ -1,7 +0,0 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="nodomain.freeyourgadget.gadgetbridge.activities.AlarmDetails">
<item android:id="@+id/action_settings" android:title="@string/action_settings"
android:orderInCategory="100" app:showAsAction="never" />
</menu>

View File

@ -1,7 +0,0 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="nodomain.freeyourgadget.gadgetbridge.activities.ConfigureAlarms">
<item android:id="@+id/action_settings" android:title="@string/action_settings"
android:orderInCategory="100" app:showAsAction="never" />
</menu>

View File

@ -142,8 +142,6 @@
<string name="connecting">Připojování</string>
<string name="connected">Připojeno</string>
<string name="unknown_state">Neznámý stav</string>
<string name="connectionstate_hw_fw">HW: %1$s FW: %2$s</string>
<string name="connectionstate_fw">Verze FW: %1$s</string>
<string name="_unknown_">(neznámé)</string>
<string name="test">Test</string>
<string name="test_notification">Test notifikací</string>

View File

@ -149,8 +149,6 @@
<string name="connecting">Verbinde</string>
<string name="connected">Verbunden</string>
<string name="unknown_state">Unbekannter Zustand</string>
<string name="connectionstate_hw_fw">HW: %1$s FW: %2$s</string>
<string name="connectionstate_fw">Firmware-Version %1$s</string>
<string name="_unknown_">(unbekannt)</string>
<string name="test">Test</string>
<string name="test_notification">Test Benachrichtigung</string>

View File

@ -149,8 +149,6 @@
<string name="connecting">conectando</string>
<string name="connected">conectado</string>
<string name="unknown_state">estado desconocido</string>
<string name="connectionstate_hw_fw">HW: %1$s FW: %2$s</string>
<string name="connectionstate_fw">FW: %1$s</string>
<string name="_unknown_">(desconocido)</string>
<string name="test">Probar</string>
<string name="test_notification">Probar notificación</string>

View File

@ -149,8 +149,6 @@
<string name="connecting">connexion en cours</string>
<string name="connected">connecté</string>
<string name="unknown_state">état inconnu</string>
<string name="connectionstate_hw_fw">HW: %1$s FW: %2$s</string>
<string name="connectionstate_fw">FW: %1$s</string>
<string name="_unknown_">(inconnu)</string>
<string name="test">Test</string>
<string name="test_notification">Notification de test</string>

View File

@ -135,8 +135,6 @@
<string name="connecting">מחובר</string>
<string name="connected">מתחבר</string>
<string name="unknown_state">מצב לא ידוע</string>
<string name="connectionstate_hw_fw">חומרה: %1$s קושחה: %2$s</string>
<string name="connectionstate_fw">קושחה: %1$s</string>
<string name="_unknown_">(לא ידוע)</string>
<string name="test">בדיקה</string>
<string name="test_notification">דיווח לבדיקה</string>

View File

@ -145,8 +145,6 @@
<string name="connecting">csatlakozás</string>
<string name="connected">csatlakoztatva</string>
<string name="unknown_state">ismeretlen állapot</string>
<string name="connectionstate_hw_fw">HW: %1$s FW: %2$s</string>
<string name="connectionstate_fw">FW: %1$s</string>
<string name="_unknown_">(ismeretlen)</string>
<string name="test">Teszt</string>
<string name="test_notification">Teszt értesítés</string>

View File

@ -144,8 +144,6 @@
<string name="connecting">in collegamento</string>
<string name="connected">connesso</string>
<string name="unknown_state">stato sconosciuto</string>
<string name="connectionstate_hw_fw">HW: %1$s FW: %2$s</string>
<string name="connectionstate_fw">FW: %1$s</string>
<string name="_unknown_">(sconosciuto)</string>
<string name="test">Test</string>
<string name="test_notification">Notifica di prova</string>

View File

@ -149,8 +149,6 @@
<string name="connecting">接続中</string>
<string name="connected">接続</string>
<string name="unknown_state">不明な状態</string>
<string name="connectionstate_hw_fw">HW: %1$s FW: %2$s</string>
<string name="connectionstate_fw">FW: %1$s</string>
<string name="_unknown_">(不明)</string>
<string name="test">テスト</string>
<string name="test_notification">通知のテスト</string>

View File

@ -67,8 +67,6 @@
<string name="connecting">연결 중</string>
<string name="connected">연결됨</string>
<string name="unknown_state">알 수 없는 상태</string>
<string name="connectionstate_hw_fw">HW: %1$s FW: %2$s</string>
<string name="connectionstate_fw">FW: %1$s</string>
<string name="_unknown_">(알 수 없음)</string>
<string name="test">테스트</string>
<string name="test_notification">알림 테스트</string>

View File

@ -98,8 +98,6 @@
<string name="connecting">łącze</string>
<string name="connected">połączony</string>
<string name="unknown_state">nieznany stan</string>
<string name="connectionstate_hw_fw">Wersja hardware: %1$s FW: %2$s</string>
<string name="connectionstate_fw">Wersja firmware: %1$s</string>
<string name="_unknown_">(nieznane)</string>
<string name="test">Test</string>
<string name="test_notification">Test powiadomień</string>

View File

@ -136,8 +136,6 @@
<string name="connecting">conectando</string>
<string name="connected">conectado</string>
<string name="unknown_state">estado desconhecido</string>
<string name="connectionstate_hw_fw">HW: %1$s FW: %2$s</string>
<string name="connectionstate_fw">FW: %1$s</string>
<string name="_unknown_">(desconhecido)</string>
<string name="test">Teste</string>
<string name="test_notification">Teste de notificação</string>

View File

@ -142,8 +142,6 @@
<string name="connecting">a ligar</string>
<string name="connected">ligado</string>
<string name="unknown_state">estado desconhecido</string>
<string name="connectionstate_hw_fw">HW: %1$s FW: %2$s</string>
<string name="connectionstate_fw">Versão FW: %1$s</string>
<string name="_unknown_">(desconhecido)</string>
<string name="test">Teste</string>
<string name="test_notification">Teste de notificação</string>

View File

@ -145,8 +145,6 @@
<string name="connecting">соединение</string>
<string name="connected">соединено</string>
<string name="unknown_state">неизвестное состояние</string>
<string name="connectionstate_hw_fw">Версия устройства: %1$s Версия ПО: %2$s</string>
<string name="connectionstate_fw">ПО: %1$s</string>
<string name="_unknown_">(неизвестно)</string>
<string name="test">Тест</string>
<string name="test_notification">Тест уведомлений</string>

View File

@ -47,8 +47,6 @@
<string name="connecting">bağlanıyor</string>
<string name="connected">bağlandı</string>
<string name="unknown_state">bilinmeyen durum</string>
<string name="connectionstate_hw_fw">HW: %1$s FW: %2$s</string>
<string name="connectionstate_fw">FW: %1$s</string>
<string name="_unknown_">(bilinmeyen)</string>
<string name="test">Test</string>
<string name="test_notification">Test bilgilendirmesi</string>

View File

@ -90,8 +90,6 @@
<string name="connecting">з\'єднання…</string>
<string name="connected">з\'єднано</string>
<string name="unknown_state">невідомий стан</string>
<string name="connectionstate_hw_fw">Пристрій: %1$s. Версія ПЗ: %2$s</string>
<string name="connectionstate_fw">ПЗ: %1$s</string>
<string name="_unknown_">(невідомо)</string>
<string name="test">Тест</string>
<string name="test_notification">Тест сповіщень</string>

View File

@ -44,8 +44,6 @@
<string name="connecting">đang kết nối</string>
<string name="connected">đã kết nối</string>
<string name="unknown_state">không rõ tình trạng</string>
<string name="connectionstate_hw_fw">HW: %1$s FW: %2$s</string>
<string name="connectionstate_fw">FW: %1$s</string>
<string name="_unknown_">(không rõ)</string>
<string name="test">Kiểm tra</string>
<string name="test_notification">Kiểm tra thông báo</string>

View File

@ -184,8 +184,6 @@
<string name="connecting">Connecting</string>
<string name="connected">Connected</string>
<string name="unknown_state">Unknown state</string>
<string name="connectionstate_hw_fw">HW: %1$s FW: %2$s</string>
<string name="connectionstate_fw">Firmware version: %1$s</string>
<string name="_unknown_">(unknown)</string>
<string name="test">Test</string>
<string name="test_notification">Test notification</string>