2025-04-11 09:40:32 +08:00

47 lines
1.3 KiB
C

/****************************************************************************
*
* Copy right: 2019-, Copyrigths of EigenComm Ltd.
* File name: ctw_task.c
* Description: ctwing platform access source file
* History: Rev1.0 2022-02-14
*
****************************************************************************/
#include <stdio.h>
#include <stdarg.h>
#include DEBUG_LOG_HEADER_FILE
#include "slpman.h"
#include "ctw_common.h"
#include "ctw_http.h"
#include "ctw_mqtt.h"
MWNvmCfgCtwMqttParam *pCtwGetMqttParam = NULL;
void ecCtwAutoRegisterInit(void)
{
slpManSlpState_t slpState = slpManGetLastSlpState();
if(pCtwGetMqttParam == NULL){
pCtwGetMqttParam = mallocEc(sizeof(MWNvmCfgCtwMqttParam));
}
mwNvmCfgGetCtwMqttParam(pCtwGetMqttParam);
if(slpState == SLP_HIB_STATE || slpState == SLP_SLP2_STATE)
{
ECPLAT_PRINTF(UNILOG_CTWING, ecCtwAutoRegisterInit_0, P_INFO, "wakeup");
}
else
{
ECPLAT_PRINTF(UNILOG_CTWING, ecCtwAutoRegisterInit_1, P_INFO, "reboot");
if((pCtwGetMqttParam->autoRegEnableFlag == 1)&&(pCtwGetMqttParam->autoRegStatus == 0))
{
ECPLAT_PRINTF(UNILOG_CTWING, ecCtwAutoRegisterInit_4, P_SIG, "register mqttClient to ctwing");
ctwMqttRegisterInit(pCtwGetMqttParam);
}
}
}