Display_Avr_3/hdlc/client.h
2024-01-12 14:17:34 +03:00

34 lines
1.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef CLIENT_H
#define CLIENT_H
#include <stdint.h>
#include <stdbool.h>
enum HDLCState {
UNINITIALIZED_STATE = 0, // состояние до инцилизации
IDLE_STATE, // Состояние ожидания начала
READY_STATE, // Состояние принятия
CONNECTING, // состояние соединения
DISCONNECTING, // состояния отключения
RECIVING // состояние приема и отправки
};
struct Client{
enum HDLCState state;
int connecting_frame_timeout; //-1
int size_data_buffer;
int count_buffers;
int number_seq_frame;
};
//название функций
int init_hdlc_client(int count_buffers, int size_data_buffer, int connecting_frame_timeout, struct Client* client);
void connect(struct Client* client);
int send_data(struct Client* client, uint8_t* data, size_t data_len);
int get_frame(struct Client *client, uint8_t buffer[], size_t lenBuffer);
//принимает буффер с уарта
int hdlc_get_raw_data(struct Client* client, uint8_t buffer[], size_t len_buffer);
void hdlc_timeout_handler(struct Client* client, int delta_time);
#endif //CLIENT_H