30 lines
879 B
C
30 lines
879 B
C
//
|
|
// Created by 79513 on 19.06.2023.
|
|
//
|
|
|
|
#ifndef CLIENT_H
|
|
#define CLIENT_H
|
|
|
|
#include "hdlc_frame.h"
|
|
#include <stdbool.h>
|
|
#include <stddef.h> // Для использования size_t
|
|
#include <stdint.h>
|
|
|
|
typedef struct {
|
|
bool TEST_IS_VALID;
|
|
uint8_t address;
|
|
uint8_t _send_sequence_number;
|
|
uint8_t poll_final;
|
|
uint8_t _receive_sequence_number;
|
|
void* serial_port; // Указатель на объект последовательного порта
|
|
} Client;
|
|
|
|
void init_Client(Client* client, bool test_is_valid, uint8_t address, void* serial_port);
|
|
void connect(Client* client);
|
|
void send(Client* client, uint8_t* data, size_t data_length);
|
|
void receive_data(Client* client);
|
|
bool validate(Client* client, HDLCFrame* frame, uint8_t* received_data, size_t received_length);
|
|
int sendSerialData(const char* port, const char* data, size_t length);
|
|
|
|
#endif
|