[ IWOWN ]

Iwown Bluetooth BLE SDK User Guide

  1. Author:hzy
  2. Shenzhen IWOWN Technology Co., Ltd.
  3. Version:1.0.1
Modify the record:
  1. New SDK code, access the new I6hc color bracelet, P1 bracelet
  2. Update Bluetooth input and output methods
Modify the record:(2018-02-06)
  1. Increase color bracelet data synchronization
  2. Increase color bracelet movement, heart rate, sleep display
  3. increase Lottery bracelet settings
  4. Debug message push
  5. Increase color bracelet firmware upgrade
  6. 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
  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()
  • Please select the SDK version before connecting:
    eg:
  1. BleApplication.getInstance().getmService().setSDKType(context, sdkType);
  1. SDK_Zeroner = 1;(i5 Plus,i7,i5 Pro,i6 Pro,i5 HR,i5 A,i3 HR,i3,16)
  2. SDK_Zg = 3;(i6 Pro C,i6 HR C)

    • 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

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
  1. public byte[] getFirmwareInformation()
  • language setting
  1. public void setLanguage(Context context, int type)
parameter Types of Description
type int 0:chinese 1:english
  • Set the metric system
  1. public void setUnitSwitch(Context context, int type)
parameter Types of Description
type int 0:Metric 1:Inch units
  • Set the temperature unit
  1. public void setTemperatureUnitSwitch(Context context, int type)
parameter Types of Description
type int 0:Celsius 1:Fahrenheit
  • Set 24/12 hours
  1. public void setTimeDisplay(Context context, int type)
parameter Types of Description
type int 0:24h 1:12h
  • Set the user's weight
  1. public void setUserWeight(Context context, int weight)
parameter Types of Description
weight int User weight
  • Set the user pace
  1. 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
  1. public void setStepsTarget(Context context, int target)
parameter Types of Description
target int step goal
  • Set the calorie goal
  1. public void setKcalTarget(Context context, int target)
parameter Types of Description
target int kcal goal
  • Phone push switch
  1. public void setCallNotificationSwitch(Context context, int type)
parameter Types of Description
targtypeet int 0:off 1:on
  • Phone push effective time
  1. public void setComingCallHours(Context context, int startHour, int endHour)
parameter Types of Description
startHour int [0,24]
endHour int [0,24]
  • Information push switch
  1. public void setMsgNotificationSwitch(Context context, int type)
parameter Types of Description
type int 0:off 1:on
  • Information push effective time
  1. 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
  1. 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
  1. 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
  1. 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
  1. 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
  1. 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
  1. public byte[] getDataDate()
  • Get the data stored in the bracelet for 7 days
  1. public byte[] getTotalData(TDay tday)
parameter Types of Description
TDay object Please read demo
  • set time
  1. public byte[] setTimeAndWeather()
  • Set time and weather
  1. public byte[] setTimeAndWeather(@IntRange(from = 0, to = 10)int weather, int temperature)
parameter Types of Description
weather int
temperature int
  • The phone hangs up
  1. public void closeCallPhone(Context context)
  • Data synchronization ends
  1. public void syncDataOver(Context context)
  • Get hardware information
  1. public byte[] getHardwareFeatures()
  • Get details of the day in steps
  1. public byte[] getDetailWalk(int day)
parameter Types of Description
day int The n-day
  • Get training data
  1. public byte[] getDetailSport(int day)
parameter Types of Description
day int The n-day
  • Get sleep details data
  1. public byte[] getDetailSleep(int day)
parameter Types of Description
day int The n-day
  • Test bracelet vibration
  1. 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]
  • Set up firmware upgrade
  1. public byte[] setUpgrade()

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
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

Bracelet there is 7 days of data information
  1. public class SevenDayStore {
  2. //Bracelet total data N days
  3. public int totalDays;
  4. //The specific collection of each day
  5. public List<EveryDayInfo> storeDateObject = new ArrayList();
  6. }
  7. public class EveryDayInfo {
  8. //year
  9. public long year;
  10. //month
  11. public int month;
  12. //day
  13. public int day;
  14. }
Data details for each day
  1. public class bh_totalinfo {
  2. private int year;
  3. private int month;
  4. private int day;
  5. //Total calories
  6. private int calorie;
  7. //Total distances
  8. private int distance;
  9. //Training time /min
  10. private int exerciseMinutes;
  11. //Total sleep time /min
  12. private int sleepMinutes;
  13. //The last one to measure heart rate
  14. private int latestHeart;
  15. //The total number of steps
  16. private int step;
  17. }
Bracelet walk data
  1. public class ZgDetailWalkData {
  2. private int year;
  3. private int month;
  4. private int day;
  5. //walk arrays
  6. private List<Integer> data;
  7. }
bracelet Sleep data
  1. public class ZgSleepData {
  2. private int year;
  3. private int month;
  4. private int day;
  5. //start time
  6. private long startTime;
  7. //end time
  8. private long endTime;
  9. //Total sleep time
  10. private int totalSleep;
  11. //Deep sleep time
  12. private int deepSleep;
  13. //Light sleep time
  14. private int lightSleep;
  15. //Awake time
  16. private int wakeSleep;
  17. //Each sleep set
  18. private List<ZgSleepData.Sleep> data;
  19. }
  20. public static class Sleep {
  21. //start time
  22. private int st;
  23. //end time
  24. private int et;
  25. //sleep type
  26. private int type;
  27. }
Bracelet sport data
  1. public class ZgDetailSportData {
  2. private int year;
  3. private int month;
  4. private int day;
  5. private int count;
  6. //sport data array
  7. private List<ZgDetailSportData.Sport> sports;
  8. }
  9. public static class Sport {
  10. //Total exercise time
  11. private int totalMin;
  12. //sport start time
  13. private int startMin;
  14. //end time
  15. private int endMin;
  16. //step
  17. private int steps;
  18. //Sport distances
  19. private float distance;
  20. //Sports calories
  21. private float calories;
  22. //This training record the largest pace
  23. private int spmMax;
  24. //The average pace of this training record
  25. private int spmAvg;
  26. //This training records the maximum heart rate
  27. private int heartMax;
  28. //The average heart rate of this training record
  29. private int heartAvg;
  30. //This type of training exercise
  31. private int sportType;
  32. //heart array
  33. private List<Integer> heart = new ArrayList();
  34. }
Bracelet Heart rate data
  1. public class ZGHeartData {
  2. public int year;
  3. public int month;
  4. public int day;
  5. //The highest heart rate
  6. public int highestHeart;
  7. //The lowest heart rate
  8. public int lowHeart;
  9. //Average heart rate
  10. public int averageHeart;
  11. //Every day data heart rate point
  12. public int[] staticHeart = new int[144];
  13. public int index;
  14. }
Bracelet time
  1. public class DeviceTime {
  2. int year = -1;
  3. int month = -1;
  4. int day = -1;
  5. int hour = -1;
  6. int minute = -1;
  7. int second = -1;
  8. int week = -1;
  9. }
Get device settings information
  1. public class DeviceSetting {
  2. //British unit
  3. private int unitSet;
  4. //weight
  5. private int weight;
  6. //stride
  7. private int walkStride;
  8. private int runStride;
  9. //Steps goal
  10. private int stepsOnceday;
  11. //kcal goal
  12. private int calorieOnceday;
  13. //distance goal
  14. private int distanceOnceday;
  15. private int stepsReachRing;
  16. private int caloriesReachRing;
  17. private int distanceReachRing;
  18. //call push switch
  19. private int comingCallEnable;
  20. //call push start time
  21. private int comingCallStartHour;
  22. //call push end time
  23. private int comingCallEndHour;
  24. //Phone push vibration mode
  25. private int comingCallRing;
  26. //Message push switch
  27. private int messageEnable;
  28. //Message push start time
  29. private int messageStartHour;
  30. //Message push end time
  31. private int messageEndHour;
  32. //Message push vibration mode
  33. private int messageRing;
  34. //Static heart rate switch
  35. private int quietHeartEnable;
  36. //Static heart rate measurement start time
  37. private int quietHeartStartHour;
  38. //Static heart rate measurement end time
  39. private int quietHeartEndHour;
  40. //Heart rate warning switch
  41. private int heartAlarmEnable;
  42. //Heart rate warning high value
  43. private int highHeartAlarm;
  44. //Low heart rate warning
  45. private int lowHeartAlarm;
  46. //Heart rate warning vibration mode
  47. private int heartRing;
  48. //Long seat switch
  49. private int sitLongAlarmEnable;
  50. //Long seat start time
  51. private int sitlongStartHour;
  52. //Long seat end time
  53. private int sitlongEndHour;
  54. //Block seat vibration mode
  55. private int sitlongRing;
  56. //Turn wrist switch
  57. private int rollEnable;
  58. //Turn wrist gesture start time
  59. private int rollStartHour;
  60. //Turn wrist gesture end time
  61. private int rollEndHour;
  62. private int watchSelect;
  63. //battery
  64. private int batteryVolume;
  65. }
Bracelet hardware information
  1. public class ZGHardwareInfo extends Result {
  2. //Firmware version number
  3. private int dev_version;
  4. private int dev_screen;
  5. private int dev_key_type;
  6. private int dev_fontic;
  7. private int dev_gsensor;
  8. private int dev_moto;
  9. private int dev_heart;
  10. private int dev_cfca;
  11. private int dev_nfc;
  12. private int dev_reserve = 0;
  13. //Bracelets model number
  14. private String model = "";
  15. }