/****************************************************************************
 * This file is part of the project AqHome.
 * AqHome (c) by 2024 Martin Preuss, all rights reserved.
 *
 * The license for this file can be found in the file COPYING which you
 * should have received along with this file.
 ****************************************************************************/

#ifndef AQHOME_REACT_PORT_H
#define AQHOME_REACT_PORT_H

#include <gwenhywfar/list.h>


typedef struct AQHREACT_PORT AQHREACT_PORT;
GWEN_LIST_FUNCTION_DEFS(AQHREACT_PORT, AQHREACT_Port)


#include "aqhome-react/types/link.h"
#include "aqhome-react/types/dataobject.h"

#include <gwenhywfar/buffer.h>



AQHREACT_PORT *AQHREACT_Port_new();
AQHREACT_PORT *AQHREACT_Port_dup(const AQHREACT_PORT *srcPort);
void AQHREACT_Port_free(AQHREACT_PORT *port);

const char *AQHREACT_Port_GetName(const AQHREACT_PORT *port);
void AQHREACT_Port_SetName(AQHREACT_PORT *port, const char *s);

int AQHREACT_Port_GetIdForUnit(const AQHREACT_PORT *port);
void AQHREACT_Port_SetIdForUnit(AQHREACT_PORT *port, int i);

const char *AQHREACT_Port_GetDescription(const AQHREACT_PORT *port);
void AQHREACT_Port_SetDescription(AQHREACT_PORT *port, const char *s);

uint32_t AQHREACT_Port_GetFlags(const AQHREACT_PORT *port);
void AQHREACT_Port_SetFlags(AQHREACT_PORT *port, uint32_t f);
void AQHREACT_Port_AddFlags(AQHREACT_PORT *port, uint32_t f);
void AQHREACT_Port_SubFlags(AQHREACT_PORT *port, uint32_t f);

int AQHREACT_Port_GetDataType(const AQHREACT_PORT *port);
void AQHREACT_Port_SetDataType(AQHREACT_PORT *port, int i);

AQHREACT_DATAOBJECT *AQHREACT_Port_GetCurrentDataObject(const AQHREACT_PORT *port);
void AQHREACT_Port_SetCurrentDataObject(AQHREACT_PORT *port, AQHREACT_DATAOBJECT *dataObject);

void AQHREACT_Port_SendData(const AQHREACT_PORT *port, const AQHREACT_DATAOBJECT *dataObject);


AQHREACT_LINK_LIST *AQHREACT_Port_GetLinkList(const AQHREACT_PORT *port);
void AQHREACT_Port_AddLink(AQHREACT_PORT *port, AQHREACT_LINK *lnk);


AQHREACT_PORT *AQHREACT_Port_List_GetByName(const AQHREACT_PORT_LIST *portList, const char *name);
AQHREACT_PORT *AQHREACT_Port_List_GetByIdForUnit(const AQHREACT_PORT_LIST *portList, int id);


void AQHREACT_Port_Dump(const AQHREACT_PORT *port, GWEN_BUFFER *buf, int indent);
void AQHREACT_Port_List_Dump(const AQHREACT_PORT_LIST *portList, GWEN_BUFFER *buf, int indent, const char *title);




#endif

