Refactor RFID handler and user structures; update memory management in main.c and users.c; improve UUID generation logic and add list handling in parseIncomingPacket function.
This commit is contained in:
@@ -1,12 +1,19 @@
|
||||
#ifndef __RFID_HANDLER_H__
|
||||
#define __RFIT_HANDLER_H__
|
||||
#define __RFID_HANDLER_H__
|
||||
|
||||
#include "main.h"
|
||||
#include "users.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *uart_address;
|
||||
list_t *person_list_head;
|
||||
} UartThreadArgs;
|
||||
|
||||
// UART handler thread
|
||||
void *uartListener(void *arg);
|
||||
|
||||
void parseIncommingPacket(BYTE * _packet);
|
||||
void parseIncommingPacket(list_t *_head, BYTE *_packet);
|
||||
|
||||
void sendPacketToDevice(BYTE * _packet);
|
||||
|
||||
|
||||
+9
-4
@@ -12,16 +12,14 @@ typedef struct person
|
||||
{
|
||||
uint16_t uuid;
|
||||
|
||||
BYTE *name;
|
||||
BYTE *surname;
|
||||
char *name;
|
||||
char *surname;
|
||||
uint32_t department;
|
||||
|
||||
time_t last_time_event;
|
||||
time_t total;
|
||||
|
||||
BYTE available;
|
||||
|
||||
pthread_mutex_t lock;
|
||||
} person_t;
|
||||
|
||||
typedef struct node
|
||||
@@ -30,6 +28,13 @@ typedef struct node
|
||||
struct node *next;
|
||||
} node_t;
|
||||
|
||||
typedef struct list
|
||||
{
|
||||
node_t *head;
|
||||
pthread_mutex_t lock;
|
||||
|
||||
} list_t;
|
||||
|
||||
/**
|
||||
* @brief Generates a unique identifier (UUID) for a new node in the linked list.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user