Iwown Bluetooth BLE SDK User Guide
- Author:hzy
- Shenzhen IWOWN Technology Co., Ltd.
- Version:1.0.1
Modify the record:
- New SDK code, access the new I6hc color bracelet, P1 bracelet
- Update Bluetooth input and output methods
Modify the record:(2018-02-06)
- Increase color bracelet data synchronization
- Increase color bracelet movement, heart rate, sleep display
- increase Lottery bracelet settings
- Debug message push
- Increase color bracelet firmware upgrade
- Increase the alarm, schedule, vibration settings demo
1.introduction
1.1Write purpose
Provide partner companies with an Android Bluetooth SDK that can be used with iwown devices that provide both basic and advanced features for the primary bracelet or other device. The documentation is intended to explain the usage context, functionality, etc. of the API.
Expected readers and reading suggestions
The expected reader and reader suggestions in this article are shown in Exhibit 1.
Readers classification |
Read the key |
software engineer |
Comprehensive description, needs analysis |
Android development engineer |
Has a certain android development capabilities |
2.API instructions
2.1Access conditions
Android 4.3 and above, Bluetooth 4.0. A iwown-bracelet, bracelet can be skilled in the use of objects.
2.2Access steps
- A Iwown-bracelet boot
- SDK access APP, according to the document call the appropriate API
Please refer to Annex SDK demo app:IWBle
2.3.1API method call description
- Bluetooth device to start scanning
public void startScan(boolean filter)
parameter |
Types of |
Description |
filter |
boolean |
true:Filter, showing the iwown bracelet;false:Not filtered |
- Bluetooth device stops scanning
public void stopScan()
- Please select the SDK version before connecting:
eg:
BleApplication.getInstance().getmService().setSDKType(context, sdkType);
- SDK_Zeroner = 1;(i5 Plus,i7,i5 Pro,i6 Pro,i5 HR,i5 A,i3 HR,i3,16)
SDK_Zg = 3;(i6 Pro C,i6 HR C)
public boolean connect(String address)
public boolean connect()
public boolean isConnecting()
public void setWristBand(WristBand wristBand)
setNeedReconnect(boolean isNeedReconnect)
public boolean isConnected()
- Please refer to demo IWBle: BluetoothUtil class related to use
parameter |
Types of |
Description |
address |
String |
Bluetooth mac address |
WristBand |
class |
Iwown bracelet category |
isNeedReconnect |
boolean |
true:Reconnection false:Do not reconnect |
- Disconnect the Bluetooth device
public void disconnect(String address, boolean needCloseGatt)
SuperBleSDK.getSDKSendBluetoothCmdImpl(context).setUnbind()
- Please refer to demo IWBle: BluetoothUtil class related to use
parameter |
Types of |
Description |
address |
String |
Bluetooth mac address |
needCloseGatt |
boolean |
true gatt is closed |
SDK TYPE =SDK_Zg Color screen bracelet
API Call the document:SDK_Zg = 3;(i6 Pro C,i6 HR C)
- Get device information: dataType=0x85
public byte[] getFirmwareInformation()
public void setLanguage(Context context, int type)
parameter |
Types of |
Description |
type |
int |
0:chinese 1:english |
public void setUnitSwitch(Context context, int type)
parameter |
Types of |
Description |
type |
int |
0:Metric 1:Inch units |
public void setTemperatureUnitSwitch(Context context, int type)
parameter |
Types of |
Description |
type |
int |
0:Celsius 1:Fahrenheit |
public void setTimeDisplay(Context context, int type)
parameter |
Types of |
Description |
type |
int |
0:24h 1:12h |
public void setUserWeight(Context context, int weight)
parameter |
Types of |
Description |
weight |
int |
User weight |
public void setStride(Context context, int wStride, int rStride)
parameter |
Types of |
Description |
wStride |
int |
walk stride default :55 |
rStride |
int |
run stride default :85 |
- Set the number of steps goal
public void setStepsTarget(Context context, int target)
parameter |
Types of |
Description |
target |
int |
step goal |
public void setKcalTarget(Context context, int target)
parameter |
Types of |
Description |
target |
int |
kcal goal |
public void setCallNotificationSwitch(Context context, int type)
parameter |
Types of |
Description |
targtypeet |
int |
0:off 1:on |
- Phone push effective time
public void setComingCallHours(Context context, int startHour, int endHour)
parameter |
Types of |
Description |
startHour |
int |
[0,24] |
endHour |
int |
[0,24] |
public void setMsgNotificationSwitch(Context context, int type)
parameter |
Types of |
Description |
type |
int |
0:off 1:on |
- Information push effective time
public void setComingMessageHours(Context context, int startHour, int endHour)
parameter |
Types of |
Description |
startHour |
int |
[0,24] |
endHour |
int |
[0,24] |
- Static heart rate switch and effective time
public void heartDetection(Context context, int heartOn, int startHour, int endHour)
parameter |
Types of |
Description |
heartOn |
int |
0:off 1:on |
startHour |
int |
[0,24] |
endHour |
int |
[0,24] |
- Heart rate warning switch and effective time
public void setHeartAlarm(Context context, int warmingOn, int heartHighAlarm, int heartLowAlarm)
parameter |
Types of |
Description |
warmingOn |
int |
0:off 1:on |
heartHighAlarm |
int |
Heart rate warning highest value |
heartLowAlarm |
int |
Heart rate warning minimum |
- Modify the bracelet vibration settings
public void setShake(Context context,int phoneType,int phoneCount,int msgType,int msgCount,int setLongType,int setLongCount,int heartType,int heartCount)
parameter |
Types of |
Description |
type |
int |
range [1,7] |
count |
int |
range [1,20] |
- Set long switch and start and end time
public void setLongSitAlarm(Context context, int alarm ,int startHour,int endHour)
parameter |
Types of |
Description |
alarm |
int |
0:off 1:on |
startHour |
int |
[0,24] |
endHour |
int |
[0,24] |
- Bowl bright screen switch
public void setGesture(Context context, int gestureOn, int startHour, int endHour)
parameter |
Types of |
Description |
gestureOn |
int |
0:off 1:on |
startHour |
int |
[0,24] |
endHour |
int |
[0,24] |
- Gets the total date the data is stored
public byte[] getDataDate()
- Get the data stored in the bracelet for 7 days
public byte[] getTotalData(TDay tday)
parameter |
Types of |
Description |
TDay |
object |
Please read demo |
public byte[] setTimeAndWeather()
public byte[] setTimeAndWeather(@IntRange(from = 0, to = 10)int weather, int temperature)
parameter |
Types of |
Description |
weather |
int |
|
temperature |
int |
|
public void closeCallPhone(Context context)
- Data synchronization ends
public void syncDataOver(Context context)
public byte[] getHardwareFeatures()
- Get details of the day in steps
public byte[] getDetailWalk(int day)
parameter |
Types of |
Description |
day |
int |
The n-day |
public byte[] getDetailSport(int day)
parameter |
Types of |
Description |
day |
int |
The n-day |
public byte[] getDetailSleep(int day)
parameter |
Types of |
Description |
day |
int |
The n-day |
public byte[] testShake(@IntRange(from = 1, to = 7) int mode, @IntRange(from = 0, to = 31) int times)
parameter |
Types of |
Description |
mode |
int |
[1,7] |
times |
int |
[1,31] |
public byte[] setUpgrade()
2.SDK returns data description
public void onScanResult(WristBand dev)
public void onBluetoothInit()
public void connectStatue(boolean isConnect)
public void onDiscoverService(String serviceUUID)
public void onCharacteristicChange(String address)
public void onDataArrived(Context context, int ble_sdk_type, int dataType, String data)
public void onBluetoothError()
public void noCallback()
- SDK data callback dataType data type description
Types of |
Description |
Types of |
Description |
0x88 |
7 days total storage data information |
0x89 |
Total daily data information |
0x90 |
walk data |
0x91 |
heart data |
0x92 |
sleep data |
0x93 |
Training data |
0x82 |
APP Read device time |
0x83 |
Read Bluetooth speed |
0x84 |
Alarm clock and schedule |
0x85 |
Read the bracelet settings |
0x86 |
Device configuration information read |
0x87 |
Hang up the phone |
0x8A |
Data synchronization ends |
0x06 |
The firmware upgrade instruction is successful |
- SDK returns json data corresponding data meaning
public class SevenDayStore {
//Bracelet total data N days
public int totalDays;
//The specific collection of each day
public List<EveryDayInfo> storeDateObject = new ArrayList();
}
public class EveryDayInfo {
//year
public long year;
//month
public int month;
//day
public int day;
}
Data details for each day
public class bh_totalinfo {
private int year;
private int month;
private int day;
//Total calories
private int calorie;
//Total distances
private int distance;
//Training time /min
private int exerciseMinutes;
//Total sleep time /min
private int sleepMinutes;
//The last one to measure heart rate
private int latestHeart;
//The total number of steps
private int step;
}
Bracelet walk data
public class ZgDetailWalkData {
private int year;
private int month;
private int day;
//walk arrays
private List<Integer> data;
}
bracelet Sleep data
public class ZgSleepData {
private int year;
private int month;
private int day;
//start time
private long startTime;
//end time
private long endTime;
//Total sleep time
private int totalSleep;
//Deep sleep time
private int deepSleep;
//Light sleep time
private int lightSleep;
//Awake time
private int wakeSleep;
//Each sleep set
private List<ZgSleepData.Sleep> data;
}
public static class Sleep {
//start time
private int st;
//end time
private int et;
//sleep type
private int type;
}
Bracelet sport data
public class ZgDetailSportData {
private int year;
private int month;
private int day;
private int count;
//sport data array
private List<ZgDetailSportData.Sport> sports;
}
public static class Sport {
//Total exercise time
private int totalMin;
//sport start time
private int startMin;
//end time
private int endMin;
//step
private int steps;
//Sport distances
private float distance;
//Sports calories
private float calories;
//This training record the largest pace
private int spmMax;
//The average pace of this training record
private int spmAvg;
//This training records the maximum heart rate
private int heartMax;
//The average heart rate of this training record
private int heartAvg;
//This type of training exercise
private int sportType;
//heart array
private List<Integer> heart = new ArrayList();
}
Bracelet Heart rate data
public class ZGHeartData {
public int year;
public int month;
public int day;
//The highest heart rate
public int highestHeart;
//The lowest heart rate
public int lowHeart;
//Average heart rate
public int averageHeart;
//Every day data heart rate point
public int[] staticHeart = new int[144];
public int index;
}
Bracelet time
public class DeviceTime {
int year = -1;
int month = -1;
int day = -1;
int hour = -1;
int minute = -1;
int second = -1;
int week = -1;
}
public class DeviceSetting {
//British unit
private int unitSet;
//weight
private int weight;
//stride
private int walkStride;
private int runStride;
//Steps goal
private int stepsOnceday;
//kcal goal
private int calorieOnceday;
//distance goal
private int distanceOnceday;
private int stepsReachRing;
private int caloriesReachRing;
private int distanceReachRing;
//call push switch
private int comingCallEnable;
//call push start time
private int comingCallStartHour;
//call push end time
private int comingCallEndHour;
//Phone push vibration mode
private int comingCallRing;
//Message push switch
private int messageEnable;
//Message push start time
private int messageStartHour;
//Message push end time
private int messageEndHour;
//Message push vibration mode
private int messageRing;
//Static heart rate switch
private int quietHeartEnable;
//Static heart rate measurement start time
private int quietHeartStartHour;
//Static heart rate measurement end time
private int quietHeartEndHour;
//Heart rate warning switch
private int heartAlarmEnable;
//Heart rate warning high value
private int highHeartAlarm;
//Low heart rate warning
private int lowHeartAlarm;
//Heart rate warning vibration mode
private int heartRing;
//Long seat switch
private int sitLongAlarmEnable;
//Long seat start time
private int sitlongStartHour;
//Long seat end time
private int sitlongEndHour;
//Block seat vibration mode
private int sitlongRing;
//Turn wrist switch
private int rollEnable;
//Turn wrist gesture start time
private int rollStartHour;
//Turn wrist gesture end time
private int rollEndHour;
private int watchSelect;
//battery
private int batteryVolume;
}
public class ZGHardwareInfo extends Result {
//Firmware version number
private int dev_version;
private int dev_screen;
private int dev_key_type;
private int dev_fontic;
private int dev_gsensor;
private int dev_moto;
private int dev_heart;
private int dev_cfca;
private int dev_nfc;
private int dev_reserve = 0;
//Bracelets model number
private String model = "";
}