MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / at_print_raw_cmd

Function at_print_raw_cmd

components/net/at/src/at_utils.c:23–58  ·  view source on GitHub ↗

* dump hex format data to console device * * @param name name for hex object, it will show on log header * @param buf hex buffer * @param size buffer size */

Source from the content-addressed store, hash-verified

21 * @param size buffer size
22 */
23void at_print_raw_cmd(const char *name, const char *buf, rt_size_t size)
24{
25#define __is_print(ch) ((unsigned int)((ch) - ' ') < 127u - ' ')
26#define WIDTH_SIZE 32
27
28 rt_size_t i, j;
29
30 for (i = 0; i < size; i += WIDTH_SIZE)
31 {
32 rt_kprintf("[D/AT] %s: %04X-%04X: ", name, i, i + WIDTH_SIZE);
33 for (j = 0; j < WIDTH_SIZE; j++)
34 {
35 if (i + j < size)
36 {
37 rt_kprintf("%02X ", (unsigned char)buf[i + j]);
38 }
39 else
40 {
41 rt_kprintf(" ");
42 }
43 if ((j + 1) % 8 == 0)
44 {
45 rt_kprintf(" ");
46 }
47 }
48 rt_kprintf(" ");
49 for (j = 0; j < WIDTH_SIZE; j++)
50 {
51 if (i + j < size)
52 {
53 rt_kprintf("%c", __is_print(buf[i + j]) ? buf[i + j] : '.');
54 }
55 }
56 rt_kprintf("\n");
57 }
58}
59rt_weak rt_size_t at_utils_send(rt_device_t dev,
60 rt_off_t pos,
61 const void *buffer,

Callers 7

at_client_obj_sendFunction · 0.85
at_client_obj_recvFunction · 0.85
at_recv_readlineFunction · 0.85
at_vprintfFunction · 0.85
at_vprintflnFunction · 0.85
at_vprintfcrFunction · 0.85
at_vprintflfFunction · 0.85

Calls 1

rt_kprintfFunction · 0.85

Tested by

no test coverage detected