Display_Avr_3/hdlc/client.h
2023-12-25 20:11:27 +03:00

31 lines
1.0 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, // состояния отключения
RECIVED // состояние приема и отправки
};
struct Client{
enum HDLCState state;
int connecting_frame_timeout; //-1
};
//название функций
struct Client init_hdlc_client(enum HDLCState *state);
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