SDK2108春版(Android)

[ 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 classificationRead the key
software engineerComprehensive description, needs analysis
Android development engineerHas 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)
parameterTypes ofDescription
filterbooleantrue: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
parameterTypes ofDescription
addressStringBluetooth mac address
WristBandclassIwown bracelet category
isNeedReconnectbooleantrue: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
parameterTypes ofDescription
addressStringBluetooth mac address
needCloseGattbooleantrue 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)
parameterTypes ofDescription
typeint1:Synchronize 0:closed

– Synchronization interval heart rate: dataType=0x51

 
  1. public byte[] syncHeartRateSegmentData(int type)
parameterTypes ofDescription
typeint1:Synchronize 0:closed
  • Set the alarm
 
  1. public void writeAlarmClock(Context context, int id, int weekRepeat, int hour, int minute, String text)
parameterTypes ofDescription
idintAlarm id, range [0,7]
weekRepeatintbit7:bit7: repeat flag, bit6-bit0: open flag on Sunday, Saturday to Monday, the value of 1 on
hourinthour
minuteintminute
textStringPrompt 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)
parameterTypes ofDescription
idintAlarm 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)
parameterTypes ofDescription
yearintyear
monthintmonth
dayintday
hourinthour
minuteintminute
textStringUp 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()
parameterTypes ofDescription
yearintyear
monthintmonth
dayintday
hourinthour
minuteintminute
secondintsecond
weekintweek 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)
parameterTypes ofDescription
startHourint 
startMinint 
endHourint 
endMinint 

– Set the bracelet specific time period Do not disturb mode

 
  1. public byte[] setQuietMode(int type)
parameterTypes ofDescription
typeint0: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)
parameterTypes ofDescription
unitTypeint0 for Celsius,1 for Fahrenheit
temperatureintWeather value
weatherintweather: 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
pmintpm 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)
parameterTypes ofDescription
idintSedentary ID [0,2]
weekintbit7: repeat bit6-bit0: open the flag on Sunday, Saturday to Monday, the value of 1 open
startHourint 
endHourint 
alertDurationintReminder interval,eg:60
workCountintNumber 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)
parameterTypes ofDescription
idintSedentary ID [0,2]
arrayclassSet collection
backLightStartTimeint 
backLightEndTimeint 
languageTypeintBracelet language switch
dataFormatintDate format
wristLightFuncStartTimeintTurn wrist gesture start time
wristLightFuncEndTimeintTurn 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)
parameterTypes ofDescription
heightint 
weightint 
genderint1 for women,0 for men
ageint 
stepsintSteps 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)
parameterTypes ofDescription
isOnintAlarm switch 0: closed, 1: open, the default is 1
highintAlarm upper limit of heart rate, higher than this value to trigger alarm, the range of 50 ~ 200, the default 160
lowintAlarm lower limit of heart rate, lower than the value of the trigger alarm, the range of 40 ~ 190, the default 50
timeOutintAlarm detection time in seconds, the default 30
intervalintAlarm trigger interval, unit minutes, default 2
  • Read heart rate warning
 
  1. public byte[] getHeartRateWarming()
  • Selfie
 
  1. public byte[] setWristBandSelfie(boolean flag)
parameterTypes ofDescription
flagbooleantrue:open,false:close

– Bracelet vibration mode setting

 
  1. public byte[] setShakeMode(int type, int shakeModeIndex, int num, ArrayList<Map<String, Integer>> model)
parameterTypes ofDescription
typeint0: Telephone 1: Undefined 2: 1 Group 3: Multiple groups
shakeModeIndexintVibration type cited
numintVibration frequency
modelclasssMulti-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)
parameterTypes ofDescription
valueint0:open 1:close
flagbooleantrue:Normal synchronization,false:Make up
indexintseq:0 flag:false Incoming sequel

– Synchronic total data

 
  1. public byte[] setDialydata29(int value)
parameterTypes ofDescription
valueint0: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 ofDescriptionTypes ofDescription
0x00Device Information0x28Segmented movement
0x01battery0x29The total number of daily exercises
0x02Device reboot0x2A 
0x03Equipment upgrade0x2B 
0x04 0x31Push the message
0x05Unbind0x40Bracelet mode control
0x06Do not disturb mode control  
0x07Weather notification0x50Heart rate parameters
0x08Data synchronization information0x51Interval heart rate
0x09ble0x52 
0x0AHardware function description0x53Hour heart rate
0x0B   
0x0C   
0x10   
0x11Read the time  
0x12   
0x13   
0x14Set the alarm  
0x15Read the alarm  
0x16Set sedentary reminder  
0x17Read sedentary reminder  
0x18Set the hardware function  
0x19Read the hardware function  
0x1AQuery device supports sports type information  
0x1BSports goal setting  
0x1CGet moving target  
0x1DSet the schedule  
0x1ERead the schedule  
0x20Set user parameters  
0x21Read 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;











Leave a Reply

You must be logged in to post a comment.