123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- #include <stdio.h>
- #include <stdlib.h>
- #ifndef __LIST_H__
- #define __LIST_H__
- #include "stdbool.h"
- #include "esp_attr.h"
- typedef enum {
- LORA_INFO_NONE = 0,
- LORA_INFO_VERSION,
- LORA_INFO_GET_CHART,
- LORA_INFO_RSSI,
- LORA_INFO_BATT,
- LORA_INFO_REPLY,
- LORA_INFO_GET_TIME,
- LORA_INFO_STATUS,
- LORA_INFO_DUR,
- LORA_INFO_END,
- } LORA_INFO_TYPE_e;
- typedef struct queue
- {
- bool flag;
- uint32_t num;
- }LORA_POOL_t;
- extern RTC_FAST_ATTR LORA_POOL_t lora_pool[LORA_INFO_END];
- typedef struct node {
- int n; /* data field(s) */
- char * data; //数据
- char cmd; //发送的命令
- int len; //发送的长度
- /* float b;
- * char c;
- * ... etc.
- */
- struct node *next; /* pointer to next element */
- }Node;
- #if 0
- Node *newNode(int ); /* physically creates a new node */
- #else
- Node *newNode(int x,int cmd,char *data,int len);
- #endif
- /* N.B. this function is called by other functions because does not take care
- * of inserting the Node in the list, but delegates this operation to other
- * functions, such as *Insert functions */
- Node *preInsert(Node *, int,int,char *,int); /* inserts a new item at the top of the list */
- Node *orderInsert(Node *, int ,int,char *,int); /* inserts a new element in order, according to a key field */
- Node *postInsert(Node *, int ,int,char *,int); /* inserts a new item at the end of the list */
- Node *findNode(Node *, int ); /* find a node in the list */
- Node *deleteNode(Node *, int ); /* deletes a node corresponding to the inserted key */
- Node *deleteList(Node *); /* deletes a list */
- void printList(Node *); /* prints all the nodes in the list */
- void MergeSort(Node **); /* sorting algorithm */
- Node *Merge(Node *, Node *); /* merges two sorted linked lists */
- void Split(Node *, Node **, Node **); /* split the nodes of the list into two sublists */
- int countNodes(Node *); /* returns the number of nodes in the list */
- Node* copyList( Node* originalList);
- int countClockNodes_byCMD(Node *top,char type_cmd);
- Node *deleteNode_head(Node *top);
- #define MAX_MSG_ID_NUM 1000
- int allocateMsgIdNum();
- void deallocateMsgIdNum(int idNum);
- #if 0
- void wait_Send_Data_Insert(int msgid,uint8_t *data,int len);
- #endif
- void wait_Send_Data_Delete(int msgid);
- #endif
|