-
Notifications
You must be signed in to change notification settings - Fork 0
/
nb__bc35_8h.html
1225 lines (1175 loc) · 83.4 KB
/
nb__bc35_8h.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>ESP8266 Centre + NB: nb_bc35.h 文件参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">ESP8266 Centre + NB
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.6 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>首页</span></a></li>
<li><a href="pages.html"><span>相关页面</span></a></li>
<li><a href="modules.html"><span>模块</span></a></li>
<li><a href="annotated.html"><span>结构体</span></a></li>
<li class="current"><a href="files.html"><span>文件</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>文件列表</span></a></li>
<li><a href="globals.html"><span>全局定义</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_e3cfce0f2579b93466aa86ecffbb9b24.html">include</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#define-members">宏定义</a> |
<a href="#func-members">函数</a> </div>
<div class="headertitle">
<div class="title">nb_bc35.h 文件参考</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include "<a class="el" href="ets__sys_8h_source.html">ets_sys.h</a>"</code><br/>
<code>#include "<a class="el" href="os__type_8h_source.html">os_type.h</a>"</code><br/>
<code>#include "<a class="el" href="osapi_8h_source.html">osapi.h</a>"</code><br/>
<code>#include "<a class="el" href="driver_2uart_8h_source.html">driver/uart.h</a>"</code><br/>
</div><div class="textblock"><div class="dynheader">
nb_bc35.h 的引用(Include)关系图:</div>
<div class="dyncontent">
<div class="center"><img src="nb__bc35_8h__incl.png" border="0" usemap="#nb__bc35_8h" alt=""/></div>
<map name="nb__bc35_8h" id="nb__bc35_8h">
<area shape="rect" id="node2" href="ets__sys_8h.html" title="ets_sys.h" alt="" coords="12,155,91,181"/><area shape="rect" id="node5" href="os__type_8h.html" title="os_type.h" alt="" coords="60,80,139,107"/><area shape="rect" id="node6" href="osapi_8h.html" title="osapi.h" alt="" coords="230,80,294,107"/><area shape="rect" id="node9" href="driver_2uart_8h.html" title="driver/uart.h" alt="" coords="116,155,205,181"/><area shape="rect" id="node3" href="c__types_8h.html" title="c_types.h" alt="" coords="121,229,200,256"/><area shape="rect" id="node4" href="eagle__soc_8h.html" title="eagle_soc.h" alt="" coords="5,229,97,256"/><area shape="rect" id="node10" href="driver_2uart__register_8h.html" title="uart_register.h" alt="" coords="224,229,329,256"/></map>
</div>
</div><div class="textblock"><div class="dynheader">
此图展示该文件直接或间接的被哪些文件引用了:</div>
<div class="dyncontent">
<div class="center"><img src="nb__bc35_8h__dep__incl.png" border="0" usemap="#nb__bc35_8hdep" alt=""/></div>
<map name="nb__bc35_8hdep" id="nb__bc35_8hdep">
<area shape="rect" id="node2" href="app__study__room_8c.html" title="app_study_room.c" alt="" coords="5,80,135,107"/><area shape="rect" id="node3" href="nb__bc35_8c.html" title="nb_bc35.c" alt="" coords="159,80,242,107"/><area shape="rect" id="node4" href="user__main_8c.html" title="user_main.c" alt="" coords="266,80,359,107"/></map>
</div>
</div>
<p><a href="nb__bc35_8h_source.html">浏览源代码.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
宏定义</h2></td></tr>
<tr class="memitem:a8d1152fd5720304d3e44fa2101541f03"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a8d1152fd5720304d3e44fa2101541f03">AT_MODU_NAME</a>   "nb_neul95"</td></tr>
<tr class="separator:a8d1152fd5720304d3e44fa2101541f03"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af0651b26f59b22f014ef8b9b42b2ed05"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#af0651b26f59b22f014ef8b9b42b2ed05">AT_NB_OPEN_RF</a>   "AT+CFUN=1\r"</td></tr>
<tr class="separator:af0651b26f59b22f014ef8b9b42b2ed05"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac5d2ee5af7efada9c1703451ef038790"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#ac5d2ee5af7efada9c1703451ef038790">AT_NB_CLOSE_PSM</a>   "AT+CPSMS=0\r"</td></tr>
<tr class="separator:ac5d2ee5af7efada9c1703451ef038790"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa687010bde7f90377faee82786b2395b"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#aa687010bde7f90377faee82786b2395b">AT_NB_CLOSE_EDRX</a>   "AT+CEDRXS=0,5\r"</td></tr>
<tr class="separator:aa687010bde7f90377faee82786b2395b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a53b06833e6fc79828555ea7bbeb2278f"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a53b06833e6fc79828555ea7bbeb2278f">AT_NB_CGATT_ATTACH</a>   "AT+<a class="el" href="nb__bc35_8h.html#a9a2068bff818d36fedd0be3b4dc67a82">CGATT</a>=1\r"</td></tr>
<tr class="separator:a53b06833e6fc79828555ea7bbeb2278f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa55fd8c8f8e1e5f62839e8f9f8ed2458"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#aa55fd8c8f8e1e5f62839e8f9f8ed2458">AT_NB_REPORT_PREFIX</a>   "AT+NMGS="</td></tr>
<tr class="separator:aa55fd8c8f8e1e5f62839e8f9f8ed2458"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2d324ffefa260f926d5eec6c15923869"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a2d324ffefa260f926d5eec6c15923869">AT_NB_LINE_END</a>   "\r\n"</td></tr>
<tr class="separator:a2d324ffefa260f926d5eec6c15923869"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a114f0dbbfbfe9ce363fb1e8d4abfdbb6"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a114f0dbbfbfe9ce363fb1e8d4abfdbb6">AT_NB_reboot</a>   "AT+NRB\r"</td></tr>
<tr class="separator:a114f0dbbfbfe9ce363fb1e8d4abfdbb6"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a94e318a85aa13f91043ab5ad676ac9fe"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a94e318a85aa13f91043ab5ad676ac9fe">AT_NB_hw_detect</a>   "AT+CFUN?\r"</td></tr>
<tr class="separator:a94e318a85aa13f91043ab5ad676ac9fe"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad3c390c89eba62a1d3444ab5ebbfcc4d"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#ad3c390c89eba62a1d3444ab5ebbfcc4d">AT_NB_get_auto_connect</a>   "AT+NCONFIG?\r"</td></tr>
<tr class="separator:ad3c390c89eba62a1d3444ab5ebbfcc4d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a5250a1012848aa5fd350a61cd3d7f7e8"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a5250a1012848aa5fd350a61cd3d7f7e8">AT_CMD_PREFIX</a>   "\r\n+NNMI:"</td></tr>
<tr class="separator:a5250a1012848aa5fd350a61cd3d7f7e8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a3477930792c6a3ef6157f54c7974e9ce"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a3477930792c6a3ef6157f54c7974e9ce">AT_DATAF_PREFIX</a>   "+NSONMI:"</td></tr>
<tr class="separator:a3477930792c6a3ef6157f54c7974e9ce"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a9a2068bff818d36fedd0be3b4dc67a82"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a9a2068bff818d36fedd0be3b4dc67a82">CGATT</a>   "AT+CGATT?\r"</td></tr>
<tr class="separator:a9a2068bff818d36fedd0be3b4dc67a82"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af698941e62444eae3d3af0c726cb8440"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#af698941e62444eae3d3af0c726cb8440">CGATT_DEATTACH</a>   "AT+<a class="el" href="nb__bc35_8h.html#a9a2068bff818d36fedd0be3b4dc67a82">CGATT</a>=0\r"</td></tr>
<tr class="separator:af698941e62444eae3d3af0c726cb8440"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa32caeb8581192d1d076801cf45ad2f5"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#aa32caeb8581192d1d076801cf45ad2f5">AT_LINE_END</a>   "\r\n"</td></tr>
<tr class="separator:aa32caeb8581192d1d076801cf45ad2f5"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a1aa9f916961c8547818a6354f61b4b15"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a1aa9f916961c8547818a6354f61b4b15">AT_CMD_BEGIN</a>   "\r\n"</td></tr>
<tr class="separator:a1aa9f916961c8547818a6354f61b4b15"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0586e510899fa54a3a28a1b57f179b11"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a0586e510899fa54a3a28a1b57f179b11">AT_USART_PORT</a>   3</td></tr>
<tr class="separator:a0586e510899fa54a3a28a1b57f179b11"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac76bbf7ac0cf5291c14a52a08bceaa26"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#ac76bbf7ac0cf5291c14a52a08bceaa26">AT_BUARDRATE</a>   9600</td></tr>
<tr class="separator:ac76bbf7ac0cf5291c14a52a08bceaa26"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a28dd4caf253f1cce669ca8928dd8cf86"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a28dd4caf253f1cce669ca8928dd8cf86">AT_CMD_TIMEOUT</a>   10000</td></tr>
<tr class="separator:a28dd4caf253f1cce669ca8928dd8cf86"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad3413977381bf16a5b513cd8edf68bcf"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#ad3413977381bf16a5b513cd8edf68bcf">AT_MAX_LINK_NUM</a>   4</td></tr>
<tr class="separator:ad3413977381bf16a5b513cd8edf68bcf"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:adf19a92cc94e73228b1a18451fff23a4"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#adf19a92cc94e73228b1a18451fff23a4">NB_STAT_LOCALPORT</a>   56</td></tr>
<tr class="separator:adf19a92cc94e73228b1a18451fff23a4"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae5a2e3b1eefb3a10a2485e28a4ccdb59"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#ae5a2e3b1eefb3a10a2485e28a4ccdb59">MAX_SOCK_NUM</a>   5</td></tr>
<tr class="separator:ae5a2e3b1eefb3a10a2485e28a4ccdb59"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a15b182d7930e0c3411c514860367d44b"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a15b182d7930e0c3411c514860367d44b">UDP_PROTO</a>   17</td></tr>
<tr class="separator:a15b182d7930e0c3411c514860367d44b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa8fcba07ec4b6d01f5b51330278f8760"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#aa8fcba07ec4b6d01f5b51330278f8760">MAX_AT_USERDATA_LEN</a>   (1024*5)</td></tr>
<tr class="separator:aa8fcba07ec4b6d01f5b51330278f8760"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a9155cd445dc93d15e329ec911602b149"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a9155cd445dc93d15e329ec911602b149">AT_MAX_PAYLOADLEN</a>   512</td></tr>
<tr class="separator:a9155cd445dc93d15e329ec911602b149"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0fe86551df906756e80b64b4b515c37d"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a0fe86551df906756e80b64b4b515c37d">IP_LEN</a>   16</td></tr>
<tr class="separator:a0fe86551df906756e80b64b4b515c37d"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
函数</h2></td></tr>
<tr class="memitem:a400010e7ae3dbd0f364708d1cefb648f"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a400010e7ae3dbd0f364708d1cefb648f">NB_ReportData</a> (<a class="el" href="c__types_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a> mid, <a class="el" href="c__types_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a> *data_str)</td></tr>
<tr class="memdesc:a400010e7ae3dbd0f364708d1cefb648f"><td class="mdescLeft"> </td><td class="mdescRight">上报数据到云端 <a href="#a400010e7ae3dbd0f364708d1cefb648f">更多...</a><br/></td></tr>
<tr class="separator:a400010e7ae3dbd0f364708d1cefb648f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8692a2f7ec697730968b4bc50e99332d"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a8692a2f7ec697730968b4bc50e99332d">NB_SendCmd</a> (<a class="el" href="c__types_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a> *cmd, <a class="el" href="c__types_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a> cmd_len, <a class="el" href="c__types_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a> *<a class="el" href="nb__bc35_8c.html#a54bb5bc6dc3de1c3aced6e63dfa6b481">response_msg</a>)</td></tr>
<tr class="memdesc:a8692a2f7ec697730968b4bc50e99332d"><td class="mdescLeft"> </td><td class="mdescRight">向NB模组发送指令 <a href="#a8692a2f7ec697730968b4bc50e99332d">更多...</a><br/></td></tr>
<tr class="separator:a8692a2f7ec697730968b4bc50e99332d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0b72979919e235285d99b57f831046f5"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a0b72979919e235285d99b57f831046f5">NB_ResponseTimerCb</a> (void *arg)</td></tr>
<tr class="separator:a0b72979919e235285d99b57f831046f5"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2cf1c3f67e168aee4fe9c184c9809307"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a2cf1c3f67e168aee4fe9c184c9809307">NB_Init</a> (void)</td></tr>
<tr class="separator:a2cf1c3f67e168aee4fe9c184c9809307"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aeb899bf88fe84dd61c113b850c2f0a2d"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#aeb899bf88fe84dd61c113b850c2f0a2d">NB_RxMsgHandler</a> (<a class="el" href="c__types_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a> *nb_msg)</td></tr>
<tr class="memdesc:aeb899bf88fe84dd61c113b850c2f0a2d"><td class="mdescLeft"> </td><td class="mdescRight">NB消息处理函数 <a href="#aeb899bf88fe84dd61c113b850c2f0a2d">更多...</a><br/></td></tr>
<tr class="separator:aeb899bf88fe84dd61c113b850c2f0a2d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a939b06c46f4df8afd26146bd0ab3b52e"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a939b06c46f4df8afd26146bd0ab3b52e">str_to_hex</a> (const char *bufin, int len, char *bufout)</td></tr>
<tr class="memdesc:a939b06c46f4df8afd26146bd0ab3b52e"><td class="mdescLeft"> </td><td class="mdescRight">将十六进制码流转换为字符串形式 <a href="#a939b06c46f4df8afd26146bd0ab3b52e">更多...</a><br/></td></tr>
<tr class="separator:a939b06c46f4df8afd26146bd0ab3b52e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a92a5da3881361b82c28d238d0c1c4ef8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="c__types_8h.html#ab1967d8591af1a4e48c37fd2b0f184d0">int32_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a92a5da3881361b82c28d238d0c1c4ef8">nb_set_cdpserver</a> (char *host, char *port)</td></tr>
<tr class="separator:a92a5da3881361b82c28d238d0c1c4ef8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a40ebdfc0654e618ad5c9407b6aba1c7a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="c__types_8h.html#ab1967d8591af1a4e48c37fd2b0f184d0">int32_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a40ebdfc0654e618ad5c9407b6aba1c7a">nb_hw_detect</a> (void)</td></tr>
<tr class="separator:a40ebdfc0654e618ad5c9407b6aba1c7a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab2bd4578e4f75b4bf028d1945248d4da"><td class="memItemLeft" align="right" valign="top"><a class="el" href="c__types_8h.html#ab1967d8591af1a4e48c37fd2b0f184d0">int32_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#ab2bd4578e4f75b4bf028d1945248d4da">nb_get_netstat</a> (void)</td></tr>
<tr class="separator:ab2bd4578e4f75b4bf028d1945248d4da"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae39b6f8a879d340bc39c40ad4d25707b"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#ae39b6f8a879d340bc39c40ad4d25707b">nb_query_ip</a> (void)</td></tr>
<tr class="separator:ae39b6f8a879d340bc39c40ad4d25707b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a61ba1701b4bd53844085cb3fac0d0e80"><td class="memItemLeft" align="right" valign="top"><a class="el" href="c__types_8h.html#ab1967d8591af1a4e48c37fd2b0f184d0">int32_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a61ba1701b4bd53844085cb3fac0d0e80">nb_send_payload</a> (const char *buf, int len)</td></tr>
<tr class="separator:a61ba1701b4bd53844085cb3fac0d0e80"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a362a7b27988f93c4d83dd7157f5ede9e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="c__types_8h.html#ab1967d8591af1a4e48c37fd2b0f184d0">int32_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a362a7b27988f93c4d83dd7157f5ede9e">nb_check_csq</a> (void)</td></tr>
<tr class="separator:a362a7b27988f93c4d83dd7157f5ede9e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a920284c773a34a6633b0793831ca2381"><td class="memItemLeft" align="right" valign="top"><a class="el" href="c__types_8h.html#ab1967d8591af1a4e48c37fd2b0f184d0">int32_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a920284c773a34a6633b0793831ca2381">nb_send_psk</a> (char *pskid, char *psk)</td></tr>
<tr class="separator:a920284c773a34a6633b0793831ca2381"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a9317a11d05e8f5e091469e171bce604c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="c__types_8h.html#ab1967d8591af1a4e48c37fd2b0f184d0">int32_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a9317a11d05e8f5e091469e171bce604c">nb_set_no_encrypt</a> (void)</td></tr>
<tr class="separator:a9317a11d05e8f5e091469e171bce604c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a3ea588900690c8c61ae4973f9f059e86"><td class="memItemLeft" align="right" valign="top"><a class="el" href="c__types_8h.html#ab1967d8591af1a4e48c37fd2b0f184d0">int32_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a3ea588900690c8c61ae4973f9f059e86">nb_reboot</a> (void)</td></tr>
<tr class="separator:a3ea588900690c8c61ae4973f9f059e86"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af849b35d9b91f8484776997755da2112"><td class="memItemLeft" align="right" valign="top"><a class="el" href="c__types_8h.html#ab1967d8591af1a4e48c37fd2b0f184d0">int32_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#af849b35d9b91f8484776997755da2112">nb_recv_timeout</a> (<a class="el" href="c__types_8h.html#ab1967d8591af1a4e48c37fd2b0f184d0">int32_t</a> id, <a class="el" href="c__types_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *buf, <a class="el" href="c__types_8h.html#a435d1572bf3f880d55459d9805097f62">uint32_t</a> len, char *ipaddr, int *port, <a class="el" href="c__types_8h.html#ab1967d8591af1a4e48c37fd2b0f184d0">int32_t</a> timeout)</td></tr>
<tr class="separator:af849b35d9b91f8484776997755da2112"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a3431e1336cc80a89c10e8b66e9977e93"><td class="memItemLeft" align="right" valign="top"><a class="el" href="c__types_8h.html#ab1967d8591af1a4e48c37fd2b0f184d0">int32_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a3431e1336cc80a89c10e8b66e9977e93">nb_cmd_match</a> (const char *buf, char *featurestr, int len)</td></tr>
<tr class="separator:a3431e1336cc80a89c10e8b66e9977e93"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a9ebe6c546f67a1846ca6b24ab9c5c460"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#a9ebe6c546f67a1846ca6b24ab9c5c460">nb_step</a> (void)</td></tr>
<tr class="separator:a9ebe6c546f67a1846ca6b24ab9c5c460"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:afb5085d087dbbc6df19f515afe5bc6bd"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="nb__bc35_8h.html#afb5085d087dbbc6df19f515afe5bc6bd">nb_reattach</a> (void)</td></tr>
<tr class="separator:afb5085d087dbbc6df19f515afe5bc6bd"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><hr/>
<dl class="section author"><dt>作者</dt><dd>Gump </dd></dl>
<dl class="section version"><dt>版本</dt><dd>V0.1 </dd></dl>
<dl class="section date"><dt>日期</dt><dd>2020-01-29 </dd></dl>
<dl class="section copyright"><dt>版权所有</dt><dd>Copyright (c) <2020> <HANSHAN NORMAL UNIVERSITY(CHAOZHOU)> All rights Reserved. Media Recognition and Intelligent System Team</dd></dl>
<hr/>
</div><h2 class="groupheader">宏定义说明</h2>
<a class="anchor" id="a8d1152fd5720304d3e44fa2101541f03"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AT_MODU_NAME   "nb_neul95"</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="af0651b26f59b22f014ef8b9b42b2ed05"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AT_NB_OPEN_RF   "AT+CFUN=1\r"</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="ac5d2ee5af7efada9c1703451ef038790"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AT_NB_CLOSE_PSM   "AT+CPSMS=0\r"</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="aa687010bde7f90377faee82786b2395b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AT_NB_CLOSE_EDRX   "AT+CEDRXS=0,5\r"</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a53b06833e6fc79828555ea7bbeb2278f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AT_NB_CGATT_ATTACH   "AT+<a class="el" href="nb__bc35_8h.html#a9a2068bff818d36fedd0be3b4dc67a82">CGATT</a>=1\r"</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="aa55fd8c8f8e1e5f62839e8f9f8ed2458"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AT_NB_REPORT_PREFIX   "AT+NMGS="</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a2d324ffefa260f926d5eec6c15923869"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AT_NB_LINE_END   "\r\n"</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a114f0dbbfbfe9ce363fb1e8d4abfdbb6"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AT_NB_reboot   "AT+NRB\r"</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a94e318a85aa13f91043ab5ad676ac9fe"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AT_NB_hw_detect   "AT+CFUN?\r"</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="ad3c390c89eba62a1d3444ab5ebbfcc4d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AT_NB_get_auto_connect   "AT+NCONFIG?\r"</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a5250a1012848aa5fd350a61cd3d7f7e8"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AT_CMD_PREFIX   "\r\n+NNMI:"</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a3477930792c6a3ef6157f54c7974e9ce"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AT_DATAF_PREFIX   "+NSONMI:"</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a9a2068bff818d36fedd0be3b4dc67a82"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define CGATT   "AT+CGATT?\r"</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="af698941e62444eae3d3af0c726cb8440"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define CGATT_DEATTACH   "AT+<a class="el" href="nb__bc35_8h.html#a9a2068bff818d36fedd0be3b4dc67a82">CGATT</a>=0\r"</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="aa32caeb8581192d1d076801cf45ad2f5"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AT_LINE_END   "\r\n"</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a1aa9f916961c8547818a6354f61b4b15"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AT_CMD_BEGIN   "\r\n"</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a0586e510899fa54a3a28a1b57f179b11"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AT_USART_PORT   3</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="ac76bbf7ac0cf5291c14a52a08bceaa26"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AT_BUARDRATE   9600</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a28dd4caf253f1cce669ca8928dd8cf86"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AT_CMD_TIMEOUT   10000</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="ad3413977381bf16a5b513cd8edf68bcf"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AT_MAX_LINK_NUM   4</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="adf19a92cc94e73228b1a18451fff23a4"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define NB_STAT_LOCALPORT   56</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="ae5a2e3b1eefb3a10a2485e28a4ccdb59"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define MAX_SOCK_NUM   5</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a15b182d7930e0c3411c514860367d44b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define UDP_PROTO   17</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="aa8fcba07ec4b6d01f5b51330278f8760"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define MAX_AT_USERDATA_LEN   (1024*5)</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a9155cd445dc93d15e329ec911602b149"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AT_MAX_PAYLOADLEN   512</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a0fe86551df906756e80b64b4b515c37d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define IP_LEN   16</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<h2 class="groupheader">函数说明</h2>
<a class="anchor" id="a400010e7ae3dbd0f364708d1cefb648f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void NB_ReportData </td>
<td>(</td>
<td class="paramtype"><a class="el" href="c__types_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a> </td>
<td class="paramname"><em>mid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="c__types_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a> * </td>
<td class="paramname"><em>data_str</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>上报数据到云端 </p>
<dl class="section user"><dt>AT Command</dt><dd>AT+NMGS=数据长度,内容</dd></dl>
<p>例如:当编解码插件中的messageId为0x11时,</p>
<ul>
<li>发送0、1两个数据:AT+NMGS=03,110001</li>
<li>发送9、10、11、16、17、32、33七个数据:AT+NMGS=08,11090A0B10112021</li>
</ul>
<dl class="section note"><dt>注解</dt><dd>上报数据的格式需要与IoT平台的“编解码插件”的解码顺序一致,不然上报的数据无法正确解析</dd></dl>
<dl class="params"><dt>参数</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">data_str</td><td>需要上报的十六进制数据字符串 </td></tr>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  {</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  </div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <a class="code" href="c__types_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a> report_buf[128];</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span> </div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  <span class="comment">/* 因为数据字符串是十六进制的,两个字符表示一个十六进制数,故数据长度为os_strlen(data_str)/2 */</span></div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <a class="code" href="osapi_8h.html#abe2ddcec42d14500c2706362e9f732e8">os_sprintf</a>(report_buf, <a class="code" href="nb__bc35_8h.html#aa55fd8c8f8e1e5f62839e8f9f8ed2458">AT_NB_REPORT_PREFIX</a> <span class="stringliteral">"%02d,%02X%s"</span> , <a class="code" href="osapi_8h.html#a07564f20970de543cfa55b055d1f6dfe">os_strlen</a>(data_str)/2 + 1, mid, data_str );</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span> </div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <a class="code" href="nb__bc35_8c.html#a566469396821ae4c881b7b558204f68f">NB_SendCmd</a>(report_buf, <a class="code" href="osapi_8h.html#a07564f20970de543cfa55b055d1f6dfe">os_strlen</a>(report_buf), <a class="code" href="c__types_8h.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span> </div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span> }</div>
<div class="ttc" id="osapi_8h_html_abe2ddcec42d14500c2706362e9f732e8"><div class="ttname"><a href="osapi_8h.html#abe2ddcec42d14500c2706362e9f732e8">os_sprintf</a></div><div class="ttdeci">#define os_sprintf</div><div class="ttdef"><b>Definition:</b> osapi.h:54</div></div>
<div class="ttc" id="nb__bc35_8c_html_a566469396821ae4c881b7b558204f68f"><div class="ttname"><a href="nb__bc35_8c.html#a566469396821ae4c881b7b558204f68f">NB_SendCmd</a></div><div class="ttdeci">void NB_SendCmd(uint8 *cmd, uint8 cmd_len, uint8 *res_msg)</div><div class="ttdoc">向NB模组发送指令 </div><div class="ttdef"><b>Definition:</b> nb_bc35.c:70</div></div>
<div class="ttc" id="osapi_8h_html_a07564f20970de543cfa55b055d1f6dfe"><div class="ttname"><a href="osapi_8h.html#a07564f20970de543cfa55b055d1f6dfe">os_strlen</a></div><div class="ttdeci">#define os_strlen</div><div class="ttdef"><b>Definition:</b> osapi.h:43</div></div>
<div class="ttc" id="c__types_8h_html_adde6aaee8457bee49c2a92621fe22b79"><div class="ttname"><a href="c__types_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a></div><div class="ttdeci">unsigned char uint8</div><div class="ttdef"><b>Definition:</b> c_types.h:43</div></div>
<div class="ttc" id="c__types_8h_html_a070d2ce7b6bb7e5c05602aa8c308d0c4"><div class="ttname"><a href="c__types_8h.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a></div><div class="ttdeci">#define NULL</div><div class="ttdef"><b>Definition:</b> c_types.h:73</div></div>
<div class="ttc" id="nb__bc35_8h_html_aa55fd8c8f8e1e5f62839e8f9f8ed2458"><div class="ttname"><a href="nb__bc35_8h.html#aa55fd8c8f8e1e5f62839e8f9f8ed2458">AT_NB_REPORT_PREFIX</a></div><div class="ttdeci">#define AT_NB_REPORT_PREFIX</div><div class="ttdef"><b>Definition:</b> nb_bc35.h:34</div></div>
</div><!-- fragment -->
<p><div class="dynheader">
函数调用图:</div>
<div class="dyncontent">
<div class="center"><img src="nb__bc35_8h_a400010e7ae3dbd0f364708d1cefb648f_cgraph.png" border="0" usemap="#nb__bc35_8h_a400010e7ae3dbd0f364708d1cefb648f_cgraph" alt=""/></div>
<map name="nb__bc35_8h_a400010e7ae3dbd0f364708d1cefb648f_cgraph" id="nb__bc35_8h_a400010e7ae3dbd0f364708d1cefb648f_cgraph">
<area shape="rect" id="node2" href="nb__bc35_8c.html#a566469396821ae4c881b7b558204f68f" title="向NB模组发送指令 " alt="" coords="165,5,269,32"/><area shape="rect" id="node3" href="driver_2uart_8h.html#a279da46b2371c1ec768cde7e525725f2" title="uart1_tx_buffer" alt="" coords="317,5,424,32"/><area shape="rect" id="node4" href="uart_8c.html#a40bca7ca9b269f93bc9f17924a38fbe0" title="uart_tx_one_char" alt="" coords="472,5,595,32"/></map>
</div>
</p>
<p><div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="nb__bc35_8h_a400010e7ae3dbd0f364708d1cefb648f_icgraph.png" border="0" usemap="#nb__bc35_8h_a400010e7ae3dbd0f364708d1cefb648f_icgraph" alt=""/></div>
<map name="nb__bc35_8h_a400010e7ae3dbd0f364708d1cefb648f_icgraph" id="nb__bc35_8h_a400010e7ae3dbd0f364708d1cefb648f_icgraph">
<area shape="rect" id="node2" href="app__study__room_8c.html#aeb5ff6543636881258702191a4575c5f" title="StudyRoom_ReportData" alt="" coords="165,5,328,32"/></map>
</div>
</p>
</div>
</div>
<a class="anchor" id="a8692a2f7ec697730968b4bc50e99332d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void NB_SendCmd </td>
<td>(</td>
<td class="paramtype"><a class="el" href="c__types_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a> * </td>
<td class="paramname"><em>cmd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="c__types_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a> </td>
<td class="paramname"><em>cmd_len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="c__types_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a> * </td>
<td class="paramname"><em>res_msg</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>向NB模组发送指令 </p>
<ol type="1">
<li>将指令通过串口发送给NB模组</li>
</ol>
<p>将响应消息复制到响应消息数组 response_msg[]</p>
<ol type="1">
<li>置位响应消息接收标志 response_flag。此标志位用于给串口消息处理函数 NB_RxMsgHandler 里的分支作判断,从而决定是否将接受的消息与响应消息作匹配。因为串口接收到的消息可能是云端 下发的指令,所以这里面加了这个标志位。</li>
</ol>
<dl class="params"><dt>参数</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">cmd</td><td>要发送的指令字符串 </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">cmd_len</td><td>指令字符串长度 </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">res_msg</td><td>期望接收到的响应消息,参见NB模组的AT指令参考手册</td></tr>
</table>
</dd>
</dl>
<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000002">待办事项:</a></b></dt><dd>增加对查询指令返回的查询结果信息的处理。将采用匹配消息头和存储消息体的方法。</dd></dl>
<div class="fragment"><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  {</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span> </div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  <a class="code" href="c__types_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a> at_cmd[128];</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span> </div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <a class="code" href="osapi_8h.html#a751d204d0c7e166a527475d79e803454">os_printf</a>(<span class="stringliteral">"MCU >>>>>> NB : %s\n"</span>, cmd);</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span> </div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="comment">/* 这里在命令前面加上 AT_CMD_BEGIN 是为了清除掉NB模块中可能存在的消息缓存 */</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  <span class="comment">/* 若是在调用该函数前NB模块中缓存了一些“意料之外”的消息,这时发送的指令会连同前面的消息</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span> <span class="comment"> 一同被NB模块解析,结果必然出错。所以在每次发送消息前加上了 AT_CMD_BEGIN */</span></div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <a class="code" href="osapi_8h.html#abe2ddcec42d14500c2706362e9f732e8">os_sprintf</a>(at_cmd, <a class="code" href="nb__bc35_8h.html#a1aa9f916961c8547818a6354f61b4b15">AT_CMD_BEGIN</a> <span class="stringliteral">"%s"</span> <a class="code" href="nb__bc35_8h.html#aa32caeb8581192d1d076801cf45ad2f5">AT_LINE_END</a>, cmd);</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <a class="code" href="driver_2uart_8h.html#a279da46b2371c1ec768cde7e525725f2">uart1_tx_buffer</a>(at_cmd, cmd_len+2);</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span> </div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="comment">/* 拷贝响应消息到响应消息数组并置位响应标志位,等待串口串接收中断调用 */</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span> </div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  <span class="keywordflow">if</span> (res_msg != <a class="code" href="c__types_8h.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>) { </div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <a class="code" href="osapi_8h.html#ac5c79bf463c8eba708ea34fccc8ec7c1">os_memcpy</a>(<a class="code" href="nb__bc35_8c.html#a54bb5bc6dc3de1c3aced6e63dfa6b481">response_msg</a>, res_msg, <span class="keyword">sizeof</span>(res_msg));</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <a class="code" href="osapi_8h.html#a751d204d0c7e166a527475d79e803454">os_printf</a>(<span class="stringliteral">"response_msg is %s\n"</span>, <a class="code" href="nb__bc35_8c.html#a54bb5bc6dc3de1c3aced6e63dfa6b481">response_msg</a>);</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <a class="code" href="nb__bc35_8c.html#ae5899d940be94e4e73d8eb45011167f1">response_flag</a> = 1;</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  }</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span> </div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span> }</div>
<div class="ttc" id="osapi_8h_html_abe2ddcec42d14500c2706362e9f732e8"><div class="ttname"><a href="osapi_8h.html#abe2ddcec42d14500c2706362e9f732e8">os_sprintf</a></div><div class="ttdeci">#define os_sprintf</div><div class="ttdef"><b>Definition:</b> osapi.h:54</div></div>
<div class="ttc" id="driver_2uart_8h_html_a279da46b2371c1ec768cde7e525725f2"><div class="ttname"><a href="driver_2uart_8h.html#a279da46b2371c1ec768cde7e525725f2">uart1_tx_buffer</a></div><div class="ttdeci">void uart1_tx_buffer(uint8 *buf, uint16 len)</div><div class="ttdef"><b>Definition:</b> uart.c:214</div></div>
<div class="ttc" id="nb__bc35_8c_html_a54bb5bc6dc3de1c3aced6e63dfa6b481"><div class="ttname"><a href="nb__bc35_8c.html#a54bb5bc6dc3de1c3aced6e63dfa6b481">response_msg</a></div><div class="ttdeci">uint8 response_msg[128]</div><div class="ttdef"><b>Definition:</b> nb_bc35.c:23</div></div>
<div class="ttc" id="nb__bc35_8c_html_ae5899d940be94e4e73d8eb45011167f1"><div class="ttname"><a href="nb__bc35_8c.html#ae5899d940be94e4e73d8eb45011167f1">response_flag</a></div><div class="ttdeci">uint8 response_flag</div><div class="ttdef"><b>Definition:</b> nb_bc35.c:22</div></div>
<div class="ttc" id="osapi_8h_html_a751d204d0c7e166a527475d79e803454"><div class="ttname"><a href="osapi_8h.html#a751d204d0c7e166a527475d79e803454">os_printf</a></div><div class="ttdeci">#define os_printf</div><div class="ttdef"><b>Definition:</b> osapi.h:62</div></div>
<div class="ttc" id="osapi_8h_html_ac5c79bf463c8eba708ea34fccc8ec7c1"><div class="ttname"><a href="osapi_8h.html#ac5c79bf463c8eba708ea34fccc8ec7c1">os_memcpy</a></div><div class="ttdeci">#define os_memcpy</div><div class="ttdef"><b>Definition:</b> osapi.h:36</div></div>
<div class="ttc" id="c__types_8h_html_adde6aaee8457bee49c2a92621fe22b79"><div class="ttname"><a href="c__types_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a></div><div class="ttdeci">unsigned char uint8</div><div class="ttdef"><b>Definition:</b> c_types.h:43</div></div>
<div class="ttc" id="nb__bc35_8h_html_a1aa9f916961c8547818a6354f61b4b15"><div class="ttname"><a href="nb__bc35_8h.html#a1aa9f916961c8547818a6354f61b4b15">AT_CMD_BEGIN</a></div><div class="ttdeci">#define AT_CMD_BEGIN</div><div class="ttdef"><b>Definition:</b> nb_bc35.h:47</div></div>
<div class="ttc" id="c__types_8h_html_a070d2ce7b6bb7e5c05602aa8c308d0c4"><div class="ttname"><a href="c__types_8h.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a></div><div class="ttdeci">#define NULL</div><div class="ttdef"><b>Definition:</b> c_types.h:73</div></div>
<div class="ttc" id="nb__bc35_8h_html_aa32caeb8581192d1d076801cf45ad2f5"><div class="ttname"><a href="nb__bc35_8h.html#aa32caeb8581192d1d076801cf45ad2f5">AT_LINE_END</a></div><div class="ttdeci">#define AT_LINE_END</div><div class="ttdef"><b>Definition:</b> nb_bc35.h:46</div></div>
</div><!-- fragment -->
<p><div class="dynheader">
函数调用图:</div>
<div class="dyncontent">
<div class="center"><img src="nb__bc35_8h_a8692a2f7ec697730968b4bc50e99332d_cgraph.png" border="0" usemap="#nb__bc35_8h_a8692a2f7ec697730968b4bc50e99332d_cgraph" alt=""/></div>
<map name="nb__bc35_8h_a8692a2f7ec697730968b4bc50e99332d_cgraph" id="nb__bc35_8h_a8692a2f7ec697730968b4bc50e99332d_cgraph">
<area shape="rect" id="node2" href="driver_2uart_8h.html#a279da46b2371c1ec768cde7e525725f2" title="uart1_tx_buffer" alt="" coords="157,5,264,32"/><area shape="rect" id="node3" href="uart_8c.html#a40bca7ca9b269f93bc9f17924a38fbe0" title="uart_tx_one_char" alt="" coords="312,5,435,32"/></map>
</div>
</p>
<p><div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="nb__bc35_8h_a8692a2f7ec697730968b4bc50e99332d_icgraph.png" border="0" usemap="#nb__bc35_8h_a8692a2f7ec697730968b4bc50e99332d_icgraph" alt=""/></div>
<map name="nb__bc35_8h_a8692a2f7ec697730968b4bc50e99332d_icgraph" id="nb__bc35_8h_a8692a2f7ec697730968b4bc50e99332d_icgraph">
<area shape="rect" id="node2" href="nb__bc35_8c.html#a400010e7ae3dbd0f364708d1cefb648f" title="上报数据到云端 " alt="" coords="157,5,269,32"/><area shape="rect" id="node4" href="nb__bc35_8c.html#a2cf1c3f67e168aee4fe9c184c9809307" title="NB_Init" alt="" coords="181,56,245,83"/><area shape="rect" id="node3" href="app__study__room_8c.html#aeb5ff6543636881258702191a4575c5f" title="StudyRoom_ReportData" alt="" coords="317,5,480,32"/><area shape="rect" id="node5" href="uart_8c.html#aeb899bf88fe84dd61c113b850c2f0a2d" title="NB消息处理函数 " alt="" coords="333,56,465,83"/><area shape="rect" id="node6" href="user__main_8c.html#a50374dadba5323609469073006ce3402" title="system_init_done" alt="" coords="337,107,461,133"/><area shape="rect" id="node7" href="user__main_8c.html#a277ffa60e88142c231a14272962e902c" title="user_init" alt="" coords="528,107,599,133"/></map>
</div>
</p>
</div>
</div>
<a class="anchor" id="a0b72979919e235285d99b57f831046f5"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void NB_ResponseTimerCb </td>
<td>(</td>
<td class="paramtype">void * </td>
<td class="paramname"><em>arg</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a2cf1c3f67e168aee4fe9c184c9809307"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void NB_Init </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<div class="fragment"><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  { </div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span> </div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  <span class="keyword">static</span> <a class="code" href="c__types_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a> cmd_order = 1;</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span> </div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  <a class="code" href="driver_2uart_8h.html#af5b6deb2bb0cd122c3384bf552dd121c">ESP_DEBUG</a>(<span class="stringliteral">"cmd_order = %d"</span>, cmd_order);</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span> </div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  <span class="keywordflow">switch</span> (cmd_order) {</div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span> </div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  <span class="keywordflow">case</span> 0:</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  <a class="code" href="nb__bc35_8c.html#a566469396821ae4c881b7b558204f68f">NB_SendCmd</a>(<span class="stringliteral">""</span>, 1, <span class="stringliteral">"OK"</span>);</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  cmd_order = 1;</div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  <span class="keywordflow">case</span> 1:</div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  <a class="code" href="nb__bc35_8c.html#a566469396821ae4c881b7b558204f68f">NB_SendCmd</a>(<span class="stringliteral">"AT"</span>, <a class="code" href="osapi_8h.html#a07564f20970de543cfa55b055d1f6dfe">os_strlen</a>(<span class="stringliteral">"AT"</span>), <span class="stringliteral">"OK"</span>);</div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  cmd_order = 2;</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  <span class="keywordflow">case</span> 2:</div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  <a class="code" href="nb__bc35_8c.html#a566469396821ae4c881b7b558204f68f">NB_SendCmd</a>(<a class="code" href="nb__bc35_8h.html#af0651b26f59b22f014ef8b9b42b2ed05">AT_NB_OPEN_RF</a>, <a class="code" href="osapi_8h.html#a07564f20970de543cfa55b055d1f6dfe">os_strlen</a>(<a class="code" href="nb__bc35_8h.html#af0651b26f59b22f014ef8b9b42b2ed05">AT_NB_OPEN_RF</a>), <span class="stringliteral">"OK"</span>);</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  cmd_order = 3;</div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  <span class="keywordflow">case</span> 3:</div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  <a class="code" href="nb__bc35_8c.html#a566469396821ae4c881b7b558204f68f">NB_SendCmd</a>(<a class="code" href="nb__bc35_8h.html#ac5d2ee5af7efada9c1703451ef038790">AT_NB_CLOSE_PSM</a>, <a class="code" href="osapi_8h.html#a07564f20970de543cfa55b055d1f6dfe">os_strlen</a>(<a class="code" href="nb__bc35_8h.html#ac5d2ee5af7efada9c1703451ef038790">AT_NB_CLOSE_PSM</a>), <span class="stringliteral">"OK"</span>);</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  cmd_order = 4;</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>  <span class="keywordflow">case</span> 4:</div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>  <a class="code" href="nb__bc35_8c.html#a566469396821ae4c881b7b558204f68f">NB_SendCmd</a>(<a class="code" href="nb__bc35_8h.html#aa687010bde7f90377faee82786b2395b">AT_NB_CLOSE_EDRX</a>, <a class="code" href="osapi_8h.html#a07564f20970de543cfa55b055d1f6dfe">os_strlen</a>(<a class="code" href="nb__bc35_8h.html#aa687010bde7f90377faee82786b2395b">AT_NB_CLOSE_EDRX</a>), <span class="stringliteral">"OK"</span>);</div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  cmd_order = 5;</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  <span class="keywordflow">case</span> 5:</div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>  <a class="code" href="nb__bc35_8c.html#a566469396821ae4c881b7b558204f68f">NB_SendCmd</a>(<a class="code" href="nb__bc35_8h.html#a53b06833e6fc79828555ea7bbeb2278f">AT_NB_CGATT_ATTACH</a>, <a class="code" href="osapi_8h.html#a07564f20970de543cfa55b055d1f6dfe">os_strlen</a>(<a class="code" href="nb__bc35_8h.html#a53b06833e6fc79828555ea7bbeb2278f">AT_NB_CGATT_ATTACH</a>), <span class="stringliteral">"OK"</span>);</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>  cmd_order = 10;</div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  <span class="keywordflow">case</span> 6:</div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  <a class="code" href="nb__bc35_8c.html#a566469396821ae4c881b7b558204f68f">NB_SendCmd</a>(<a class="code" href="nb__bc35_8h.html#af0651b26f59b22f014ef8b9b42b2ed05">AT_NB_OPEN_RF</a>, <a class="code" href="osapi_8h.html#a07564f20970de543cfa55b055d1f6dfe">os_strlen</a>(<a class="code" href="nb__bc35_8h.html#af0651b26f59b22f014ef8b9b42b2ed05">AT_NB_OPEN_RF</a>), <span class="stringliteral">"OK"</span>);</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  <a class="code" href="nb__bc35_8c.html#a566469396821ae4c881b7b558204f68f">NB_SendCmd</a>(<span class="stringliteral">"AT"</span>, <a class="code" href="osapi_8h.html#a07564f20970de543cfa55b055d1f6dfe">os_strlen</a>(<span class="stringliteral">"AT"</span>), <span class="stringliteral">"OK"</span>);</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  cmd_order = 6;</div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  <span class="keywordflow">default</span>:</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  }</div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span> </div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span> }</div>
<div class="ttc" id="nb__bc35_8c_html_a566469396821ae4c881b7b558204f68f"><div class="ttname"><a href="nb__bc35_8c.html#a566469396821ae4c881b7b558204f68f">NB_SendCmd</a></div><div class="ttdeci">void NB_SendCmd(uint8 *cmd, uint8 cmd_len, uint8 *res_msg)</div><div class="ttdoc">向NB模组发送指令 </div><div class="ttdef"><b>Definition:</b> nb_bc35.c:70</div></div>
<div class="ttc" id="driver_2uart_8h_html_af5b6deb2bb0cd122c3384bf552dd121c"><div class="ttname"><a href="driver_2uart_8h.html#af5b6deb2bb0cd122c3384bf552dd121c">ESP_DEBUG</a></div><div class="ttdeci">#define ESP_DEBUG(fmt,...)</div><div class="ttdef"><b>Definition:</b> driver/uart.h:35</div></div>
<div class="ttc" id="osapi_8h_html_a07564f20970de543cfa55b055d1f6dfe"><div class="ttname"><a href="osapi_8h.html#a07564f20970de543cfa55b055d1f6dfe">os_strlen</a></div><div class="ttdeci">#define os_strlen</div><div class="ttdef"><b>Definition:</b> osapi.h:43</div></div>
<div class="ttc" id="nb__bc35_8h_html_aa687010bde7f90377faee82786b2395b"><div class="ttname"><a href="nb__bc35_8h.html#aa687010bde7f90377faee82786b2395b">AT_NB_CLOSE_EDRX</a></div><div class="ttdeci">#define AT_NB_CLOSE_EDRX</div><div class="ttdef"><b>Definition:</b> nb_bc35.h:32</div></div>
<div class="ttc" id="c__types_8h_html_adde6aaee8457bee49c2a92621fe22b79"><div class="ttname"><a href="c__types_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a></div><div class="ttdeci">unsigned char uint8</div><div class="ttdef"><b>Definition:</b> c_types.h:43</div></div>
<div class="ttc" id="nb__bc35_8h_html_af0651b26f59b22f014ef8b9b42b2ed05"><div class="ttname"><a href="nb__bc35_8h.html#af0651b26f59b22f014ef8b9b42b2ed05">AT_NB_OPEN_RF</a></div><div class="ttdeci">#define AT_NB_OPEN_RF</div><div class="ttdef"><b>Definition:</b> nb_bc35.h:30</div></div>
<div class="ttc" id="nb__bc35_8h_html_a53b06833e6fc79828555ea7bbeb2278f"><div class="ttname"><a href="nb__bc35_8h.html#a53b06833e6fc79828555ea7bbeb2278f">AT_NB_CGATT_ATTACH</a></div><div class="ttdeci">#define AT_NB_CGATT_ATTACH</div><div class="ttdef"><b>Definition:</b> nb_bc35.h:33</div></div>
<div class="ttc" id="nb__bc35_8h_html_ac5d2ee5af7efada9c1703451ef038790"><div class="ttname"><a href="nb__bc35_8h.html#ac5d2ee5af7efada9c1703451ef038790">AT_NB_CLOSE_PSM</a></div><div class="ttdeci">#define AT_NB_CLOSE_PSM</div><div class="ttdef"><b>Definition:</b> nb_bc35.h:31</div></div>
</div><!-- fragment -->
<p><div class="dynheader">
函数调用图:</div>
<div class="dyncontent">
<div class="center"><img src="nb__bc35_8h_a2cf1c3f67e168aee4fe9c184c9809307_cgraph.png" border="0" usemap="#nb__bc35_8h_a2cf1c3f67e168aee4fe9c184c9809307_cgraph" alt=""/></div>
<map name="nb__bc35_8h_a2cf1c3f67e168aee4fe9c184c9809307_cgraph" id="nb__bc35_8h_a2cf1c3f67e168aee4fe9c184c9809307_cgraph">
<area shape="rect" id="node2" href="nb__bc35_8c.html#a566469396821ae4c881b7b558204f68f" title="向NB模组发送指令 " alt="" coords="117,5,221,32"/><area shape="rect" id="node3" href="driver_2uart_8h.html#a279da46b2371c1ec768cde7e525725f2" title="uart1_tx_buffer" alt="" coords="269,5,376,32"/><area shape="rect" id="node4" href="uart_8c.html#a40bca7ca9b269f93bc9f17924a38fbe0" title="uart_tx_one_char" alt="" coords="424,5,547,32"/></map>
</div>
</p>
<p><div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="nb__bc35_8h_a2cf1c3f67e168aee4fe9c184c9809307_icgraph.png" border="0" usemap="#nb__bc35_8h_a2cf1c3f67e168aee4fe9c184c9809307_icgraph" alt=""/></div>
<map name="nb__bc35_8h_a2cf1c3f67e168aee4fe9c184c9809307_icgraph" id="nb__bc35_8h_a2cf1c3f67e168aee4fe9c184c9809307_icgraph">
<area shape="rect" id="node2" href="uart_8c.html#aeb899bf88fe84dd61c113b850c2f0a2d" title="NB消息处理函数 " alt="" coords="117,5,249,32"/><area shape="rect" id="node3" href="user__main_8c.html#a50374dadba5323609469073006ce3402" title="system_init_done" alt="" coords="121,56,245,83"/><area shape="rect" id="node4" href="user__main_8c.html#a277ffa60e88142c231a14272962e902c" title="user_init" alt="" coords="297,56,368,83"/></map>
</div>
</p>
</div>
</div>
<a class="anchor" id="aeb899bf88fe84dd61c113b850c2f0a2d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void NB_RxMsgHandler </td>
<td>(</td>
<td class="paramtype"><a class="el" href="c__types_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a> * </td>
<td class="paramname"><em>nb_msg</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>NB消息处理函数 </p>
<p>NB消息有以下几种类型:</p>
<ul>
<li>动作指令的执行情况。如“OK”、“ERROR”</li>
<li>查询指令的查询结果</li>
</ul>
<p>云端下发的控制命令。以“+NNMI:”为前缀</p>
<p>当NB发送消息来的时候,我们先判断在接收到这条消息之前有没有发送过指令,即判断响应标志位 response_flag是否被置位,再决定是否去匹配响应消息。</p>
<dl class="params"><dt>参数</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">nb_msg</td><td>串口接收到的NB消息 </td></tr>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  {</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span> </div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <span class="keywordflow">if</span> (<a class="code" href="nb__bc35_8c.html#ae5899d940be94e4e73d8eb45011167f1">response_flag</a> != 0 ) { <span class="comment">/* 等待响应匹配 */</span></div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span> </div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  <a class="code" href="driver_2uart_8h.html#af5b6deb2bb0cd122c3384bf552dd121c">ESP_DEBUG</a>(<span class="stringliteral">"response_flag = 1"</span>);</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  </div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  <span class="keywordflow">if</span> (0 != <a class="code" href="osapi_8h.html#a51bc56747f146b58e4bbbef0f4b62230">os_strstr</a>(nb_msg, <a class="code" href="nb__bc35_8c.html#a54bb5bc6dc3de1c3aced6e63dfa6b481">response_msg</a>)) {</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span> </div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  <a class="code" href="driver_2uart_8h.html#af5b6deb2bb0cd122c3384bf552dd121c">ESP_DEBUG</a>(<span class="stringliteral">"OK! response message parse!"</span>);</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span> </div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <a class="code" href="osapi_8h.html#a8b6e05160473ebb1f7f87ca232f87c7b">os_memset</a>(<a class="code" href="nb__bc35_8c.html#a54bb5bc6dc3de1c3aced6e63dfa6b481">response_msg</a>, 0, <span class="keyword">sizeof</span>(<a class="code" href="nb__bc35_8c.html#a54bb5bc6dc3de1c3aced6e63dfa6b481">response_msg</a>));</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <a class="code" href="nb__bc35_8c.html#ae5899d940be94e4e73d8eb45011167f1">response_flag</a> = 0;</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span> </div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <a class="code" href="nb__bc35_8c.html#a2cf1c3f67e168aee4fe9c184c9809307">NB_Init</a>();</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span> </div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span> </div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  <a class="code" href="driver_2uart_8h.html#af5b6deb2bb0cd122c3384bf552dd121c">ESP_DEBUG</a>(<span class="stringliteral">"ERROR! response message parse failed"</span>);</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span> </div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  }</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span> </div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  <a class="code" href="driver_2uart_8h.html#af5b6deb2bb0cd122c3384bf552dd121c">ESP_DEBUG</a>(<span class="stringliteral">"response_flag = 0"</span>);</div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span> </div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  <span class="comment">/* 匹配下发消息前缀 */</span></div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span> </div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  <span class="comment">/* 命令下发 */</span></div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span> </div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  }</div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span> </div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span> }</div>
<div class="ttc" id="nb__bc35_8c_html_a54bb5bc6dc3de1c3aced6e63dfa6b481"><div class="ttname"><a href="nb__bc35_8c.html#a54bb5bc6dc3de1c3aced6e63dfa6b481">response_msg</a></div><div class="ttdeci">uint8 response_msg[128]</div><div class="ttdef"><b>Definition:</b> nb_bc35.c:23</div></div>
<div class="ttc" id="nb__bc35_8c_html_ae5899d940be94e4e73d8eb45011167f1"><div class="ttname"><a href="nb__bc35_8c.html#ae5899d940be94e4e73d8eb45011167f1">response_flag</a></div><div class="ttdeci">uint8 response_flag</div><div class="ttdef"><b>Definition:</b> nb_bc35.c:22</div></div>
<div class="ttc" id="driver_2uart_8h_html_af5b6deb2bb0cd122c3384bf552dd121c"><div class="ttname"><a href="driver_2uart_8h.html#af5b6deb2bb0cd122c3384bf552dd121c">ESP_DEBUG</a></div><div class="ttdeci">#define ESP_DEBUG(fmt,...)</div><div class="ttdef"><b>Definition:</b> driver/uart.h:35</div></div>
<div class="ttc" id="osapi_8h_html_a8b6e05160473ebb1f7f87ca232f87c7b"><div class="ttname"><a href="osapi_8h.html#a8b6e05160473ebb1f7f87ca232f87c7b">os_memset</a></div><div class="ttdeci">#define os_memset</div><div class="ttdef"><b>Definition:</b> osapi.h:38</div></div>
<div class="ttc" id="osapi_8h_html_a51bc56747f146b58e4bbbef0f4b62230"><div class="ttname"><a href="osapi_8h.html#a51bc56747f146b58e4bbbef0f4b62230">os_strstr</a></div><div class="ttdeci">#define os_strstr</div><div class="ttdef"><b>Definition:</b> osapi.h:46</div></div>
<div class="ttc" id="nb__bc35_8c_html_a2cf1c3f67e168aee4fe9c184c9809307"><div class="ttname"><a href="nb__bc35_8c.html#a2cf1c3f67e168aee4fe9c184c9809307">NB_Init</a></div><div class="ttdeci">void NB_Init(void)</div><div class="ttdef"><b>Definition:</b> nb_bc35.c:140</div></div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a939b06c46f4df8afd26146bd0ab3b52e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int str_to_hex </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>bufin</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char * </td>
<td class="paramname"><em>bufout</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>将十六进制码流转换为字符串形式 </p>
<dl class="params"><dt>参数</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">bufin</td><td>输入的十六进制码流 </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">len</td><td>十六进制码流的长度 </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">bufout</td><td>输出的十六进制字符串 </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>int</dd></dl>
<dl class="section user"><dt>示例</dt><dd>bufin[0] = 0x01, bufin[1] = 0x02, bufin[2] = 0x03, len = 3, 则bufout = "010203" bufin[0] = 0x01, bufin[1] = 0x05, bufin[2] = 0x06, bufin[3] = 0x07, len = 4, 则bufout = "01050607" </dd></dl>
<div class="fragment"><div class="line"><a name="l00197"></a><span class="lineno"> 197</span> {</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>  <span class="keywordtype">int</span> i = 0;</div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>  <span class="keywordflow">if</span> (<a class="code" href="c__types_8h.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a> == bufin || len <= 0 || <a class="code" href="c__types_8h.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a> == bufout)</div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  {</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>  <span class="keywordflow">return</span> -1;</div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>  }</div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>  <span class="keywordflow">for</span>(i = 0; i < len; i++)</div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>  {</div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>  <a class="code" href="osapi_8h.html#abe2ddcec42d14500c2706362e9f732e8">os_sprintf</a>(bufout+i*2, <span class="stringliteral">"%02X"</span>, bufin[i]);</div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>  }</div>
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>  <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span> }</div>
<div class="ttc" id="osapi_8h_html_abe2ddcec42d14500c2706362e9f732e8"><div class="ttname"><a href="osapi_8h.html#abe2ddcec42d14500c2706362e9f732e8">os_sprintf</a></div><div class="ttdeci">#define os_sprintf</div><div class="ttdef"><b>Definition:</b> osapi.h:54</div></div>
<div class="ttc" id="c__types_8h_html_a070d2ce7b6bb7e5c05602aa8c308d0c4"><div class="ttname"><a href="c__types_8h.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a></div><div class="ttdeci">#define NULL</div><div class="ttdef"><b>Definition:</b> c_types.h:73</div></div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a92a5da3881361b82c28d238d0c1c4ef8"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="c__types_8h.html#ab1967d8591af1a4e48c37fd2b0f184d0">int32_t</a> nb_set_cdpserver </td>
<td>(</td>
<td class="paramtype">char * </td>
<td class="paramname"><em>host</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char * </td>
<td class="paramname"><em>port</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a40ebdfc0654e618ad5c9407b6aba1c7a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="c__types_8h.html#ab1967d8591af1a4e48c37fd2b0f184d0">int32_t</a> nb_hw_detect </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="ab2bd4578e4f75b4bf028d1945248d4da"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="c__types_8h.html#ab1967d8591af1a4e48c37fd2b0f184d0">int32_t</a> nb_get_netstat </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="ae39b6f8a879d340bc39c40ad4d25707b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int nb_query_ip </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a61ba1701b4bd53844085cb3fac0d0e80"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="c__types_8h.html#ab1967d8591af1a4e48c37fd2b0f184d0">int32_t</a> nb_send_payload </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>buf</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>len</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>