- 001
- 002
- 003
- 004
- 005
- 006
- 007
- 008
- 009
- 010
- 011
- 012
- 013
- 014
- 015
- 016
- 017
- 018
- 019
- 020
- 021
- 022
- 023
- 024
- 025
- 026
- 027
- 028
- 029
- 030
- 031
- 032
- 033
- 034
- 035
- 036
- 037
- 038
- 039
- 040
- 041
- 042
- 043
- 044
- 045
- 046
- 047
- 048
- 049
- 050
- 051
- 052
- 053
- 054
- 055
- 056
- 057
- 058
- 059
- 060
- 061
- 062
- 063
- 064
- 065
- 066
- 067
- 068
- 069
- 070
- 071
- 072
- 073
- 074
- 075
- 076
- 077
- 078
- 079
- 080
- 081
- 082
- 083
- 084
- 085
- 086
- 087
- 088
- 089
- 090
- 091
- 092
- 093
- 094
- 095
- 096
- 097
- 098
- 099
- 100
/**
* 连接指定的手环
*
* @param callback
*/
public void connect(BluetoothDevice device, final ActionCallback callback) {
this.io.connect(context, device, callback);
}
public void setDisconnectedListener(NotifyListener disconnectedListener) {
this.io.setDisconnectedListener(disconnectedListener);
}
/**
* 和手环配对, 实际用途未知, 不配对也可以做其他的操作
*
* @return data = null
*/
public void pair(final ActionCallback callback) {
ActionCallback ioCallback = new ActionCallback() {
@Override
public void onSuccess(Object data) {
BluetoothGattCharacteristic characteristic = (BluetoothGattCharacteristic) data;
Log.d(TAG, "pair result " + Arrays.toString(characteristic.getValue()));
if (characteristic.getValue().length == 1 && characteristic.getValue()[0] == 2) {
callback.onSuccess(null);
} else {
callback.onFail(-1, "respone values no succ!");
}
}
@Override
public void onFail(int errorCode, String msg) {
callback.onFail(errorCode, msg);
}
};
this.io.writeAndRead(Profile.UUID_CHAR_PAIR, Protocol.PAIR, ioCallback);
}
public BluetoothDevice getDevice() {
return this.io.getDevice();
}
/**
* 读取和连接设备的信号强度RSSI值
*
* @param callback
* @return data : int, rssi值
*/
public void readRssi(ActionCallback callback) {
this.io.readRssi(callback);
}
/**
* 读取手环电池信息
*
* @return {@link BatteryInfo}
*/
public void getBatteryInfo(final ActionCallback callback) {
ActionCallback ioCallback = new ActionCallback() {
@Override
public void onSuccess(Object data) {
BluetoothGattCharacteristic characteristic = (BluetoothGattCharacteristic) data;
Log.d(TAG, "getBatteryInfo result " + Arrays.toString(characteristic.getValue()));
if (characteristic.getValue().length == 10) {
BatteryInfo info = BatteryInfo.fromByteData(characteristic.getValue());
callback.onSuccess(info);
} else {
callback.onFail(-1, "result format wrong!");
}
}
@Override
public void onFail(int errorCode, String msg) {
callback.onFail(errorCode, msg);
}
};
this.io.readCharacteristic(Profile.UUID_CHAR_BATTERY, ioCallback);
}
/**
* 让手环震动
*/
public void startVibration(VibrationMode mode) {
byte[] protocal;
switch (mode) {
case VIBRATION_WITH_LED:
protocal = Protocol.VIBRATION_WITH_LED;
break;
case VIBRATION_10_TIMES_WITH_LED:
protocal = Protocol.VIBRATION_10_TIMES_WITH_LED;
break;
case VIBRATION_WITHOUT_LED:
protocal = Protocol.VIBRATION_WITHOUT_LED;
break;
default:
return;
}
guest 16.08.2016 00:00 # −5
guest 16.08.2016 00:33 # −7
guesto 16.08.2016 03:44 # −14
wvxvw 16.08.2016 08:13 # +19
Hanazono-Satoshi 16.08.2016 11:01 # +18
Dummy00001 16.08.2016 11:41 # +20
inkanus-gray 16.08.2016 15:55 # +16
http://govnokod.ru/3408
ngc-598 16.08.2016 15:15 # +16
3_14dar 16.08.2016 16:21 # +2
bormand 16.08.2016 17:32 # +11
inkanus-gray 16.08.2016 17:55 # +11
HaskellGovno 16.08.2016 20:47 # +12
звонить зад.
видимо просто вибратор, управляемый с телефона
void_main 16.08.2016 20:48 # −12
1024-- 16.08.2016 20:50 # +15
HaskellGovno 16.08.2016 20:57 # +13
У багра (пидорки, шамили, анал) есть много различных расщепленных личностей.
Я решительно рад, что у него появилась хоть одна ответственная и не матерная.
inkanus-gray 16.08.2016 21:07 # +13
HaskellGovno 16.08.2016 21:20 # +13
кокой перфоратор )))