/**************************************************************************** * This file is part of the project AqHome. * AqHome (c) by 2023 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. ****************************************************************************/ #ifdef HAVE_CONFIG_H # include #endif #include "./fini.h" #include "./aqhome_data_p.h" #include #include #include #include #include /* ------------------------------------------------------------------------------------------------ * defines * ------------------------------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------------------------------ * forward declarations * ------------------------------------------------------------------------------------------------ */ static void _disconnectTree(GWEN_MSG_ENDPOINT *ep); /* ------------------------------------------------------------------------------------------------ * implementations * ------------------------------------------------------------------------------------------------ */ void AqHomeData_Fini(AQHOME_DATA *aqh) { if (aqh) { if (aqh->ipcdEndpoint) { _disconnectTree(aqh->ipcdEndpoint); GWEN_MsgEndpoint_Disconnect(aqh->ipcdEndpoint); } GWEN_MsgEndpoint_free(aqh->ipcdEndpoint); aqh->ipcdEndpoint=NULL; if (aqh->pidFile) remove(aqh->pidFile); } } void _disconnectTree(GWEN_MSG_ENDPOINT *ep) { GWEN_MSG_ENDPOINT *epChild; epChild=GWEN_MsgEndpoint_Tree2_GetFirstChild(ep); while(epChild) { _disconnectTree(epChild); epChild=GWEN_MsgEndpoint_Tree2_GetNext(epChild); } /* while */ GWEN_MsgEndpoint_Disconnect(ep); }