This repository has been archived on 2026-05-29. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
LightTAM/include/rfid_handler.h
T

57 lines
1.6 KiB
C

#ifndef __RFID_HANDLER_H__
#define __RFID_HANDLER_H__
#include "main.h"
#include "users.h"
typedef struct
{
BYTE wait_for_UART_flag;
BYTE end_from_main_flag;
BYTE uart_status;
} UartThreadFlags;
typedef struct
{
char *uart_address;
list_t *person_list_head;
UartThreadFlags *flags;
} UartThreadArgs;
// UART handler thread
/**
* @brief Thread function to listen for UART data.
*
* This function is intended to be run as a separate thread. It continuously listens
* for incoming data on a UART interface and processes the received data accordingly.
*
* @param arg Pointer to arguments required by the UART listener (typically a struct with UART configuration).
* @return void* Returns NULL upon thread completion.
*/
void *uartListener(void *arg);
/**
* @brief Parses an incoming RFID packet.
*
* This function processes the provided packet and extracts relevant information.
*
* @param _packet Pointer to the incoming packet data (array of BYTE).
* @return uint16_t Parsed value.
*/
uint16_t parseIncommingPacket(BYTE *_packet);
/**
* @brief Sends a data packet to a device over the specified UART interface.
*
* This function constructs and transmits a packet containing information about a person (node)
* and a specified state to a device connected via UART.
*
* @param _uart The UART interface identifier to use for transmission.
* @param _person Pointer to a node_t structure representing the person whose data is to be sent.
* @param state The state value to include in the packet.
*/
void sendPacketToDevice(int _uart, node_t *_person, BYTE state);
#endif