/* Update Scan data /
4 C7 f, S# p) Y" |& F/ N- r9 k" f{
, _2 a% D) C$ g# M! v4 \1 D! Yuint8_t scan_data[31] =
& O$ Z$ ^2 Z% |9 o# f# x{
2 D, J" b$ v- o- L( h* H9 w; p( k. \0x14, /len 1/
% L& j. T6 M" v! |4 T1 _' r" Q% _$ hAD_TYPE_MANUFACTURER_SPECIFIC_DATA,/type 1/4 l9 N" o" d3 a3 Y' c" b' u# s. e* g
0x7e, 0xff, /manuf id 2/
d4 R! l, i" p/ The following are your payload */
- f1 q, q+ V# f3 Q7 Y1 E8 q E" v7 U0x05, 0x01, /type code 2/
( E o9 s+ G9 \6 L: T7 \! _5 @0x01, 0x00, /fun code 2/
" G$ T: X& P$ T% `2 F0x10, 0x0a, /fw ver 2/
$ K7 ^+ V% K2 W0x01, 0x22, /battery 2/* c9 N6 U/ F( j6 S% j( x2 x
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,/mac 6/' s* B! [" B& j
0x00, /enroll flag 1/
3 v, \; z) W* y) \, c0 l0x32, /protocol ver 1/
8 l8 t [& q) @0x01, /trigg reason 1/5 K& W* t( o1 r2 o/ G
};) J0 T/ q) o# w/ f2 W$ @
4 I; ~ M7 w( {0 u+ Z( A) g9 Y$ [- const uint8_t *bd_addr = BleGetBdAddress();
8 H2 n! w- @- F5 V3 q5 ^ - /* set mac addr big endian */% ]8 z3 R v7 s0 Z y+ u
- scan_data[12] = bd_addr[5];
, C" A4 M9 F8 y/ U+ Q - scan_data[13] = bd_addr[4];8 B6 ~/ u% f( L, m; l
- scan_data[14] = bd_addr[3];8 P/ b' Y! Z+ q: d
- scan_data[15] = bd_addr[2];
8 N* V9 p+ U( i) H8 V! X - scan_data[16] = bd_addr[1];; A1 z* H$ E# Y" `- s" x
- scan_data[17] = bd_addr[0];& t3 s8 a; U# E* c ]
- ret = hci_le_set_scan_response_data(scan_data[0]+1, scan_data);
+ U9 p4 l, t9 k1 P. l; a% e) h - if(BLE_STATUS_SUCCESS == ret)& ~2 D: m) c' P0 c# w
- { \1 b/ x# j. W( I3 G0 u
- printf("set scan data ok \r\n");
1 i* J2 r3 D* H! _4 D - }( ?+ F2 H( N% M0 z9 `6 N# y
- else- D3 y$ {" Y" l$ f) t; h
- {
6 T2 T, L& h2 }3 }# A7 a - printf("set scan data fail \r\n");
: K0 d4 }; e* y$ t. P7 U9 } - }
: K* q: D1 O( Y - }
0 |2 j8 m. Q+ d/ I5 } - /* Start Fast or Low Power Advertising */8 `/ {6 Q" z& y8 ]5 D* Z" Z
- ret = aci_gap_set_discoverable(
! m7 z. o4 x8 J5 R5 { - ADV_IND,/*普通可链接广播*/
( L* H0 B/ x5 I* f - Min_Inter,
S3 p9 h0 A. z6 n6 i" s" t6 _ - Max_Inter,
$ y! n; W7 u, Q1 ` - PUBLIC_ADDR,
* L1 G+ Y$ Q! }9 [2 Y$ x - NO_WHITE_LIST_USE, /* use white list */ U% C4 n) J. G
- sizeof(local_name),. M( o2 a% t9 J& @
- (uint8_t*) &local_name,$ V$ y1 V1 k- e& c3 K+ f
- BleApplicationContext.BleApplicationContext_legacy.advtServUUIDlen,4 m% S/ z' c- f2 {
- BleApplicationContext.BleApplicationContext_legacy.advtServUUID,
7 x* V) F, Z5 J7 ]4 i7 K: ]. } - 0,5 B' x7 T$ I: _, i
- 0);. n z/ D: C% e, ~/ V4 ^ V
复制代码 . Y' t! I: f! @3 a& S! S/ A
————————————————8 z; o0 s1 f+ u7 |$ `" ^- ~- Q
版权声明:&热爱
% p/ b: R8 X) R- _3 h, J, d7 Y; l7 U2 X
|