-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathat_module.h
56 lines (44 loc) · 1.69 KB
/
at_module.h
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
/*
* Copyright (c) 2022, smartmx <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-08-22 smartmx the first version
*
*/
#ifndef _AT_MODULE_H_
#define _AT_MODULE_H_
#define AT_MODULE_DATA_MAX_LEN 1024
typedef struct at_module_data_struct
{
uint16_t data_rec_index;
uint8_t state;
unsigned char data[AT_MODULE_DATA_MAX_LEN];
} at_module_data_t;
enum
{
AT_MODULE_REC_STATE_WAIT_DATA = 0,
AT_MODULE_REC_STATE_HANDLING,
AT_MODULE_REC_STATE_CONTINUE_RECEIVE,
AT_MODULE_REC_STATE_EXIT,
};
typedef struct at_module_process_struct
{
uint8_t state;
uint8_t sendRepeatTimesSet;
uint8_t sendRepeatTimes;
uint8_t corfirm_cnt;
void (*dataHandler)(at_module_data_t *rec_data);
struct at_module_process_struct *prev_process;
struct at_module_process_struct *next_process;
} at_module_process_t;
extern void at_module_send_data_to_process(at_module_process_t *head_process, at_module_data_t *rec_data);
extern void at_module_add_process(at_module_process_t *head_process, at_module_process_t *wait_for_add);
extern void at_module_delete_process(at_module_process_t *wait_for_delete);
extern uint8_t at_module_is_process_running(at_module_process_t *head_process, at_module_process_t *wait_for_add);
extern void at_module_startup_process_Init(at_module_process_t *head_process, uint8_t sendRepeatTimesSet, void (*dataHandler)(at_module_data_t *rec_data));
#define AT_BUFFER_NO_MATCH 0xffff
extern uint16_t at_module_buffer_match_search(unsigned char *det, uint16_t det_len, unsigned char *part, uint16_t part_len, uint8_t max_len, uint8_t direction);
#endif /* _AT_MODULE_H_ */