Skip to content

Commit 398efbc

Browse files
authored
Merge pull request #157 from mysterywolf/master
format codes
2 parents 59cd278 + 3742312 commit 398efbc

38 files changed

+338
-338
lines changed

class/a9g/at_device_a9g.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
#define LOG_TAG "at.dev.a9g"
3232
#include <at_log.h>
33-
33+
3434
#ifdef AT_DEVICE_USING_A9G
3535

3636
#define A9G_WAIT_CONNECT_TIME 5000
@@ -107,7 +107,7 @@ static int a9g_netdev_set_info(struct netdev *netdev)
107107
ip_addr_t addr;
108108
at_response_t resp = RT_NULL;
109109
struct at_device *device = RT_NULL;
110-
110+
111111
RT_ASSERT(netdev);
112112

113113
device = at_device_get_by_name(AT_DEVICE_NAMETYPE_NETDEV, netdev->name);
@@ -175,7 +175,7 @@ static int a9g_netdev_set_info(struct netdev *netdev)
175175
char ipaddr[IP_ADDR_SIZE_MAX] = {0};
176176

177177
at_resp_set_info(resp, A9G_IPADDR_RESP_SIZE, 2, A9G_INFO_RESP_TIMO);
178-
178+
179179
/* send "AT+CIFSR" commond to get IP address */
180180
if (at_obj_exec_cmd(device->client, resp, "AT+CIFSR") < 0)
181181
{
@@ -234,7 +234,7 @@ static int a9g_netdev_set_info(struct netdev *netdev)
234234
{
235235
at_delete_resp(resp);
236236
}
237-
237+
238238
return result;
239239
}
240240

@@ -301,7 +301,7 @@ static int a9g_netdev_check_link_status(struct netdev *netdev)
301301

302302
rt_snprintf(tname, RT_NAME_MAX, "%s_link", netdev->name);
303303

304-
tid = rt_thread_create(tname, check_link_status_entry, (void *) netdev,
304+
tid = rt_thread_create(tname, check_link_status_entry, (void *) netdev,
305305
a9g_LINK_THREAD_STACK_SIZE, a9g_LINK_THREAD_PRIORITY, a9g_LINK_THREAD_TICK);
306306
if (tid)
307307
{
@@ -328,7 +328,7 @@ static int a9g_netdev_set_up(struct netdev *netdev)
328328
{
329329
a9g_net_init(device);
330330
device->is_init = RT_TRUE;
331-
331+
332332
netdev_low_level_set_status(netdev, RT_TRUE);
333333
LOG_D("the network interface device(%s) set up status.", netdev->name);
334334
}
@@ -429,7 +429,7 @@ static int a9g_ping_domain_resolve(struct at_device *device, const char *name, c
429429
result = -RT_ERROR;
430430
goto __exit;
431431
}
432-
432+
433433
if (at_resp_parse_line_args_by_kw(resp, "+CDNSGIP:", "%*[^,],%*[^,],\"%[^\"]", recv_ip) < 0)
434434
{
435435
rt_thread_mdelay(100);
@@ -458,7 +458,7 @@ static int a9g_ping_domain_resolve(struct at_device *device, const char *name, c
458458

459459
#ifdef NETDEV_USING_PING
460460
#ifdef AT_DEVICE_USING_A9G
461-
static int a9g_netdev_ping(struct netdev *netdev, const char *host,
461+
static int a9g_netdev_ping(struct netdev *netdev, const char *host,
462462
size_t data_len, uint32_t timeout, struct netdev_ping_resp *ping_resp)
463463
{
464464
rt_kprintf("I don't have PING function!\r\n");
@@ -469,7 +469,7 @@ static int a9g_netdev_ping(struct netdev *netdev, const char *host,
469469

470470
#ifdef NETDEV_USING_NETSTAT
471471
void a9g_netdev_netstat(struct netdev *netdev)
472-
{
472+
{
473473
// TODO netstat support
474474
}
475475
#endif /* NETDEV_USING_NETSTAT */
@@ -602,15 +602,15 @@ static void a9g_init_thread_entry(void *parameter)
602602
result = -RT_ERROR;
603603
goto __exit;
604604
}
605-
606-
/* make the device restart */
605+
606+
/* make the device restart */
607607
AT_SEND_CMD(client, resp, 0, 300, "AT+RST=1");
608608
for(i = 0; i<=30; i++)
609609
{
610610
i++;
611611
rt_thread_mdelay(1000);
612612
}
613-
613+
614614
/* waiting for dirty data to be digested */
615615
rt_thread_mdelay(1000);
616616

@@ -644,7 +644,7 @@ static void a9g_init_thread_entry(void *parameter)
644644
}
645645
rt_thread_mdelay(1000);
646646
}
647-
647+
648648
/* check the GPRS network is registered */
649649
for (i = 0; i < CGREG_RETRY; i++)
650650
{
@@ -658,14 +658,14 @@ static void a9g_init_thread_entry(void *parameter)
658658
}
659659
rt_thread_mdelay(1000);
660660
}
661-
661+
662662
AT_SEND_CMD(client, resp, 0, 1000, "AT+CGDCONT=1,\"IP\",\"CMNET\"");
663663
rt_thread_mdelay(10);
664664
AT_SEND_CMD(client, resp, 0, 5 * 1000, "AT+CGACT=1,1");
665665
rt_thread_mdelay(10);
666666
at_resp_parse_line_args_by_kw(resp, "OK", "%s", &parsed_data);
667-
668-
if (!strncmp(parsed_data, "OK", sizeof(parsed_data)))
667+
668+
if (!strncmp(parsed_data, "OK", sizeof(parsed_data)))
669669
{
670670
LOG_D("a9g device(%s) GPRS network is registered(%s).", device->name, parsed_data);
671671
break;
@@ -736,7 +736,7 @@ static void a9g_init_thread_entry(void *parameter)
736736
result = -RT_ERROR;
737737
goto __exit;
738738
}
739-
#ifdef AT_USING_A9G_GPS
739+
#ifdef AT_USING_A9G_GPS
740740
AT_SEND_CMD(client, resp, 0, 300, "AT+GPS?");
741741
at_resp_parse_line_args_by_kw(resp, "+GPS:", "+GPS: %d", &qimux);
742742
if (qimux == 0)
@@ -769,7 +769,7 @@ static void a9g_init_thread_entry(void *parameter)
769769
if (result == RT_EOK)
770770
{
771771
device->is_init = RT_TRUE;
772-
772+
773773
/* set network interface device status and address information */
774774
a9g_netdev_set_info(device->netdev);
775775
/* */
@@ -781,7 +781,7 @@ static void a9g_init_thread_entry(void *parameter)
781781
else
782782
{
783783
device->is_init = RT_FALSE;
784-
784+
785785
netdev_low_level_set_status(device->netdev, RT_FALSE);
786786
LOG_E("a9g device(%s) network initialize failed(%d)!", device->name, result);
787787
}
@@ -818,7 +818,7 @@ static void urc_func(struct at_client *client, const char *data, rt_size_t size)
818818
}
819819

820820
/* a9g device URC table for the device control */
821-
static const struct at_urc urc_table[] =
821+
static const struct at_urc urc_table[] =
822822
{
823823
{"READY", "\r\n", urc_func},
824824
};
@@ -851,8 +851,8 @@ static int a9g_init(struct at_device *device)
851851
LOG_E("a9g device(%s) initialize failed, get network interface device failed.", a9g->device_name);
852852
return -RT_ERROR;
853853
}
854-
855-
/* initialize a9g pin configuration */
854+
855+
/* initialize a9g pin configuration */
856856
if (a9g->power_pin != -1 && a9g->power_status_pin != -1)
857857
{
858858
rt_pin_mode(a9g->power_pin, PIN_MODE_OUTPUT);
@@ -898,7 +898,7 @@ static int a9g_control(struct at_device *device, int cmd, void *arg)
898898
return result;
899899
}
900900

901-
const struct at_device_ops a9g_device_ops =
901+
const struct at_device_ops a9g_device_ops =
902902
{
903903
a9g_init,
904904
a9g_deinit,

class/a9g/at_device_a9g.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* Date Author Notes
2222
* 2019-11-23 luliang first version
2323
*/
24-
24+
2525
#ifndef __A9G_DEVICE_H__
2626
#define __A9G_DEVICE_H__
2727

@@ -34,19 +34,19 @@ extern "C" {
3434
#include <at_device.h>
3535

3636
/* The maximum number of sockets supported by the a9g device */
37-
#define AT_DEVICE_A9G_SOCKETS_NUM 8
37+
#define AT_DEVICE_A9G_SOCKETS_NUM 8
3838

3939
struct at_device_a9g
4040
{
41-
char *device_name;
42-
char *client_name;
43-
44-
int power_pin;
45-
int power_status_pin;
46-
size_t recv_line_num;
47-
struct at_device device;
48-
49-
void *user_data;
41+
char *device_name;
42+
char *client_name;
43+
44+
int power_pin;
45+
int power_status_pin;
46+
size_t recv_line_num;
47+
struct at_device device;
48+
49+
void *user_data;
5050
};
5151

5252
#ifdef AT_USING_SOCKET
@@ -64,4 +64,4 @@ int a9g_socket_class_register(struct at_device_class *class);
6464
#endif
6565

6666

67-
#endif /* __AT_DEVICE_A9G_H__*/
67+
#endif /* __AT_DEVICE_A9G_H__*/

class/a9g/at_socket_a9g.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* Date Author Notes
2222
* 2019-11-23 luliang first version
2323
*/
24-
24+
2525
#include <stdio.h>
2626
#include <string.h>
2727

@@ -85,15 +85,15 @@ static int a9g_socket_close(struct at_socket *socket)
8585
at_response_t resp = RT_NULL;
8686
int device_socket = (int) socket->user_data;
8787
struct at_device *device = (struct at_device *) socket->device;
88-
88+
8989
resp = at_create_resp(64, 0, rt_tick_from_millisecond(600));
90-
90+
9191
if (resp == RT_NULL)
9292
{
9393
LOG_E("no memory for a9g device(%s) response creat.", device->name);
9494
return -RT_ENOMEM;
9595
}
96-
96+
9797
if (at_obj_exec_cmd(device->client, resp, "AT+CIPCLOSE=%d", device_socket) < 0)
9898
{
9999
result = -RT_ERROR;
@@ -105,7 +105,7 @@ static int a9g_socket_close(struct at_socket *socket)
105105
{
106106
at_delete_resp(resp);
107107
}
108-
108+
109109
return result;
110110
}
111111

@@ -175,7 +175,7 @@ static int a9g_socket_connect(struct at_socket *socket, char *ip, int32_t port,
175175
result = -RT_ERROR;
176176
goto __exit;
177177
}
178-
}
178+
}
179179

180180
/* waiting result event from AT URC, the device default connection timeout is 75 seconds, but it set to 10 seconds is convenient to use */
181181
if (a9g_socket_event_recv(device, SET_EVENT(device_socket, 0), 10 * RT_TICK_PER_SECOND, RT_EVENT_FLAG_OR) < 0)
@@ -185,7 +185,7 @@ static int a9g_socket_connect(struct at_socket *socket, char *ip, int32_t port,
185185
goto __exit;
186186
}
187187
/* waiting OK or failed result */
188-
event_result = a9g_socket_event_recv(device,
188+
event_result = a9g_socket_event_recv(device,
189189
A9G_EVENT_CONN_OK | A9G_EVENT_CONN_FAIL, 1 * RT_TICK_PER_SECOND, RT_EVENT_FLAG_OR);
190190
if (event_result < 0)
191191
{
@@ -198,7 +198,7 @@ static int a9g_socket_connect(struct at_socket *socket, char *ip, int32_t port,
198198
{
199199
if (retryed == RT_FALSE)
200200
{
201-
LOG_D("a9g device(%s) socket(%d) connect failed, maybe the socket was not be closed at the last time and now will retry.",
201+
LOG_D("a9g device(%s) socket(%d) connect failed, maybe the socket was not be closed at the last time and now will retry.",
202202
device->name, device_socket);
203203
if (a9g_socket_close(socket) < 0)
204204
{
@@ -218,7 +218,7 @@ static int a9g_socket_connect(struct at_socket *socket, char *ip, int32_t port,
218218
{
219219
at_delete_resp(resp);
220220
}
221-
221+
222222
return result;
223223
}
224224

@@ -268,23 +268,23 @@ static int a9g_socket_send(struct at_socket *socket, const char *buff, size_t bf
268268
{
269269
cur_pkt_size = A9G_MODULE_SEND_MAX_SIZE;
270270
}
271-
271+
272272
/* send the "AT+CIPSEND" commands to AT server than receive the '>' response on the first line. */
273273
if (at_obj_exec_cmd(device->client, resp, "AT+CIPSEND=%d,%d", device_socket, cur_pkt_size) < 0)
274274
{
275275
result = -RT_ERROR;
276276
goto __exit;
277277
}
278-
278+
279279
/* send the real data to server or client */
280280
result = (int) at_client_obj_send(device->client, buff + sent_size, cur_pkt_size);
281281
if (result == 0)
282282
{
283283
result = -RT_ERROR;
284284
goto __exit;
285285
}
286-
287-
/* waiting OK or failed result */
286+
287+
/* waiting OK or failed result */
288288
at_resp_set_info(resp, 128, 0, 30 * RT_TICK_PER_SECOND);
289289
if (at_obj_exec_cmd(device->client, resp, "") < 0)
290290
{
@@ -369,9 +369,9 @@ static int a9g_domain_resolve(const char *name, char ip[16])
369369
goto __exit;
370370
}
371371
}
372-
372+
373373
/* parse the third line of response data, get the IP address */
374-
if (at_resp_parse_line_args_by_kw(resp, "+CDNSGIP:", "%*[^,],%*[^,],\"%[^\"]", recv_ip) < 0)
374+
if (at_resp_parse_line_args_by_kw(resp, "+CDNSGIP:", "%*[^,],%*[^,],\"%[^\"]", recv_ip) < 0)
375375
{
376376
rt_thread_mdelay(100);
377377
/* resolve failed, maybe receive an URC CRLF */
@@ -398,7 +398,7 @@ static int a9g_domain_resolve(const char *name, char ip[16])
398398
{
399399
at_delete_resp(resp);
400400
}
401-
401+
402402
return result;
403403
}
404404

@@ -582,7 +582,7 @@ static void urc_recv_func(struct at_client *client, const char *data, rt_size_t
582582
}
583583

584584
/* A9G device URC table for the socket data */
585-
static const struct at_urc urc_table[] =
585+
static const struct at_urc urc_table[] =
586586
{
587587
{"", "CONNECT OK\r\n", urc_connect_func},
588588
{"", ",CONNECT FAIL\r\n", urc_connect_func},
@@ -591,7 +591,7 @@ static const struct at_urc urc_table[] =
591591
{"+CIPRCV,", "\r\n", urc_recv_func},
592592
};
593593

594-
static const struct at_socket_ops a9g_socket_ops =
594+
static const struct at_socket_ops a9g_socket_ops =
595595
{
596596
a9g_socket_connect,
597597
a9g_socket_close,

class/air720/at_device_air720.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ extern "C" {
3434
#include <at_device.h>
3535

3636
/* The maximum number of sockets supported by the air720 device */
37-
#define AT_DEVICE_AIR720_SOCKETS_NUM 6
37+
#define AT_DEVICE_AIR720_SOCKETS_NUM 6
3838

3939
struct at_device_air720
40-
{
40+
{
4141
char *device_name;
4242
char *client_name;
4343

class/air720/at_socket_air720.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,8 +624,8 @@ static void urc_dataaccept_func(struct at_client *client, const char *data, rt_s
624624
}
625625

626626
/* get the current socket by receive data */
627-
sscanf(data, "DATA ACCEPT:%d,%d", &device_socket, (int *)&bfsz);
628-
627+
sscanf(data, "DATA ACCEPT:%d,%d", &device_socket, (int *)&bfsz);
628+
629629
air720_socket_event_send(device, SET_EVENT(device_socket, AIR720_EVENT_SEND_OK));
630630
}
631631

0 commit comments

Comments
 (0)