Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Flipper-Zero/STM32CubeWB.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Projects/P-NUCLEO-WB55.Nucleo/Applications/Thread/Thread_Coap_Generic_Ota/STM32_WPAN/App/app_thread.c')
-rw-r--r--Projects/P-NUCLEO-WB55.Nucleo/Applications/Thread/Thread_Coap_Generic_Ota/STM32_WPAN/App/app_thread.c95
1 files changed, 31 insertions, 64 deletions
diff --git a/Projects/P-NUCLEO-WB55.Nucleo/Applications/Thread/Thread_Coap_Generic_Ota/STM32_WPAN/App/app_thread.c b/Projects/P-NUCLEO-WB55.Nucleo/Applications/Thread/Thread_Coap_Generic_Ota/STM32_WPAN/App/app_thread.c
index 4cf5bf62b..ac57fe673 100644
--- a/Projects/P-NUCLEO-WB55.Nucleo/Applications/Thread/Thread_Coap_Generic_Ota/STM32_WPAN/App/app_thread.c
+++ b/Projects/P-NUCLEO-WB55.Nucleo/Applications/Thread/Thread_Coap_Generic_Ota/STM32_WPAN/App/app_thread.c
@@ -17,6 +17,7 @@
******************************************************************************
*/
/* USER CODE END Header */
+
/* Includes ------------------------------------------------------------------*/
#include "app_common.h"
#include "utilities_common.h"
@@ -103,28 +104,23 @@ static void RxCpltCallback(void);
/* USER CODE BEGIN PFP */
static void APP_THREAD_CoapSendRequest(otCoapResource* pCoapRessource, otCoapType CoapType, otCoapCode CoapCode, const char *Address, uint8_t* Payload, uint16_t Size);
-static void APP_THREAD_DummyReqHandler(void * p_context,
- otCoapHeader * pHeader,
- otMessage * pMessage,
- const otMessageInfo * pMessageInfo);
-static void APP_THREAD_CoapRequestHandler(otCoapHeader * pHeader,
- otMessage * pMessage,
- const otMessageInfo * pMessageInfo);
+static void APP_THREAD_CoapRequestHandler(void * pContext,
+ otCoapHeader * pHeader,
+ otMessage * pMessage,
+ const otMessageInfo * pMessageInfo);
static void APP_THREAD_CoapSendDataResponse(otCoapHeader * pRequestHeader,
const otMessageInfo * pMessageInfo);
-static void APP_THREAD_CoapDataRespHandler(otCoapHeader * pHeader,
- otMessage * pMessage,
- const otMessageInfo * pMessageInfo,
- otError Result);
-static void APP_THREAD_CoapDummyRespHandler(void * p_context,
- otCoapHeader * pHeader,
+static void APP_THREAD_CoapDataRespHandler(
+ void * pContext,
+ otCoapHeader * pHeader,
otMessage * pMessage,
const otMessageInfo * pMessageInfo,
otError Result);
-static void APP_THREAD_CoapRequestHandlerFuotaReboot(otCoapHeader * pHeader,
- otMessage * pMessage,
- const otMessageInfo * pMessageInfo);
+static void APP_THREAD_CoapRequestHandlerFuotaReboot(void * pContext,
+ otCoapHeader * pHeader,
+ otMessage * pMessage,
+ const otMessageInfo * pMessageInfo);
static void APP_THREAD_InitPayloadWrite(void);
static void APP_THREAD_SendCoapMsg(void);
@@ -159,8 +155,8 @@ PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static uint8_t ThreadNotifRspEvtBuffer[size
PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static TL_CmdPacket_t ThreadCliCmdBuffer;
/* USER CODE BEGIN PV */
-static otCoapResource OT_Ressource = {C_RESSOURCE, APP_THREAD_DummyReqHandler, (void*)APP_THREAD_CoapRequestHandler, NULL};
-static otCoapResource OT_Ressource_FuotaReboot = {C_RESSOURCE_FUOTA_REBOOT, APP_THREAD_DummyReqHandler, (void*)APP_THREAD_CoapRequestHandlerFuotaReboot, NULL};
+static otCoapResource OT_Ressource = {C_RESSOURCE, APP_THREAD_CoapRequestHandler,"StdContext", NULL};
+static otCoapResource OT_Ressource_FuotaReboot = {C_RESSOURCE_FUOTA_REBOOT, APP_THREAD_CoapRequestHandlerFuotaReboot,"FuotaContext", NULL};
static otMessageInfo OT_MessageInfo = {0};
static otCoapHeader OT_Header = {0};
@@ -552,8 +548,8 @@ static void APP_THREAD_CoapSendRequest(otCoapResource* pCoapRessource,
error = otCoapSendRequest(NULL,
pOT_Message,
&OT_MessageInfo,
- &APP_THREAD_CoapDummyRespHandler,
- (void*)&APP_THREAD_CoapDataRespHandler);
+ &APP_THREAD_CoapDataRespHandler,
+ "myContext");
}
}while(false);
@@ -565,29 +561,18 @@ static void APP_THREAD_CoapSendRequest(otCoapResource* pCoapRessource,
}
/**
- * @brief Dummy request handler
- *
- * @param None
- * @retval None
- */
-static void APP_THREAD_DummyReqHandler(void * p_context,
- otCoapHeader * pHeader,
- otMessage * pMessage,
- const otMessageInfo * pMessageInfo)
-{
-}
-
-/**
* @brief Handler called when the server receives a COAP request.
*
+ * @param pContext : Context
* @param pHeader : Header
* @param pMessage : Message
* @param pMessageInfo : Message information
* @retval None
*/
-static void APP_THREAD_CoapRequestHandler(otCoapHeader * pHeader,
- otMessage * pMessage,
- const otMessageInfo * pMessageInfo)
+static void APP_THREAD_CoapRequestHandler(void * pContext,
+ otCoapHeader * pHeader,
+ otMessage * pMessage,
+ const otMessageInfo * pMessageInfo)
{
APP_DBG(" Received CoAP request");
/* USER CODE BEGIN APP_THREAD_CoapRequestHandler */
@@ -646,18 +631,22 @@ static void APP_THREAD_CoapSendDataResponse(otCoapHeader * pRequestHeader,
/**
* @brief This function manages the data response handler.
*
+ * @param pContext context
* @param pHeader header
* @param pMessage message pointer
* @param pMessageInfo message info pointer
* @param Result error code
* @retval None
*/
-static void APP_THREAD_CoapDataRespHandler(otCoapHeader * pHeader,
+static void APP_THREAD_CoapDataRespHandler(
+ void * pContext,
+ otCoapHeader * pHeader,
otMessage * pMessage,
const otMessageInfo * pMessageInfo,
otError Result)
{
/* Prevent unused argument(s) compilation warning */
+ UNUSED(pContext);
UNUSED(pHeader);
UNUSED(pMessage);
UNUSED(pMessageInfo);
@@ -673,30 +662,6 @@ static void APP_THREAD_CoapDataRespHandler(otCoapHeader * pHeader,
}
/**
- * @brief This function is used to handle a dummy response handler
- *
- * @param p_context context
- * @param pHeader coap header
- * @param pMessage message
- * @paramp pMessageInfo otMessage information
- * @param Result error status
- * @retval None
- */
-static void APP_THREAD_CoapDummyRespHandler(void * p_context,
- otCoapHeader * pHeader,
- otMessage * pMessage,
- const otMessageInfo * pMessageInfo,
- otError Result)
-{
- /* Prevent unused argument(s) compilation warning */
- UNUSED(p_context);
- UNUSED(pHeader);
- UNUSED(pMessage);
- UNUSED(pMessageInfo);
- UNUSED(Result);
-}
-
-/**
* @brief Initialize CoAP write buffer.
* @param None
* @retval None
@@ -768,14 +733,16 @@ static bool APP_THREAD_CheckMsgValidity(void)
/**
* @brief Handler called when the server receives a COAP request.
*
+ * @param pContext : Context
* @param pHeader : Header
* @param pMessage : Message
* @param pMessageInfo : Message information
* @retval None
*/
-static void APP_THREAD_CoapRequestHandlerFuotaReboot(otCoapHeader * pHeader,
- otMessage * pMessage,
- const otMessageInfo * pMessageInfo)
+static void APP_THREAD_CoapRequestHandlerFuotaReboot(void * pContext,
+ otCoapHeader * pHeader,
+ otMessage * pMessage,
+ const otMessageInfo * pMessageInfo)
{
uint32_t l_data = 0;
APP_DBG(" Received CoAP request on %s", C_RESSOURCE_FUOTA_REBOOT);