mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-18 08:55:53 +08:00
[update] 增加STM32智慧宿舍基础代码
This commit is contained in:
467
firmware/stm32/smart_dormitory/User/xiaoyi_wifi/esp8266.c
Normal file
467
firmware/stm32/smart_dormitory/User/xiaoyi_wifi/esp8266.c
Normal file
@@ -0,0 +1,467 @@
|
||||
#include "esp8266.h"
|
||||
#include "usart.h"
|
||||
|
||||
|
||||
struct STRUCT_USART_Fram ESP8266_Fram_Record_Struct= { 0 }; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
void ESP8266_Init(uint32_t bound)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
|
||||
// GPIO_InitStructure.Pin = ESP8266_RST_Pin;
|
||||
// GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
// HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
//
|
||||
// GPIO_InitStructure.Pin = ESP8266_CH_PD_Pin;
|
||||
// HAL_GPIO_Init(ESP8266_CH_PD_Pin_Port, &GPIO_InitStructure);
|
||||
//
|
||||
ESP8266_Rst();
|
||||
}
|
||||
|
||||
//<2F><>ESP8266ģ<36>鷢<EFBFBD><E9B7A2>ATָ<54><D6B8>
|
||||
// cmd <20><><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>ָ<EFBFBD><D6B8>
|
||||
// ack1,ack2;<3B>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ΪNULL<4C><4C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><DFBC><EFBFBD>ϵ
|
||||
// time <20>ȴ<EFBFBD><C8B4><EFBFBD>Ӧʱ<D3A6><CAB1>
|
||||
//<2F><><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD>ͳɹ<CDB3><C9B9><EFBFBD> 0ʧ<30><CAA7>
|
||||
bool ESP8266_Send_AT_Cmd(char *cmd,char *ack1,char *ack2,uint32_t time)
|
||||
{
|
||||
ESP8266_Fram_Record_Struct.InfBit .FramLength = 0; //<2F><><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD>ݰ<EFBFBD>
|
||||
ESP8266_USART("%s\r\n", cmd);
|
||||
if(ack1==0&&ack2==0) //<2F><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
{
|
||||
return true;
|
||||
}
|
||||
delay_ms(time); //<2F><>ʱ
|
||||
delay_ms(1000);
|
||||
ESP8266_Fram_Record_Struct.Data_RX_BUF[ESP8266_Fram_Record_Struct.InfBit.FramLength ] = '\0';
|
||||
|
||||
printf("------ %s", ESP8266_Fram_Record_Struct.Data_RX_BUF);
|
||||
if(ack1!=0&&ack2!=0)
|
||||
{
|
||||
return ( ( bool ) strstr ( ESP8266_Fram_Record_Struct.Data_RX_BUF, ack1 ) ||
|
||||
( bool ) strstr ( ESP8266_Fram_Record_Struct.Data_RX_BUF, ack2 ) );
|
||||
}
|
||||
else if( ack1 != 0 ) //strstr(s1,s2);<3B><><EFBFBD><EFBFBD>s2<73>Ƿ<EFBFBD>Ϊs1<73><31>һ<EFBFBD><D2BB><EFBFBD>֣<EFBFBD><D6A3>Ƿ<EFBFBD><C7B7>ظ<EFBFBD>λ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD>false<73><65><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF>ת<EFBFBD><D7AA>Ϊbool<6F><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
return ( ( bool ) strstr ( ESP8266_Fram_Record_Struct.Data_RX_BUF, ack1 ) );
|
||||
|
||||
else
|
||||
return ( ( bool ) strstr ( ESP8266_Fram_Record_Struct.Data_RX_BUF, ack2 ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
//<2F><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
void ESP8266_Rst(void)
|
||||
{
|
||||
// ESP8266_RST_Pin_SetL;
|
||||
// delay_ms(500);
|
||||
// ESP8266_RST_Pin_SetH;
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
//<2F><><EFBFBD>ͻָ<CDBB><D6B8><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD>ģ<EEBDAB><C4A3><EFBFBD>ָ<EFBFBD><D6B8>ɳ<EFBFBD><C9B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void ESP8266_AT_Test(void)
|
||||
{
|
||||
char count=0;
|
||||
delay_ms(1000);
|
||||
while(count < 10)
|
||||
{
|
||||
if(ESP8266_Send_AT_Cmd("AT+RESTORE","OK",NULL,500))
|
||||
{
|
||||
printf("OK\r\n");
|
||||
return;
|
||||
}
|
||||
++ count;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//ѡ<><D1A1>ESP8266<36>Ĺ<EFBFBD><C4B9><EFBFBD>ģʽ
|
||||
// enumMode ģʽ<C4A3><CABD><EFBFBD><EFBFBD>
|
||||
//<2F>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>true<75><65>ʧ<EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>false
|
||||
bool ESP8266_Net_Mode_Choose(ENUM_Net_ModeTypeDef enumMode)
|
||||
{
|
||||
switch ( enumMode )
|
||||
{
|
||||
case STA:
|
||||
return ESP8266_Send_AT_Cmd ( "AT+CWMODE=1", "OK", "no change", 2500 );
|
||||
|
||||
case AP:
|
||||
return ESP8266_Send_AT_Cmd ( "AT+CWMODE=2", "OK", "no change", 2500 );
|
||||
|
||||
case STA_AP:
|
||||
return ESP8266_Send_AT_Cmd ( "AT+CWMODE=3", "OK", "no change", 2500 );
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//ESP8266<36><36><EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD><E2B2BF>WIFI
|
||||
//pSSID WiFi<46>ʺ<EFBFBD>
|
||||
//pPassWord WiFi<46><69><EFBFBD><EFBFBD>
|
||||
//<2F><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD><EFBFBD><EFBFBD>true <20><>֮false
|
||||
bool ESP8266_JoinAP( char * pSSID, char * pPassWord)
|
||||
{
|
||||
char cCmd [120];
|
||||
|
||||
sprintf ( cCmd, "AT+CWJAP=\"%s\",\"%s\"", pSSID, pPassWord );
|
||||
return ESP8266_Send_AT_Cmd( cCmd, "OK", NULL, 5000 );
|
||||
}
|
||||
|
||||
//ESP8266 <><CDB8>ʹ<EFBFBD><CAB9>
|
||||
//enumEnUnvarnishTx <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD>bool<6F><6C><EFBFBD><EFBFBD>
|
||||
//<2F><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD><EFBFBD><EFBFBD>true<75><65><EFBFBD><EFBFBD>֮false
|
||||
bool ESP8266_Enable_MultipleId (FunctionalState enumEnUnvarnishTx )
|
||||
{
|
||||
char cStr [20];
|
||||
|
||||
sprintf ( cStr, "AT+CIPMUX=%d", ( enumEnUnvarnishTx ? 1 : 0 ) );
|
||||
|
||||
return ESP8266_Send_AT_Cmd ( cStr, "OK", 0, 500 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
//ESP8266 <20><><EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
//enumE <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//ip <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP
|
||||
//ComNum <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
||||
//id<69><64><EFBFBD><EFBFBD><EFBFBD>Ӻţ<D3BA>ȷ<EFBFBD><C8B7>ͨ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//<2F><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD><EFBFBD><EFBFBD>true<75><65><EFBFBD><EFBFBD>֮fasle
|
||||
bool ESP8266_Link_Server(ENUM_NetPro_TypeDef enumE, char * ip, char * ComNum, ENUM_ID_NO_TypeDef id)
|
||||
{
|
||||
char cStr [100] = { 0 }, cCmd [120];
|
||||
|
||||
switch ( enumE )
|
||||
{
|
||||
case enumTCP:
|
||||
sprintf ( cStr, "\"%s\",\"%s\",%s", "TCP", ip, ComNum );
|
||||
break;
|
||||
|
||||
case enumUDP:
|
||||
sprintf ( cStr, "\"%s\",\"%s\",%s", "UDP", ip, ComNum );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ( id < 5 )
|
||||
sprintf ( cCmd, "AT+CIPSTART=%d,%s", id, cStr);
|
||||
|
||||
else
|
||||
sprintf ( cCmd, "AT+CIPSTART=%s", cStr );
|
||||
|
||||
return ESP8266_Send_AT_Cmd ( cCmd, "OK", "ALREAY CONNECT", 4000 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
//<><CDB8>ʹ<EFBFBD><CAB9>
|
||||
//<2F><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD><EFBFBD><EFBFBD>true<75><65> <20><>֮false
|
||||
bool ESP8266_UnvarnishSend ( void )
|
||||
{
|
||||
if (!ESP8266_Send_AT_Cmd ( "AT+CIPMODE=1", "OK", 0, 500 ))
|
||||
return false;
|
||||
|
||||
return
|
||||
ESP8266_Send_AT_Cmd( "AT+CIPSEND", "OK", ">", 500 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
//ESP8266<36><36><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
//enumEnUnvarnishTx<54>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><CDB8>ģʽ
|
||||
//pStr<74>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
//ulStrLength<74>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//ucId <20><><EFBFBD>Ӻ<EFBFBD>
|
||||
//<2F><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD><EFBFBD><EFBFBD>true<75><65> <20><>֮false
|
||||
bool ESP8266_SendString(FunctionalState enumEnUnvarnishTx, char * pStr, uint32_t ulStrLength, ENUM_ID_NO_TypeDef ucId )
|
||||
{
|
||||
char cStr [20];
|
||||
bool bRet = false;
|
||||
|
||||
|
||||
if ( enumEnUnvarnishTx )
|
||||
{
|
||||
ESP8266_USART ( "%s", pStr );
|
||||
|
||||
bRet = true;
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if ( ucId < 5 )
|
||||
sprintf ( cStr, "AT+CIPSEND=%d,%d", ucId, ulStrLength + 2 );
|
||||
|
||||
else
|
||||
sprintf ( cStr, "AT+CIPSEND=%d", ulStrLength + 2 );
|
||||
|
||||
ESP8266_Send_AT_Cmd ( cStr, "> ", 0, 1000 );
|
||||
|
||||
bRet = ESP8266_Send_AT_Cmd ( pStr, "SEND OK", 0, 1000 );
|
||||
}
|
||||
|
||||
return bRet;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//ESP8266<36>˳<EFBFBD><EFBFBD><CDB8>ģʽ
|
||||
void ESP8266_ExitUnvarnishSend ( void )
|
||||
{
|
||||
delay_ms(1000);
|
||||
ESP8266_USART( "+++" );
|
||||
delay_ms( 500 );
|
||||
}
|
||||
|
||||
|
||||
//ESP8266 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
||||
//<2F><><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD>ȡ״̬ʧ<CCAC><CAA7>
|
||||
//<2F><><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ip
|
||||
//<2F><><EFBFBD><EFBFBD>3<EFBFBD><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//<2F><><EFBFBD><EFBFBD>4<EFBFBD><34>ʧȥ<CAA7><C8A5><EFBFBD><EFBFBD>
|
||||
uint8_t ESP8266_Get_LinkStatus ( void )
|
||||
{
|
||||
if (ESP8266_Send_AT_Cmd( "AT+CIPSTATUS", "OK", 0, 500 ) )
|
||||
{
|
||||
if ( strstr ( ESP8266_Fram_Record_Struct.Data_RX_BUF, "STATUS:2\r\n" ) )
|
||||
return 2;
|
||||
|
||||
else if ( strstr ( ESP8266_Fram_Record_Struct.Data_RX_BUF, "STATUS:3\r\n" ) )
|
||||
return 3;
|
||||
|
||||
else if ( strstr ( ESP8266_Fram_Record_Struct.Data_RX_BUF, "STATUS:4\r\n" ) )
|
||||
return 4;
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *itoa( int value, char *string, int radix )
|
||||
{
|
||||
int i, d;
|
||||
int flag = 0;
|
||||
char *ptr = string;
|
||||
|
||||
/* This implementation only works for decimal numbers. */
|
||||
if (radix != 10)
|
||||
{
|
||||
*ptr = 0;
|
||||
return string;
|
||||
}
|
||||
|
||||
if (!value)
|
||||
{
|
||||
*ptr++ = 0x30;
|
||||
*ptr = 0;
|
||||
return string;
|
||||
}
|
||||
|
||||
/* if this is a negative value insert the minus sign. */
|
||||
if (value < 0)
|
||||
{
|
||||
*ptr++ = '-';
|
||||
|
||||
/* Make the value positive. */
|
||||
value *= -1;
|
||||
|
||||
}
|
||||
|
||||
for (i = 10000; i > 0; i /= 10)
|
||||
{
|
||||
d = value / i;
|
||||
|
||||
if (d || flag)
|
||||
{
|
||||
*ptr++ = (char)(d + 0x30);
|
||||
value -= (d * i);
|
||||
flag = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Null terminate the string. */
|
||||
*ptr = 0;
|
||||
|
||||
return string;
|
||||
|
||||
} /* NCL_Itoa */
|
||||
|
||||
|
||||
void USART_printf ( char * Data, ... )
|
||||
{
|
||||
const char *s;
|
||||
int d;
|
||||
char buf[16];
|
||||
uint8_t ch = 0;
|
||||
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, Data);
|
||||
|
||||
while ( * Data != 0 ) // <20>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<C7B7><F1B5BDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
{
|
||||
if ( * Data == 0x5c ) //'\'
|
||||
{
|
||||
switch ( *++Data )
|
||||
{
|
||||
case 'r': //<2F>س<EFBFBD><D8B3><EFBFBD>
|
||||
ch = 0x0d;
|
||||
HAL_UART_Transmit(&huart3, (uint8_t *)&ch, 1, 0xFFFF);
|
||||
Data ++;
|
||||
break;
|
||||
|
||||
case 'n': //<2F><><EFBFBD>з<EFBFBD>
|
||||
ch = 0x0a;
|
||||
HAL_UART_Transmit(&huart3, (uint8_t *)&ch, 1, 0xFFFF);
|
||||
Data ++;
|
||||
break;
|
||||
|
||||
default:
|
||||
Data ++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
else if ( * Data == '%')
|
||||
{
|
||||
switch ( *++Data )
|
||||
{
|
||||
case 's': //<2F>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
s = va_arg(ap, const char *);
|
||||
for ( ; *s; s++)
|
||||
{
|
||||
HAL_UART_Transmit(&huart3, (uint8_t *)s, 1, 0xFFFF);
|
||||
while( __HAL_UART_GET_FLAG(&huart3, UART_FLAG_TXE) == false);
|
||||
}
|
||||
Data++;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
//ʮ<><CAAE><EFBFBD><EFBFBD>
|
||||
d = va_arg(ap, int);
|
||||
itoa(d, buf, 10);
|
||||
for (s = buf; *s; s++)
|
||||
{
|
||||
HAL_UART_Transmit(&huart3, (uint8_t *)s, 1, 0xFFFF);
|
||||
while( __HAL_UART_GET_FLAG(&huart3, UART_FLAG_TXE) == false);
|
||||
}
|
||||
Data++;
|
||||
break;
|
||||
default:
|
||||
Data++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HAL_UART_Transmit(&huart3, (uint8_t *)Data, 1, 0xFFFF);
|
||||
Data++;
|
||||
while( __HAL_UART_GET_FLAG(&huart3, UART_FLAG_TXE) == false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>ΪESP8266MQTT<54><54><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
||||
|
||||
/*
|
||||
*MQTT<54><54><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
||||
*LinkID <20><><EFBFBD><EFBFBD>ID,Ŀǰֻ֧<D6BB><D6A7>0
|
||||
*scheme <20><><EFBFBD>ӷ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>MQTT over TCP,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ1
|
||||
*client_id MQTTclientID <20><><EFBFBD>ڱ<EFBFBD>־client<6E><74><EFBFBD><EFBFBD>
|
||||
*username <20><><EFBFBD>ڵ<EFBFBD>¼ MQTT <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> username
|
||||
*password <20><><EFBFBD>ڵ<EFBFBD>¼ MQTT <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> password
|
||||
*cert_key_ID ֤<><D6A4> ID, Ŀǰ֧<C7B0><D6A7>һ<EFBFBD><D2BB> cert ֤<><D6A4>, <20><><EFBFBD><EFBFBD>Ϊ 0
|
||||
*CA_ID Ŀǰ֧<C7B0><D6A7>һ<EFBFBD><D2BB> CA ֤<><D6A4>, <20><><EFBFBD><EFBFBD>Ϊ 0
|
||||
*path <20><>Դ·<D4B4><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ""
|
||||
*<2A><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD><EFBFBD><EFBFBD>true <20><>֮false
|
||||
*/
|
||||
bool ESP8266_MQTTUSERCFG( char * pClient_Id, char * pUserName,char * PassWord)
|
||||
{
|
||||
char cCmd [120];
|
||||
sprintf ( cCmd, "AT+MQTTUSERCFG=0,1,\"%s\",\"%s\",\"%s\",0,0,\"\"", pClient_Id,pUserName,PassWord );
|
||||
return ESP8266_Send_AT_Cmd( cCmd, "OK", NULL, 500 );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*<2A><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>MQTT<54><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*LinkID <20><><EFBFBD><EFBFBD>ID,Ŀǰֻ֧<D6BB><D6A7>0
|
||||
*IP<49><50>MQTT<54><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD>Ӧ<EFBFBD><D3A6>IP<49><50>ַ
|
||||
*ComNum MQTT<54><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD>Ӧ<EFBFBD>Ķ˿ںţ<DABA>һ<EFBFBD><D2BB>Ϊ1883
|
||||
*<2A><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD><EFBFBD><EFBFBD>true <20><>֮false
|
||||
*/
|
||||
bool ESP8266_MQTTCONN( char * Ip, int Num)
|
||||
{
|
||||
char cCmd [120];
|
||||
sprintf ( cCmd,"AT+MQTTCONN=0,\"%s\",%d,0", Ip,Num);
|
||||
return ESP8266_Send_AT_Cmd( cCmd, "OK", NULL, 500 );
|
||||
}
|
||||
|
||||
/*
|
||||
*<2A><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD> MQTT <20><><EFBFBD><EFBFBD>, <20><><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD>ζ<EFBFBD><CEB6>IJ<EFBFBD>ͬ topic
|
||||
*LinkID <20><><EFBFBD><EFBFBD>ID,Ŀǰֻ֧<D6BB><D6A7>0
|
||||
*Topic <20><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪTopic
|
||||
*Qosֵ<73><D6B5>һ<EFBFBD><D2BB>Ϊ0<CEAA><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ1
|
||||
*<2A><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD><EFBFBD><EFBFBD>true <20><>֮false
|
||||
*/
|
||||
bool ESP8266_MQTTSUB(char * Topic)
|
||||
{
|
||||
char cCmd [120];
|
||||
sprintf ( cCmd, "AT+MQTTSUB=0,\"%s\",1",Topic );
|
||||
return ESP8266_Send_AT_Cmd( cCmd, "OK", NULL, 500 );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*<2A><>LinkID<49><44>ͨ<EFBFBD><CDA8> topic <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> data, <20><><EFBFBD><EFBFBD> data Ϊ<>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
*LinkID <20><><EFBFBD><EFBFBD>ID,Ŀǰֻ֧<D6BB><D6A7>0
|
||||
*Topic <20><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪTopic
|
||||
*data<74><61><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
*<2A><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD><EFBFBD><EFBFBD>true <20><>֮false
|
||||
*/
|
||||
bool ESP8266_MQTTPUB( char * Topic,char *temp)
|
||||
{
|
||||
char cCmd [512];
|
||||
sprintf (cCmd, "AT+MQTTPUB=0,\"%s\",\"%s\",0,0", Topic ,temp);
|
||||
return ESP8266_Send_AT_Cmd( cCmd, "OK", NULL, 1000 );
|
||||
}
|
||||
|
||||
/*
|
||||
*<2A>ر<EFBFBD> MQTT Client Ϊ LinkID <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD>ͷ<EFBFBD><CDB7>ڲ<EFBFBD>ռ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD>Դ
|
||||
*LinkID <20><><EFBFBD><EFBFBD>ID,Ŀǰֻ֧<D6BB><D6A7>0
|
||||
*Topic <20><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪTopic
|
||||
*data<74><61><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
*<2A><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD><EFBFBD><EFBFBD>true <20><>֮false
|
||||
*/
|
||||
bool ESP8266_MQTTCLEAN(void)
|
||||
{
|
||||
char cCmd [120];
|
||||
sprintf ( cCmd, "AT+MQTTCLEAN=0");
|
||||
return ESP8266_Send_AT_Cmd( cCmd, "OK", NULL, 500 );
|
||||
}
|
||||
|
||||
//ESP8266<36><36><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
//enumEnUnvarnishTx<54>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><CDB8>ģʽ
|
||||
//pStr<74>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
//ulStrLength<74>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//ucId <20><><EFBFBD>Ӻ<EFBFBD>
|
||||
//<2F><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD><EFBFBD><EFBFBD>true<75><65> <20><>֮false
|
||||
bool MQTT_SendString(char * pTopic,char *temp2)
|
||||
{
|
||||
|
||||
bool bRet = false;
|
||||
ESP8266_MQTTPUB(pTopic,temp2);
|
||||
delay_ms(1000);
|
||||
bRet = true;
|
||||
return bRet;
|
||||
}
|
||||
|
||||
98
firmware/stm32/smart_dormitory/User/xiaoyi_wifi/esp8266.h
Normal file
98
firmware/stm32/smart_dormitory/User/xiaoyi_wifi/esp8266.h
Normal file
@@ -0,0 +1,98 @@
|
||||
#ifndef __ESP8266_H
|
||||
#define __ESP8266_H
|
||||
|
||||
#include "main.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#if defined ( __CC_ARM )
|
||||
#pragma anon_unions
|
||||
#endif
|
||||
|
||||
//ESP8266ģʽѡ<CABD><D1A1>
|
||||
typedef enum
|
||||
{
|
||||
STA,
|
||||
AP,
|
||||
STA_AP
|
||||
}ENUM_Net_ModeTypeDef;
|
||||
|
||||
//<2F><><EFBFBD>紫<EFBFBD><E7B4AB><EFBFBD><EFBFBD>Э<EFBFBD>飬ö<E9A3AC><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
typedef enum{
|
||||
enumTCP,
|
||||
enumUDP,
|
||||
} ENUM_NetPro_TypeDef;
|
||||
//<2F><><EFBFBD>Ӻţ<D3BA>ָ<EFBFBD><D6B8>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>Ӻſ<D3BA><C5BF>Է<EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬһ<CDAC>˿ڶ<CBBF><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
typedef enum{
|
||||
Multiple_ID_0 = 0,
|
||||
Multiple_ID_1 = 1,
|
||||
Multiple_ID_2 = 2,
|
||||
Multiple_ID_3 = 3,
|
||||
Multiple_ID_4 = 4,
|
||||
Single_ID_0 = 5,
|
||||
} ENUM_ID_NO_TypeDef;
|
||||
|
||||
#define ESP8266_RST_Pin GPIO_PIN_4 //<2F><>λ<EFBFBD>ܽ<EFBFBD>
|
||||
#define ESP8266_RST_Pin_Port GPIOA //<2F><>λ
|
||||
|
||||
#define ESP8266_CH_PD_Pin GPIO_PIN_5 //ʹ<>ܹܽ<DCB9>
|
||||
#define ESP8266_CH_PD_Pin_Port GPIOA //ʹ<>ܶ˿<DCB6>
|
||||
|
||||
|
||||
#define ESP8266_RST_Pin_SetH HAL_GPIO_WritePin(ESP8266_RST_Pin_Port, ESP8266_RST_Pin, GPIO_PIN_SET)
|
||||
#define ESP8266_RST_Pin_SetL HAL_GPIO_WritePin(ESP8266_RST_Pin_Port, ESP8266_RST_Pin, GPIO_PIN_RESET)
|
||||
|
||||
|
||||
#define ESP8266_CH_PD_Pin_SetH HAL_GPIO_WritePin(ESP8266_CH_PD_Pin_Port,ESP8266_CH_PD_Pin, GPIO_PIN_SET)
|
||||
#define ESP8266_CH_PD_Pin_SetL HAL_GPIO_WritePin(ESP8266_CH_PD_Pin_Port,ESP8266_CH_PD_Pin, GPIO_PIN_RESET)
|
||||
|
||||
|
||||
#define ESP8266_USART(fmt, ...) USART_printf (fmt, ##__VA_ARGS__)
|
||||
#define PC_USART(fmt, ...) printf(fmt, ##__VA_ARGS__) //<2F><><EFBFBD>Ǵ<EFBFBD><C7B4>ڴ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31>ִ<EFBFBD><D6B4>printf<74><66><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>ִ<EFBFBD><D6B4>fput<75><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD><EFBFBD><EFBFBD>printf<74><66>
|
||||
|
||||
|
||||
|
||||
#define RX_BUF_MAX_LEN 1024 //<2F><><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>
|
||||
extern struct STRUCT_USART_Fram //<2F><><EFBFBD><EFBFBD>֡<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
{
|
||||
char Data_RX_BUF[RX_BUF_MAX_LEN];
|
||||
union
|
||||
{
|
||||
__IO uint16_t InfAll;
|
||||
struct
|
||||
{
|
||||
__IO uint16_t FramLength :15; // 14:0
|
||||
__IO uint16_t FramFinishFlag :1; // 15
|
||||
}InfBit;
|
||||
};
|
||||
|
||||
}ESP8266_Fram_Record_Struct;
|
||||
|
||||
|
||||
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>TCP<43><50><EFBFBD>ܺ<EFBFBD><DCBA><EFBFBD>
|
||||
void ESP8266_Init(uint32_t bound);
|
||||
void ESP8266_AT_Test(void);
|
||||
bool ESP8266_Send_AT_Cmd(char *cmd,char *ack1,char *ack2,uint32_t time);
|
||||
void ESP8266_Rst(void);
|
||||
bool ESP8266_Net_Mode_Choose(ENUM_Net_ModeTypeDef enumMode);
|
||||
bool ESP8266_JoinAP( char * pSSID, char * pPassWord );
|
||||
bool ESP8266_Enable_MultipleId ( FunctionalState enumEnUnvarnishTx );
|
||||
bool ESP8266_Link_Server(ENUM_NetPro_TypeDef enumE, char * ip, char * ComNum, ENUM_ID_NO_TypeDef id);
|
||||
bool ESP8266_SendString(FunctionalState enumEnUnvarnishTx, char * pStr, uint32_t ulStrLength, ENUM_ID_NO_TypeDef ucId );
|
||||
bool ESP8266_UnvarnishSend ( void );
|
||||
void ESP8266_ExitUnvarnishSend ( void );
|
||||
uint8_t ESP8266_Get_LinkStatus ( void );
|
||||
void USART_printf( char * Data, ... );
|
||||
|
||||
//MQTT<54><54><EFBFBD>ܺ<EFBFBD><DCBA><EFBFBD>
|
||||
bool ESP8266_MQTTUSERCFG( char * pClient_Id, char * pUserName,char * PassWord);
|
||||
bool ESP8266_MQTTCONN( char * Ip, int Num);
|
||||
bool ESP8266_MQTTSUB(char * Topic);
|
||||
bool ESP8266_MQTTPUB( char * Topic,char *temp);
|
||||
bool ESP8266_MQTTCLEAN(void);
|
||||
bool MQTT_SendString(char * pTopic,char *temp2);
|
||||
|
||||
#endif
|
||||
|
||||
42
firmware/stm32/smart_dormitory/User/xiaoyi_wifi/mqtt.c
Normal file
42
firmware/stm32/smart_dormitory/User/xiaoyi_wifi/mqtt.c
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "mqtt.h"
|
||||
|
||||
void ESP8266_STA_MQTTClient_Init(void)
|
||||
{
|
||||
char str[] = "{\
|
||||
\"deviceNum\": \"E8DB84933089\",\
|
||||
\"relayStatus\": 0,\
|
||||
\"lightStatus\": 0,\
|
||||
\"isOnline\": 1,\
|
||||
\"rssi\": -54,\
|
||||
\"deviceTemperature\": 40,\
|
||||
\"airTemperature\": 0,\
|
||||
\"airHumidity\": 0,\
|
||||
\"triggerSource\": 0,\
|
||||
\"brightness\": 11,\
|
||||
\"lightInterval\": 432,\
|
||||
\"lightMode\": 0,\
|
||||
\"fadeTime\": 259,\
|
||||
\"red\": 255,\
|
||||
\"green\": 0,\
|
||||
\"blue\": 0,\
|
||||
\"remark\":{\"door_status\":1, \"light\":60}\
|
||||
}";
|
||||
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ESP8266<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\r\n");
|
||||
// ESP8266_AT_Test();//<2F>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ģʽ
|
||||
ESP8266_Net_Mode_Choose(STA);
|
||||
while(!ESP8266_JoinAP(User_ESP8266_SSID, User_ESP8266_PWD));
|
||||
ESP8266_MQTTUSERCFG(User_ESP8266_client_id,User_ESP8266_username,User_ESP8266_password);
|
||||
ESP8266_MQTTCONN( User_ESP8266_MQTTServer_IP, User_ESP8266_MQTTServer_PORT);
|
||||
ESP8266_MQTTSUB( User_ESP8266_MQTTServer_Topic_SUB);
|
||||
printf("\r\nMQTT<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
|
||||
// sprintf(str,"{}");//<2F><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>MQTT<54><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
MQTT_SendString (User_ESP8266_MQTTServer_Topic_PUB,str);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>MQTT<54><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// while(1)
|
||||
// {
|
||||
|
||||
// delay_ms(20);
|
||||
// }
|
||||
}
|
||||
|
||||
26
firmware/stm32/smart_dormitory/User/xiaoyi_wifi/mqtt.h
Normal file
26
firmware/stm32/smart_dormitory/User/xiaoyi_wifi/mqtt.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef __MQTT_H
|
||||
#define __MQTT_H
|
||||
|
||||
#include "main.h"
|
||||
#include "esp8266.h"
|
||||
|
||||
/*
|
||||
*<2A><><EFBFBD>²<EFBFBD><C2B2><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<DEB8><C4B2>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD>ù<EFBFBD>
|
||||
*/
|
||||
|
||||
|
||||
#define User_ESP8266_SSID "brown" //wifi<66><69>
|
||||
#define User_ESP8266_PWD "123456789a" //wifi<66><69><EFBFBD><EFBFBD>
|
||||
|
||||
#define User_ESP8266_client_id "50fccfefb50a48b98a93ce27bb04591f" //MQTTclientID <20><><EFBFBD>ڱ<EFBFBD>־client<6E><74><EFBFBD><EFBFBD> <20>256<35>ֽ<EFBFBD>
|
||||
#define User_ESP8266_username "admin" //<2F><><EFBFBD>ڵ<EFBFBD>¼ MQTT <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> username, <20> 64 <20>ֽ<EFBFBD>
|
||||
#define User_ESP8266_password "admin13" //<2F><><EFBFBD>ڵ<EFBFBD>¼ MQTT <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> password, <20> 64 <20>ֽ<EFBFBD>
|
||||
#define User_ESP8266_MQTTServer_IP "106.12.9.213" //MQTT<54><54><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD>IP
|
||||
#define User_ESP8266_MQTTServer_PORT 1883 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿ں<CBBF>
|
||||
#define User_ESP8266_MQTTServer_Topic_PUB "status" //<2F><><EFBFBD><EFBFBD>MQTT<54><54><EFBFBD><EFBFBD>
|
||||
#define User_ESP8266_MQTTServer_Topic_SUB "status/set/E8DB84933089" //<2F><><EFBFBD><EFBFBD>MQTT<54><54><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
void ESP8266_STA_MQTTClient_Init(void);
|
||||
|
||||
#endif
|
||||
42
firmware/stm32/smart_dormitory/User/xiaoyi_wifi/tcp.c
Normal file
42
firmware/stm32/smart_dormitory/User/xiaoyi_wifi/tcp.c
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "tcp.h"
|
||||
|
||||
volatile uint8_t TcpClosedFlag = 0;
|
||||
|
||||
void ESP8266_STA_TCPClient_Test(void)
|
||||
{
|
||||
uint8_t res;
|
||||
|
||||
char str[100]={0};
|
||||
ESP8266_AT_Test();
|
||||
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ESP8266\r\n");
|
||||
ESP8266_Net_Mode_Choose(STA);
|
||||
while(!ESP8266_JoinAP(User_ESP8266_SSID, User_ESP8266_PWD));
|
||||
ESP8266_Enable_MultipleId ( DISABLE );
|
||||
while(!ESP8266_Link_Server(enumTCP, User_ESP8266_TCPServer_IP, User_ESP8266_TCPServer_PORT, Single_ID_0));
|
||||
while(!ESP8266_UnvarnishSend());
|
||||
printf("\r\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
while ( 1 )
|
||||
{
|
||||
sprintf (str,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD><EFBFBD>ſɿƼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˾" );//<2F><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>TCP<43><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ESP8266_SendString ( ENABLE, str, 0, Single_ID_0 );
|
||||
delay_ms(1000);
|
||||
if(TcpClosedFlag) //<2F>ж<EFBFBD><D0B6>Ƿ<EFBFBD>ʧȥ<CAA7><C8A5><EFBFBD><EFBFBD>
|
||||
{
|
||||
ESP8266_ExitUnvarnishSend(); //<2F>˳<EFBFBD><EFBFBD><CDB8>ģʽ
|
||||
do
|
||||
{
|
||||
res = ESP8266_Get_LinkStatus(); //<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>״̬
|
||||
}
|
||||
while(!res);
|
||||
|
||||
if(res == 4) //ȷ<><C8B7>ʧȥ<CAA7><C8A5><EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD><EFBFBD>
|
||||
{
|
||||
|
||||
|
||||
while (!ESP8266_JoinAP(User_ESP8266_SSID, User_ESP8266_PWD ) );
|
||||
while (!ESP8266_Link_Server(enumTCP, User_ESP8266_TCPServer_IP, User_ESP8266_TCPServer_PORT, Single_ID_0 ) );
|
||||
}
|
||||
while(!ESP8266_UnvarnishSend());
|
||||
}
|
||||
}
|
||||
}
|
||||
22
firmware/stm32/smart_dormitory/User/xiaoyi_wifi/tcp.h
Normal file
22
firmware/stm32/smart_dormitory/User/xiaoyi_wifi/tcp.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef __TCP_H
|
||||
#define __TCP_H
|
||||
|
||||
#include "main.h"
|
||||
#include "esp8266.h"
|
||||
|
||||
/*
|
||||
*<2A><><EFBFBD>²<EFBFBD><C2B2><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<DEB8><C4B2>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD>ù<EFBFBD>
|
||||
*/
|
||||
|
||||
#define User_ESP8266_SSID "miot_default" //wifi<66><69>
|
||||
#define User_ESP8266_PWD "123456789x" //wifi<66><69><EFBFBD><EFBFBD>
|
||||
|
||||
#define User_ESP8266_TCPServer_IP "192.168.31.16" //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP
|
||||
#define User_ESP8266_TCPServer_PORT "8888" //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿ں<CBBF>
|
||||
|
||||
|
||||
extern volatile uint8_t TcpClosedFlag; //<2F><><EFBFBD><EFBFBD>״̬<D7B4><CCAC>־
|
||||
|
||||
void ESP8266_STA_TCPClient_Test(void);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user