[ IWOWN ]
Bluetooth BLE SDK User Guide
Android編
Modify the record:
- New SDK code, access the new I6hc color bracelet, P1 bracelet
- Update Bluetooth input and output methods
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()
- Connect Bluetooth device
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 |
- Get device information: dataType=0x00
public byte[] getFirmwareInformation()
- Set the time:
public byte[] setTime()
- Synchronize heart rate for 24 hours: dataType=0x53
public byte[] syncHeartRateHourData(int type)
parameter | Types of | Description |
---|---|---|
type | int | 1:Synchronize 0:closed |
– Synchronization interval heart rate: dataType=0x51
public byte[] syncHeartRateSegmentData(int type)
parameter | Types of | Description |
---|---|---|
type | int | 1:Synchronize 0:closed |
- Set the alarm
public void writeAlarmClock(Context context, int id, int weekRepeat, int hour, int minute, String text)
parameter | Types of | Description |
---|---|---|
id | int | Alarm id, range [0,7] |
weekRepeat | int | bit7:bit7: repeat flag, bit6-bit0: open flag on Sunday, Saturday to Monday, the value of 1 on |
hour | int | hour |
minute | int | minute |
text | String | Prompt message length up to 5 Chinese characters (15 bytes) |
– Turn off / read the alarm
public void closeAlarm(int id,Context context)
public void getAlarmClock(Context context, int id)
parameter | Types of | Description |
---|---|---|
id | int | Alarm id, range [0,7] |
- Set / close the schedule
public void setSchedule(Context context,int year, int month, int day, int hour, int minute, String text)
public void closeSchedule(Context context,int year, int month, int day, int hour, int minute)
parameter | Types of | Description |
---|---|---|
year | int | year |
month | int | month |
day | int | day |
hour | int | hour |
minute | int | minute |
text | String | Up to 18 Chinese characters, 36 bytes |
– Clear all / read schedule
public void clearAllSchedule(Context context)
public void readScheduleInfo(Context context)
- Set / read time
public byte[] setTime(int year, int month, int day, int hour, int minute, int second, int week)
public byte[] getTime()
parameter | Types of | Description |
---|---|---|
year | int | year |
month | int | month |
day | int | day |
hour | int | hour |
minute | int | minute |
second | int | second |
week | int | week of year |
– Read power
public byte[] getBattery()
- Set the bracelet to enter upgrade mode
public byte[] setUpgrade()
- Bracelet unbundled
public byte[] setUnbind()
- Set the ring is not disturbing mode
public byte[] setQuietMode(int startHour, int startMin, int endHour, int endMin)
parameter | Types of | Description |
---|---|---|
startHour | int | |
startMin | int | |
endHour | int | |
endMin | int |
– Set the bracelet specific time period Do not disturb mode
public byte[] setQuietMode(int type)
parameter | Types of | Description |
---|---|---|
type | int | 0:Do not disturb sleep mode 1:Do not disturb the whole day mode |
- Clear Do Not Disturb Mode / Read Quiet Mode Setup Parameters
public byte[] clearQuietMode()
public byte[] getQuietModeInfo()
- Bracelet synchronized weather
public byte[] setWeather(int unitType, int temperature, int weather, int pm)
parameter | Types of | Description |
---|---|---|
unitType | int | 0 for Celsius,1 for Fahrenheit |
temperature | int | Weather value |
weather | int | weather: 0:sunny day 1:partly cloudy 2:cloudy day 3:Light rain4:In the rain 5:heavy rain 6:shower 7:snow 8:smog 9:Sandstorm |
pm | int | pm value |
- Set Goals / Get Supported Sports Type / Clear All Sports / Get Moving Target
public byte[] setSportGole(ArrayList<Byte> datas)
public byte[] getSportType()
public void clearAllSport(Context context)
public byte[] getSportGoles(int week)
- Bracelet set sedentary reminder
public byte[] setSedentary(int id, int week, int startHour, int endHour, int alertDuration, int workCount)
parameter | Types of | Description |
---|---|---|
id | int | Sedentary ID [0,2] |
week | int | bit7: repeat bit6-bit0: open the flag on Sunday, Saturday to Monday, the value of 1 open |
startHour | int | |
endHour | int | |
alertDuration | int | Reminder interval,eg:60 |
workCount | int | Number of steps threshold:eg:50 |
– Read a long reminder
public byte[] getSedentary()
- Set the bracelet setting
public byte[] setWristBandGestureAndLight(SparseBooleanArray array, int backLightStartTime, int backLightEndTime, int languageType, int dataFormat,int wristLightFuncStartTime, int wristLightFuncEndTime)
parameter | Types of | Description |
---|---|---|
id | int | Sedentary ID [0,2] |
array | class | Set collection |
backLightStartTime | int | |
backLightEndTime | int | |
languageType | int | Bracelet language switch |
dataFormat | int | Date format |
wristLightFuncStartTime | int | Turn wrist gesture start time |
wristLightFuncEndTime | int | Turn wrist gesture end time |
– Read the bracelet settings
public byte[] getDeviceStateDate()
- Set user information
public byte[] setUserProfile(int height, int weight, boolean gender, int age, int steps)
parameter | Types of | Description |
---|---|---|
height | int | |
weight | int | |
gender | int | 1 for women,0 for men |
age | int | |
steps | int | Steps goal |
– Read user information
public byte[] getUserProfile()
- Set heart rate warning
public byte[] setHeartRateWarming(boolean isOn, int high, int low, int timeOut, int interval)
parameter | Types of | Description |
---|---|---|
isOn | int | Alarm switch 0: closed, 1: open, the default is 1 |
high | int | Alarm upper limit of heart rate, higher than this value to trigger alarm, the range of 50 ~ 200, the default 160 |
low | int | Alarm lower limit of heart rate, lower than the value of the trigger alarm, the range of 40 ~ 190, the default 50 |
timeOut | int | Alarm detection time in seconds, the default 30 |
interval | int | Alarm trigger interval, unit minutes, default 2 |
- Read heart rate warning
public byte[] getHeartRateWarming()
- Selfie
public byte[] setWristBandSelfie(boolean flag)
parameter | Types of | Description |
---|---|---|
flag | boolean | true:open,false:close |
– Bracelet vibration mode setting
public byte[] setShakeMode(int type, int shakeModeIndex, int num, ArrayList<Map<String, Integer>> model)
parameter | Types of | Description |
---|---|---|
type | int | 0: Telephone 1: Undefined 2: 1 Group 3: Multiple groups |
shakeModeIndex | int | Vibration type cited |
num | int | Vibration frequency |
model | classs | Multi-group vibration (value 0 means alarm, value 1 means call, value 2 means short message, value 3 means sedentary, value 4 means charge, value 5 means schedule value 6 means common reminder value 7 means Heart rate alarm) |
- Bracelet data storage capacity
public byte[] readDataInfoStored()
- Synchronize the segmented data
public byte[] setDialydata28(int value, boolean flag, int index)
parameter | Types of | Description |
---|---|---|
value | int | 0:open 1:close |
flag | boolean | true:Normal synchronization,false:Make up |
index | int | seq:0 flag:false Incoming sequel |
– Synchronic total data
public byte[] setDialydata29(int value)
parameter | Types of | Description |
---|---|---|
value | int | 0:close 1:open |
2.SDK returns data description
- SDK scan callback
public void onScanResult(WristBand dev)
- SDK connection callback
public void onBluetoothInit()
public void connectStatue(boolean isConnect)
public void onDiscoverService(String serviceUUID)
public void onCharacteristicChange(String address)
- SDK data callback
public void onDataArrived(Context context, int ble_sdk_type, int dataType, String data)
- SDK error callback
public void onBluetoothError()
public void noCallback()
- SDK data callback dataType data type description
Types of | Description | Types of | Description |
---|---|---|---|
0x00 | Device Information | 0x28 | Segmented movement |
0x01 | battery | 0x29 | The total number of daily exercises |
0x02 | Device reboot | 0x2A | |
0x03 | Equipment upgrade | 0x2B | |
0x04 | 0x31 | Push the message | |
0x05 | Unbind | 0x40 | Bracelet mode control |
0x06 | Do not disturb mode control | ||
0x07 | Weather notification | 0x50 | Heart rate parameters |
0x08 | Data synchronization information | 0x51 | Interval heart rate |
0x09 | ble | 0x52 | |
0x0A | Hardware function description | 0x53 | Hour heart rate |
0x0B | |||
0x0C | |||
0x10 | |||
0x11 | Read the time | ||
0x12 | |||
0x13 | |||
0x14 | Set the alarm | ||
0x15 | Read the alarm | ||
0x16 | Set sedentary reminder | ||
0x17 | Read sedentary reminder | ||
0x18 | Set the hardware function | ||
0x19 | Read the hardware function | ||
0x1A | Query device supports sports type information | ||
0x1B | Sports goal setting | ||
0x1C | Get moving target | ||
0x1D | Set the schedule | ||
0x1E | Read the schedule | ||
0x20 | Set user parameters | ||
0x21 | Read user parameters | ||
0x22 | |||
0x23 | |||
0x24 |
– SDK returns json data corresponding data meaning
Bracelet firmware class:FMdeviceInfo
public class FMdeviceInfo{
//model eg:i6hr
private String model="";
private int oadmode;
//firmware version:1.0.0.0
private String swversion;
//Firmware version number int type
private long intSwversion;
//bracelet mac address
private String bleAddr;
}
Bracelet bettary class:Power
public class Power {
//bettary
private int power;
}
Bracelet set class:IWDevSetting
//The value of 1 indicates that the LED is blinking, and 0 means the LED is off
private int light;
//A value of 1 indicates that gesture recognition is on, and a value of 0 means off
private int gesture;
//A value of 0 means that metric units are used and 1 means an English unit
private int unit;
//A value of 0 means that the use of hexadecimal display, 1 for 12-hexadecimal display
private int is24Hour;
//A value of 1 means automatic sleep, and a value of 0 means manual sleep
private int autoSleep;
//Backlight automatically open time, unit hours, 0 ~ 23, the default 0
private int backLightSt;
//Backlight automatically shut down time, unit hours, 0 ~ 23, the default 23
private int backLightEt;
//A value of 0 means a black background, and a value of 1 means a white background
private int screen;
//0: English 1: Chinese Simplified, default 0
private int language;
//Disconnect reminder, the value of 1 open disconnected reminder, the value of 0 turn off the reminder
private int isConnectTipOpen;
//Date format: 0: month / day, 1: day / month, default: 0
private int is_dd_mm_format = -1;
//Turn wrist bright screen function open time
private int reverse_light_St = -1;
//Turn wrist bright screen function off time
private int reverse_light_Et = -1;
//Automatic heart rate switch
private int autoHr = -1;
private int canFindPhone = -1;
private int autoSpt = -1;
private int isSmartTrackOpen = -1;
private int wearingManner = -1;
}
Bracelet button touch control:KeyModel
public class KeyModel {
//Key event
//A value of 0 means that normal mode is returned
//A value of 1 indicates that the camera mode is entered
//The value of 2 means to find the phone
//A value of 8 indicates that the request is muted
//A value of 9 indicates that the request is dropped
//A value of 12 indicates a request to answer
private int keyCode;
}
Bracelet data synchronization information:StoredDataInfoTotal
public class StoredDataInfoTotal{
//data type
private int dataTypeNum;
private List<StoredDataInfoDetail> infoList = new ArrayList();
}
public class StoredDataInfoDetail {
//type of data:0x28,0x29,0x51,0x53
private int type;
//start seq
private int start_index;
//end seq
private int end_index;
//max range
private int max_range;
}
Bracelet sleep data:ZeronerSleepData
public class ZeronerSleepData {
private int year;
private int month;
private int day;
//1:Fall asleep 2:get up 3:Deep sleep 4:Shallow sleep 5:place 6:wide awake
private int type;
//Some time to start a minute
private int start;
//Some end time
private int end;
//Reserved words
private int allStart;
private int allEnd;
//seq
public int index;
//duration
private int times;
//2 or 5 2:sleep 5:place
private int mode;
//Into sleep time
private int sleep_enter;
//Wake up time
private int sleep_exit;
}
Bracelet movement data:ZeronerSleepData
public class ZeronerDetailSportData {
private int year;
private int month;
private int day;
// Type of exercise
private int sport_type;
//Duration of exercise
private int activity;
//Movement start time (minutes)
private int startMin;
//End of exercise (minutes)
private int endMin;
//Step count
private int steps;
//Distance in meters:
private float distance;
//kcal
private float calories;
//Number of units of movement
private int otherCount;
public int index;
}
Bracelet daily total data freeze:TotalSportData
public class TotalSportData {
private int year;
private int month;
private int day;
private int steps;
//unit kcal
private float calories;
//unit m
private float distance;
//The last tag of the data
private boolean last;
//type
private int sport_type;
}
Bracelet hour heart rate data:DataHourHeart
public class DataHourHeart {
private int year;
private int month;
private int day;
private int hour;
//An hour 60 heart rate point
private int[] rates;
private int nowAdd53;
//Last data tag
private boolean last;
}
Leave a Reply
You must be logged in to post a comment.