[ IWOWN ]

 

 
 Version:1.0.0
 
Modify the record:
  1. New SDK code, access the new I6hc color bracelet, P1 bracelet
  2. 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
 
  1. public void startScan(boolean filter)
parameter Types of Description
filter boolean true:Filter, showing the iwown bracelet;false:Not filtered

– Bluetooth device stops scanning

 
  1. public void stopScan()
  • Connect Bluetooth device
 
  1. public boolean connect(String address)
  2. public boolean connect()
  3. public boolean isConnecting()
  4. public void setWristBand(WristBand wristBand)
  5. setNeedReconnect(boolean isNeedReconnect)
  6. public boolean isConnected()
  1. 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

 
  1. public void disconnect(String address, boolean needCloseGatt)
  2. SuperBleSDK.getSDKSendBluetoothCmdImpl(context).setUnbind()
  1. 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
 
  1. public byte[] getFirmwareInformation()
  • Set the time:
 
  1. public byte[] setTime()
  • Synchronize heart rate for 24 hours: dataType=0x53
 
  1. public byte[] syncHeartRateHourData(int type)
parameter Types of Description
type int 1:Synchronize 0:closed

– Synchronization interval heart rate: dataType=0x51

 
  1. public byte[] syncHeartRateSegmentData(int type)
parameter Types of Description
type int 1:Synchronize 0:closed
  • Set the alarm
 
  1. 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

 
  1. public void closeAlarm(int id,Context context)
  2. public void getAlarmClock(Context context, int id)
parameter Types of Description
id int Alarm id, range [0,7]
  • Set / close the schedule
 
  1. public void setSchedule(Context context,int year, int month, int day, int hour, int minute, String text)
  2. 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

 
  1. public void clearAllSchedule(Context context)
  2. public void readScheduleInfo(Context context)
  • Set / read time
 
  1. public byte[] setTime(int year, int month, int day, int hour, int minute, int second, int week)
  2. 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

 
  1. public byte[] getBattery()
  • Set the bracelet to enter upgrade mode
 
  1. public byte[] setUpgrade()
  • Bracelet unbundled
 
  1. public byte[] setUnbind()
  • Set the ring is not disturbing mode
 
  1. 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

 
  1. 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
 
  1. public byte[] clearQuietMode()
  2. public byte[] getQuietModeInfo()
  • Bracelet synchronized weather
 
  1. 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
 
  1. public byte[] setSportGole(ArrayList<Byte> datas)
  2. public byte[] getSportType()
  3. public void clearAllSport(Context context)
  4. public byte[] getSportGoles(int week)
  • Bracelet set sedentary reminder
 
  1. 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

 
  1. public byte[] getSedentary()
  • Set the bracelet setting
 
  1. 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

 
  1. public byte[] getDeviceStateDate()
  • Set user information
 
  1. 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

 
  1. public byte[] getUserProfile()
  • Set heart rate warning
 
  1. 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
 
  1. public byte[] getHeartRateWarming()
  • Selfie
 
  1. public byte[] setWristBandSelfie(boolean flag)
parameter Types of Description
flag boolean true:open,false:close

– Bracelet vibration mode setting

 
  1. 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
 
  1. public byte[] readDataInfoStored()
  • Synchronize the segmented data
 
  1. 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

 
  1. public byte[] setDialydata29(int value)
parameter Types of Description
value int 0:close 1:open
 

2.SDK returns data description

  • SDK scan callback
 
  1. public void onScanResult(WristBand dev)
  • SDK connection callback
 
  1. public void onBluetoothInit()
  2. public void connectStatue(boolean isConnect)
  3. public void onDiscoverService(String serviceUUID)
  4. public void onCharacteristicChange(String address)
  • SDK data callback
 
  1. public void onDataArrived(Context context, int ble_sdk_type, int dataType, String data)
  • SDK error callback
 
  1. public void onBluetoothError()
  2. 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
 
  1. public class FMdeviceInfo{
  2. //model eg:i6hr
  3. private String model="";
  4. private int oadmode;
  5. //firmware version:1.0.0.0
  6. private String swversion;
  7. //Firmware version number int type
  8. private long intSwversion;
  9. //bracelet mac address
  10. private String bleAddr;
 
Bracelet bettary class:Power
 
  1. public class Power {
  2. //bettary
  3. private int power;
 
Bracelet set class:IWDevSetting
 
  1. //The value of 1 indicates that the LED is blinking, and 0 means the LED is off
  2. private int light;
  3. //A value of 1 indicates that gesture recognition is on, and a value of 0 means off
  4. private int gesture;
  5. //A value of 0 means that metric units are used and 1 means an English unit
  6. private int unit;
  7. //A value of 0 means that the use of hexadecimal display, 1 for 12-hexadecimal display
  8. private int is24Hour;
  9. //A value of 1 means automatic sleep, and a value of 0 means manual sleep
  10. private int autoSleep;
  11. //Backlight automatically open time, unit hours, 0 ~ 23, the default 0
  12. private int backLightSt;
  13. //Backlight automatically shut down time, unit hours, 0 ~ 23, the default 23
  14. private int backLightEt;
  15. //A value of 0 means a black background, and a value of 1 means a white background
  16. private int screen;
  17. //0: English 1: Chinese Simplified, default 0
  18. private int language;
  19. //Disconnect reminder, the value of 1 open disconnected reminder, the value of 0 turn off the reminder
  20. private int isConnectTipOpen;
  21. //Date format: 0: month / day, 1: day / month, default: 0
  22. private int is_dd_mm_format = -1;
  23. //Turn wrist bright screen function open time
  24. private int reverse_light_St = -1;
  25. //Turn wrist bright screen function off time
  26. private int reverse_light_Et = -1;
  27. //Automatic heart rate switch
  28. private int autoHr = -1;
  29. private int canFindPhone = -1;
  30. private int autoSpt = -1;
  31. private int isSmartTrackOpen = -1;
  32. private int wearingManner = -1;
 
Bracelet button touch control:KeyModel
 
  1. public class KeyModel {
  2. //Key event
  3. //A value of 0 means that normal mode is returned
  4. //A value of 1 indicates that the camera mode is entered
  5. //The value of 2 means to find the phone
  6. //A value of 8 indicates that the request is muted
  7. //A value of 9 indicates that the request is dropped
  8. //A value of 12 indicates a request to answer
  9. private int keyCode;
 
Bracelet data synchronization information:StoredDataInfoTotal
 
  1. public class StoredDataInfoTotal{
  2. //data type
  3. private int dataTypeNum;
  4. private List<StoredDataInfoDetail> infoList = new ArrayList();
 
  1. public class StoredDataInfoDetail {
  2. //type of data:0x28,0x29,0x51,0x53
  3. private int type;
  4. //start seq
  5. private int start_index;
  6. //end seq
  7. private int end_index;
  8. //max range
  9. private int max_range;
 
Bracelet sleep data:ZeronerSleepData
 
  1. public class ZeronerSleepData {
  2. private int year;
  3. private int month;
  4. private int day;
  5. //1:Fall asleep 2:get up 3:Deep sleep 4:Shallow sleep 5:place 6:wide awake
  6. private int type;
  7. //Some time to start a minute
  8. private int start;
  9. //Some end time
  10. private int end;
  11. //Reserved words
  12. private int allStart;
  13. private int allEnd;
  14. //seq
  15. public int index;
  16. //duration
  17. private int times;
  18. //2 or 5 2:sleep 5:place
  19. private int mode;
  20. //Into sleep time
  21. private int sleep_enter;
  22. //Wake up time
  23. private int sleep_exit;
 
Bracelet movement data:ZeronerSleepData
 
  1. public class ZeronerDetailSportData {
  2. private int year;
  3. private int month;
  4. private int day;
  5. // Type of exercise
  6. private int sport_type;
  7. //Duration of exercise
  8. private int activity;
  9. //Movement start time (minutes)
  10. private int startMin;
  11. //End of exercise (minutes)
  12. private int endMin;
  13. //Step count
  14. private int steps;
  15. //Distance in meters:
  16. private float distance;
  17. //kcal
  18. private float calories;
  19. //Number of units of movement
  20. private int otherCount;
  21. public int index;
 
Bracelet daily total data freeze:TotalSportData
 
  1. public class TotalSportData {
  2. private int year;
  3. private int month;
  4. private int day;
  5. private int steps;
  6. //unit kcal
  7. private float calories;
  8. //unit m
  9. private float distance;
  10. //The last tag of the data
  11. private boolean last;
  12. //type
  13. private int sport_type;
 
Bracelet hour heart rate data:DataHourHeart
 
  1. public class DataHourHeart {
  2. private int year;
  3. private int month;
  4. private int day;
  5. private int hour;
  6. //An hour 60 heart rate point
  7. private int[] rates;
  8. private int nowAdd53;
  9. //Last data tag
  10. private boolean last;











コメントはこちら

You must be logged in to post a comment.