Skip to content

Instantly share code, notes, and snippets.

@aeonSolutions
Forked from mahadirz/BleService.java
Created January 3, 2021 18:33
Show Gist options
  • Save aeonSolutions/9cf10330bb9370e630325ecb3534e4ce to your computer and use it in GitHub Desktop.
Save aeonSolutions/9cf10330bb9370e630325ecb3534e4ce to your computer and use it in GitHub Desktop.
N58
package com.zjw.wearheart.service;
import android.annotation.SuppressLint;
import android.app.Notification;
import android.app.PendingIntent;
import android.app.Service;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothAdapter.LeScanCallback;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCallback;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattDescriptor;
import android.bluetooth.BluetoothGattService;
import android.bluetooth.BluetoothManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.media.MediaPlayer;
import android.media.RemoteController.OnClientUpdateListener;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.support.p012v4.content.LocalBroadcastManager;
import android.text.TextUtils;
import android.util.Log;
import com.lowagie.text.DocWriter;
import com.lowagie.text.html.HtmlTags;
import com.lowagie.text.pdf.BidiOrder;
import com.tencent.connect.common.Constants;
import com.zjw.wearheart.HomeActivity;
import com.zjw.wearheart.MyNotificationsListenerService;
import com.zjw.wearheart.R;
import com.zjw.wearheart.bean.BraceletData;
import com.zjw.wearheart.bean.SleepData;
import com.zjw.wearheart.bean.SleepData.SleepDataItem;
import com.zjw.wearheart.bean.entity.MovementData;
import com.zjw.wearheart.broadcastreceiver.PhoneReceiver;
import com.zjw.wearheart.p093b.C2509a;
import com.zjw.wearheart.p094c.C2567m;
import com.zjw.wearheart.p096e.C2576a;
import com.zjw.wearheart.p097f.C2578a;
import com.zjw.wearheart.p097f.C2579b;
import com.zjw.wearheart.p097f.C2581d;
import com.zjw.wearheart.p097f.C2583f;
import com.zjw.wearheart.p097f.C2586i;
import com.zjw.wearheart.p097f.C2587j;
import com.zjw.wearheart.p098g.C2671a;
import com.zjw.wearheart.p098g.C2674d;
import com.zjw.wearheart.p099h.C2676a;
import com.zjw.wearheart.p099h.C2677b;
import com.zjw.wearheart.p099h.C2678c;
import com.zjw.wearheart.p101j.C2786ac;
import com.zjw.wearheart.p101j.C2787ad;
import com.zjw.wearheart.p101j.C2790ag;
import com.zjw.wearheart.p101j.C2792ai;
import com.zjw.wearheart.p101j.C2800ap;
import com.zjw.wearheart.p101j.C2802b;
import com.zjw.wearheart.p101j.C2804d;
import com.zjw.wearheart.p101j.C2813m;
import com.zjw.wearheart.p101j.C2819s;
import com.zjw.wearheart.p101j.C2822v;
import com.zjw.wearheart.p101j.C2823w; // logger based on verbosity mode
import com.zjw.wearheart.p101j.C2825y;
import com.zjw.wearheart.p101j.C2826z;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import org.apache.mina.proxy.handlers.socks.SocksProxyConstants;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class BleService extends Service {
/* renamed from: A */
public static final String f12013A = "com.zjw.myapp.ACTION_GATT_CONNECTED";
/* renamed from: B */
public static final String f12014B = "com.zjw.myapp.ACTION_GATT_DISCONNECTED";
/* renamed from: C */
public static final String f12015C = "com.zjw.myapp.ACTION_GATT_SERVICES_DISCOVERED";
/* renamed from: D */
public static final String f12016D = "com.zjw.myapp.ACTION_DATA_AVAILABLE";
/* renamed from: E */
public static final String f12017E = "com.zjw.myapp.EXTRA_DATA";
/* renamed from: F */
public static final String f12018F = "com.zjw.myapp.DEVICE_DOES_NOT_SUPPORT_UART";
/* renamed from: G */
public static final String f12019G = "com.zjw.myapp.UPDATE_BATTERY_INFO";
/* renamed from: H */
public static final String f12020H = "com.zjw.myapp.ACTION_DATA_SYNC_COMPLETED";
/* renamed from: I */
public static final String f12021I = "com.zjw.myapp.ACTION_DATA_SYNC_UPDATE";
/* renamed from: J */
public static final String f12022J = "android.bluetooth.device.action.PAIRING_REQUEST";
/* renamed from: K */
public static final String f12023K = "com.zjw.myapp.BRACELET_ID";
/* renamed from: L */
public static final String f12024L = "com.nordicsemi.nrfUART.ACTION_TAKE_PHOTO";
/* renamed from: M */
public static final String f12025M = "com.zjw.myapp.ACTION_GATT_SERVICES_DFU";
/* renamed from: N */
public static final String f12026N = "com.zjw.myapp.ACTION_GATT_OFF_LINE_START";
/* renamed from: O */
public static final String f12027O = "com.zjw.myapp.ACTION_GATT_OFF_LINE_STOP";
/* renamed from: P */
public static final String f12028P = "TAG_SEND_USER_IMAGE_SUCCESS";
/* renamed from: Q */
public static final String f12029Q = "TAG_SEND_USER_IMAGE_FAIL";
/* renamed from: R */
public static final UUID f12030R = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb");
/* renamed from: S */
// 00000001 is the service
// is base https://stackoverflow.com/a/37053967
public static final UUID f12031S = UUID.fromString("00000001-0000-1000-8000-00805f9b34fb");
/* renamed from: T */
public static final UUID f12032T = UUID.fromString("00000002-0000-1000-8000-00805f9b34fb");
/* renamed from: U */
public static final UUID f12033U = UUID.fromString("00000003-0000-1000-8000-00805f9b34fb");
/* renamed from: V */
static Handler f12034V = null;
/* renamed from: W */
public static final String f12035W = "android.provider.Telephony.SMS_RECEIVED";
/* renamed from: X */
public static final UUID f12036X = UUID.fromString("00003e01-0000-1000-8000-00805f9b34fb");
/* renamed from: Y */
public static final UUID f12037Y = UUID.fromString("00003e03-0000-1000-8000-00805f9b34fb");
/* renamed from: Z */
public static final UUID f12038Z = UUID.fromString("00002c01-0000-1000-8000-00805f9b34fb");
/* renamed from: aC */
private static final String f12039aC = "BleService";
/* renamed from: aD */
private static final int f12040aD = 268505089;
/* renamed from: aE */
private static final int f12041aE = 268505088;
/* access modifiers changed from: private */
/* renamed from: aM */
public static int f12042aM = 0;
/* renamed from: aa */
public static final UUID f12043aa = UUID.fromString("00002c03-0000-1000-8000-00805f9b34fb");
/* renamed from: ab */
public static final UUID f12044ab = UUID.fromString("00003d01-0000-1000-8000-00805f9b34fb");
/* renamed from: ac */
public static final UUID f12045ac = UUID.fromString("00003d02-0000-1000-8000-00805f9b34fb");
/* renamed from: aw */
public static boolean f12046aw = true;
/* renamed from: ay */
public static boolean f12047ay = false;
/* renamed from: b */
public static String f12048b = "no data";
/* renamed from: c */
public static int f12049c = -1;
/* renamed from: d */
public static int f12050d = -1;
/* renamed from: e */
public static int f12051e = -1;
/* renamed from: f */
public static String f12052f = ""; //device name
/* renamed from: g */
public static String f12053g = ""; //device addrress
/* renamed from: h */
public static final String f12054h = "com.zjw.myapp.ACTION_NOTIFICATION_SEND_DATA";
/* renamed from: i */
public static final String f12055i = "com.zjw.myapp.ACTION_NOTIFICATION_SEND_SET_USER_INFO";
/* renamed from: j */
public static final String f12056j = "com.zjw.myapp.ACTION_NOTIFICATION_SEND_SET_TARGET_STEP";
/* renamed from: k */
public static final String f12057k = "com.zjw.myapp.ACTION_NOTIFICATION_SEND_SET_DEVICE_THEME";
/* renamed from: l */
public static final String f12058l = "com.zjw.myapp.ACTION_NOTIFICATION_SEND_SET_SKIN_COLOUR";
/* renamed from: m */
public static final String f12059m = "com.zjw.myapp.ACTION_NOTIFICATION_SEND_SET_SCREEN_BRIGHESS";
/* renamed from: n */
public static final String f12060n = "com.zjw.myapp.ACTION_NOTIFICATION_SEND_SET_BRIHNESS_TIME";
/* renamed from: x */
public static final int f12061x = 0;
/* renamed from: y */
public static final int f12062y = 1;
/* renamed from: z */
public static final int f12063z = 2;
/* renamed from: a */
ArrayList<MovementData> f12064a = new ArrayList<>();
/* renamed from: aA */
JSONObject f12065aA;
/* renamed from: aB */
JSONObject f12066aB = null;
/* access modifiers changed from: private */
/* renamed from: aF */
public MediaPlayer f12067aF;
/* access modifiers changed from: private */
/* renamed from: aG */
public int f12068aG = 0;
/* renamed from: aH */
private int f12069aH = C2813m.f11560F;
/* renamed from: aI */
private int f12070aI = 65;
/* renamed from: aJ */
private int f12071aJ = 0;
/* access modifiers changed from: private */
/* renamed from: aK */
public Handler f12072aK = null;
/* access modifiers changed from: private */
/* renamed from: aL */
public Handler f12073aL = new Handler();
/* access modifiers changed from: private */
/* renamed from: aN */
public BluetoothGatt f12074aN;
/* renamed from: aO */
private BluetoothManager f12075aO;
/* renamed from: aP */
private String f12076aP;
/* renamed from: aQ */
private C2567m f12077aQ;
/* access modifiers changed from: private */
/* renamed from: aR */
public BluetoothGattService f12078aR = null;
/* access modifiers changed from: private */
/* renamed from: aS */
public BluetoothGattService f12079aS = null;
/* access modifiers changed from: private */
/* renamed from: aT */
public BluetoothGattService f12080aT = null;
/* access modifiers changed from: private */
/* renamed from: aU */
public BluetoothGattService f12081aU = null;
/* renamed from: aV */
private OnClientUpdateListener f12082aV;
/* renamed from: aW */
private long f12083aW = 0;
/* renamed from: aX */
private BluetoothDevice f12084aX;
/* access modifiers changed from: private */
/* renamed from: aY */
public byte[] f12085aY = new byte[400];
/* renamed from: aZ */
private byte[] f12086aZ = new byte[400];
/* renamed from: ad */
BluetoothGattCharacteristic f12087ad;
/* renamed from: ae */
BluetoothGattCharacteristic f12088ae;
/* renamed from: af */
BluetoothGattCharacteristic f12089af;
/* renamed from: ag */
BluetoothGattCharacteristic f12090ag;
/* renamed from: ah */
BluetoothGattCharacteristic f12091ah;
/* renamed from: ai */
C2587j f12092ai;
/* renamed from: aj */
PhoneReceiver f12093aj;
/* renamed from: ak */
int f12094ak = 1;
/* renamed from: al */
int f12095al = 1;
/* renamed from: am */
int f12096am = 0;
/* renamed from: an */
int f12097an = 0;
/* renamed from: ao */
int f12098ao = 0;
/* renamed from: ap */
int f12099ap = 0;
/* renamed from: aq */
int f12100aq = 0;
/* renamed from: ar */
int f12101ar = 3;
/* renamed from: as */
int f12102as = 5;
/* renamed from: at */
BraceletData f12103at = new BraceletData();
/* renamed from: au */
List<SleepData> f12104au = new ArrayList();
/* renamed from: av */
int f12105av = 25;
/* renamed from: ax */
boolean f12106ax = true;
/* renamed from: az */
C2581d f12107az = null;
/* renamed from: bA */
private int f12108bA = 0;
/* renamed from: bB */
private int f12109bB = 0;
/* renamed from: bC */
private C2802b f12110bC;
/* renamed from: bD */
private int f12111bD = 70;
/* renamed from: bE */
private int f12112bE = 120;
/* renamed from: bF */
private int f12113bF = 70;
/* access modifiers changed from: private */
@SuppressLint({"NewApi"})
/* renamed from: bG */
public LeScanCallback f12114bG = new C2935b(this);
/* renamed from: ba */
private int f12115ba = 0;
/* renamed from: bb */
private int f12116bb = 0;
/* renamed from: bc */
private int f12117bc = 0;
/* access modifiers changed from: private */
/* renamed from: bd */
public boolean f12118bd = false;
/* renamed from: be */
private SleepData f12119be = new SleepData();
/* renamed from: bf */
private long f12120bf = 0;
/* renamed from: bg */
private long f12121bg = 0;
/* renamed from: bh */
private long f12122bh = 0;
/* renamed from: bi */
private int f12123bi = 0;
/* renamed from: bj */
private C2924e f12124bj;
/* renamed from: bk */
private C2925f f12125bk;
/* renamed from: bl */
private C2921b f12126bl;
/* renamed from: bm */
private C2922c f12127bm;
/* renamed from: bn */
private C2926g f12128bn;
/* renamed from: bo */
private C2920a f12129bo;
/* renamed from: bp */
private DecimalFormat f12130bp;
/* renamed from: bq */
private boolean f12131bq;
/* renamed from: br */
private C2923d f12132br;
/* access modifiers changed from: private */
/* renamed from: bs */
public JSONObject f12133bs;
/* access modifiers changed from: private */
/* renamed from: bt */
public Handler f12134bt = new C2942i(this);
/* access modifiers changed from: private */
/* renamed from: bu */
public C2678c f12135bu;
/* renamed from: bv */
private String f12136bv = "";
/* renamed from: bw */
private String f12137bw = "";
/* renamed from: bx */
private int f12138bx = 0;
/* renamed from: by */
private int f12139by = 0;
/* renamed from: bz */
private int f12140bz = 0;
/* renamed from: o */
int f12141o = 0;
/* renamed from: p */
int f12142p = 0;
/* renamed from: q */
int f12143q = 0;
/* renamed from: r */
int f12144r = 0;
/* renamed from: s */
int f12145s = 0;
/* renamed from: t */
int f12146t = 0;
/* renamed from: u */
C2676a f12147u;
/* renamed from: v */
C2677b f12148v;
/* renamed from: w */
public BluetoothAdapter f12149w;
/* renamed from: com.zjw.wearheart.service.BleService$a */
public interface C2920a {
/* renamed from: a */
void mo20725a(int i);
}
/* renamed from: com.zjw.wearheart.service.BleService$b */
public interface C2921b {
/* renamed from: a */
void mo20726a(int i);
}
/* renamed from: com.zjw.wearheart.service.BleService$c */
public interface C2922c {
/* renamed from: a */
void mo20727a(BraceletData braceletData);
}
/* renamed from: com.zjw.wearheart.service.BleService$d */
class C2923d extends BluetoothGattCallback {
C2923d() {
}
public void onConnectionStateChange(BluetoothGatt bluetoothGatt, int i, int i2) {
if (i2 == 1) {
// Ble test = Bluetooth is connecting...
System.out.println("Ble 测试 = 蓝牙 正在连...");
BleService.f12042aM = 1;
} else if (i2 == 2) {
BleService.this.mo20708n();
BleService.f12047ay = false;
// Ble test = Bluetooth connected
System.out.println("Ble 测试 = 蓝牙 连上了");
BleService.f12052f = bluetoothGatt.getDevice().getAddress();
BleService.f12053g = bluetoothGatt.getDevice().getName();
// check for empty and invalid address and name
if (!C2822v.m12114e(BleService.f12052f) && !C2822v.m12114e(BleService.f12053g)) {
BleService.this.f12147u.mo20027b(BleService.f12052f);
BleService.this.f12147u.mo19980a(BleService.f12053g);
}
BleService.f12049c = -1;
BleService.f12050d = -1;
BleService.f12051e = -1;
BleService.this.f12147u.mo20031c("(1.1.0)");
BleService.this.f12135bu.mo20124a(0);
BleService.f12042aM = 2;
BleService.this.m12398g(BleService.f12015C);
BleService.this.f12074aN.discoverServices();
if (BleService.this.f12147u.mo20108z()) {
BleService.this.f12094ak = 1;
} else {
BleService.this.f12094ak = 0;
}
if (BleService.this.f12147u.mo19924A()) {
BleService.this.f12095al = 0;
} else {
BleService.this.f12095al = 0;
}
if (BleService.this.f12147u.mo19927B()) {
BleService.this.f12096am = 1;
} else {
BleService.this.f12096am = 0;
}
if (BleService.this.f12147u.mo19933D()) {
BleService.this.f12097an = 1;
} else {
BleService.this.f12097an = 0;
}
if (BleService.this.f12147u.mo19930C()) {
BleService.this.f12098ao = 1;
} else {
BleService.this.f12098ao = 0;
}
BleService.this.f12099ap = BleService.this.f12147u.mo20005ag();
BleService.this.f12100aq = BleService.this.f12147u.mo20006ah();
BleService.this.f12101ar = BleService.this.f12147u.mo20008aj();
BleService.this.f12102as = BleService.this.f12147u.mo20009ak();
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append("ble 发出去的是 = 时间 = ");
sb.append(BleService.this.f12147u.mo19940G());
printStream.println(sb.toString());
PrintStream printStream2 = System.out;
StringBuilder sb2 = new StringBuilder();
sb2.append("ble 发出去的是 = 单位 = ");
sb2.append(BleService.this.f12147u.mo19943H());
printStream2.println(sb2.toString());
PrintStream printStream3 = System.out;
StringBuilder sb3 = new StringBuilder();
sb3.append("ble 发出去的是 = 抬手 = ");
sb3.append(BleService.this.f12094ak);
printStream3.println(sb3.toString());
PrintStream printStream4 = System.out;
StringBuilder sb4 = new StringBuilder();
sb4.append("ble 发出去的是 = 转腕 = ");
sb4.append(BleService.this.f12095al);
printStream4.println(sb4.toString());
PrintStream printStream5 = System.out;
StringBuilder sb5 = new StringBuilder();
sb5.append("ble 发出去的是 = 心率 = ");
sb5.append(BleService.this.f12096am);
printStream5.println(sb5.toString());
PrintStream printStream6 = System.out;
StringBuilder sb6 = new StringBuilder();
sb6.append("ble 发出去的是 = 免打扰 = ");
sb6.append(BleService.this.f12097an);
printStream6.println(sb6.toString());
PrintStream printStream7 = System.out;
StringBuilder sb7 = new StringBuilder();
sb7.append("ble 发出去的是 = 主题 = ");
sb7.append(BleService.this.f12099ap);
printStream7.println(sb7.toString());
PrintStream printStream8 = System.out;
StringBuilder sb8 = new StringBuilder();
sb8.append("ble 发出去的是 = 皮肤 = ");
sb8.append(BleService.this.f12100aq);
printStream8.println(sb8.toString());
PrintStream printStream9 = System.out;
StringBuilder sb9 = new StringBuilder();
sb9.append("ble 发出去的是 = 亮度等级 = ");
sb9.append(BleService.this.f12101ar);
printStream9.println(sb9.toString());
PrintStream printStream10 = System.out;
StringBuilder sb10 = new StringBuilder();
sb10.append("ble 发出去的是 = 亮屏时间 = ");
sb10.append(BleService.this.f12102as);
printStream10.println(sb10.toString());
BleService.this.f12073aL.postDelayed(new C2947n(this), 2000);
BleService.this.f12073aL.postDelayed(new C2948o(this), 2200);
BleService.this.f12073aL.postDelayed(new C2949p(this), 2400);
BleService.this.f12073aL.postDelayed(new C2950q(this), 2600);
BleService.this.f12073aL.postDelayed(new C2951r(this), 2800);
} else if (i2 == 0) {
System.out.println("Ble 测试 = 蓝牙 断开了");
BleService.this.f12147u.mo20031c("(1.1.0)");
Log.w("BleService", "Disconnected from GATT server.");
BleService.f12042aM = 0;
BleService.this.m12398g(BleService.f12014B);
String c = BleService.this.f12147u.mo20029c();
if (c == null || c.equals("")) {
bluetoothGatt.close();
BleService.this.mo20693f();
System.out.println("Ble 测试 重连 mac 为空= ");
return;
}
bluetoothGatt.close();
BleService.this.mo20693f();
BleService.this.mo20716q();
}
}
public void onServicesDiscovered(BluetoothGatt bluetoothGatt, int i) {
System.out.println("Ble 初始化"); //initialization
if (i == 0) {
boolean z = false;
boolean z2 = false;
boolean z3 = false;
boolean z4 = false;
for (BluetoothGattService bluetoothGattService : BleService.this.mo20703k()) {
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append("PPG数据下发 ===== "); //PPG Data issuance
sb.append(bluetoothGattService.getUuid());
printStream.println(sb.toString());
if (bluetoothGattService.getUuid().equals(BleService.f12036X)) {
// PPG data is sent = ecg
System.out.println("PPG数据下发 = ecg");
BleService.this.f12079aS = bluetoothGattService;
z = true;
}
if (bluetoothGattService.getUuid().equals(BleService.f12031S)) {
System.out.println("PPG数据下发 = sys");
BleService.this.f12078aR = bluetoothGattService;
z3 = true;
}
if (bluetoothGattService.getUuid().equals(BleService.f12038Z)) {
System.out.println("PPG数据下发 = ppg");
BleService.this.f12080aT = bluetoothGattService;
z4 = true;
}
if (bluetoothGattService.getUuid().equals(BleService.f12044ab)) {
System.out.println("图片数据 = 发现服务"); //Image data = discovery service
BleService.this.f12081aU = bluetoothGattService;
z2 = true;
}
}
if (z) {
// ECG service enabled so enable notification on descriptor 3e03
// BleService.this.f12079aS = bluetoothGattService;
// f12037Y = 00003e03-0000-1000-8000-00805f9b34fb
BleService.this.f12089af = BleService.this.f12079aS.getCharacteristic(BleService.f12037Y);
BleService.this.m12374a("ecg", bluetoothGatt, BleService.this.f12089af);
}
if (z2) {
// image data discovery
BleService.this.f12091ah = BleService.this.f12081aU.getCharacteristic(BleService.f12045ac);
}
if (z3) {
//sys
BleService.this.f12088ae = BleService.this.f12078aR.getCharacteristic(BleService.f12032T);
BleService.this.f12087ad = BleService.this.f12078aR.getCharacteristic(BleService.f12033U);
BleService.this.f12073aL.postDelayed(new C2952s(this), 700);
}
if (z4) {
//ppg
BleService.this.f12073aL.postDelayed(new C2954u(this, bluetoothGatt), 1200);
} else {
// PPG data is sent without data
System.out.println("PPG数据下发 没有数据");
}
}
}
public void onCharacteristicRead(BluetoothGatt bluetoothGatt, BluetoothGattCharacteristic bluetoothGattCharacteristic, int i) {
BleService.this.m12375a(BleService.f12016D, bluetoothGattCharacteristic);
}
public void onCharacteristicChanged(BluetoothGatt bluetoothGatt, BluetoothGattCharacteristic bluetoothGattCharacteristic) {
if (bluetoothGattCharacteristic.getUuid().equals(BleService.f12037Y)) {
// BleService.f12037Y = 3e03
int i = 1;
byte[] value = bluetoothGattCharacteristic.getValue();
if (value.length >= 19) {
i = value[18] >> 7;
}
int[] iArr = new int[9];
BleService.this.mo20679a(C2955v.m12562e(bluetoothGattCharacteristic), i);
if (!BleService.f12047ay) {
BleService.this.mo20671a(bluetoothGattCharacteristic);
}
} else if (bluetoothGattCharacteristic.getUuid().equals(BleService.f12043aa)) {
// 00002c03 service
BleService.this.mo20678a(C2955v.m12567f(bluetoothGattCharacteristic));
} else if (bluetoothGattCharacteristic.getUuid().equals(BleService.f12033U)) {
// 00000003
BleService.this.m12375a(BleService.f12016D, bluetoothGattCharacteristic); //broadcast
byte[] value2 = bluetoothGattCharacteristic.getValue();
String a = BleService.this.m12411o(value2); //get as hex string
String str = "BleService"; // f12039aC = BleService
StringBuilder sb = new StringBuilder();
sb.append("onCharacteristicChanged:");
sb.append(a);
C2823w.m12115a(str, sb.toString()); //log to trace
if (value2.length > 0) {
BleService.this.m12406m(value2); //preproces?
}
if (BleService.this.f12118bd) { //default false
// parse the data
BleService.this.m12409n(BleService.this.f12085aY); // this.f12085aY = new byte[400]
}
}
}
}
/* renamed from: com.zjw.wearheart.service.BleService$e */
private class C2924e extends BroadcastReceiver {
private C2924e() {
}
/* synthetic */ C2924e(BleService bleService, C2933a aVar) {
this();
}
public void onReceive(Context context, Intent intent) {
String str;
if (intent.getAction().equals("android.bluetooth.adapter.action.STATE_CHANGED")) {
if (BleService.this.f12149w.getState() == 10) {
System.out.println("Ble 测试 广播接收到蓝牙已经关闭 ");
}
if (BleService.this.f12149w.getState() == 12) {
System.out.println("Ble 测试 广播接收到蓝牙已经打开 ");
BleService.this.mo20716q();
}
} else if (!intent.getAction().equals(BleService.f12022J)) { //android.bluetooth.device.action.PAIRING_REQUEST
if (intent.getAction().equals(BleService.f12035W)) {
//android.provider.Telephony.SMS_RECEIVED
//Receive SMS
C2823w.m12115a("BleService", "接受到短信");
if (BleService.f12042aM == 2) {
//Received SMS 1
System.out.println("ble 收到短信1");
} else {
//Bluetooth Receive SMS 2
System.out.println("ble 蓝牙 收到短信2");
}
} else if (intent.getAction().equals(BleService.f12054h)) {
byte[] byteArray = intent.getExtras().getByteArray("count0");
if (byteArray != null) {
BleService.this.mo20681a(byteArray);
}
//Notice received"
System.out.println("ble 通知 收到了");
} else if (intent.getAction().equals(BleService.f12055i)) {
// com.zjw.myapp.ACTION_NOTIFICATION_SEND_SET_USER_INFO
BleService.this.mo20681a(C2955v.m12518a(1, 24, BleService.this.f12135bu.mo20176t(), BleService.this.f12135bu.mo20177u()));
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append("上传设备 个人信息到BLE = 收到了-发送身高 = ");
sb.append(BleService.this.f12135bu.mo20176t());
printStream.println(sb.toString());
PrintStream printStream2 = System.out;
StringBuilder sb2 = new StringBuilder();
sb2.append("上传设备 个人信息到BLE = 收到了-发送体重 = ");
sb2.append(BleService.this.f12135bu.mo20177u());
printStream2.println(sb2.toString());
} else if (intent.getAction().equals(BleService.f12056j)) {
//com.zjw.myapp.ACTION_NOTIFICATION_SEND_SET_TARGET_STEP
if (BleService.this.f12135bu.mo20160k() == null || BleService.this.f12135bu.mo20160k().equals("")) {
System.out.println("设置目标步数 = 8000");
BleService.this.mo20681a(C2955v.m12514a(8000));
} else {
String k = BleService.this.f12135bu.mo20160k();
if (Integer.parseInt(k) < C2813m.f11570d) {
str = String.valueOf(C2813m.f11570d);
} else if (Integer.parseInt(k) > C2813m.f11569c) {
str = String.valueOf(C2813m.f11569c);
} else {
StringBuilder sb3 = new StringBuilder();
sb3.append((Integer.parseInt(k) / 1000) * 1000);
sb3.append("");
str = sb3.toString();
}
PrintStream printStream3 = System.out;
StringBuilder sb4 = new StringBuilder();
sb4.append("设置目标步数 = ");
sb4.append(str);
printStream3.println(sb4.toString());
BleService.this.mo20681a(C2955v.m12514a(Integer.valueOf(str).intValue()));
}
PrintStream printStream4 = System.out;
StringBuilder sb5 = new StringBuilder();
sb5.append("上传设备 个人信息到BLE = 收到了-目标 = ");
sb5.append(BleService.this.f12135bu.mo20176t());
printStream4.println(sb5.toString());
} else if (intent.getAction().equals(BleService.f12057k)) {
//com.zjw.myapp.ACTION_NOTIFICATION_SEND_SET_DEVICE_THEME
int ag = BleService.this.f12147u.mo20005ag();
PrintStream printStream5 = System.out;
StringBuilder sb6 = new StringBuilder();
sb6.append("上传设备 设备主题到BLE = 收到了-主题 = ");
sb6.append(ag);
printStream5.println(sb6.toString());
BleService.this.mo20681a(C2955v.m12590m(ag));
} else if (intent.getAction().equals(BleService.f12058l)) {
// com.zjw.myapp.ACTION_NOTIFICATION_SEND_SET_SKIN_COLOUR
int ah = BleService.this.f12147u.mo20006ah();
PrintStream printStream6 = System.out;
StringBuilder sb7 = new StringBuilder();
sb7.append("上传设备 设置肤色到BLE = 收到了-肤色 = ");
sb7.append(ah);
printStream6.println(sb7.toString());
BleService.this.mo20681a(C2955v.m12592n(ah));
} else if (intent.getAction().equals(BleService.f12059m)) {
int aj = BleService.this.f12147u.mo20008aj();
PrintStream printStream7 = System.out;
StringBuilder sb8 = new StringBuilder();
sb8.append("上传设备 设置亮度等级= 收到了-亮屏等级 = ");
sb8.append(aj);
printStream7.println(sb8.toString());
BleService.this.mo20681a(C2955v.m12594o(aj));
} else if (intent.getAction().equals(BleService.f12060n)) {
int ak = BleService.this.f12147u.mo20009ak();
PrintStream printStream8 = System.out;
StringBuilder sb9 = new StringBuilder();
sb9.append("上传设备 设置亮屏时间 = 收到了-亮屏时间 = ");
sb9.append(ak);
printStream8.println(sb9.toString());
BleService.this.mo20681a(C2955v.m12596p(ak));
}
}
}
}
/* renamed from: com.zjw.wearheart.service.BleService$f */
public class C2925f extends Binder {
public C2925f() {
}
/* renamed from: a */
public BleService mo20733a() {
return BleService.this;
}
}
/* renamed from: com.zjw.wearheart.service.BleService$g */
public interface C2926g {
/* renamed from: a */
void mo20734a(List<SleepData> list);
}
/* renamed from: a */
private byte m12362a(byte b, byte b2) {
byte b3 = (byte) (b ^ b2);
for (int i = 0; i < 8; i++) {
b3 = (byte) ((b3 & 128) != 0 ? ((byte) (b3 << 1)) ^ -105 : b3 << 1);
}
return b3;
}
/* access modifiers changed from: private */
/* renamed from: A */
public void m12356A() {
Notification notification = new Notification(R.drawable.ic_launcher, getString(R.string.app_name), System.currentTimeMillis());
PendingIntent.getActivity(this, 0, new Intent(this, HomeActivity.class), 0);
startForeground(0, notification);
}
public void onCreate() {
System.out.println("APP通知 蓝牙服务 = onCreate");
this.f12135bu = new C2678c(this);
this.f12110bC = new C2802b();
m12356A();
this.f12072aK = new C2933a(this);
this.f12072aK.sendEmptyMessageDelayed(f12040aD, 1000);
this.f12147u = new C2676a(this);
this.f12148v = new C2677b(this);
this.f12131bq = mo20683b();
this.f12077aQ = new C2567m(this);
m12357B();
this.f12132br = new C2923d();
f12034V = new Handler();
if (this.f12131bq) {
if (this.f12149w.getState() == 10) {
System.out.println("Ble 测试 = 蓝牙状态 = 关闭");
}
if (this.f12149w.getState() == 12) {
System.out.println("Ble 测试 = 蓝牙状态 = 打开");
mo20688d();
mo20716q();
}
}
mo20721v();
}
/* renamed from: a */
public void mo20665a() {
if (this.f12135bu.mo20157i()) {
System.out.println("Ble 测试 广播接收到蓝牙已经打开 登陆了");
String c = this.f12147u.mo20029c();
if (c == null || c.equals("")) {
System.out.println("Ble 测试 尝试 mac 为空= ");
return;
}
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append("Ble 测试 尝试 调用 connect() mac = ");
sb.append(c);
printStream.println(sb.toString());
mo20680a(c);
} else {
System.out.println("Ble 测试 广播接收到蓝牙已经打开 没登录");
}
}
public int onStartCommand(Intent intent, int i, int i2) {
return super.onStartCommand(intent, i, i2);
}
public IBinder onBind(Intent intent) {
if (this.f12125bk == null) {
this.f12125bk = new C2925f();
}
return this.f12125bk;
}
public boolean onUnbind(Intent intent) {
return super.onUnbind(intent);
}
public void onDestroy() {
System.out.println("Ble onDestroy");
m12361F();
unregisterReceiver(this.f12124bj);
mo20693f();
}
/* renamed from: B */
private void m12357B() {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.PHONE_STATE");
intentFilter.addAction("android.bluetooth.adapter.action.STATE_CHANGED");
intentFilter.addAction(f12022J);
intentFilter.addAction(f12035W);
intentFilter.addAction(f12054h);
intentFilter.addAction(f12055i);
intentFilter.addAction(f12056j);
intentFilter.addAction(f12057k);
intentFilter.addAction(f12058l);
intentFilter.addAction(f12059m);
intentFilter.addAction(f12060n);
C2823w.m12115a("BleService", "initIncommingCallReceiver");
this.f12124bj = new C2924e(this, null);
registerReceiver(this.f12124bj, intentFilter);
m12360E();
}
/* renamed from: b */
public boolean mo20683b() {
if (this.f12075aO == null) {
this.f12075aO = (BluetoothManager) getSystemService("bluetooth");
if (this.f12075aO == null) {
Log.e("BleService", "Unable to initialize BluetoothManager.");
return false;
}
}
this.f12149w = this.f12075aO.getAdapter();
if (this.f12149w != null) {
return true;
}
Log.e("BleService", "Unable to obtain a BluetoothAdapter.");
return false;
}
/* renamed from: c */
public BluetoothDevice mo20685c() {
return this.f12084aX;
}
/* renamed from: a */
public boolean mo20680a(String str) {
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append("Ble 测试 调用 connect() address = ");
sb.append(str);
printStream.println(sb.toString());
if (this.f12074aN != null) {
System.out.println("Ble 测试 调用 connect() mBluetoothGatt 不等于空,断开");
this.f12074aN.close();
mo20693f();
}
if (this.f12149w == null || str == null) {
System.out.println("Ble 测试 调用 connect() mBluetoothAdapter 等于空,addrss 等于空");
return false;
} else if (this.f12074aN == null) {
System.out.println("Ble 测试 调用 connect() mBluetoothGatt 等于空 未连接 ");
BluetoothDevice remoteDevice = this.f12149w.getRemoteDevice(str);
if (remoteDevice == null) {
System.out.println("Ble 测试 调用 connect() device 等于空");
return false;
}
this.f12074aN = remoteDevice.connectGatt(this, false, this.f12132br);
System.out.println("Ble 测试 调用 connect() 33333333333333333");
Log.d("BleService", "Trying to create a new connection.");
f12042aM = 1;
return true;
} else if (this.f12074aN.connect()) {
System.out.println("Ble 测试 调用 connect() mBluetoothGatt 不是空 已连接 ");
f12042aM = 1;
return true;
} else {
System.out.println("Ble 测试 调用 connect() mBluetoothGatt 不是空 未连接 ");
return false;
}
}
/* renamed from: C */
private boolean m12358C() {
String str = Build.BRAND;
StringBuilder sb = new StringBuilder();
sb.append(" brand:");
sb.append(str);
Log.i("", sb.toString());
return str.toLowerCase().contains("samsung");
}
/* renamed from: d */
public void mo20688d() {
System.out.println("Ble 测试 = 调用disconnect()");
if (this.f12074aN != null) {
this.f12074aN.disconnect();
}
}
/* renamed from: e */
public String mo20691e() {
return this.f12084aX != null ? this.f12084aX.getName() : "";
}
/* renamed from: a */
// get ecg
public boolean mo20681a(byte[] bArr) {
if (!f12046aw) {
System.out.println("Offline ECG data = write data can't be synced now");
return false;
}
System.out.println("Offline ECG data = write data can now be synchronized");
if (this.f12074aN == null) {
return false;
}
BluetoothGattService service = this.f12074aN.getService(f12031S); //service 00000001
if (service == null) {
m12398g(f12018F); // local broadcast DEVICE_DOES_NOT_SUPPORT_UART
return false;
}
BluetoothGattCharacteristic characteristic = service.getCharacteristic(f12032T); // 00000002
if (characteristic == null) {
m12398g(f12018F); // local broadcast DEVICE_DOES_NOT_SUPPORT_UART
return false;
}
int length = bArr.length;
boolean z = false;
int i = 0;
while (length > 0) {
if (length < 20) {
byte[] bArr2 = new byte[length];
for (int i2 = 0; i2 < length; i2++) {
bArr2[i2] = bArr[i2 + i];
}
characteristic.setValue(bArr2);
boolean writeCharacteristic = this.f12074aN.writeCharacteristic(characteristic);
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append("QQ with text data write command = state 1 =");
sb.append(bArr2);
printStream.println(sb.toString());
z = writeCharacteristic;
} else {
byte[] bArr3 = new byte[20];
for (int i3 = 0; i3 < 20; i3++) {
bArr3[i3] = bArr[i3 + i];
}
characteristic.setValue(bArr3);
z = this.f12074aN.writeCharacteristic(characteristic);
PrintStream printStream2 = System.out;
StringBuilder sb2 = new StringBuilder();
sb2.append("QQ with text data write command = state 2 =");
sb2.append(z);
printStream2.println(sb2.toString());
}
i += 20;
length -= 20;
try {
Thread.sleep(80);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return z;
}
/* renamed from: b */
public boolean mo20684b(byte[] bArr) {
if (this.f12074aN == null) {
return false;
}
BluetoothGattService service = this.f12074aN.getService(f12031S);
if (service == null) {
m12398g(f12018F);
return false;
}
BluetoothGattCharacteristic characteristic = service.getCharacteristic(f12032T);
if (characteristic == null) {
m12398g(f12018F);
return false;
}
int length = bArr.length;
boolean z = false;
int i = 0;
while (length > 0) {
if (length < 20) {
byte[] bArr2 = new byte[length];
for (int i2 = 0; i2 < length; i2++) {
bArr2[i2] = bArr[i2 + i];
}
characteristic.setValue(bArr2);
z = this.f12074aN.writeCharacteristic(characteristic);
} else {
byte[] bArr3 = new byte[20];
for (int i3 = 0; i3 < 20; i3++) {
bArr3[i3] = bArr[i3 + i];
}
characteristic.setValue(bArr3);
z = this.f12074aN.writeCharacteristic(characteristic);
}
i += 20;
length -= 20;
try {
Thread.sleep(40);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return z;
}
/* access modifiers changed from: private */
/* renamed from: g */
public void m12398g(String str) {
LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(str));
}
/* renamed from: h */
private void m12400h(String str) {
Intent intent = new Intent();
intent.setAction(str);
sendBroadcast(intent);
}
/* access modifiers changed from: private */
/* renamed from: a */
public void m12375a(String str, BluetoothGattCharacteristic bluetoothGattCharacteristic) {
Intent intent = new Intent(str);
if (f12033U.equals(bluetoothGattCharacteristic.getUuid())) {
// com.zjw.myapp.EXTRA_DATA
intent.putExtra(f12017E, bluetoothGattCharacteristic.getValue());
}
LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
}
/* renamed from: f */
public void mo20693f() {
System.out.println("Ble 调用 close");
f12042aM = 0;
if (this.f12074aN != null) {
this.f12074aN.close();
this.f12074aN = null;
}
}
/* access modifiers changed from: 0000 */
/* renamed from: a */
public void mo20679a(int[] iArr, int i) {
Intent intent = new Intent();
intent.setAction(C2576a.f9965b);
Bundle bundle = new Bundle();
bundle.putIntArray("ecg_data", iArr);
bundle.putInt("ecg_tuoluo", i);
intent.putExtras(bundle);
sendBroadcast(intent);
}
/* access modifiers changed from: 0000 */
/* renamed from: a */
public void mo20678a(int[] iArr) {
Intent intent = new Intent();
intent.setAction(C2576a.f9966c);
Bundle bundle = new Bundle();
bundle.putIntArray("ppg_data", iArr);
intent.putExtras(bundle);
sendBroadcast(intent);
}
/* access modifiers changed from: 0000 */
/* renamed from: a */
public void mo20666a(int i) {
Intent intent = new Intent();
intent.setAction(C2576a.f9969f);
Bundle bundle = new Bundle();
bundle.putInt("ecg_heart", i);
intent.putExtras(bundle);
sendBroadcast(intent);
}
/* access modifiers changed from: private */
/* renamed from: m */
public void m12406m(byte[] bArr) {
switch (this.f12115ba) { // by default this.f12115ba = 0
case 0:
if (bArr[0] == -85) {
this.f12116bb = 0; //by default is 0
//this.f12086aZ = new byte[400]
//this.f12085aY = new byte[400]
// int f12116bb = 0;
// arraycopy(Object source_arr, int sourcePos, Object dest_arr, int destPos, int len)
System.arraycopy(this.f12086aZ, 0, this.f12085aY, this.f12116bb, 100);
System.arraycopy(bArr, 0, this.f12085aY, this.f12116bb, bArr.length);
this.f12116bb = bArr.length;
this.f12117bc = ((bArr[2] << 8) | bArr[3]) + 8;
this.f12117bc -= bArr.length;
if (this.f12117bc <= 0) {
this.f12115ba = 0;
this.f12116bb = 0;
this.f12118bd = true;
return;
}
this.f12115ba = 1;
this.f12118bd = false;
return;
}
return;
case 1:
System.arraycopy(bArr, 0, this.f12085aY, this.f12116bb, bArr.length);
this.f12116bb += bArr.length;
this.f12117bc -= bArr.length;
if (this.f12117bc <= 0) {
this.f12115ba = 0;
this.f12118bd = true;
return;
}
this.f12118bd = false;
return;
default:
return;
}
}
/* renamed from: c */
public boolean mo20687c(byte[] bArr) {
byte b = bArr[4];
int i = (bArr[3] & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD) - 5;
byte b2 = 0;
for (int i2 = 13; i2 < 13 + i; i2++) {
b2 = m12362a(bArr[i2], b2);
}
String str = "BleService";
StringBuilder sb = new StringBuilder();
sb.append("校验结果 length:");
sb.append(i);
Log.i(str, sb.toString());
String str2 = "BleService";
StringBuilder sb2 = new StringBuilder();
sb2.append("校验结果 checkNum:");
sb2.append(m12366a(b));
Log.i(str2, sb2.toString());
String str3 = "BleService";
StringBuilder sb3 = new StringBuilder();
sb3.append("校验结果 crc:");
sb3.append(m12366a(b2));
Log.i(str3, sb3.toString());
if (b == b2) {
return true;
}
return false;
}
/* access modifiers changed from: private */
/* renamed from: n */
public void m12409n(byte[] bArr) {
byte[] bArr2 = bArr;
if (bArr2[0] == -85) {
int i = 8;
if (bArr2[8] == 3) {
String str = "BleService";
StringBuilder sb = new StringBuilder();
sb.append("parseRcvData Data[0]=");
sb.append(bArr2[0]);
sb.append(" Data[8]");
sb.append(bArr2[8]);
sb.append(" Data[10]=");
sb.append(bArr2[10]);
Log.i(str, sb.toString());
switch (bArr2[10]) {
case 2:
// Bled synchronous motion = start
System.out.println("ble 同步运动= 开始");
boolean c = mo20687c(bArr);
PrintStream printStream = System.out;
StringBuilder sb2 = new StringBuilder();
//Ble synchronous motion = check result
sb2.append("ble 同步运动 = 校验结果");
sb2.append(c);
printStream.println(sb2.toString());
String o = m12411o(bArr);
PrintStream printStream2 = System.out;
StringBuilder sb3 = new StringBuilder();
sb3.append("同步步数回调 checkData = ");
sb3.append(c);
sb3.append(" data = ");
sb3.append(o);
printStream2.println(sb3.toString());
StringBuilder sb4 = new StringBuilder();
sb4.append("checkData = ");
sb4.append(c);
sb4.append(" data = ");
sb4.append(o);
f12048b = sb4.toString();
if (c) {
mo20692e(bArr);
m12398g(f12016D);
break;
}
break;
case 3:
if (mo20687c(bArr)) {
mo20694f(bArr);
m12398g(f12016D);
break;
}
break;
case 4:
System.out.println("ble 同步数据 = 完成");
// Ble sync data = complete
m12377a(this.f12064a);
if (this.f12064a != null && this.f12064a.size() > 0) {
this.f12064a.clear();
break;
}
case 5:
// Ble sync data = whole snack rate
System.out.println("ble 同步数据 = 整点心率");
String o2 = m12411o(bArr);
String str2 = "BleService";
StringBuilder sb5 = new StringBuilder();
sb5.append("自动心率源数据:");
sb5.append(o2);
C2823w.m12115a(str2, sb5.toString());
boolean c2 = mo20687c(bArr);
String str3 = "BleService";
StringBuilder sb6 = new StringBuilder();
sb6.append("自动心率数据校验结果:");
sb6.append(c2);
Log.i(str3, sb6.toString());
if (c2) {
mo20696g(bArr);
break;
}
break;
case 6:
Intent intent = new Intent();
intent.setAction("TAG_SEND_PHOTO_ACTION");
sendBroadcast(intent);
break;
case 7:
// Bled sync data = find phone
System.out.println("ble 同步数据 = 找手机");
this.f12072aK.sendEmptyMessage(3);
this.f12068aG = 5;
this.f12072aK.sendEmptyMessage(2);
break;
case 8:
System.out.println("ble Synchronize data = get battery information");
byte b = bArr2[13];
String str4 = "BleService";
StringBuilder sb7 = new StringBuilder();
sb7.append("电池电量信息info:"); //Battery power info:
sb7.append(b);
Log.i(str4, sb7.toString());
StringBuilder sb8 = new StringBuilder();
sb8.append(b);
sb8.append("");
C2792ai.m11929a(getApplicationContext(), "battery", sb8.toString());
new C2800ap(this, "bat_info").mo20459a("level", (int) b);
if (this.f12126bl != null) {
this.f12126bl.mo20726a(b);
}
// broadcast discovered
m12398g(f12019G);
f12049c = bArr2[13] & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD;
f12050d = ((bArr2[7] & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD) << 8) | (bArr2[14] & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD);
f12051e = bArr2[15] & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD;
int[] a = C2787ad.m11876a(bArr2[16]);
int[] a2 = C2787ad.m11876a(bArr2[17]);
int[] a3 = C2787ad.m11876a(bArr2[18]);
int[] a4 = C2787ad.m11876a(bArr2[19]);
int[] a5 = C2787ad.m11876a(bArr2[20]);
for (int i2 = 0; i2 < a.length; i2++) {
PrintStream printStream3 = System.out;
StringBuilder sb9 = new StringBuilder();
sb9.append("08 固件升级4 = i = "); //08 Firmware Upgrade 4 = i =
sb9.append(i2);
sb9.append(" result_data = ");
sb9.append(a[i2]);
printStream3.println(sb9.toString());
}
if (a[0] == 0) {
System.out.println("固件升级4 = ECG 频率 = 125"); //Firmware Upgrade 4 = ECG Frequency = 125
this.f12147u.mo20042f(0);
} else {
System.out.println("固件升级4 = ECG 频率 = 250"); // Firmware upgrade 4 = ECG frequency = 250
this.f12147u.mo20042f(1);
}
if (a[3] == 0) {
System.out.println("固件升级4 = PPG 频率 = 25");
this.f12147u.mo20046g(0);
} else {
this.f12147u.mo20046g(1);
System.out.println("固件升级4 = PGG 频率 = 不知道?");
}
if (a[1] == 0 && a[2] == 0) {
System.out.println("固件升级4 = ECG = 有");
System.out.println("固件升级4 = PPG = 无");
this.f12147u.mo20049h(1);
this.f12147u.mo20053i(0);
} else if (a[1] == 0 && a[2] == 1) {
System.out.println("固件升级4 = ECG = 有");
System.out.println("固件升级4 = PPG = 有");
this.f12147u.mo20049h(1);
this.f12147u.mo20053i(1);
} else if (a[1] == 1 && a[2] == 0) {
System.out.println("固件升级4 = ECG = 无");
System.out.println("固件升级4 = PPG = 有");
this.f12147u.mo20049h(0);
this.f12147u.mo20053i(1);
} else if (a[1] == 1 && a[2] == 1) {
System.out.println("固件升级4 = ECG = 无"); //Firmware Upgrade 4 = ECG = None
System.out.println("固件升级4 = PPG = 无");
this.f12147u.mo20049h(0);
this.f12147u.mo20053i(0);
}
if (a.length >= 8) {
if (a[5] == 1) {
// Firmware return value = WeChat motion = Not supported =
// ("Version number is greater than or equal to 23" and "WeChat
// flag is not supported") = Still not supported
System.out.println("固件返回值 = 微信运动 = 不支持 = (“版本号大于等于23”则且“微信标志位不支持”)=还是不支持");
this.f12147u.mo19951J(false);
} else {
System.out.println("固件返回值 = 微信运动 = 支持 = (“版本号大于等于23”则且且“微信标志位不支持”)=支持");
this.f12147u.mo19951J(true);
}
if (a[6] == 1) {
System.out.println("固件返回值 = 计步算法 = 算法2");
this.f12147u.mo20064l(1);
} else {
this.f12147u.mo20064l(0);
System.out.println("固件返回值 = 计步算法 = 算法1");
}
if (a[7] == 1) {
this.f12147u.mo20067m(1);
System.out.println("固件返回值 = 通知类型 = 推送类型2");
} else {
this.f12147u.mo20067m(0);
System.out.println("固件返回值 = 通知类型 = 推送类型1");
}
}
if (a2[0] == 1) {
this.f12147u.mo20057j(1);
System.out.println("固件返回值 = 血压 = 不支持");
} else {
this.f12147u.mo20057j(0);
System.out.println("固件返回值 = 血压 = 支持");
}
if (a2[1] == 1) {
this.f12147u.mo20061k(1);
System.out.println("固件返回值 = 心率 = 连续心率");
} else {
this.f12147u.mo20061k(0);
System.out.println("固件返回值 = 心率 = 整点心率");
}
if (a2[2] == 1) {
System.out.println("固件返回值 传图片 = 支持");
this.f12147u.mo20070n(1);
this.f12073aL.postDelayed(new C2939f(this), 400);
} else {
System.out.println("固件返回值 传图片 = 不支持");
this.f12147u.mo20070n(0);
}
if (a2[3] == 1) {
System.out.println("固件返回值 Flash = 可用");
this.f12147u.mo20073o(1);
} else {
System.out.println("固件返回值 Flash = 不可用"); //Firmware return value Flash = not available
this.f12147u.mo20073o(0);
}
int i3 = ((bArr2[17] << 4) >> 5) & 7;
PrintStream printStream4 = System.out;
StringBuilder sb10 = new StringBuilder();
sb10.append("固件返回值 = 屏保个数 = ");
sb10.append(i3);
printStream4.println(sb10.toString());
this.f12147u.mo19925B(i3);
byte b2 = bArr2[17] & 1;
PrintStream printStream5 = System.out;
StringBuilder sb11 = new StringBuilder();
sb11.append("固件返回值 = 是否支持屏幕设置 = ");
sb11.append(b2);
printStream5.println(sb11.toString());
if (b2 == 1) {
this.f12147u.mo20098w(true);
} else {
this.f12147u.mo20098w(false);
}
if (a3[0] == 1) {
System.out.println("firmware return value = weather = support");
this.f12147u.mo20102x(true);
} else {
System.out.println("firmware return value = weather = not supported");
this.f12147u.mo20102x(false);
}
if (a3[1] == 1) {
System.out.println("firmware return value = scan mode = vertical");
this.f12147u.mo20105y(true);
} else {
System.out.println("firmware return value = scan mode = landscape");
this.f12147u.mo20105y(false);
}
if (a3[2] == 1) {
System.out.println("firmware return value = physiological cycle = support");
this.f12147u.mo20107z(true);
} else {
System.out.println("firmware return value = physiological cycle = not supported");
this.f12147u.mo20107z(false);
}
if (a3[3] == 0 && a3[4] == 0) {
System.out.println("sport mode = not supported");
this.f12147u.mo19923A(false);
this.f12147u.mo19953K(1);
} else if (a3[3] == 0 && a3[4] == 1) {
System.out.println("运动模式 = 支持 协议1=01");
this.f12147u.mo19923A(true);
this.f12147u.mo19953K(1);
} else if (a3[3] == 1 && a3[4] == 0) {
System.out.println("运动模式 = 支持 协议2=10");
this.f12147u.mo19923A(true);
this.f12147u.mo19953K(2);
} else if (a3[3] == 1 && a3[4] == 1) {
System.out.println("Sports Mode = Support Protocol 3=11");
this.f12147u.mo19923A(true);
this.f12147u.mo19953K(3);
}
if (a3[5] == 1) {
System.out.println("firmware return value = sleep preference = support");
this.f12147u.mo19926B(true);
} else {
System.out.println("firmware return value = sleep preference = not supported");
this.f12147u.mo19926B(false);
}
if (a3[6] == 1) {
System.out.println("firmware return value = do not disturb mode = support");
this.f12147u.mo19929C(true);
} else {
System.out.println("firmware return value = do not disturb mode = not supported");
this.f12147u.mo19929C(false);
}
if (a3[7] == 1) {
System.out.println("firmware return value = heart rate interval = support");
this.f12147u.mo19932D(true);
} else {
System.out.println("firmware return value = heart rate interval = not supported");
this.f12147u.mo19932D(false);
}
if (a4[0] == 1) {
System.out.println("firmware return value = PPG calibration = support");
this.f12147u.mo19935E(true);
} else {
System.out.println("firmware return value = PPG calibration = not supported");
this.f12147u.mo19935E(false);
}
if (a4[1] != 1) {
i = 0;
}
if (a4[2] == 1) {
i += 4;
}
if (a4[3] == 1) {
i += 2;
}
if (a4[4] == 1) {
i++;
}
this.f12147u.mo19971T(i);
if (a4[5] == 1) {
System.out.println("firmware return value = target distance = support");
this.f12147u.mo19939F(true);
} else {
System.out.println("firmware return value = target distance = not supported");
this.f12147u.mo19939F(false);
}
if (a4[6] == 1) {
System.out.println("firmware return value = target calories = support");
this.f12147u.mo19942G(true);
} else {
System.out.println("firmware return value = target calories = not supported");
this.f12147u.mo19942G(false);
}
if (a4[7] == 1) {
System.out.println("firmware return value = temperature unit setting = support");
this.f12147u.mo19945H(true);
} else {
System.out.println("firmware return value = temperature unit setting = not supported);
this.f12147u.mo19945H(false);
}
if (a5[0] == 1) {
System.out.println("firmware return value = whether the alarm is valid (turn on do not disturb) = support");
this.f12147u.mo19948I(true);
} else {
System.out.println("firmware return value = whether the alarm is valid (turn on do not disturb) = not supported");
this.f12147u.mo19948I(false);
}
PrintStream printStream6 = System.out;
StringBuilder sb12 = new StringBuilder();
sb12.append("firmware return value = DeviceVersion = ");
sb12.append(f12051e);
printStream6.println(sb12.toString());
PrintStream printStream7 = System.out;
StringBuilder sb13 = new StringBuilder();
sb13.append("固件返回值 = DeviceType = ");
sb13.append(f12050d);
printStream7.println(sb13.toString());
PrintStream printStream8 = System.out;
StringBuilder sb14 = new StringBuilder();
sb14.append("固件返回值 = data lenght = ");
sb14.append(bArr2.length);
printStream8.println(sb14.toString());
PrintStream printStream9 = System.out;
StringBuilder sb15 = new StringBuilder();
sb15.append("固件返回值 = data lenght result_two_data = ");
sb15.append(a2.length);
printStream9.println(sb15.toString());
PrintStream printStream10 = System.out;
StringBuilder sb16 = new StringBuilder();
sb16.append("固件返回值 = data lenght result_three_data = ");
sb16.append(a2.length);
printStream10.println(sb16.toString());
PrintStream printStream11 = System.out;
StringBuilder sb17 = new StringBuilder();
sb17.append("08 固件升级1 = ");
sb17.append(f12049c);
printStream11.println(sb17.toString());
PrintStream printStream12 = System.out;
StringBuilder sb18 = new StringBuilder();
sb18.append("08 固件升级2 = ");
sb18.append(f12050d);
printStream12.println(sb18.toString());
PrintStream printStream13 = System.out;
StringBuilder sb19 = new StringBuilder();
sb19.append("08 固件升级3 = ");
sb19.append(f12051e);
printStream13.println(sb19.toString());
System.out.println("08 固件升级8 ");
PrintStream printStream14 = System.out;
StringBuilder sb20 = new StringBuilder();
sb20.append("08 固件升级8 device.getAddress = ");
sb20.append(f12052f);
printStream14.println(sb20.toString());
PrintStream printStream15 = System.out;
StringBuilder sb21 = new StringBuilder();
sb21.append("08 固件升级8 device.getName = ");
sb21.append(f12053g);
printStream15.println(sb21.toString());
PrintStream printStream16 = System.out;
StringBuilder sb22 = new StringBuilder();
sb22.append("08 固件升级8 device.getAddress = ");
sb22.append(f12052f);
printStream16.println(sb22.toString());
System.out.println("多次回调手环信息 = ACTION_GATT_SERVICES_DFU 11111 ");
m12398g(f12025M);
m12400h(f12025M);
if (f12052f != null && !f12052f.equals("") && !f12052f.equals("null") && f12053g != null && !f12053g.equals("") && !f12053g.equals("null")) {
if ((f12050d != -1) && (f12051e != -1)) {
if (f12050d >= 1 && f12051e >= 1) {
this.f12147u.mo20031c(C2787ad.m11889c(f12050d, f12051e));
this.f12147u.mo19979a(f12051e);
this.f12147u.mo20026b(f12050d);
if (this.f12147u.mo20033d().equals(C2787ad.m11889c(118, 27))) {
this.f12147u.mo20049h(1);
this.f12147u.mo20053i(1);
this.f12147u.mo20061k(0);
System.out.println("固件升级4 = ECG = 有 特殊处理");
System.out.println("固件升级4 = PPG = 有 特殊处理");
System.out.println("固件升级4 = 是否支持血压 = 不支持 特殊处理");
}
if (this.f12147u.mo20033d().equals(C2787ad.m11889c(87, 32)) || this.f12147u.mo20033d().equals(C2787ad.m11889c(87, 31))) {
this.f12147u.mo20095v(false);
}
}
m12402i(C2787ad.m11896d(f12050d, f12051e));
break;
}
}
break;
case 12:
System.out.println("来电拒接");
C2790ag.m11914a(this);
break;
case 14:
mo20698h(bArr);
break;
case 15:
byte b3 = bArr2[13] & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD;
PrintStream printStream17 = System.out;
StringBuilder sb23 = new StringBuilder();
sb23.append("ble 同步数据 = is_success = ");
sb23.append(b3);
printStream17.println(sb23.toString());
if (b3 != 1) {
System.out.println("ble 同步数据 = no");
m12398g(f12029Q);
break;
} else {
System.out.println("ble 同步数据 = yes");
m12398g(f12028P);
break;
}
case 16:
boolean c3 = mo20687c(bArr);
PrintStream printStream18 = System.out;
StringBuilder sb24 = new StringBuilder();
sb24.append("离线血压校验 checkData = ");
sb24.append(c3);
printStream18.println(sb24.toString());
if (c3) {
mo20700i(bArr);
break;
}
break;
}
}
}
}
/* access modifiers changed from: private */
/* renamed from: o */
public String m12411o(byte[] bArr) {
StringBuilder sb = new StringBuilder();
for (byte b : bArr) {
String hexString = Integer.toHexString(b & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD);
if (hexString.length() == 1) {
StringBuilder sb2 = new StringBuilder();
sb2.append("0");
sb2.append(hexString);
hexString = sb2.toString();
}
sb.append(hexString);
}
return sb.toString();
}
/* renamed from: g */
public static int m12396g() {
return f12042aM;
}
/* renamed from: b */
public static void m12381b(int i) {
f12042aM = i;
}
/* renamed from: a */
public void mo20674a(C2921b bVar) {
this.f12126bl = bVar;
}
/* renamed from: a */
public void mo20675a(C2922c cVar) {
this.f12127bm = cVar;
}
/* renamed from: a */
public void mo20676a(C2926g gVar) {
this.f12128bn = gVar;
}
/* renamed from: a */
public void mo20673a(C2920a aVar) {
this.f12129bo = aVar;
}
/* renamed from: b */
public void mo20682b(String str) {
try {
mo20681a(C2955v.m12523a(str));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
/* renamed from: c */
public void mo20686c(String str) {
try {
mo20681a(C2955v.m12539b(str));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
/* renamed from: d */
public void mo20689d(String str) {
try {
mo20681a(C2955v.m12548c(str));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
/* renamed from: h */
public void mo20697h() {
mo20681a(C2955v.m12533b());
}
/* renamed from: a */
public void mo20672a(C2583f fVar) {
if (fVar != null) {
mo20681a(C2955v.m12517a(Integer.valueOf(fVar.mo19717c()).intValue(), Integer.valueOf(fVar.mo19721e()).intValue(), Integer.valueOf(fVar.mo19719d()).intValue()));
}
}
/* renamed from: a */
public void mo20669a(int i, int i2, int i3) {
mo20681a(C2955v.m12517a(i, i2, i3));
}
/* renamed from: a */
public void mo20667a(int i, int i2) {
mo20681a(C2955v.m12515a(i, i2));
}
/* renamed from: i */
public void mo20699i() {
//from start measuring in ECGMeasure.java m11344n()
mo20681a(C2955v.m12573h());
}
/* renamed from: j */
public void mo20701j() {
mo20681a(C2955v.m12577i());
}
/* renamed from: k */
public List<BluetoothGattService> mo20703k() {
if (this.f12074aN == null) {
return null;
}
return this.f12074aN.getServices();
}
/* access modifiers changed from: private */
/* renamed from: a */
// f12037Y = 00003e03-0000-1000-8000-00805f9b34fb
//BleService.this.f12089af = BleService.this.f12079aS.getCharacteristic(BleService.f12037Y);
public void m12374a(String str, BluetoothGatt bluetoothGatt, BluetoothGattCharacteristic bluetoothGattCharacteristic) {
if (bluetoothGatt != null && bluetoothGattCharacteristic != null) {
bluetoothGatt.setCharacteristicNotification(bluetoothGattCharacteristic, true);
// f12030R = 00002902-0000-1000-8000-00805f9b34fb
BluetoothGattDescriptor descriptor = bluetoothGattCharacteristic.getDescriptor(f12030R);
descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
bluetoothGatt.writeDescriptor(descriptor);
}
}
/* access modifiers changed from: private */
/* renamed from: b */
public boolean m12385b(String str, BluetoothGatt bluetoothGatt, BluetoothGattCharacteristic bluetoothGattCharacteristic) {
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append("ble 使能 = ");
sb.append(str);
printStream.println(sb.toString());
if (bluetoothGatt == null || bluetoothGattCharacteristic == null) {
return false;
}
bluetoothGatt.setCharacteristicNotification(bluetoothGattCharacteristic, true);
BluetoothGattDescriptor descriptor = bluetoothGattCharacteristic.getDescriptor(f12030R);
descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
return bluetoothGatt.writeDescriptor(descriptor);
}
/* renamed from: d */
public static String m12391d(byte[] bArr) {
String str = "";
for (byte b : bArr) {
String hexString = Integer.toHexString(b & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD);
if (hexString.length() == 1) {
StringBuilder sb = new StringBuilder();
sb.append('0');
sb.append(hexString);
hexString = sb.toString();
}
StringBuilder sb2 = new StringBuilder();
sb2.append(str);
sb2.append(hexString.toUpperCase());
sb2.append("-");
str = sb2.toString();
}
return str;
}
/* renamed from: i */
private void m12402i(String str) {
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append("08 固件升级8 device.getAddress = ");
sb.append(f12052f);
printStream.println(sb.toString());
PrintStream printStream2 = System.out;
StringBuilder sb2 = new StringBuilder();
sb2.append("08 固件升级8 device.getName = ");
sb2.append(f12053g);
printStream2.println(sb2.toString());
PrintStream printStream3 = System.out;
StringBuilder sb3 = new StringBuilder();
sb3.append("08 固件升级8 device.getAddress = ");
sb3.append(f12052f);
printStream3.println(sb3.toString());
StringBuilder sb4 = new StringBuilder();
sb4.append("{c:\"ctl000018\",m:\"saveDevice\",data:{c_uid:\"");
sb4.append(this.f12076aP);
sb4.append("\",c_mac_address:\"");
sb4.append(f12052f);
sb4.append("\",c_device_name:\"");
sb4.append(f12053g);
sb4.append("\",c_identifier:\"");
sb4.append(String.valueOf(f12050d));
sb4.append("\",c_version:\"");
sb4.append(str);
sb4.append("\"}}");
try {
this.f12133bs = new JSONObject(sb4.toString());
} catch (JSONException e) {
e.printStackTrace();
}
PrintStream printStream4 = System.out;
StringBuilder sb5 = new StringBuilder();
sb5.append("ble 得到 上传版本号到后台 = 上一次的 = ");
sb5.append(this.f12147u.mo20015aq());
printStream4.println(sb5.toString());
PrintStream printStream5 = System.out;
StringBuilder sb6 = new StringBuilder();
sb6.append("ble 得到 上传版本号到后台 = 这一次的 = ");
sb6.append(this.f12133bs.toString());
printStream5.println(sb6.toString());
if (!this.f12133bs.toString().equals(this.f12147u.mo20015aq())) {
C2674d.m11041a(getApplicationContext(), C2804d.f11532b, "BleService", this.f12133bs, new C2940g(this, getApplicationContext(), C2671a.f10520f, C2671a.f10521g));
}
}
/* renamed from: a */
private void m12376a(String str, String str2, int i, int i2, int i3, int i4) {
JSONObject jSONObject = new JSONObject();
if (i <= 280 && i >= 30) {
mo20709o();
HashMap hashMap = new HashMap();
hashMap.put("c_uid", this.f12076aP);
hashMap.put("c_heart", String.valueOf(i));
hashMap.put("c_systolic", String.valueOf(i2));
hashMap.put("c_diastolic", String.valueOf(i3));
hashMap.put("c_ecg_report", String.valueOf(i4));
hashMap.put("c_ecg_raw_data", str2);
hashMap.put("c_date", str);
hashMap.put("c_health_index", String.valueOf(this.f12141o));
hashMap.put("c_fatigue_index", String.valueOf(this.f12143q));
hashMap.put("c_body_load", String.valueOf(this.f12144r));
hashMap.put("c_body_quality", String.valueOf(this.f12145s));
hashMap.put("c_cardiac_function", String.valueOf(this.f12146t));
JSONObject jSONObject2 = new JSONObject(hashMap);
ArrayList arrayList = new ArrayList();
arrayList.add(jSONObject2.toString());
try {
jSONObject.put("c", "ctl000016");
jSONObject.put("m", "postHealthData");
jSONObject.put("data", arrayList.toString());
} catch (JSONException e) {
e.printStackTrace();
}
C2674d.m11041a(this, C2804d.f11532b, "BleService", jSONObject, new C2941h(this, this, C2671a.f10520f, C2671a.f10521g));
}
}
/* renamed from: l */
public void mo20705l() {
this.f12134bt.removeMessages(1);
m12398g(f12026N);
this.f12105av = 25;
System.out.println("Offline ECG data = timer START");
this.f12134bt.sendEmptyMessage(1);
f12046aw = false;
}
/* renamed from: m */
public void mo20707m() {
m12398g(f12027O);
System.out.println("Offline ECG data = timer STOP");
this.f12134bt.sendEmptyMessage(0);
f12046aw = true;
}
/* access modifiers changed from: 0000 */
/* renamed from: n */
public void mo20708n() {
this.f12136bv = "";
this.f12137bw = "";
this.f12138bx = 0;
this.f12139by = 0;
this.f12140bz = 0;
this.f12108bA = 0;
this.f12109bB = 0;
this.f12110bC.mo20463a();
C2826z.f11613I = 0;
this.f12111bD = this.f12135bu.mo20132c();
this.f12112bE = this.f12135bu.mo20136d();
this.f12113bF = this.f12135bu.mo20140e();
C2825y.m12122a();
}
/* access modifiers changed from: 0000 */
/* renamed from: a */
// get the value of heart rate
public void mo20671a(BluetoothGattCharacteristic bluetoothGattCharacteristic) {
// for characteristic 3e03
String str;
byte[] value = bluetoothGattCharacteristic.getValue();
if ((value[0] & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD) == 170 && (value[1] & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD) == 170 && (value[2] & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD) == 170 && (value[3] & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD) == 170)
{
mo20708n();
int i = (value[4] & 252) >> 2;
int i2 = ((3 & value[4]) << 2) | ((value[5] & 192) >> 6);
int i3 = (value[5] & DocWriter.f5396GT) >> 1;
int i4 = ((value[6] & 240) >> 4) | ((value[5] & 1) << 4);
int i5 = ((value[6] & BidiOrder.f5448B) << 2) | ((value[7] & 192) >> 6);
byte b = value[7] & 63;
if (i >= 10) {
StringBuilder sb = new StringBuilder();
sb.append("20");
sb.append(String.valueOf(i));
str = sb.toString();
} else {
StringBuilder sb2 = new StringBuilder();
sb2.append("200");
sb2.append(String.valueOf(i));
str = sb2.toString();
}
String valueOf = String.valueOf(i2);
if (i2 < 10) {
StringBuilder sb3 = new StringBuilder();
sb3.append("0");
sb3.append(valueOf);
valueOf = sb3.toString();
}
String valueOf2 = String.valueOf(i3);
if (i3 < 10) {
StringBuilder sb4 = new StringBuilder();
sb4.append("0");
sb4.append(valueOf2);
valueOf2 = sb4.toString();
}
String valueOf3 = String.valueOf(i4);
if (i4 < 10) {
StringBuilder sb5 = new StringBuilder();
sb5.append("0");
sb5.append(valueOf3);
valueOf3 = sb5.toString();
}
String valueOf4 = String.valueOf(i5);
if (i5 < 10) {
StringBuilder sb6 = new StringBuilder();
sb6.append("0");
sb6.append(valueOf4);
valueOf4 = sb6.toString();
}
String valueOf5 = String.valueOf(b);
if (b < 10) {
StringBuilder sb7 = new StringBuilder();
sb7.append("0");
sb7.append(valueOf5);
valueOf5 = sb7.toString();
}
StringBuilder sb8 = new StringBuilder();
sb8.append(str);
sb8.append("-");
sb8.append(valueOf);
sb8.append("-");
sb8.append(valueOf2);
sb8.append(" ");
sb8.append(valueOf3);
sb8.append(":");
sb8.append(valueOf4);
sb8.append(":");
sb8.append(valueOf5);
this.f12137bw = sb8.toString();
this.f12109bB = (((value[8] & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD) << 8) | (value[9] & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD)) - 1;
PrintStream printStream = System.out;
StringBuilder sb9 = new StringBuilder();
sb9.append("离线心电数据 = 是包头 OffLineEcgTime = ");
sb9.append(this.f12137bw);
sb9.append(" OffLineEcgNowPageSize ");
sb9.append(this.f12109bB);
printStream.println(sb9.toString());
mo20705l();
return;
}
int[] iArr = new int[9];
int[] e = C2955v.m12562e(bluetoothGattCharacteristic);
for (int i6 : e) {
StringBuilder sb10 = new StringBuilder();
sb10.append(this.f12136bv);
sb10.append(String.valueOf(i6));
sb10.append(",");
this.f12136bv = sb10.toString();
double c = (double) ((float) C2826z.m12137c(C2826z.m12139e(C2826z.m12126a(((((double) i6) * 3300.0d) / 1638000.0d) * 64.0d))));
C2825y.m12123a(10.0d * c);
this.f12110bC.mo20464a(c);
C2826z.m12131a(this.f12110bC, this.f12072aK);
}
this.f12109bB--;
if (this.f12109bB == 5) {
this.f12138bx = C2826z.f11621a;
this.f12139by = C2787ad.m11860a(C2826z.f11621a, this.f12111bD, this.f12112bE);
this.f12140bz = C2787ad.m11879b(C2826z.f11621a, this.f12111bD, this.f12112bE);
if (this.f12138bx <= 50) {
this.f12108bA = 1;
} else if (this.f12138bx >= 100) {
this.f12108bA = 2;
}
PrintStream printStream2 = System.out;
StringBuilder sb11 = new StringBuilder();
// Offline ECG data = yes data = end = heart rate =
sb11.append("离线心电数据 = 是数据 = 结束了 = 心率 = ");
sb11.append(this.f12138bx);
// High pressure =
sb11.append(" 高压 = ");
sb11.append(this.f12139by);
//Low pressure =
sb11.append(" 低压 = ");
sb11.append(this.f12140bz);
// Report =
sb11.append(" 报告 = ");
sb11.append(this.f12108bA);
// ECG data length =
sb11.append(" 心电数据长度 = ");
sb11.append(this.f12136bv.length());
printStream2.println(sb11.toString());
mo20707m();
C2509a.m10291a(this.f12138bx, this.f12139by, this.f12140bz, this.f12108bA);
// m12376a(String date, String raw_ecg, int heart_rate, int c_systolic, int c_diastolic, int c_ecg_report)
m12376a(this.f12137bw, this.f12136bv, this.f12138bx, this.f12139by, this.f12140bz, this.f12108bA);
mo20669a(this.f12138bx, this.f12139by, this.f12140bz);
} else if (this.f12109bB > 10) {
f12046aw = false;
PrintStream printStream3 = System.out;
StringBuilder sb12 = new StringBuilder();
sb12.append("离线心电数据 = 是数据 还有 = ");
sb12.append(this.f12109bB);
printStream3.println(sb12.toString());
} else {
System.out.println("离线心电数据 = 是数据 = 2222222");
}
}
/* access modifiers changed from: 0000 */
/* renamed from: e */
public void mo20692e(byte[] bArr) {
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append("ble 得到 运动 解析运动数据 = 日期 = ");
sb.append(C2955v.m12543c(bArr));
sb.append("===================");
printStream.println(sb.toString());
PrintStream printStream2 = System.out;
StringBuilder sb2 = new StringBuilder();
sb2.append("ble 得到 数据测试 = 日期 = ");
sb2.append(C2955v.m12543c(bArr));
sb2.append("===================");
printStream2.println(sb2.toString());
this.f12076aP = C2792ai.m11930b(this, "uid", "");
C2579b a = C2579b.m10583a(bArr, this.f12076aP, this);
if (a == null || !C2955v.m12568g(a.mo19644b())) {
System.out.println("ble 得到 运动 mBleMotionModle = null 或者 日期不合法");
return;
}
this.f12064a = C2955v.m12511a(this.f12064a, a);
PrintStream printStream3 = System.out;
StringBuilder sb3 = new StringBuilder();
sb3.append("ble 得到 运动 解析运动数据 = mBleMotionModle = ");
sb3.append(a.toString());
printStream3.println(sb3.toString());
PrintStream printStream4 = System.out;
StringBuilder sb4 = new StringBuilder();
sb4.append("ble 得到 运动 解析运动数据 lenght = ");
sb4.append(this.f12064a.size());
printStream4.println(sb4.toString());
}
/* access modifiers changed from: 0000 */
/* renamed from: f */
public void mo20694f(byte[] bArr) {
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append("ble 得到 睡眠 解析睡眠数据 = 日期 = ");
sb.append(C2955v.m12543c(bArr));
sb.append(" 加1 = ");
sb.append(C2786ac.m11851p(C2955v.m12543c(bArr)));
printStream.println(sb.toString());
this.f12076aP = C2792ai.m11930b(this, "uid", "");
C2581d a = C2581d.m10615a(bArr, this.f12076aP);
if (a == null || !C2955v.m12568g(a.mo19676b())) {
System.out.println("ble 得到 睡眠 mBleSleepModle = null 或者 日期不合法");
return;
}
this.f12064a = C2955v.m12512a(this.f12064a, a);
PrintStream printStream2 = System.out;
StringBuilder sb2 = new StringBuilder();
sb2.append("ble 得到 睡眠 解析睡眠数据 = mBleSleepModle = ");
sb2.append(a.toString());
printStream2.println(sb2.toString());
PrintStream printStream3 = System.out;
StringBuilder sb3 = new StringBuilder();
sb3.append("ble 得到 睡眠 解析睡眠数据 lenght = ");
sb3.append(this.f12064a.size());
printStream3.println(sb3.toString());
if (m12383b(a)) {
this.f12107az = null;
return;
}
this.f12107az = a;
System.out.println("ble 得到 睡眠 解析睡眠数据 无效 = ");
}
/* access modifiers changed from: 0000 */
/* renamed from: g */
public void mo20696g(byte[] bArr) {
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append("ble 得到 心率 解析心率数据= 日期 = ");
sb.append(C2955v.m12543c(bArr));
printStream.println(sb.toString());
this.f12076aP = C2792ai.m11930b(this, "uid", "");
C2578a a = C2578a.m10568a(bArr, this.f12076aP);
if (a == null || !C2955v.m12568g(a.mo19629b())) {
System.out.println("ble 得到 心率 mBleHeartModle = null 或者 日期不合法");
return;
}
this.f12064a = C2955v.m12510a(this.f12064a, a);
PrintStream printStream2 = System.out;
StringBuilder sb2 = new StringBuilder();
sb2.append("ble 得到 心率 解析心率数据 = mBleSleepModle = ");
sb2.append(a.toString());
printStream2.println(sb2.toString());
PrintStream printStream3 = System.out;
StringBuilder sb3 = new StringBuilder();
sb3.append("ble 得到 心率 解析心率数据 lenght = ");
sb3.append(this.f12064a.size());
printStream3.println(sb3.toString());
}
/* access modifiers changed from: 0000 */
/* renamed from: h */
public void mo20698h(byte[] bArr) {
byte b = bArr[14] & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD;
byte b2 = bArr[16] & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD;
byte b3 = bArr[17] & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD;
byte b4 = bArr[18] & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD;
int[] a = C2787ad.m11876a(bArr[19]);
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append("屏保返回值 = screensaverWidth = ");
sb.append(b);
printStream.println(sb.toString());
PrintStream printStream2 = System.out;
StringBuilder sb2 = new StringBuilder();
sb2.append("屏保返回值 = screensaverHeight = ");
sb2.append(b2);
printStream2.println(sb2.toString());
PrintStream printStream3 = System.out;
StringBuilder sb3 = new StringBuilder();
sb3.append("屏保返回值 = timeWidth = ");
sb3.append(b3);
printStream3.println(sb3.toString());
PrintStream printStream4 = System.out;
StringBuilder sb4 = new StringBuilder();
sb4.append("屏保返回值 = timeHeight = ");
sb4.append(b4);
printStream4.println(sb4.toString());
this.f12147u.mo20097w((int) b);
this.f12147u.mo20101x((int) b2);
this.f12147u.mo20104y((int) b3);
this.f12147u.mo20106z((int) b4);
PrintStream printStream5 = System.out;
StringBuilder sb5 = new StringBuilder();
sb5.append("屏保返回值 = result_data[0] = ");
sb5.append(a[0]);
printStream5.println(sb5.toString());
PrintStream printStream6 = System.out;
StringBuilder sb6 = new StringBuilder();
sb6.append("屏保返回值 = result_data[1] = ");
sb6.append(a[1]);
printStream6.println(sb6.toString());
PrintStream printStream7 = System.out;
StringBuilder sb7 = new StringBuilder();
sb7.append("屏保返回值 = result_data[2] = ");
sb7.append(a[2]);
printStream7.println(sb7.toString());
if (a[0] == 0 && a[1] == 0 && a[2] == 0) {
System.out.println("屏保返回值 = 屏幕类型 = 方形");
this.f12147u.mo20082r(0);
} else if (a[0] == 0 && a[1] == 0 && a[2] == 1) {
System.out.println("屏保返回值 = 屏幕类型 = 球拍1");
this.f12147u.mo20082r(1);
System.out.println("屏保返回值 = 屏幕类型 = 球拍2");
} else if (a[0] == 0 && a[1] == 1 && a[2] == 0) {
System.out.println("屏保返回值 = 屏幕类型 = 圆形");
this.f12147u.mo20082r(2);
int i = (b - b3) / 2;
int i2 = (b2 - b4) / 2;
PrintStream printStream8 = System.out;
StringBuilder sb8 = new StringBuilder();
sb8.append("xx2 = ");
sb8.append(i);
printStream8.println(sb8.toString());
PrintStream printStream9 = System.out;
StringBuilder sb9 = new StringBuilder();
sb9.append("yy2 = ");
sb9.append(i2);
printStream9.println(sb9.toString());
this.f12147u.mo20088t(i);
this.f12147u.mo20091u(i2);
this.f12147u.mo20094v(1);
}
this.f12073aL.postDelayed(new C2943j(this), 400);
}
/* access modifiers changed from: 0000 */
/* renamed from: i */
public void mo20700i(byte[] bArr) {
byte b = bArr[15] & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD;
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append("离线血压 = 个数 = ");
sb.append(b);
printStream.println(sb.toString());
this.f12076aP = C2792ai.m11930b(this, "uid", "");
List a = C2583f.m10656a(bArr, this.f12076aP);
if (a != null && a.size() > 0) {
PrintStream printStream2 = System.out;
StringBuilder sb2 = new StringBuilder();
sb2.append("离线血压 my_list = ");
sb2.append(a.toString());
printStream2.println(sb2.toString());
for (int i = 0; i < a.size(); i++) {
PrintStream printStream3 = System.out;
StringBuilder sb3 = new StringBuilder();
sb3.append("离线血压 my_list i = ");
sb3.append(i);
sb3.append(" health = ");
sb3.append(((C2583f) a.get(i)).toString());
printStream3.println(sb3.toString());
}
mo20677a(a);
}
}
/* access modifiers changed from: 0000 */
/* renamed from: j */
public void mo20702j(byte[] bArr) {
byte b = bArr[15] & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD;
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append("离线血氧 = 个数 = ");
sb.append(b);
printStream.println(sb.toString());
if (bArr.length >= 16 && b != 0) {
for (int i = 0; i < b; i++) {
byte[] bArr2 = new byte[5];
for (int i2 = 0; i2 < 5; i2++) {
bArr2[i2] = bArr[i2 + 16 + (i * 5)];
}
String a = C2583f.m10655a(bArr2);
byte b2 = bArr2[4] & SocksProxyConstants.NO_ACCEPTABLE_AUTH_METHOD;
if (C2955v.m12572h(a)) {
PrintStream printStream2 = System.out;
StringBuilder sb2 = new StringBuilder();
sb2.append("离线血氧 = i = ");
sb2.append(i);
sb2.append(" measure_time = ");
sb2.append(a);
sb2.append(" spo2 = ");
sb2.append(b2);
printStream2.println(sb2.toString());
} else {
System.out.println("ble 得到 离线血氧 日期不合法");
}
}
}
}
/* access modifiers changed from: 0000 */
/* renamed from: a */
public void mo20677a(List<C2583f> list) {
if (list.size() > 0) {
JSONObject jSONObject = new JSONObject();
ArrayList arrayList = new ArrayList();
if (list.size() > 0) {
int i = 0;
while (i < list.size()) {
C2583f fVar = (C2583f) list.get(i);
int intValue = Integer.valueOf(fVar.mo19717c()).intValue();
int intValue2 = Integer.valueOf(fVar.mo19721e()).intValue();
int intValue3 = Integer.valueOf(fVar.mo19719d()).intValue();
int intValue4 = Integer.valueOf(fVar.mo19713a()).intValue();
String b = fVar.mo19715b();
if (intValue <= 280 && intValue >= 30) {
if (C2786ac.m11853q(b)) {
C2509a.m10291a(intValue, intValue2, intValue3, intValue4);
}
HashMap hashMap = new HashMap();
hashMap.put("c_uid", fVar.mo19723f());
hashMap.put("c_heart", String.valueOf(intValue));
hashMap.put("c_systolic", String.valueOf(intValue2));
hashMap.put("c_diastolic", String.valueOf(intValue3));
hashMap.put("c_ecg_report", String.valueOf(intValue4));
hashMap.put("c_date", b);
hashMap.put("c_ecg_raw_data", "");
hashMap.put("c_ppg_raw_data", "");
arrayList.add(new JSONObject(hashMap).toString());
i++;
} else {
return;
}
}
}
if (arrayList != null && arrayList.size() != 0) {
try {
jSONObject.put("c", "ctl000016");
jSONObject.put("m", "postHealthData");
jSONObject.put("data", arrayList.toString());
} catch (JSONException e) {
e.printStackTrace();
}
C2674d.m11041a(this, C2804d.f11532b, "BleService", jSONObject, new C2944k(this, this, C2671a.f10520f, C2671a.f10521g));
}
}
}
/* renamed from: a */
private void m12377a(ArrayList<MovementData> arrayList) {
if (arrayList == null || arrayList.size() == 0) {
m12398g(f12021I);
return;
}
MovementData movementTodayData = MovementData.getMovementTodayData(arrayList);
if (movementTodayData.c_sleep_total_time != null && !movementTodayData.c_sleep_total_time.equals("") && !movementTodayData.c_sleep_total_time.equals("0")) {
this.f12147u.mo19981a(C2786ac.m11836i(), movementTodayData.c_sleep_total_time);
}
C2586i.m10690a(movementTodayData);
m12398g(f12021I);
JSONArray movementListData = MovementData.getMovementListData(arrayList);
HashMap hashMap = new HashMap();
hashMap.put("c", "ctl000016");
hashMap.put("m", "hpin7");
hashMap.put("data", movementListData);
this.f12065aA = new JSONObject(hashMap);
if (!this.f12065aA.toString().equals(this.f12147u.mo20012an())) {
C2674d.m11041a(getApplicationContext(), C2804d.f11532b, "BleService", this.f12065aA, new C2945l(this, getApplicationContext(), C2671a.f10520f, C2671a.f10521g));
}
}
/* access modifiers changed from: private */
/* renamed from: D */
public void m12359D() {
if (this.f12107az != null) {
StringBuilder sb = new StringBuilder();
sb.append("{c:\"ctl000001\",m:\"saveBadSleepData\",data:{userId:\"");
sb.append(this.f12107az.mo19674a());
sb.append("\",deviceMac:\"");
sb.append(f12052f);
sb.append("\",deviceName:\"");
sb.append(f12053g);
sb.append("\",deviceModel:\"");
sb.append(f12050d);
sb.append("\",deviceVersion:\"");
sb.append(f12051e);
sb.append("\",sleepDate:\"");
sb.append(this.f12107az.mo19676b());
sb.append("\",sleepdata:\"");
sb.append(this.f12107az.mo19696l());
sb.append("\"}}");
try {
this.f12066aB = new JSONObject(sb.toString());
} catch (JSONException e) {
e.printStackTrace();
}
if (!this.f12066aB.toString().equals(this.f12147u.mo20013ao())) {
C2674d.m11041a(getApplicationContext(), C2804d.f11532b, "BleService", this.f12066aB, new C2946m(this, getApplicationContext(), C2671a.f10520f, C2671a.f10521g));
}
}
}
/* renamed from: e */
public int mo20690e(String str) {
int i;
try {
i = C2955v.m12597p(str, this.f12147u.mo19962P()).length;
try {
mo20681a(C2955v.m12597p(str, this.f12147u.mo19962P()));
} catch (UnsupportedEncodingException e) {
e = e;
}
} catch (UnsupportedEncodingException e2) {
e = e2;
i = 0;
e.printStackTrace();
return i;
}
return i;
}
/* renamed from: a */
private boolean m12378a(C2581d dVar) {
if (dVar == null || dVar.mo19698m() == null || dVar.mo19698m().equals("")) {
return true;
}
SleepData sleepData = (SleepData) C2819s.m12091a(dVar.mo19698m().replace("*", "\""), SleepData.class);
if (sleepData == null || sleepData.sleepDataItems == null || sleepData.sleepDataItems.size() < 1) {
return true;
}
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append("ble 得到 睡眠 解析睡眠数据222 = sleepDataItems = ");
sb.append(sleepData.sleepDataItems.size());
printStream.println(sb.toString());
PrintStream printStream2 = System.out;
StringBuilder sb2 = new StringBuilder();
sb2.append("ble 得到 睡眠 解析睡眠数据222 = mBleSleepModle = ");
sb2.append(dVar.mo19684f());
printStream2.println(sb2.toString());
if (Integer.valueOf(dVar.mo19684f()).intValue() < 240 || sleepData.sleepDataItems.size() > 10) {
return true;
}
return false;
}
/* renamed from: b */
private boolean m12383b(C2581d dVar) {
if (dVar == null || dVar.mo19698m() == null || dVar.mo19698m().equals("")) {
return true;
}
SleepData sleepData = (SleepData) C2819s.m12091a(dVar.mo19698m().replace("*", "\""), SleepData.class);
if (sleepData == null || sleepData.sleepDataItems == null || sleepData.sleepDataItems.size() < 1 || sleepData.sleepDataItems.size() > 10) {
return true;
}
boolean z = true;
for (int i = 0; i < sleepData.sleepDataItems.size() - 1; i++) {
if (((SleepDataItem) sleepData.sleepDataItems.get(i)).sleep_type.equals("3") && Integer.valueOf(C2786ac.m11818c(((SleepDataItem) sleepData.sleepDataItems.get(i)).startTime, ((SleepDataItem) sleepData.sleepDataItems.get(i + 1)).startTime)).intValue() >= 240) {
z = false;
}
}
return z;
}
/* access modifiers changed from: 0000 */
/* renamed from: o */
public void mo20709o() {
if (this.f12135bu.mo20177u() >= 0) {
this.f12070aI = this.f12135bu.mo20177u();
} else {
this.f12070aI = 65;
}
if (this.f12135bu.mo20176t() >= 0) {
this.f12069aH = this.f12135bu.mo20176t();
} else {
this.f12069aH = C2813m.f11560F;
}
this.f12071aJ = this.f12135bu.mo20166n();
this.f12141o = 0;
this.f12142p = 0;
this.f12143q = 0;
this.f12144r = 0;
this.f12145s = 0;
this.f12146t = 0;
if (this.f12069aH > 0 && this.f12070aI > 0) {
this.f12141o = C2787ad.m11861a(Integer.valueOf(this.f12069aH).intValue(), Integer.valueOf(this.f12070aI).intValue(), this.f12071aJ, Integer.valueOf(C2509a.f9705a).intValue());
ArrayList b = C2825y.m12124b();
this.f12142p = C2825y.m12125c();
this.f12143q = C2787ad.m11858a(Integer.valueOf(C2509a.f9705a).intValue());
this.f12144r = C2787ad.m11887c(Integer.valueOf(this.f12069aH).intValue(), Integer.valueOf(this.f12070aI).intValue(), Integer.valueOf(C2509a.f9705a).intValue());
this.f12145s = C2787ad.m11880b(Integer.valueOf(this.f12069aH).intValue(), Integer.valueOf(this.f12070aI).intValue(), Integer.valueOf(C2509a.f9705a).intValue(), this.f12142p);
this.f12146t = C2787ad.m11898e(Integer.valueOf(C2509a.f9705a).intValue(), this.f12142p);
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append("指数 峰值 list_data1 = ");
sb.append(b);
printStream.println(sb.toString());
PrintStream printStream2 = System.out;
StringBuilder sb2 = new StringBuilder();
sb2.append("指数 峰值 size = ");
sb2.append(b.size());
printStream2.println(sb2.toString());
PrintStream printStream3 = System.out;
StringBuilder sb3 = new StringBuilder();
sb3.append("指数 峰值 AmpAvg = ");
sb3.append(this.f12142p);
printStream3.println(sb3.toString());
PrintStream printStream4 = System.out;
StringBuilder sb4 = new StringBuilder();
sb4.append("指数 健康 = health_number = ");
sb4.append(this.f12141o);
printStream4.println(sb4.toString());
PrintStream printStream5 = System.out;
StringBuilder sb5 = new StringBuilder();
sb5.append("指数 疲劳 fatigue_index = ");
sb5.append(this.f12143q);
printStream5.println(sb5.toString());
PrintStream printStream6 = System.out;
StringBuilder sb6 = new StringBuilder();
sb6.append("指数 负荷 load_index = ");
sb6.append(this.f12144r);
printStream6.println(sb6.toString());
PrintStream printStream7 = System.out;
StringBuilder sb7 = new StringBuilder();
sb7.append("指数 负荷 body_index = ");
sb7.append(this.f12145s);
printStream7.println(sb7.toString());
PrintStream printStream8 = System.out;
StringBuilder sb8 = new StringBuilder();
sb8.append("指数 负荷 heart_index = ");
sb8.append(this.f12146t);
printStream8.println(sb8.toString());
if (this.f12141o <= 0 || this.f12141o > 100) {
this.f12135bu.mo20153h(0);
} else {
this.f12135bu.mo20153h(this.f12141o);
}
if (this.f12143q <= 0 || this.f12143q > 100) {
this.f12135bu.mo20155i(0);
} else {
this.f12135bu.mo20155i(this.f12143q);
}
if (this.f12144r <= 0 || this.f12144r > 100) {
this.f12135bu.mo20159j(0);
} else {
this.f12135bu.mo20159j(this.f12144r);
}
if (this.f12145s <= 0 || this.f12145s > 100) {
this.f12135bu.mo20161k(0);
} else {
this.f12135bu.mo20161k(this.f12145s);
}
if (this.f12146t <= 0 || this.f12146t > 100) {
this.f12135bu.mo20163l(0);
} else {
this.f12135bu.mo20163l(this.f12146t);
}
}
}
/* renamed from: p */
public void mo20715p() {
if (this.f12149w != null) {
this.f12149w.startLeScan(this.f12114bG);
this.f12073aL.postDelayed(new C2936c(this), 1000);
}
}
/* renamed from: q */
public void mo20716q() {
mo20715p();
}
/* renamed from: a */
public static String m12366a(byte b) {
String[] strArr = {"0", "1", "2", "3", "4", "5", Constants.VIA_SHARE_TYPE_INFO, "7", "8", "9", HtmlTags.ANCHOR, HtmlTags.f5430B, "c", "d", "e", "f"};
byte b2 = b & BidiOrder.f5448B;
int i = (b >> 4) & 15;
StringBuilder sb = new StringBuilder();
sb.append(strArr[i]);
sb.append(strArr[b2]);
return sb.toString();
}
/* renamed from: r */
public boolean mo20717r() {
this.f12085aY = new byte[400];
this.f12086aZ = new byte[400];
return mo20681a(C2955v.m12513a());
}
/* renamed from: s */
public boolean mo20718s() {
this.f12085aY = new byte[400];
this.f12086aZ = new byte[400];
return mo20681a(C2955v.m12584k());
}
/* renamed from: t */
public boolean mo20719t() {
System.out.println("获取设备屏保信息");
this.f12085aY = new byte[400];
this.f12086aZ = new byte[400];
return mo20681a(C2955v.m12587l());
}
/* renamed from: u */
public boolean mo20720u() {
System.out.println("上传设备 屏保设置");
return mo20681a(C2955v.m12522a(this.f12147u));
}
/* renamed from: a */
public void mo20668a(int i, int i2, byte b) {
mo20704k(C2955v.m12516a(i, i2, b));
}
/* renamed from: k */
public boolean mo20704k(byte[] bArr) {
if (this.f12074aN == null) {
return false;
}
BluetoothGattService service = this.f12074aN.getService(f12044ab);
if (service == null) {
return false;
}
BluetoothGattCharacteristic characteristic = service.getCharacteristic(f12045ac);
if (characteristic == null) {
return false;
}
characteristic.setValue(bArr);
return this.f12074aN.writeCharacteristic(characteristic);
}
/* renamed from: l */
public boolean mo20706l(byte[] bArr) {
return mo20704k(bArr);
}
/* renamed from: E */
private void m12360E() {
if (this.f12093aj == null) {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.PHONE_STATE");
intentFilter.addAction("android.intent.action.NEW_OUTGOING_CALL");
this.f12093aj = new PhoneReceiver(new C2937d(this));
registerReceiver(this.f12093aj, intentFilter);
}
}
/* renamed from: F */
private void m12361F() {
if (this.f12093aj != null) {
unregisterReceiver(this.f12093aj);
}
}
/* access modifiers changed from: 0000 */
/* renamed from: a */
public void mo20670a(int i, String str) {
String c = C2790ag.m11920c(this, str);
switch (i) {
case 0:
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append("来电测试 挂电话 = phoneNumber = ");
sb.append(str);
sb.append(" callName = ");
sb.append(c);
printStream.println(sb.toString());
if (str != null) {
if (System.currentTimeMillis() - this.f12121bg > 2000 && System.currentTimeMillis() - this.f12122bh > 500) {
System.out.println("来电测试 = 通话结束");
mo20681a(C2955v.m12569g());
}
this.f12121bg = System.currentTimeMillis();
return;
}
return;
case 1:
PrintStream printStream2 = System.out;
StringBuilder sb2 = new StringBuilder();
sb2.append("来电测试 来电 = phoneNumber = ");
sb2.append(str);
sb2.append(" callName = ");
sb2.append(c);
printStream2.println(sb2.toString());
if (str != null && System.currentTimeMillis() - this.f12122bh > 2000) {
System.out.println("来电测试 = 来电话");
if (this.f12147u.mo20052h()) {
System.out.println("ble 蓝牙服务 来电 ture");
PrintStream printStream3 = System.out;
StringBuilder sb3 = new StringBuilder();
sb3.append("ble 蓝牙 = callName = ");
sb3.append(c);
printStream3.println(sb3.toString());
PrintStream printStream4 = System.out;
StringBuilder sb4 = new StringBuilder();
sb4.append("ble 蓝牙 = callName = BleService.DeviceType = ");
sb4.append(f12050d);
printStream4.println(sb4.toString());
PrintStream printStream5 = System.out;
StringBuilder sb5 = new StringBuilder();
sb5.append("ble 蓝牙 = callName = BleService.DeviceVersion = ");
sb5.append(f12051e);
printStream5.println(sb5.toString());
if (f12050d == 6 && f12051e == 16) {
if (TextUtils.isEmpty(c)) {
mo20686c(str);
} else {
mo20686c(c);
}
} else if ((f12050d == 59 && f12051e == 24) || ((f12050d == 68 && f12051e == 24) || ((f12050d == 70 && f12051e == 24) || ((f12050d == 74 && f12051e == 24) || (f12050d == 75 && f12051e == 24))))) {
if (TextUtils.isEmpty(c)) {
mo20689d(str);
} else {
mo20689d(c);
}
} else if (TextUtils.isEmpty(c)) {
mo20682b(str);
} else {
mo20682b(c);
}
} else {
System.out.println("ble 蓝牙服务 来电 false");
}
this.f12122bh = System.currentTimeMillis();
return;
}
return;
case 2:
PrintStream printStream6 = System.out;
StringBuilder sb6 = new StringBuilder();
sb6.append("来电测试 接电话了 = phoneNumber = ");
sb6.append(str);
sb6.append(" callName = ");
sb6.append(c);
printStream6.println(sb6.toString());
if (str != null) {
if (System.currentTimeMillis() - this.f12120bf > 2000 && System.currentTimeMillis() - this.f12122bh > 500) {
System.out.println("来电测试 = 接电话");
mo20681a(C2955v.m12569g());
}
this.f12120bf = System.currentTimeMillis();
return;
}
return;
default:
return;
}
}
/* access modifiers changed from: 0000 */
/* renamed from: v */
public void mo20721v() {
this.f12082aV = new C2938e(this);
MyNotificationsListenerService.m10130a(this.f12082aV);
}
/* access modifiers changed from: private */
/* renamed from: a */
public void m12368a(C2587j jVar) {
if (jVar.equals(jVar)) {
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append("音乐控制 等于 = musicModle = ");
sb.append(jVar.toString());
printStream.println(sb.toString());
return;
}
PrintStream printStream2 = System.out;
StringBuilder sb2 = new StringBuilder();
sb2.append("音乐控制 不等于 = musicModle = ");
sb2.append(jVar.toString());
printStream2.println(sb2.toString());
}
/* access modifiers changed from: private */
/* renamed from: d */
public void m12392d(int i) {
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append("音乐控制 = state = ");
sb.append(i);
printStream.println(sb.toString());
}
/* renamed from: w */
public void mo20722w() {
System.out.println("音乐控制 = musicPrevious");
MyNotificationsListenerService.m10131a(88);
}
/* renamed from: x */
public void mo20723x() {
System.out.println("音乐控制 = musicNext");
MyNotificationsListenerService.m10131a(87);
}
/* renamed from: y */
public void mo20724y() {
System.out.println("音乐控制 = musicPause");
MyNotificationsListenerService.m10131a(85);
}
/* renamed from: f */
public boolean mo20695f(String str) {
this.f12085aY = new byte[400];
this.f12086aZ = new byte[400];
return mo20681a(C2955v.m12565f(str));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment