aqhome: Added test for serial interface, added api.h.

This commit is contained in:
Martin Preuss
2023-01-22 17:47:30 +01:00
parent a8a9571a27
commit c0fca3bf98
4 changed files with 142 additions and 8 deletions

View File

@@ -9,7 +9,10 @@
#ifndef AQH_SERIAL_H
#define AQH_SERIAL_H
#include <aqhome/api.h>
#include <gwenhywfar/buffer.h>
#include <inttypes.h>
@@ -21,19 +24,19 @@ extern "C" {
typedef struct AQH_SERIAL AQH_SERIAL;
AQH_SERIAL *AQH_Serial_new(const char *deviceName, uint8_t addr);
void AQH_Serial_free(AQH_SERIAL *sr);
AQHOME_API AQH_SERIAL *AQH_Serial_new(const char *deviceName, uint8_t addr);
AQHOME_API void AQH_Serial_free(AQH_SERIAL *sr);
uint8_t AQH_Serial_GetAddress(const AQH_SERIAL *sr);
AQHOME_API uint8_t AQH_Serial_GetAddress(const AQH_SERIAL *sr);
int AQH_Serial_Open(AQH_SERIAL *sr);
void AQH_Serial_Close(AQH_SERIAL *sr);
AQHOME_API int AQH_Serial_Open(AQH_SERIAL *sr);
AQHOME_API void AQH_Serial_Close(AQH_SERIAL *sr);
int AQH_Serial_Recv(AQH_SERIAL *sr, uint8_t *buf, int len);
int AQH_Serial_Send(AQH_SERIAL *sr, const uint8_t *ptr, uint8_t len);
AQHOME_API int AQH_Serial_Recv(AQH_SERIAL *sr, uint8_t *buf, int len);
AQHOME_API int AQH_Serial_Send(AQH_SERIAL *sr, const uint8_t *ptr, uint8_t len);
int AQH_Serial_SendPacket(AQH_SERIAL *sr, uint8_t destAddr, const uint8_t *ptr, uint8_t len);
AQHOME_API int AQH_Serial_SendPacket(AQH_SERIAL *sr, uint8_t destAddr, const uint8_t *ptr, uint8_t len);
#ifdef __cplusplus