0% found this document useful (0 votes)
87 views16 pages

OKOK Protocol

Uploaded by

Frank
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views16 pages

OKOK Protocol

Uploaded by

Frank
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Protocol of OKOK APP

The History:

Versions Amended Date

REV1.0 Original 2014-12-11


REV1.1 Connected with product ID 2015-05-08

 Modify the 0x10 synchronous user information


REV1.3 Amended version, with history data 2015-08
2016-01-20

 Added 0x15 multi user matching acknowledgement


instructions

REV1.4
Modify 0x00-0x01 broadcasts to send weighting data
acknowledgement command

 Add Table 1 (message body property definition)


instructions

 Modify 0x12 Add Table 1 (message body property


definition) transmit data by sending data
Modify the 0x13 send through history to weigh data

 Added 0x14 multi user matching acknowledgement


instructions

instruction

1. Protocol overview

The document describes in detail the access to OKOK health scale APP communication frame
format, as well as equipment and APP interactive process.

Currently available devices are Bluetooth body scales and Bluetooth body fat scales,
in which Bluetooth body scales are used in blue Dental broadcast mode and APP transmission
data, the Bluetooth body fat scale uses the broadcast + transparent transmission mode
to transmit data.

1.1 Protocol frame format

Description Start bit Version number Data field length Data domain Body check bits

Code 0xCA Ver Len DATA CS

Byte 1 1 1 Variable 1
Frame format field description:

Field name
Start bit
Description
The command starts with 0xCA to determine whether the start
of a frame.
Version number The version number of the frame for use when the subsequent
frame is extended.
Data field length To indicate the length of the data domain text and how many
bytes are in it.

Data domain Here to save all the information and data that is associated
with the device.
Check digital bit (version number begins at the end of the data domain text, bit
by bit or XOR).

2. The Access Protocol of Bluetooth Body-fat scale.

2.1. Using scenario diagrams.


2.1.1.Scence 1. Interactive flow chart of weighing and locking in advance
of Bluetooth body-fat scale.
2.1.2. Scence 2 APP advance connection weighing interaction flow
chart(Contains offline weighting scenarios)
2.2 Data frame format

2.2.1 APP send to BLE data format

1) 0x10 synchronizes all user information instructions (first packs):


Byte Value Description
1 0xCA
2 0x11 Version V1.1
Frame head

3 0x10
4 0x10
Data domain length

0x--
Command byte,0x10

5
Subcontracting information (high four bits representing
current packages, low four representing packages)

6 0x--
Number)

7 0x--
Current App time, in seconds

8 0x--
Note: current time is between January 1, 1970, 00:00:00.0,

9 0x--
UTC, total seconds.

10 0x--
11 0x--
Hold back

12-15 0x-- First user’s ID


Hold back

16 0x-- Sex and age,the highest position is 1 for men and 0 for women .

17 0x--
18 0x--
Height

19 0x--
High weight byte

20 0x--
Low weight byte
Check code

Byte Value Description


Follow-up package:

1 0xCA
2 0x11 Version V1.1
Frame head

3 0x0A
4 0x10
Data domain length

0x--
Command byte,0x10

5
Subcontracting information (high four bits representing

6-9 0x-- Second user’s ID


current packages, low four representing packages)

10 0x--
women .
Sex and age,The highest position is 1, for men and 0 for

11 0x--
12 0x--
Height

13 0x--
High weight byte

14 0x--
Low weight byte
Check code

Note: since BLE4.0 is transmitted with a maximum of 20 bytes per frame, the maximum number
of bytes in the case of the 8 characters is at most 5 times send.
Byte Value Description
2) 0x11 Synchronous historical data instruction:

1 0xCA Frame head


2 0x11 Protocol version number, V1.1
3 0x02 Data domain length
4 0x11 The command byte, 0X11, represents synchronous
historical data
5 0x01 Device type, Bluetooth body grease scale
6 0x00 Check code
Note: after receiving this instruction,BLE will return the saved historical data to APP.

Byte Value Description


3) 0x15 Multiple user matching acknowledgement response command.

1 0xCA Frame head


2 0x11 Protocol version number, V1.1
3 0x10 Data domain length
4 0x15
5 0x--
The command byte,0x15

6 0x--
The final user number selected by the user

7 0x--
8 0x--
9 0x-- Check code

2.2.2 BLE send to APP data format


1) 0x00-0x01 broadcast send weighing data instructions
Byte Value Description
1 0xCA
2 0x11 Protocol version number, V1.1
Start bit

3 0x0F Data domain length


4 0x-- 0x00 not locked
0x01 locked
5 0x01
6 0x--
Device type, Bluetooth body grease scale

7 0x--
High weight byte

8-11 0x-- Product ID


Low weight byte

12 0x
tables 1
Message body properties, defined reference

13 0x00
14 0x00
Hold back

15 0x00
Hold back

16 0x00
Hold back

17 0x00
Hold back

18 0x00
Hold back

19 0x--
Hold back
Check code
Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
Table 1
Message body
properties

Bit4-3 Unit back


Hold Unit selection Decimal point hold

00 = KG(default)
selection

01 = Jin
10 = LB
11 = ST:LB

Bit2-1
00 = 1 decimal(default)
Decimal digit selection

01 = 0 decimal
10 = 2 decimal

Hold back 1 decimal,the upload weight is 10 times the actual value, and 2 decimal places are
retained. The weight value uploaded is 100 times of the actual value, and so on.
Instructions on the number of units and decimals: the number of decimal digits displayed by
APP is determined by the scale, which is determined by the decimal number of the message body,
the default unit is kg, and the decimal digit is 1 bits.

e.g.
Item Message body High weight byte Low weight byte
properties
50kg,1 decimal, 0X00 0X01 0XF4
not locked
50LB,1 decimal, 0X10 0X01 0XF4
not locked
4:13 ST:LB,1 0X00 0X04 0X82
decimal, not
locked

Note: the 1.ST:LB unit defaults to: ST bytes are fixed to integers, and LB bytes are fixed
to 1 decimal places. The decimal point at this point selects the bits that are converted into
other units.
2) 0x12 Transmit data by sending data through instruction

The first package:

Byte Value Description


1 0xCA Frame head
2 0x11 Protocol version number, V1.1
3 0x10 Data domain length
4 0x12
5 0x--
The command byte,0x12
Subcontracting information (high four bits representing
current packet number, low four representing total
package)

6 0x--
7 0x--
Weighing time is in seconds

8 0x--
Note: weighing time is between January 1 and 1970

9
00:00:00.0 UTC total seconds.
0x--
10 0x-- Message body properties, defined by reference table 1

11 0x--
12-15 0x-- User ID
Hold back

16 0x--
17 0x--
High weight byte

18 0x--
Low weight byte

19 0x--
High body-fat byte

20 0x-
Low body-fat byte
Check code
Byte Value Description
The second package:

1 0xCA Frame head


2 0x11 Protocol version number, V1.1
3 0x0B Data domain length
4 0x12
5 0x--
The command byte,0x12
Subcontracting information (high four bits
representing current packet number, low four

6 0x--
representing total package)

7 0x--
High water byte

8 0x--
Low water byte

9 0x--
High byte of muscle

10 0x-- BMR
Low byte of muscle

11 0x-- BMR
high byte

12 0x--
low byte

13 0x--
Visceral fat high byte

14 0x--
Visceral fat low byte

15 0x--
Bone
Check code

3) 0x13 Transmit & send instructions of weigh history data

Byte Value Description


The first package

1 0xCA Frame head


2 0x11 Protocol version number, V1.1
3 0x10 Data domain length
4 0x13
5 0x--
The command byte,0x13
Subcontracting information (high four bits representing current
packet number, low four representing total package)
6 0x--
7 0x--
Weighing time is in seconds

8 0x--
Note: weighing time is between January 1 and 1970 00:00:00.0 UTC

9
total seconds.
0x--
10 0x-- Message body properties, defined reference tables 1
11 0x--
12- 0x-- User ID
Hold back

15
16 0x--
17 0x--
High weight byte

18 0x--
Low weight byte

19 0x--
High body-fat byte

20 0x-
Low body-fat byte
Check code
The second package:

Byte Value Description


1 0xCA Frame head
2 0x11 Protocol version number, V1.1
3 0x0B Data domain length
4 0x13 The command byte,0x13
5 0x-- Subcontracting information (high four bits
representing current packet number, low four

6 0x--
representing total package)

7 0x--
High water byte

8 0x--
Low water byte

9 0x--
High byte of muscle

10 0x-- BMR
Low byte of muscle

11 0x-- BMR
high byte

12 0x--
low byte

13 0x--
Visceral fat high byte

14 0x--
Visceral fat low byte

15 0x--
Bone
Check code

Byte Value Description


4) 0x14 Multi user matching acknowledgement instruction:

1 0xCA Frame head


2 0x11 Protocol version number, V1.1
3 0x10 Data domain length
4 0x14
5 0x--
The command byte,0x14
Subcontracting information (high four bits representing

6 0x--
current packet number,low four representing total package)

7 0x--
High weight byte

8 0x-- Message body properties, defined reference tables 1


Low weight byte

9 0x--
10 0x--
Match user 1 number

11 0x--
12 0x--
13 0x--
14 0x--
Match user 2 number

15 0x--
16 0x--
17 0x--
18 0x--
19 0x--
20 0x-
Byte Value Description
1 0xCA Frame head
2 0x11 Protocol version number, V1.1
3 0x10 Data domain length
4 0x14
5 0x--
The command byte,0x14
Subcontracting information (high four bits
representing current packet number, low four
representing total package)

6 0x--
7 0x--
Match user 3 number

8
Match user 4 number
0x--
9 0x--
10 0x--
11 0x--
12
Match user 5 number
0x--
13 0x--
14 0x--
15 0x--
16
Match user 6 number
0x--
17 0x--
18 0x--
19 0x--
20 0x-
Match user 7 number
Check code

Byte Value Description


1 0xCA Frame head
2 0x11 Protocol version number, V1.1
3 0x10 Data domain length
4 0x14
5 0x--
The command byte,0x14
Subcontracting information (high four bits
representing current packet number, low four
representing total package)

6 0x--
7 0x--
Match user 7 number

8 0x--
9 0x--
10
Match user 8 number
0x--
11 0x--
12 0x--
13 0x-- Check code

REMARKS:
Bluetooth status through the P1.3 pin, High level indicates broadcast,
low level indicates connection. V1.4 version send data with 96 instructions,
sleep with 80 command, only these 2 commands.
2.2.3 MCU and BLE data interaction format (for MCU Engineers)

1. Interaction flow chart between MCU and BLE


2、Data command
1) the instruction that BLE sends to MCU

Byte Value Description


Synchronous command:

1 0xCA
2 0x0A
Frame head

3 0x10
Data length, length 3-11 bytes
Synchronous command
4 0x--
5~8 0x--
User number,0x00~0x09
Time, the unit is second, is relative to a certain benchmark
time offset, the reference time is defined as the benchmark
in the C function library time (1970 1)April 1, 0, 0), high
byte in front, low byte in back.
9 0x--
10 0x--
Gender, 0x80 means male, 0x00 means female

11 0x-- Height,unit is cm
Age

12 0x--
13 0x--
Note: the direction BLE-->MCU
Check code

2)MCU send data to BLE, not locked body weight


data(MCUBLE)
Byte Value Description

1 0xCA Frame head

2 0x11 Version number 3

3 0x0F Data domain length

4 0x-- 0x00 not locked

5 0x01 Bluetooth body-fat scale:0x01

6 0x-- High weight byte,Small end mode, 10 times the actual weight value

7 0x-- Low weight byte

8-11 0x-- Product ID

12 0x Message body properties, defined by reference table 1

13 0x00 Hold back

14 0x00 Hold back

15 0x00 Hold back

16 0x00 Hold back

17 0x00 Hold back


18 0x00 Hold back

19 XOR check value

Description: Command direction MCU-->BLE, the command data using small end data format, and the data
is 10 times the actual value, so as to retain 1 decimal places. For example: 65.5KG = 655 = 0x28F

Byte Value Description


Send locked weight data(MCUBLE)

1 0x--
2-5 0x--
Message body properties, defined by reference table 1
Time, the unit is second, the offset is relative to a certain
base time, Quasi time is defined as the benchmark in the C
function library (January 1, 1970, 0, time),0 minutes) high
byte in front, low byte in back.

6 0x--
7 0x-- High weight byte,Unit: kg (Modifiable)
User code,0x00~0x09

8 0x--
9 0x--
Low weight byte

10 0x--
Fat high byte, percent

11 0x--
Fat low byte

12 0x--
Water high byte, percent

13 0x--
Water low byte

14 0x--
Muscle high byte,kg

15 0x-- BMR high byte,kcal


Muscle low byte

16 0x-- BMR low byte


17 0x--
18 0x--
Visceral fat, high byte, percentage

19 0x--
Visceral fat, low byte

20 0x--
Bone ,kg
Exclusive or checksum value, exclusive or value of byte 1-19
Description: Command direction MCU-->BLE, the command data using small end data format,
and the data is 10 times the actual value.
In order to retain 1 decimal places. For example: 65.5KG = 655 = 0x28F.
Table 1:
Message Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0

Bit4-3 Unit selection


Hold back Unit selection Decimal point Not locked/locked

02 = KG(default)
03 = Jin
10 = LB
11 = ST:LB

Bit2-1
00 = 1 decimal places (default)
decimal places selection

01 = 0 decimal places
10 = 2 decimal places
Retain 1 decimal places, the weight of the uploaded value is 10 times the actual value,
and retain 2 decimal places, then upload the weight value of 100 times the actual value,
and so on.

Bit0
0 = Non lock data
Non lock / lock data

1 = lock data
Instructions on the number of units and decimals: the number of decimal digits displayed
by APP is determined by the scale, which is determined by the decimal number of the message
body attribute, the default unit is kg, and the decimal digit is 1 bits.

e.g.:

50kg,1 decimal, not locked 0x00 0x01 0xF4


Item Message body High weight byte Low weight byte

50 Jin,1 decimal, not locked 0x08 0x01 0xF4


50LB,1 decimal, not locked 0x10 0x01 0xF4
4:13 ST:LB,1 decimal, not 0x00 0x04 0x82
locked

Note: the 1.ST:LB unit defaults to: ST bytes are fixed to integers, and LB bytes are fixed to
1 decimal places. The decimal point at this point. Select bits represent small bits that are
converted to other units.
Sleep command:

Byte Value Description


1-4 0x10 00 00 C5 Frame head,fixed as 10 00 00 C5
5 0x01
6 0x80
Length

7 0x44
Sleep command
Check code
Description: Command direction MCU-->BLE, which enables Bluetooth to enter deep
sleep mode.

Byte Value Description


If Bluetooth have storage history data commands:

1 0xC5
2 0x01
Frame head

3 0x-- 0x03,have history data


Length

0x04,non history data


4 0x-- Check, 1~3 byte XOR value
Description: Command direction BLE-->MCU, the command Bluetooth power (or wake
up) sent to the MCU.

You might also like