/****************************************************************************
 * This file is part of the project AqHome.
 * AqHome (c) by 2025 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 AQH_MSGWRITER_H
#define AQH_MSGWRITER_H

#include <aqhome/events2/object.h>


enum {
  /** param1=msgSize, param2=msgPointer */
  AQH_MSG_WRITER_SIGNAL_MSGSENT=AQH_OBJECT_SIGNAL_LAST,
  /** param1: error code */
  AQH_MSG_WRITER_SIGNAL_ERROR,
  AQH_MSG_WRITER_SIGNAL_CLOSED
};


enum {
  AQH_MSGWRITER_SLOT_SOCKETREADY=1,
  AQH_MSGWRITER_SLOT_SOCKETCLOSED
};




AQH_OBJECT *AQH_MsgWriter_new(AQH_EVENT_LOOP *eventLoop, AQH_OBJECT *fdObject);


void AQH_MsgWriter_SendMsg(AQH_OBJECT *o, const uint8_t *ptr, int len);


#endif

