// 蓝牙事件通知处理模块
// 杭州秒寻科技有限公司
// 周涛
// 2024-9-27

#include "includes.h"

// 导入全局变量
extern WIFI_BLE_PARAM_T gWifiBle_stParam;
extern WIFI_PARAM_T gWifi_stParam;

// 模块事件广播处理函数
void wifible_event_main(uint8 *pbyData)
{
    // wifi断开连接
    if (NULL != strstr((char *)pbyData, EVENT_WIFI_DISCONNECT))
    {
        gWifiBle_stParam.byWifiConnected = 0;
    }
    // wifi连接成功
    else if (NULL != strstr((char *)pbyData, EVENT_WIFI_CONNECT))
    {
        gWifiBle_stParam.byWifiConnected = 1;
    }
    // socket断开
    else if (NULL != strstr((char *)pbyData, EVENT_SOCKET_DISCONNECT))
    {
        gWifiBle_stParam.bySocketConnected = 0;
    }
    // 重新连接socket成功
    else if (NULL != strstr((char *)pbyData, EVENT_SOCKET_RECONNECT))
    {
        gWifiBle_stParam.bySocketConnected = 1;
    }

    return;
}

// 获得TCP连接状态，0：断开，1：连接
uint8 wifible_event_get_tcp_connect_status()
{
    return gWifiBle_stParam.bySocketConnected;
}