Maxim Integrated / MaximBLE

Dependents:   BLE_Thermometer MAXWSNENV_demo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers wsf_msg.h Source File

wsf_msg.h

Go to the documentation of this file.
00001 /*************************************************************************************************/
00002 /*!
00003  *  \file   wsf_msg.h
00004  *
00005  *  \brief  Message passing service.
00006  *
00007  *          $Date: 2013-07-02 15:08:09 -0700 (Tue, 02 Jul 2013) $
00008  *          $Revision: 779 $
00009  *
00010  *  Copyright (c) 2009-2016 ARM Limited. All rights reserved.
00011  *
00012  *  SPDX-License-Identifier: LicenseRef-PBL
00013  *
00014  *  Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use
00015  *  this file except in compliance with the License.  You may obtain a copy of the License at
00016  *
00017  *  https://www.mbed.com/licenses/PBL-1.0
00018  *
00019  *  See the License for the specific language governing permissions and limitations under the License.
00020  */
00021 /*************************************************************************************************/
00022 #ifndef WSF_MSG_H
00023 #define WSF_MSG_H
00024 
00025 #include "wsf_queue.h"
00026 #include "wsf_os.h"
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031 
00032 /**************************************************************************************************
00033   Function Declarations
00034 **************************************************************************************************/
00035 
00036 /*************************************************************************************************/
00037 /*!
00038  *  \fn     WsfMsgAlloc
00039  *
00040  *  \brief  Allocate a message buffer to be sent with WsfMsgSend().
00041  *
00042  *  \param  len   Message length in bytes.
00043  *
00044  *  \return Pointer to message buffer or NULL if allocation failed.
00045  */
00046 /*************************************************************************************************/
00047 void *WsfMsgAlloc(uint16_t len);
00048 
00049 /*************************************************************************************************/
00050 /*!
00051  *  \fn     WsfMsgFree
00052  *
00053  *  \brief  Free a message buffer allocated with WsfMsgAlloc().
00054  *
00055  *  \param  pMsg  Pointer to message buffer.
00056  *
00057  *  \return None.
00058  */
00059 /*************************************************************************************************/
00060 void WsfMsgFree(void *pMsg);
00061 
00062 /*************************************************************************************************/
00063 /*!
00064  *  \fn     WsfMsgSend
00065  *
00066  *  \brief  Send a message to an event handler.
00067  *
00068  *  \param  handlerId   Event handler ID.
00069  *  \param  pMsg        Pointer to message buffer.
00070  *
00071  *  \return None.
00072  */
00073 /*************************************************************************************************/
00074 void WsfMsgSend(wsfHandlerId_t handlerId, void *pMsg);
00075 
00076 /*************************************************************************************************/
00077 /*!
00078  *  \fn     WsfMsgEnq
00079  *
00080  *  \brief  Enqueue a message.
00081  *
00082  *  \param  pQueue    Pointer to queue.
00083  *  \param  handerId  Set message handler ID to this value.
00084  *  \param  pElem     Pointer to message buffer.
00085  *
00086  *  \return None.
00087  */
00088 /*************************************************************************************************/
00089 void WsfMsgEnq(wsfQueue_t  *pQueue, wsfHandlerId_t handlerId, void *pMsg);
00090 
00091 /*************************************************************************************************/
00092 /*!
00093  *  \fn     WsfMsgDeq
00094  *
00095  *  \brief  Dequeue a message.
00096  *
00097  *  \param  pQueue      Pointer to queue.
00098  *  \param  pHandlerId  Handler ID of returned message; this is a return parameter.
00099  *
00100  *  \return Pointer to message that has been dequeued or NULL if queue is empty.
00101  */
00102 /*************************************************************************************************/
00103 void *WsfMsgDeq(wsfQueue_t  *pQueue, wsfHandlerId_t *pHandlerId);
00104 
00105 /*************************************************************************************************/
00106 /*!
00107  *  \fn     WsfMsgPeek
00108  *
00109  *  \brief  Get the next message without removing it from the queue.
00110  *
00111  *  \param  pQueue      Pointer to queue.
00112  *  \param  pHandlerId  Handler ID of returned message; this is a return parameter.
00113  *
00114  *  \return Pointer to the next message on the queue or NULL if queue is empty.
00115  */
00116 /*************************************************************************************************/
00117 void *WsfMsgPeek(wsfQueue_t  *pQueue, wsfHandlerId_t *pHandlerId);
00118 
00119 #ifdef __cplusplus
00120 };
00121 #endif
00122 
00123 #endif /* WSF_MSG_H */