MOKOSmart LW003-B User manual

1
LW003-B User Manual
LW003-B
MOKO TECHNOLOGY LTD.
Version 2.1 www.mokosmart.com
User Manual

www.mokosmart.com
Contents
1 About This Manual.................................................................................. 1
2 Product Introduction............................................................................... 1
2.1 Overview ................................................................................................................................1
2.2 Application .............................................................................................................................1
2.3 Product Specifications............................................................................................................2
2.3.1 Appearance .................................................................................................................2
2.3.2 Mechanical Size...........................................................................................................2
2.3.3 LED Indicators and Button...........................................................................................3
3 Device Feature and Function .................................................................. 4
3.1 Introduction to Device Application ........................................................................................4
3.1.1 Indoor Positioning.......................................................................................................4
3.1.2 Asset Monitoring.........................................................................................................5
3.1.3 Personnel Over-Limit Alarm........................................................................................5
3.1.4 Environment Monitoring.............................................................................................6
3.2 Bluetooth Capabilities............................................................................................................7
3.2.1 Bluetooth Advertise ....................................................................................................7
3.2.2 Bluetooth Scan............................................................................................................8
3.2.2.1 Scanning Filtering Rules ...................................................................................9
3.2.2.2 Filter Repeating Data......................................................................................10
3.3 LoRaWAN Capabilities..........................................................................................................10
3.4 Local Data Sync.....................................................................................................................10
3.5 Temperature and Humidity Monitoring...............................................................................11
3.6 Default Power Status............................................................................................................11
3.7 Battery Performance............................................................................................................11
3.8 Time Synchronization...........................................................................................................12
3.9 Configuration Tool................................................................................................................12
4 Uplink Payload ...................................................................................... 12
4.1 Device Information Payload.................................................................................................12
4.2 Beacon Payload ....................................................................................................................14
4.3 Uplink Payload Decoder.......................................................................................................16
5 Maintenance Instruction...........................................................19
6 Revision.....................................................................................19

LW003-B
www.mokosmart.com
1
1 About This Manual
The purpose of this manual is to outline how to apply LW003-B in suitable scenarios, as well as the
main function of LW003-B.
2 Product Introduction
2.1 Overview
LW003-B is a Bluetooth-LoRaWAN gateway integrating LoRa and Bluetooth wireless
Communication. LW003-B can scan Bluetooth Beacon data and send data to LoRaWAN-Based
gateway, and then upload to server, so as to realize personnel tracking, indoor positioning, asset
monitoring and environmental monitoring.
2.2 Application
➢Positioning & Location tracking
➢Asset& Equipment tracking
➢Personal tracking
➢Environmental temperature and humidity monitoring
In the actual application, it should consider the
ability of Bluetooth scan, and the time
synchronization should be considered in the
indoor position application otherwise the time
stamp will not be accurate.

LW003-B
www.mokosmart.com
2
2.3 Product Specifications
2.3.1 Appearance
2.3.2 Mechanical Size
Unit
:
mm

LW003-B
www.mokosmart.com
3
2.3.3 LED Indicators and Button
Items
Indicator
Operation
Remark
Turn ON
Solid blue and
keep 3S
Press and hold the power button
for 5 seconds till the LED indicate
blue and release. The LED will
indicate blue for 3 seconds to
show the LW003-B is turned on.
Turn OFF
Red LED Blink 3S
Press and hold the power button
for 5 seconds till the red indicator
flashes quickly and release. The
indicator will flash red for 3
seconds to show the LW003-B is
turned off.
Join LoRa
Network
Solid green and
keep 3S
If the device had never
Joined any network, after turning
on, the device automatically
sends join request
It will send join request
automatic after power on
the device or save “LoRa
Setting” parameter
in APP
Bluetooth
connection
established
successfully
Green LED Blink
1S
Connect to the device
via APP successfully
Bluetooth
connection
disconnected
Red LED Blink 1S
APP disconnect to the device
If the device is in alarm
status, the indicator may
be not visible
Firmware
Upgrade
Green LED Blink
during the
upgrade
Firmware upgrade via OTA in DFU
mode
Solid Blue and
keep 3S after
upgrade
successfully
Solid Red and
keep 3S after
upgrade failed
Charging
Blue LED blink
Plug in Micro USB charger
Full Charged
Solid blue
Plug in Micro USB charger
Low Battery
Reminder
Red LED blink
once every 30s
Battery level lower than 10%
Over-limit
Indication
Solid Red
Solid red when the device is in
Over-limit status

LW003-B
www.mokosmart.com
4
3 Device Feature and Function
3.1 Introduction to Device Application
3.1.1 Indoor Positioning
➢Firstly, the LW003-B should be installed in the corresponding position according to the preset
position to ensure that the scanning range of LW003-B can cover the space to be positioned.
➢The beacon information required by customers can be filtered according to Scanning Filtering
Rules (Pls refer to 3.2.2.1 Scanning Filtering Rules).
➢Because the installation location of the LW003-B is known, the user can continuously analyze
the Beacon Payload (Pls refer to 4.2 Beacon Payload)data on the server side to monitor the
location and movement of the personnel.

LW003-B
www.mokosmart.com
5
3.1.2 Asset Monitoring
LW003-B also can be used in factory to monitor critical assets.
For example:
➢user can attach Bluetooth beacons to important devices that need to be monitored and install
LW003-B around the important devices in factory.
➢LW003-B will continuously scan the Bluetooth beacon broadcast information and report to
the server.
➢In this case, the background server should be able to continuously receive the information
from the Bluetooth beacon bound on the device transmitted from the corresponding
LW003-B. If no information is received in a certain period of time or the data is not
transmitted from the corresponding LW003-B, the server can trigger an alarm to indicate that
the device has been moved.
3.1.3 Personnel Over-Limit Alarm
When too many people gather around the same place in a short duration, the indicator light of
LW003-B will turn red to remind the crowd of too many people.
For example:

LW003-B
www.mokosmart.com
6
➢In the office application scenario, all people wear the Bluetooth Beacon device of work card
type in office and install a LW003-B on meeting room or Tea area. Set a limited number (7
people) of people in each area in advance via MKLoRa APP and ensure that the Bluetooth
Beacon device worn by all people meets the filtering conditions of LW003-B.
➢On meeting room or Tea area, if eight or more people gather here in a short duration (The
duration can be set according to the actual situation after testing), LW003-B will send out an
alarm warning of overstaffing.
Note: The area of each area is different, and we can change the Over-Limit RSSI to adjust the
coverage of the over-limit function
3.1.4 Environment Monitoring
LW003-B has built-in temperature and humidity sensors and regularly reports data to the server.
The user can analyze and statistics the temperature and humidity of the server, so as to realize the
function of environmental monitoring, which is mainly suitable for office, factory, hospital, school
and other occasions.

LW003-B
www.mokosmart.com
7
3.2 Bluetooth Capabilities
3.2.1 Bluetooth Advertise
When user turn on the LW003-B, the LW003-B will constantly Bluetooth broadcast.
When the device is broadcasting, users can scan LW003-B and establish a connection via cell
phones, iPad, etc.
Note: About the MKLoRa app, pls refer to LW003-B APP Guide
The following is an example of the Advertise Packet:

LW003-B
www.mokosmart.com
8
⚫Service UUID: AA00
⚫MAC Address: DC ED 9E F2 20 CB
⚫Battery Level: 0x64 (100%)
⚫Environment Temperature: 0x 0A 26 (25.98℃)
⚫Environment Humidity: 0x 19 D7 (64.292%)
Note: For data conversion, refer to the corresponding parameter data conversion in Chapter 4
Uplink Payload, especially for battery level, environment temperature, environment humidity.
3.2.2 Bluetooth Scan
➢When scan switch status is on, the device will start to scan beacons nearby and cache the
beacon information that meets the conditions. Then the device will report beacon data
regularly, and the reporting interval can be set.
➢Scan capacity of BLE is limited by uplink beacon data payload length. Based on our default
format of the uplink beacon data payload, the max BLE scan capacity is 300 beacons. And it
will filter out duplicate beacon and follow FIFO.
➢The quantities of beacons upload to server is also limit by the report interval. If the upload
interval time is not enough to upload all beacon payload it will be covered by new cycle
beacon payload.

LW003-B
www.mokosmart.com
9
➢The Bluetooth scan window can be set by user, if you want improve the scanning performance,
you can make it higher, but accordingly broadcast performance will be reduced and will affect
the battery life of the device.
3.2.2.1 Scanning Filtering Rules
In order to better scan and filter out the user's desired beacon device, we develop Scanning
Filtering Rules on LW003. Only beacons that meet Scanning Filtering Rules will be cached and
uploaded.
The following is the specific description of Scanning Filtering Rules:
①There are two sets of filter conditions, one is Filter Condition A, and other one is Filter
Condition B. Each filter condition has a separate switch setting, which can be arbitrarily switched
on or off.
②When both of Filter Condition A and Filter Condition B are switched on, the relationship
between two sets of filter conditions can be set as AND or OR.
AND: Beacon information is stored and reported only when the data meets both Filter Condition A
and Filter Condition B.
OR: Beacon information is stored and reported when the beacon data meets either filter condition
A or filter condition B.
If only one condition is opening, the data that meets this filter condition will be saved and
uploaded.
③ There are seven filter items in each set of filter conditions, which are RSSI Filter, MAC Address
Filter, UUID Filter, ADV Name Filter, Major Filter, Minor Filter and Raw Data Filter. Only if these
seven filter items are met at the same time can this filter condition be considered to be met.
Each filter item can be set to off, positive filter and reverse filter.
Off: Regardless of this filter item.
Positive filter: If the device being scanned matches the content of this filter item, it is
considered to meet the filter item.
Reverse filter: If the device being scanned does not match the contents of this filter
item, it is considered to meet the filter item.
Note: For the RSSI Filter item, it can’t be set to Reverse filter. Refer to LW003-B APP Guide for
detailed Settings of filter items and an example.

LW003-B
www.mokosmart.com
10
3.2.2.2 Filter Repeating Data
Because each beacon device may be scanned and saved more than one time in one scan cycle, we
have opened up Filter Repeating Data. With this function, for the same data, we only reported it
once in the same reporting cycle and the data reported was the most recent scanned.
There are four types of Filter Repeating Data:
No: Don't do anything.
MAC: Beacon data with the same MAC will only be reported once in the same cycle
MAC + Data Type: Beacon data with the same MAC and the same beacon data type will only be
reported once in the same cycle. Common data types are IBEACONS, Eddystone and AltBeacon.
MAC + Raw Data: Beacon data with the same MAC address and raw data will only be reported
once in the same cycle.
Some beacons have multiple slots and each slot can broadcast different types of data and different
content. Through the Filter Repeating Data, users can better get the data they want.
3.3 LoRaWAN Capabilities
The data of LW003 will be transmitted via LORA and LW003 is based on the standard LoRaWAN
protocol V1.0.3. LW003 is compatible with most gateways and servers (TTN, SENET, LORA IOT, etc.)
in the market
Link Check MAC Commands: LW003 supports LinkCheck function. Users can use this function to
realize regular network monitoring function and confirm the network status of the device.
Device Time MAC Commands: LW003 supports the DeviceTime feature, which enables Users can
periodically synchronize the time of the device to avoid time offset. The Time Sync Interval of the
MKLoRa APP is the Device Time MAC Command interval. (Please refer to Chapter 2.3.1 LORA
Parameter of LW003-B APP Guide)
Note: Some LoRa Server platforms did not support LinkCheck and DevicTtime function, for example
TTN server, if you want use device in these platforms, should set the corresponding Settings item to
0.
3.4 Local Data Sync
LW003-B Built-in 4M FLASH memory chip, can support 20,000 pieces of data local storage at most.
All data uploaded by the device is stored in the device.

LW003-B
www.mokosmart.com
11
Users can read data of the past 1 day, 7 days, 1 month, 3 months, 6 months, 1 year or custom days
via Bluetooth or downlink command.
When the LoRaWAN network has problems or data loss is severe, users can quickly get the
historical reporting data from the device.
Note: When the data is synchronized and exported successfully, pls remember to delete the device
local data in case there is too much data in the next synchronization.
3.5 Temperature and Humidity Monitoring
LW003-B has built-in temperature and humidity sensor SHT30, which can be used to monitor
environmental temperature and humidity through continuous analysis of uplink data.
3.6 Default Power Status
In the application scenario of LW003-B, power supply may be suddenly cut off. Because the
LW003-B's built-in battery has limited capacity, in this case, the device will quickly run out of power
and shut down.
When power is restored later, if the device will not automatically be turn on, the user must
manually turn on the LW003, this will result in increased human costs and there will be a risk of
losing some uplink payload.
Based on the above situation, LW003-B adds the function to set the state of the device when the
device is powered back on. There are three options: “Switch off”, “Switch on” and “Revert to last
status”.
➢If set to “switch on”, it means that the LW003-B will be on when the device is powered back
on.
➢If set to “switch off”, it means that the LW003-B will be off when the device is powered back
on.
➢If set to “Revert to last status”, it means that the LW003-B will be in the same state as it was
before the power was cut off.
3.7 Battery Performance
The LW003-B can support both battery and DC power. The device is equipped with a 4200 mAh
rechargeable battery.
With batteries, the typical service life of the device is around 20 days (Scan Window:50ms, Report
Interval:3 minutes).

LW003-B
www.mokosmart.com
12
3.8 Time Synchronization
There are four methods to sync time through the MKLoRa APP, DeviceTime function, RTC or
Downlink Command.
➢MKLoRa APP: When the APP connect with the device success the phone system time will be
sync to the device.
➢Device Time MAC Commands: LW003 supports the DeviceTime feature, which enables users
can periodically synchronize the time of the device to avoid time offset.
➢RTC: The LW003 has a built-in RTC circuit. When LW003 is completely shut down, the RTC will
continue to keep the time updated in ten days, then if the device is powered on in these ten
days, the RTC will immediately synchronize the time to LW003.
➢Downlink Command: User can use the downlink command to sync time, it is better to send the
RTC time to device when the device send heartbeat (device information packet) as the device
only open the receive window in CLASS A when there is uplink transmission or CLASS C.
3.9 Configuration Tool
The device can use MKLoRa app developed by Moko for quick OTA upgrades and parameter
settings. About the detail of MKLoRa, pls refer to LW003-B APP Guide.
4 Uplink Payload
There are two different types uplink payloads: device information payload and beacon data
payload.
4.1 Device Information Payload
When the device is successfully connected to the LoRaWAN network, the device will immediately
send a Device Information Payload to server, and periodically report Device Information Payload
thereafter.
Device information payloads will be sent in Port 1.
Byte Index
Type
Data Type
Value
Description
Byte 0
Battery Level
Uint
0x00-0x64
Convert to decimal, unit is %.

LW003-B
www.mokosmart.com
13
Example: 4D 0F 42 86 64 00 0A 2B 11 7E 05
⚫4D: battery level is 100%
⚫0F 42: battery voltage is 3.906V
⚫86: firmware version is V2.0.6
⚫64: 3-Axis sensitivity is 100mg
⚫00: Tamper state is normal.
Note: The battery level will be
always nearly 100% when the
device is powered by USB.
Bytes 1-2
Battery
Voltage
Uint
0x0000-0xFFFF
The voltage value of battery, the
byte order is Big-Endian. The
actual voltage need divide 1000
after the hexadecimal data
convert to decimal. Example: 3C
0Econvert to decimal is 3644, the
actual voltage is 3.644V. If the
device is powered by USB, the
voltage will always above 3.4V
Byte 3
Firmware
Version
Uint
0x00-0xFF
Firstly, convert to 8-bit binary
number. Example:86 is 1000 0110
in binary number, 10 equals to 2,
00 equals to 0, 0110 equals to 6,
so the firmware version is V 2.0.6
Byte 4
3-Axis
sensitivity
Uint
0x00-0xFF
Converts directly to decimal
numbers, the unit is mg.
Byte 5
Tamper state
Uint
0x00/0x01
0x00 means normal,0x01 means
that the device was removed
abnormally.
Note: This function is not enabled
yet
Byte 6-7
Temperature
Int
0x0000-0xFFFF
Converts directly to decimal
numbers, then divide 100.The unit
is degree centigrade.
Byte 8-9
Humidity
Uint
0x0000-0xFFFF
Converts directly to decimal
numbers, then divide 100.The unit
is %.
Byte 10
Region
Uint
0x00-0x09
0x00 means AS923;0x01 means
AU915;0x02 means CN470;0x03
means CN779;0x04 means
EU433;0x05 means EU868;0x06
means KR920;0x07 means
IN865;0x08 means US915;0x09
means RU864.

LW003-B
www.mokosmart.com
14
⚫0A 2B: Temperature is 26.03℃
⚫11 7E: Humidity is 44.78%
⚫05: Region is EU868
4.2 Beacon Payload
➢Beacon data will be uploaded per 10s by default after the device start to scan beacon, and the
report interval can be changed by MKLoRa APP or downlink command.
➢Beacon Data Payloads will be sent in Port 2.
➢The user can select what type of beacon data to report and the content of the beacon payload
(Pls refer to LW003 APP Guide).
➢The user can select the maximum length of the reported beacon payload. There are two
options, one is 115bytes and the other is 242bytes. It affects the number of beacons per
beacon payload.
Byte Index
Type
Data Type
Value
Description
Byte 0
Payload Type
Uint
0x20-0xFF
The header of the beacon data
payload message. In each beacon
payload reporting cycle, the
beacon data payload header will
start on 20.
20: the first packet beacon data.
21: the second packet beacon
data and so on.
Byte 1
Total Beacon
Quantities of
this payload
Uint
0x00-0xFF
The total beacon quantities in this
payload. It depends on the length
of beacon broadcast data.
Byte 2
The First
Beacon Data
Length
Uint
0X00-0XFF
Converts directly to decimal
numbers.
Byte 3-9
The First
Beacon
Timestamp
Uint
0X0000000000
0000-
OxFFFFFFFFFFF
FFF
Byte 10-15
The First
Beacon MAC
Uint
0X0000000000
00-
0XFFFFFFFFFFF
F
The byte order is Big-Endian.
Example: B1 FA 1E 36 EF 03, the
real MAC address is B1 FA 1E 36
EF 03.
Byte 16
The First
Beacon RSSI
Int
0X00-0XFF
Converts directly to decimal
numbers, then Minus 256. The
unit is dBm.
Byte 17-XX
The First
Beacon Raw
Data
Uint
The beacon raw data length and
data content depend the real
beacon, please check the beacon

LW003-B
www.mokosmart.com
15
The Second
Beacon Data
Length
Uint
0X01-0XFF
Converts directly to decimal
numbers.
The Second
Beacon
Timestamp
Uint
0X0000000000
0000-
OxFFFFFFFFFFF
FFF
The Second
Beacon MAC
Uint
0X0000000000
00-
0XFFFFFFFFFFF
F
The byte order is Big-Endian
The Second
Beacon RSSI
Int
0X00-0XFF
Converts directly to decimal
numbers, then Minus 256. The
unit is dBm.
The Second
Beacon Raw
Data
Unit
The beacon raw data length and
data content depend the real
beacon, please check the beacon.
………….
……………
………………
……………………………………………
Example: 21 03 2D 07 E5 04 1C 09 06 0C 58 B7 2E 09 F2 A5 BD 1E FF 06 00 01 09 20 02 B7 D7 18
C2 1D B5 F4 49 A7 50 FB 52 E5 0E 89 40 54 BF 4F 58 15 19 73 49 07 E5 04 1C 09 06 0C E4 4B 4B A7
93 D0 BA 02 01 06 1A FF 4C 00 02 15 E2 C5 6D B5 DF FB 48 D2 B0 60 D0 F5 A7 10 96 E0 00 00 00
00 BF 12 16 01 AA 01 00 00 00 00 BF 00 0E 64 E4 4B 4B A7 93 D0 09 09 4C 57 30 30 34 2D 43 54 2D
07 E5 04 1C 09 06 0C 37 6A D3 16 30 D9 BC 1E FF 06 00 01 09 20 02 90 7B A4 89 DA 98 7A EC 14 24
F3 8D 60 13 A4 28 42 C2 E6 6E 6C 85 FC
⚫21: beacon data payload.
⚫03: Total Beacon Quantities of this payload is 3.
⚫2D: The first Beacon Data Length is 45.
⚫07 E5 04 1C 09 06 0C: Timestamp of 1st beacon, it has been scanned at 2021-4-28 9:6:12.
⚫58 B7 2E 09 F2 A5: The 1st MAC Address is 58 B7 2E 09 F2 A5.
⚫BD: 1st beacon RSSI is -67 dBm.
⚫1E FF 06 00 01 09 20 02 B7 D7 18 C2 1D B5 F4 49 A7 50 FB 52 E5 0E 89 40 54 BF 4F 58 15 19
73: The first beacon broadcast raw data.
⚫49:The second Beacon Data Length is 73.
⚫07 E5 04 1C 09 06 0C: Timestamp of 1st beacon, it has been scanned at 2021-4-28 9:6:12.
⚫E4 4B 4B A7 93 D0: The 2nd MAC Address is E4 4B 4B A7 93 D0.
⚫BA: 2nd beacon RSSI is -70 dBm.
⚫02 01 06 1A FF 4C 00 02 15 E2 C5 6D B5 DF FB 48 D2 B0 60 D0 F5 A7 10 96 E0 00 00 00 00 BF
12 16 01 AA 01 00 00 00 00 BF 00 0E 64 E4 4B 4B A7 93 D0 09 09 4C 57 30 30 34 2D 43 54: The
second beacon broadcast raw data.
⚫2D: The third Beacon Data Length is 45.
⚫07 E5 04 1C 09 06 0C: Timestamp of 1st beacon, it has been scanned at 2021-4-28 9:6:12.
⚫37 6A D3 16 30 D9: The 3rd MAC Address is 37 6A D3 16 30 D9.

LW003-B
www.mokosmart.com
16
⚫BC: 3rd beacon RSSI is -68 dBm.
⚫1E FF 06 00 01 09 20 02 90 7B A4 89 DA 98 7A EC 14 24 F3 8D 60 13 A4 28 42 C2 E6 6E 6C 85
FC: The third beacon broadcast raw data.
4.3 Uplink Payload Decoder
GITHUB Link: https://github.com/LoRaWAN-Product-Decoder/Decoder
/*
according dev config,show report data format choose, this flag must be the same as the device
bit 4 have timestamp
bit 3 have ble mac
bit 2 have ble rssi
bit 1 have ble adv data
bit 0 have ble response data
*/
var flag = 0x1F;
function substringBytes(bytes, start, len)
{
var char = [];
for(var i = 0; i < len; i++)
{
char.push("0x"+ bytes[start+i].toString(16) < 0X10 ? ("0"+bytes[start+i].toString(16)) :
bytes[start+i].toString(16) );
}
return char.join("");
}
function Decoder(bytes, port)
{
var region =
["AS923","AU915","CN470","CN779","EU433","EU868","KR920","IN865","US915","RU864"];
var dev_info = {};
if(port == 1)
{
dev_info.batt_level = bytes[0] + "%";
dev_info.batt_v = bytes[1]*256 + bytes[2] + "mV";
ver_major = (bytes[3]>>6)&0x03;
ver_mijor = (bytes[3]>>4)&0x03;
ver_patch = bytes[3]&0x0f;
dev_info.ver = "V" + ver_major+"."+ver_mijor+"."+ver_patch;
dev_info.sensitivity = bytes[4] + "mg";
dev_info.demolition_state = bytes[5];
temperature = bytes[6]*256 + bytes[7];
if(temperature >0x8000)

LW003-B
www.mokosmart.com
17
dev_info.temperature = "-" + (0X10000-temperature )/100 + "°C";
else
dev_info.temperature = temperature /100 + "°C";
dev_info.humility = (bytes[8]*256 + bytes[9])/100+"%";
dev_info.region = region[bytes[10]];
}
else if(port == 2)
{
dev_info.head = bytes[0];
dev_info.beacon_num = bytes[1];
var parse_len = 2;
var datas = [];
for(var i = 0; i < dev_info.beacon_num; i++)
{
var data = {};
var beacon_len = 0;
var current_data_len = bytes[parse_len++];
if(flag&0x10)
{
year = bytes[parse_len]*256 + bytes[parse_len+1];
parse_len += 2;
mon = bytes[parse_len++];
days = bytes[parse_len++];
hour = bytes[parse_len++];
minute = bytes[parse_len++];
sec = bytes[parse_len++];
data.utc_time = year + "-" + mon + "-" + days + " " + hour + ":" + minute + ":" +
sec;
beacon_len +=7;
}
if(flag&0x08)
{
data.mac = substringBytes(bytes, parse_len, 6);
parse_len += 6;
beacon_len +=6;
}
if(flag&0x04)
{
data.rssi = bytes[parse_len++]-256 +"dBm";
beacon_len +=1;
}
if(flag&0x03)
{
data.adv_len = current_data_len-beacon_len ;
data.adv_data = substringBytes(bytes, parse_len, data.adv_len);

LW003-B
www.mokosmart.com
18
parse_len += data.adv_len;
}
datas.push(data);
}
dev_info.scan_data = datas;
}
else if(port == 4)
{
var parse_len = 0;
dev_info.beacon_num = bytes[4];
if(dev_info.beacon_num)
{
parse_len += 5;
var datas = [];
for(var i = 0; i < dev_info.beacon_num; i++)
{
var data = {};
var beacon_len = 0;
var current_data_len = bytes[parse_len++];
year = bytes[parse_len]*256 + bytes[parse_len+1];
parse_len += 2;
mon = bytes[parse_len++];
days = bytes[parse_len++];
hour = bytes[parse_len++];
minute = bytes[parse_len++];
sec = bytes[parse_len++];
data.utc_time = year + "-" + mon + "-" + days + " " + hour + ":" + minute + ":" +
sec;
beacon_len +=7;
data.mac = substringBytes(bytes, parse_len, 6);
parse_len += 6;
beacon_len +=6;
data.rssi = bytes[parse_len++]-256 +"dBm";
beacon_len +=1;
data.adv_len = current_data_len-beacon_len ;
data.adv_data = substringBytes(bytes, parse_len, data.adv_len);
parse_len += data.adv_len;
datas.push(data);
}
dev_info.store_data = datas;
Table of contents