This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CC3100SDK:CC3100 SDK-Ver-1.3.1电子邮件不再工作

Guru**** 657930 points
Other Parts Discussed in Thread: CC3200, CC3100, MSP430FR6989, CC3220SF, CC3100BOOST, UNIFLASH, CC31XXEMUBOOST, CC3100MOD, MSP430F5529
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/wi-fi-group/wifi/f/wi-fi-forum/1208388/cc3100sdk-cc3100-sdk-ver-1-3-1-email-no-longer-works

器件型号:CC3100SDK
主题中讨论的其他器件:CC3100、CC3200、 MSP430FR6989CC3220SFCC3100BOOST、UNIFLASHCC31XXEMUBOOSTCC3100MODMSP430F5529

您好、专家!  

我们的客户有一个问题、如下所示:

TI CC3100 SDK-Ver-1.3.1电子邮件不再工作
A.解决办法请求
我们正在寻找有关 CC3100电子邮件示例的 TI 修复。 当前发布的 CC3100电子邮件示例不再起作用。 因此请提供解决方案、或提供更新警告、指出 CC3100不再支持电子邮件。
b. CC3100电子邮件代码使用 Gmail 合作超过3年
3年多来、我们已在使用 WiFi 的 F5529和 FR6989 LaunchPad 微控制器上安装了使用 SDK-1.3.1对多个 TI CC3100进行了升级、以"从 SNTP 计时器服务器获取计时器"、 以及使用 SMTP 从 Gmail 发送"状态电子邮件"并将电子邮件发送到多种不同的目标电子邮件服务。
2021年、Gmail 要求升级像带有 CC3100 WiFi 卡的 TI 微控制器这样的 AP、以使用 Gmail 生成的 AP 密码。 创建 Gmail AP 密码可以使 TI 器件成功发送电子邮件。
c. TI CC3100电子邮件长时间不适用于 Gmail、Outlook.com target="_blank">Outlook.com 电子邮件或 SOHO 电子邮件
2022年的 Gmail 发布的结果是、他们未来很快就不支持 AP 密码、设备更不安全。 2023年1月27日星期五、多个采用 CC3100的 TI 微控制器在不同状态下均停止发送电子邮件状态。 这些微控制器无法进行远程软件更新、因此不会对多个微控制器进行代码更改。 此外、在多个城市/州中的多个微型系统在完全相同的日期和时间发生代码腐败的可能性接近零。 很显然、某些 Gmail 代码和安全的更改现在阻止了 TI 的 Micro。
我们尝试了 Outlook.com 电子邮件、SOHO 电子邮件、AOL 电子邮件和 Proton 电子邮件。 这些电子邮件服务均不能与 TI CC3100和 SDK-1.3.1配合使用。 所有这些电子邮件服务都通过代码逐步完成并以"器件无法发送电子邮件"结尾。
D.代码序列跟踪
这表明器件可以首先连接到 SNPT 时间服务器并成功获取时间。 这证明 CC3100硬件、大部分代码、WiFi 访问等都仍在运行。 发送电子邮件跟踪显示无法发送电子邮件。


获取 Time 应用-版本1.3.0
**
行1774设备配置为默认状态
线路1791设备作为药柜启动
获取与 AP 和 IP 建立的线路1803连接
Get HostIP 后的行1808 LH
线路1818 LH 就在 createConnection 之后
getSNTPTTime 前的行1825 LH ...
socket.c 中的第336行
socket.c、_sl_BuildAddress 中的第95行
socket.c、_sl_BuildAddress 中的第95行
getSNTPTTime 之后的行1829 LH ...
RetVal = sl_WlanDisconnect ()之后_i32 disconnectFromAP ()中的第1488行;
在 if (0 == RetVal)后面的_i32 disconnectFromAP ()中的第1490行
应应用的请求、从 AP 断开1022线路器件


电子邮件应用程序-版本1.3.0
**
第881行器件配置为默认状态
线路898设备已作为药柜启动
第171行电子邮件用户名
第180行电子邮件密码
第159行电子邮件端口、安全性
采集使用 AP 和 IP 建立的线路915连接
线路918正在发送电子邮件...
第189行电子邮件目标
第1253行、位于...destination_email 后面
第198行电子邮件主题
第1265行... LHemailSubject 之后
第208行:电子邮件正文
行1278在...LHemailBody 之后
如果 TLS 创建安全套接字、则_smtpConnect 中的第301行
smtpConnect 套接字中的第306行
连接到套接字之前、_smtpConnect 中的333行
socket.c、_sl_Connect 中的第513行
socket.c、_sl_BuildAddress 中的第95行
socket.c 中的第554行_sl_Connect Verify_RET_OK
连接到套接字后、_smtpConnect 中的行335
如果 Status < 0 && SL_ESECSNOVERIFY!= Status、则_smtpConnect 中的第339行
行1281在...Status = sl_NetAppEmailConnect ()之后
第922行设备无法发送电子邮件
RetVal = sl_WlanDisconnect ()之后_i32 disconnectFromAP ()中的第1488行;
在 if (0 == RetVal)后面的_i32 disconnectFromAP ()中的第1490行
应应用程序的请求、断开线路1011器件与 AP 的连接

这是发送电子邮件尝试的子集更长版本、更详细地显示所有 SPI 读取和写入 CC3100器件的信息。 就在"Line 922 Device Could not send the email"(线路922设备无法发送电子邮件)前后
socket.c 中的第554行_sl_Connect Verify_RET_OK
SPI.c SPI_Write (...)中的第211行
SPI.c 中的第239行 SPI_READ (...)
SPI.c 中的第239行 SPI_READ (...)
SPI.c 中的第239行 SPI_READ (...)
连接到套接字后、_smtpConnect 中的行335
如果 Status < 0 && SL_ESECSNOVERIFY!= Status、则_smtpConnect 中的第339行
行1281在...Status = sl_NetAppEmailConnect ()之后
第922行设备无法发送电子邮件
SPI.c SPI_Write (...)中的第211行
SPI.c SPI_Write (...)中的第211行
SPI.c SPI_Write (...)中的第211行
SPI.c 中的第239行 SPI_READ (...)
SPI.c 中的第239行 SPI_READ (...)
SPI.c 中的第239行 SPI_READ (...)
RetVal = sl_WlanDisconnect ()之后_i32 disconnectFromAP ()中的第1488行;
在 if (0 == RetVal)后面的_i32 disconnectFromAP ()中的第1490行
SPI.c SPI_Write (...)中的第211行
SPI.c 中的第239行 SPI_READ (...)
SPI.c 中的第239行 SPI_READ (...)
SPI.c 中的第239行 SPI_READ (...)
应应用程序的请求、断开线路1011器件与 AP 的连接

e.选择代码提取以显示主代码路径
E.1 _SetEmail
我怀疑 CC3100 SDK-1.3.0不再工作的原因与电子邮件服务安全更改有关。 我从2014年到2023年成功使用了 TLS……μ s.so、已经使用了9年了。 我试过端口465与 SSL 也一样,但这也不起作用。
eMailServerSetting.Family = AF_INET;
// eMailServerSetting.Port = Gmail_host_port;// config.h 中的第27行#define Gmail_host_port 465
// eMailServerSetting.Port = Outlook_HOST_PORT;//行 i41n config.h #define Outlook_port 587
eMailServerSetting.Port = Zoho _HOST_PORT;//Line i41n config.h #define Outlook_port 587
// eMailServerSetting.Port = verizon_host_port;// 2-14-2023更改为 verizon,因此可以尝试 LBH2015NVR
eMailServerSetting.IP = SL_IPV4_VAL (74、125、129、108);
eMailServerSeting.SecurityMethod = SL_SO_SEC_METHO_TLSv1_2;//最初版本2014年1月至2023年1月
eMailServerSetting.SecurityCypher = SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA;// Original 2014年1月至2023日

//2-23-2023 Thomas Schmitt link 称 Gmail 端口465使用 SSL
// CC3100 SDK1.3.0显示了大约25个传输安全选项,其中两个采用 SSL
// SSLv3 SSL_RSA_WITH_RC4_128_SHA
// SSLv3 SSL_RSA_WITH_RC4_128_MD5
// eMailServerSetting.SecurityMethod = SL_SO_SEC_METHOD_SSLv3;
// eMailServerSetting.SecurityCypher = SL_SEC_MASK_SSL_RSA_WITH_RC4_128_SHA;
// eMailServerSetting.SecurityCypher = SL_SEC_MASK_SSL_RSA_WITH_RC4_128_MD5;

E.2 Config.h
请参阅下面的设置:Gmail、Yahoo、Outlook、Zoho Per There 网站
#define SMTP_BUF_LEN 100
//#define Gmail_host_name"smtp.gmail.com
//#define Gmail_host_port 465 // emailAndGetTime.c eMailServerSetting.Port = Gmail_host_port;
//#define Gmail_host_port 465 // emailAndGetTime.c 的2-23-2023链接 Thomas 465可以与 SSL 一起使用
//#define Gmail_host_port 587 //10-5-2022 Google 文章说端口465不再被接受为标准端口 NO2 587、2525和25
// 2-18-2023尝试587、2525和25
//另一篇文章说对于纯文本,使用端口465表示 SSL,使用端口587表示 TLS
// emailAndGetTime.c 中的第1215行定义了安全方法..... 请参阅下面看起来像 TLS V1_2
// eMailServerSetting.SecurityMethod = SL_SO_SEC_METHOD_TLSv1_2;

//#define yahoo_host_name"smtp.mail.yahoo.com
//#define yahoo_host_port 25.

//#define Outlook_host_name"smtp-mail.outlook.com
//#define Outlook_HOST_PORT 587 //端口号:587 (带 TLS)
//#define outlook_host_port 25 //备选端口号:25 (无 TLS/SSL) 2-21-2023、但在 emailAndGetTime.c 中、我不知道如何指定无

#define Zoho _host_name"smtp.zoho.com
//#define Zoho HOST_PORT 465 //端口号:465 (含 SSL)
#define Zoho HOST_PORT 587 //端口号:587 (含 TLS)

/// 2 - 14-2023.
//#define AOL_HOST_NAME"smtp.aol.com
//#define verizone_host_name "smtp.verizon.net target="_blank">smtp.verizon.net
//#define Gmail_host_name "smtp.verizon.net //无法找到任何地方,因为它是指 Gmail_host_name ,所以我可以更改为 Verizon 所以假的它
//#define Verizon_host_port 465 //2-14-2023,发现 AOL 端口也是465

e.3行137–217 _i32 sl_NetAppEmailSet
_i32 sl_NetAppEmailSet (_u8命令、_u8 pValueLen、
_u8 *pValue)


SlNetAppEmailOpt_t* pEmailOpt = 0;
SlNetAppSourceEmail_t* pSourceEmail = NULL;
SlNetAppSourcePassword_t* pSourcePassword = NULL;
SlNetAppDestination_t* pDestinationEmail = NULL;
SlNetAppEmailSubject_t* pSubject = NULL;

switch (命令)

案例 NETAPP_ADVANCED_OPT:
pEmailOpt =(SlNetAppEmailOpt_t*) pValue;

G_EmailOpt.Port = pEmailOpt->Port;
G_EmailOpt.Family = pEmailOpt->Family;
G_EmailOpt.SecurityMethod = pEmailOpt->SecurityMethod;
G_EmailOpt.SecurityCypher = pEmailOpt->SecurityCypher;
G_EmailOpt.IP = pEmailOpt->IP;

G_EmailSetStatus++= 1;
CLI_Write ("第159行电子邮件端口、安全性\n\r\n);//2-16-2023已添加
// cli_Write ("\n 行159电子邮件端口:%d\n\"、端口);//提供错误
中断;
//查看 mytimers.c 中的恒温器控制器代码;在此处工作但不在此处
// printf ("\n 消息正文为:%d\n",usiGMTOffsetHrSet);//%d 是整数
// CLI_Write ("\n 消息正文是:%s\n",LHemailBody);
案例 NETAPP_SOURCE_EMAIL:
pSourceEmail =(SlNetAppSourceEmail_t*) pValue;
PAL_Memset (g_Email.Username、'\0'、MAX_USERNAME_LEN);
PAL_memcpy (g_Email.Username、pSourceEmail->Username、pValueLen);

G_EmailSetStatus+=2;
CLI_Write ("第171行电子邮件用户名\n\r\n ");//2-16-2023已添加
中断;

案例 NETAPP_PASSWORD:
pSourcePassword =(SlNetAppSourcePassword_t*) pValue;
PAL_Memset (g_SourcePass.Password、'\0'、MAX_PASSWORD_LEN);
PAL_memcpy (g_SourcePass.Password、pSourcePassword->Password、pValueLen);

G_EmailSetStatus+=4;
CLI_Write ("第180行电子邮件密码\n\r\n ");//2-16-2023已添加
中断;

案例 NETAPP_DEST_EMAIL:
pDestinationEmail=(SlNetAppDestination_t*)pValue;
PAL_Memset (g_destination.Email target="_blank"> Destination.Email、"\0"、MAX_DEST_EMAIL_LEN);
PAL_memcpy(g_Destination.Email, pDestinationEmail->Email, pValueLen);

G_EmailSetStatus+=8;
CLI_Write ("第189行电子邮件目标\n\r\n ");//2-16-2023已添加
中断;

案例 NETAPP_PROJECT:
pSubject=(SlNetAppEmailSubject_t*) pValue;
PAL_Memset (g_subject.value、"\0"、MAX_Subject_LEN);
PAL_memcpy (g_subject.value、pSubject->value、pValueLen);

G_EmailSetStatus+=16;
CLI_Write ("第198行电子邮件主题\n\n");//2-16-2023已添加
中断;

案例 NETAPP_MESSAGE:
if (pValueLen >(MAX_MESSAGE_LEN - 1))

assert_on_error (email_set_invalid_message);
}
PAL_Memset (消息、"\0"、MAX_MESSAGE_LEN);
PAL_memcpy (message,pValue,pValueLen);
CLI_Write ("第208行电子邮件正文\n\n");//2-16-2023已添加
中断;

默认值:
CLI_Write ((_u8*)"\n\rLine209错误:默认大小写\n\r\n);
assert_on_error (email_set_invalid_case);
}

返回成功;
}

e.4行271–351 _i32 _smtpConnect
静态_i32 _smtpConnect (void)

SlSockAddrIn_t LocalAddr;
SlTimeval_t tTimeout;
_i32密码= 0;
_i32 LocalAddrSize = 0;
i8方法= 0;
_i32状态= 0;

LocalAddr.sin_family = g_EmailOpt.Family;
LocalAddr.sin_port = sl_Htons (g_EmailOpt.Port);
LocalAddr.sin_addr.s_addr = sl_Htonl (g_EmailOpt.ip);
LocalAddrSize = sizeof (SlSockAddrIn_t);

/*如果需要 TLS */
if (g_EmailOpt.SecurityMethod <= 5)

/*创建安全套接字*/
smtpSocket = SL_Socket (SL_AF_INET、SL_SOCK_STREAM、SL_SEC_SOCKET);
assert_on_error (smtpSocket);

tTimeout.tv target="_blank">tTimeout.tv_sec = 10;
tTimeout.tv_usec = 90000;
状态= sl_SetSockOpt (smtpsocket、SOL_SOCKET、SL_SO_RCVTIMEO、
tTimeout、sizeof (SlTimeval_t)(&T);
ASSERT_ON_ERROR (状态);

方法= g_EmailOpt.SecurityMethod;
cipher = g_EmailOpt.SecurityCypher;

CLI_Write ("如果 TLS 创建安全套接字\n\r"、则_smtpConnect 中的第301行);

/*设置刚刚定义的套接字选项*/
状态= SL_SetSockOpt (smtpsocket、SL_SOL_SOCKET、SL_SO_SECMETHOD、
method、sizeof (method)(&方法);
CLI_Write ("_smtpConnect Set Socket 中的第306行\n\r");
if (状态<0)

sl_Close (smtpSocket);
ASSERT_ON_ERROR (状态);
CLI_Write ("_smtpConnect sl_Close smtpSocket 步骤1 \n\r\n"中的第311行);
}
状态= SL_SetSockOpt (smtpsocket、SL_SOL_SOCKET、SL_SO_SECURE_MASK、
cipher、sizeof (cipher)(密码(&C));
if (状态<0)

sl_Close (smtpSocket);
ASSERT_ON_ERROR (状态);
CLI_Write ("_smtpConnect sl_Close smtpSocket 步骤2\n\r\n 中的第319行);
}
}
/*如果不需要 TLS */
方案

/*创建套接字*/
smtpSocket = SL_Socket (SL_AF_INET、SL_SOCK_STREAM、SL_IPPROTO_TCP);
assert_on_error (smtpSocket);

CLI_Write ("在不需要 TLS 的情况下创建套接字\n\r"后、_smtpConnect 中的第329行);
}

/*连接至套接字*/
CLI_Write ("连接到套接字前,_smtpConnect 中的第333行\n\r\n);
状态= sl_Connect (smtpsocket、(SlSockAddr_t *)&LocalAddr、LocalAddrSize);
CLI_Write ("连接到套接字后_smtpConnect 中的第335行\n\r\n);//2-16-2023可以打印此内容

if (((Status < 0)&&(SL_ESECSNOVERIFY!= Status))

cli_Write ("_smtpConnect 中的第339行(如果 Status < 0 && SL_ESECSNOVERIFY!= Status \n\r\n);//2-16-2023打印此页
//
// 2023年1月30日,我得到了上面的 CLI 写入,但没有更多
//显示连接到套接字不成功
//下一个写我得到的是在914行
//

ASSERT_ON_ERROR (状态);
CLI_Write ("连接到套接字后_smtpConnect 状态中的第347行"\n");//2-16-2023不会执行此操作
}
CLI_Write ("在返回成功前,_smtpConnect 中的第349行\n\r\n");//2-16-2023不能执行此操作
返回成功;
}

E.5行839–951 int LHSendEmail()
int LHSendEmail()

usiEmailDummy = 0;
usiEmail1OrTime2 = 1;//在函数调用中,电子邮件设置为1,获取时间设置为2


i32 RetVal =-1;

RetVal = initializeAppVariables();
ASSERT_ON_ERROR (RetVal);

///*停止 WDT 并初始化 MCU 的系统时钟*/
// stopWDT();
// initClk();

/*配置命令行界面*/
CLI_Configure();

displaybanna();

/*
*以下函数通过清理将设备配置为默认状态
*存储在 NVMEM 中的持久性设置(即连接配置文件&
*策略、电源策略等)
*
*如果开发人员确定,应用程序可以选择跳过此步骤
*设备在应用程序启动时处于默认状态
*
*请注意、在上完成的所有配置文件和持续设置
*设备将丢失
*/
RetVal = configureSimpleLinkToDefaultState ();
if (RetVal < 0)

如果(DEVICE_NOT_IN_STATION_MODE == RetVal)
CLI_Write ("行874在其默认状态下配置设备失败\n\r\n);

// 5-24-2020 ,我看不到 loop_forever ()的值;因为这只是在这个时候把程序永久挂起
//我认为更好的继续,因为已经打印出的失败,也许一段时间后,它会起作用
// loop_forever ();
}

CLI_Write ("行881设备配置为默认状态\n\r\n);

/*
*初始化 CC3100器件
*假设设备已配置为工作站模式
*它处于默认状态
*/
RetVal = sl_Start (0、0、0);
如果((RetVal < 0)||
(ROLE_STA != RetVal))

CLI_Write ("第892行无法启动设备\n\r\n ");
// 5-24-2020 ,我看不到 loop_forever ()的值;因为这只是在这个时候把程序永久挂起
//我认为更好的继续,因为已经打印出的失败,也许一段时间后,它会起作用
// loop_forever ();
}

CLI_Write ("第898行设备作为工作站启动\n\r\n);

/*配置源电子邮件*/
RetVal = setEmail();
if (RetVal < 0)
loop_forever ();

/*正在连接到 WLAN AP */
RetVal =建立连接 WithAP();
if (RetVal < 0)

CLI_Write ("第909行无法与 AP 建立连接\n\r\n);
// 5-24-2020 ,我看不到 loop_forever ()的值;因为这只是在这个时候把程序永久挂起
//我认为更好的继续,因为已经打印出的失败,也许一段时间后,它会起作用
// loop_forever ();
}

CLI_Write ("通过 AP 和 IP 建立的线路915连接已获取\n\r\n);

/*配置并发送电子邮件*/
CLI_Write ("第918行正在发送电子邮件... \n\r\n);//2023年1月30日成功获得此内容
RetVal = SendEmail();
如果(RetVal < 0)

CLI_Write ("第922行设备无法发送电子邮件\n\n");
// 5-24-2020 ,我看不到 loop_forever ()的值;因为这只是在这个时候把程序永久挂起
//我认为更好的继续,因为已经打印出的失败,也许一段时间后,它会起作用
// loop_forever ();
// loop_forever ();// 2023年1月30日将其放回,因为 GET 设备无法发送电子邮件\n\r\n
//没有解决不发送电子邮件的问题,只是锁定在这一点
}
方案

CLI_Write ("第931行电子邮件已成功发送\n\r\n ");
}

/*断开与 AP 的连接*/
RetVal = disconnectFromAP ();
if (RetVal < 0)

CLI_Write ("行938无法从 AP 断开\n\r\n);
// 5-24-2020 ,我看不到 loop_forever ()的值;因为这只是在这个时候把程序永久挂起
//我认为更好的继续,因为已经打印出的失败,也许一段时间后,它会起作用
// loop_forever ();
}

RetVal = SL_Stop (SL_STOP_TIMEOUT);
// 5-24-2020 ,我看不到 loop_forever ()的值;因为这只是在这个时候把程序永久挂起
//我认为更好的继续,因为已经打印出的失败,也许一段时间后,它会起作用
// if (RetVal < 0)
// loop_forever ();

返回0;
}//结束括号用于 int LHSendEmail()

E.6行1194-1233 _i32 setEmail()

静态_i32 setEmail()

i32 RetVal =-1;
SlNetAppSourceEmail_t sourceEmailId ={0};
SlNetAppSourcePassword_t sourceEmailPwd ={0};
SlNetAppEmailOpt_t eMailServerSetting ={0};

PAL_memcpy (sourceEmailId.Username、user、PAL_strlen (user)+1);
RetVal = sl_NetAppEmailSet (NETAPP_SOURCE_EMAIL、PAL_strlen (USER)+1、
(_u8*)&sourceEmailId;
ASSERT_ON_ERROR (RetVal);

PAL_memcpy (sourceEmailPwd.Password、PASS、PAL_strlen (Pass)+1);
RetVal = sl_NetAppEmailSet (NETAPP_PASSWORD、PAL_strlen (PASS)+1、
(_u8*)&sourceEmailPwd);
ASSERT_ON_ERROR (RetVal);

eMailServerSetting.Family = AF_INET;
// eMailServerSetting.Port = Gmail_host_port;// config.h 中的第27行#define Gmail_host_port 465
// eMailServerSetting.Port = Outlook_HOST_PORT;//行 i41n config.h #define Outlook_port 587
eMailServerSetting.Port = Zoho _HOST_PORT;//Line i41n config.h #define Outlook_port 587
// eMailServerSetting.Port = verizon_host_port;// 2-14-2023更改为 verizon,因此可以尝试 LBH2015NVR
eMailServerSetting.IP = SL_IPV4_VAL (74、125、129、108);
eMailServerSeting.SecurityMethod = SL_SO_SEC_METHO_TLSv1_2;//最初版本2014年1月至2023年1月
eMailServerSetting.SecurityCypher = SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA;// Original 2014年1月至2023日

//2-23-2023 Thomas Schmitt link 称 Gmail 端口465使用 SSL
// CC3100 SDK1.3.0显示了大约25个传输安全选项,其中两个采用 SSL
// SSLv3 SSL_RSA_WITH_RC4_128_SHA
// SSLv3 SSL_RSA_WITH_RC4_128_MD5
// eMailServerSetting.SecurityMethod = SL_SO_SEC_METHOD_SSLv3;
// eMailServerSetting.SecurityCypher = SL_SEC_MASK_SSL_RSA_WITH_RC4_128_SHA;
// eMailServerSetting.SecurityCypher = SL_SEC_MASK_SSL_RSA_WITH_RC4_128_MD5;

RetVal = sl_NetAppEmailSet (NETAPP_ADVANCE_OPT、sizeof (SlNetAppEmailOpt_t)、
(_u8*)&eMailServerSetting;
ASSERT_ON_ERROR (RetVal);

返回成功;
}



E.7行1246–1290 _i32 SendEmail()
静态_i32 SendEmail()

_i32状态=-1;

状态= sl_NetAppEmailSet (NETAPP_DEST_EMAIL、
PAL_strlen (destination_email)、
(_u8 *) destination_email);
ASSERT_ON_ERROR (状态);
CLI_Write ("在...destination_email\n\r\n 之后的第1253行);//Jan 30、2023添加了此内容
// Status = sl_NetAppEmailSet (NetApp_Subject、
// PAL_strlen (email_subject),
//(_u8 *) email_subject);

//LH 添加了5-20-2020以使用我的字符数组作为电子邮件主题
状态= sl_NetAppEmailSet (NetApp_Subject、
PAL_strlen (LHemailSubject)、
(_u8 *) HemailSubject);


ASSERT_ON_ERROR (状态);
CLI_Write ("第1265行、在...LHemailSubject \n\r\n)之后;//Jan 30、2023添加了此内容、将打印此内容

// Status = sl_NetAppEmailSet (NETAPP_MESSAGE、
// PAL_strlen (email_message),
//(_u8 *) email_message);

//LH 添加了5-20-2020以使用我的字符数组作为电子邮件信息
状态= sl_NetAppEmailSet (NETAPP_MESSAGE、
PAL_strlen (LHemailBody)、
(_u8 *) LHemailBody);


ASSERT_ON_ERROR (状态);
CLI_Write ("...LHemailBody \n\r\n 之后的第1278行);//JAN 30、2023添加了此内容、即会打印此内容

状态= sl_NetAppEmailConnect ();//2-16-2022年似乎此函数未完成
CLI_Write ("第1281行在...Status = sl_NetAppEmailConnect ()\n\n");//2-16-2022、未打印此页
ASSERT_ON_ERROR (状态);
CLI_Write ("第1283行、在...sl_NetAppEmailConnect \n\r\n 之后);//JAN 30、2023添加了此内容、但未打印此内容

状态= sl_NetAppEmailSend ();
ASSERT_ON_ERROR (状态);
CLI_Write ("第1287行、在...sl_NetAppEmailSend \n\r\n 之后);//添加了2023年1月30日、未打印此内容
返回成功;
}

e.8行1480–1498 _i32 disconnectFromAP ()
静态_i32脱接 FromAP()

i32 RetVal =-1;

/*
*当"已断开连接"时,该函数返回0 ,如果已断开,则返回负数
*如果返回0、则等待"断开连接"事件、忽略其他返回代码
*/
RetVal = sl_WlanDisconnect ();
cli_Write (" RetVal = sl_WlanDisconnect ();\n\r\n)之后_i32 disconnectFromAP ()中的第1488行;
if (0 => RetVal)
cli_Write ("在_i32 disconnectFromAP()中的第1490行、位于 if (0 == RetVal)\n\r\n);

/*等待*/
while (is_connected (g_Status)){_SlNonOsMainLoopTask ();}
}

返回成功;
}


结束

Terma 术语跟踪逐行显示代码是如何步进各种函数调用的。 我有包括代码行、这样您就可以看到它执行了哪些行、直到它说无法发送电子邮件。

又来了
左侧
电子邮件应用程序-版本1.3.0
**
第881行器件配置为默认状态
线路898设备已作为药柜启动
第171行电子邮件用户名
第180行电子邮件密码
第159行电子邮件端口、安全性
采集使用 AP 和 IP 建立的线路915连接
线路918正在发送电子邮件...
第189行电子邮件目标
第1253行、位于...destination_email 后面
第198行电子邮件主题
第1265行... LHemailSubject 之后
第208行:电子邮件正文
行1278在...LHemailBody 之后
如果 TLS 创建安全套接字、则_smtpConnect 中的第301行
smtpConnect 套接字中的第306行
连接到套接字之前、_smtpConnect 中的333行
socket.c、_sl_Connect 中的第513行
socket.c、_sl_BuildAddress 中的第95行
socket.c 中的第554行_sl_Connect Verify_RET_OK
连接到套接字后、_smtpConnect 中的行335
如果 Status < 0 && SL_ESECSNOVERIFY!= Status、则_smtpConnect 中的第339行
行1281在...Status = sl_NetAppEmailConnect ()之后
第922行设备无法发送电子邮件
RetVal = sl_WlanDisconnect ()之后_i32 disconnectFromAP ()中的第1488行;
在 if (0 == RetVal)后面的_i32 disconnectFromAP ()中的第1490行
应应用程序的请求、断开线路1011器件与 AP 的连接
 
我相信它与安全设置有关
 
eMailServerSetting.Family = AF_INET;
// eMailServerSetting.Port = Gmail_host_port;// config.h 中的第27行#define Gmail_host_port 465
// eMailServerSetting.Port = Outlook_HOST_PORT;//行 i41n config.h #define Outlook_port 587
eMailServerSetting.Port = Zoho _HOST_PORT;//Line i41n config.h #define Outlook_port 587
// eMailServerSetting.Port = verizon_host_port;// 2-14-2023更改为 verizon,因此可以尝试 LBH2015NVR
eMailServerSetting.IP = SL_IPV4_VAL (74、125、129、108);
eMailServerSeting.SecurityMethod = SL_SO_SEC_METHO_TLSv1_2;//最初版本2014年1月至2023年1月
eMailServerSetting.SecurityCypher = SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA;// Original 2014年1月至2023日
 
1) 1)我需要进行几行代码更改。 或2) CC3100的当前有效示例、其中 FR6989使用 Gmail、 Outlook.com 或 SOHO 电子邮件服务发送电子邮件。 TI CC3100上当前发布的电子邮件示例不再起作用。
 
如果你需要更多的代码上载,我很乐意这样做,但我相信你有你需要的一切。 我甚至可以上传整个 Code Composser Studio 工作项目、除了电子邮件部分不再使用。
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

我敢肯定 TI 会告知他们有一个修复程序、因此 CC3100 SDK-1.3.0仍可以发送电子邮件。

我在聊天中提到过、但在随附的电子邮件中没有看到。

我们得到 SMTP 返回代码-111。

Google 表示

当连接远程 SMTP 服务器时出现问题时、会出现 SMTP 111错误。 例如、您可能会遇到该错误  无效的发件人域或防火墙问题。

如果您需要更多信息、请告诉我。 我想我已提交了您需要的所有代码部分。  我已经粘贴了使用 F5529和 FR6989 micros 运行了9年的完整 Code Composer Studio emailAndGetTime.c 和.h 以及 simplelink 文件、其中包括 SDK_1.3.0。

您应该能够加载并运行该文件。 主函数的调用是:

   RET = LHGetTime ();    //调用 emailAndGetTime.c 中的函数来获取时间

RET = LHSendEmail ();  //调用 emailAndGetTime.c 中的函数以发送电子邮件

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

我更新了要发布的问题描述文档。 我还计划将一个基于 FR6989并使用 CC3100 Boost 导出的 Code Composer Studio 工作应用程序发布。

我很高兴与大家分享这个工作代码、这样 TI 电子邮件/安全专家就可以很轻松地加载和运行这个程序并开发出解决方案。 emailAndGetTime.c 代码是99%不变的原始 TI SDK-1.3.0代码、具有增强的应用链接。 所以所有的 WiFi、smpt 等代码都是原始的 TI 代码、但显然现在缺少能够处理新的电子邮件服务器安全协议。

我也希望其它 TI 客户发现广泛的 LCD 显示代码和电子邮件消息创建框架/代码对他们的项目有帮助。

附件为发布和 CCS 导出应用准备好使用 CC3100升压子卡加载到 FR6989微控制器中。  

e2e.ti.com/.../CS1635787.zip

感谢您的帮助。

杰拉德

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Code Composser Studio 应用 ZIP 文件需要您的特定 WiFi、电子邮件地址和密码  

    sl-common:您的 WiFi 访问名称和 SSID

    config.h:发送电子邮件服务名称和密码以及目标电子邮件名称

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    大家好、Gerald、

    CC3100是一款非常旧的器件。 我们没有计划更新 CC3100 SDK 或此电子邮件示例。

    您可以使用源代码进行更新、也可以使用 其他电子邮件应用程序(将源代码轻松移植到 Simplelink BSD API 之上)。  

    这些示例以参考设计的形式给出。 当服务器更新时、我们无法维护它们。

    Br、

    Kobi.

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢 Kobi 的回复,

    1. 我们感到很失望的是、TI 不再支持 CC3100和 SDK-1.3.0 (我在帖子中的错误:我拼写错误是1.3.1而不是1.3.0)我们有许多应用程序、我敢肯定其他客户也支持,这些应用程序现在已被电子邮件状态关闭。
    2. 对于原型开发、配有 LCD 显示屏的 FR6989以及可发送状态数据的 CC3100等 WiFi 卡非常出色。 每小时–每天-每月来自远程物联网设备的电子邮件状态数据可帮助我们优化/优化产品算法。 我们搜索了 CC3100 Boost 是否有更新的替代产品、但没有找到这样的子卡。 请确定此类更新的 WiFi 子卡是否存在、并具有经证明仍可正常工作的发送电子邮件示例。
    3. 如果 TI 不再支持此电子邮件示例、请标记此项、以便其他开发人员不要浪费时间尝试使其正常工作。 此外、这是虚假的广告。
    4. 有一些其他客户使用 E2E 表单、有一个开发人员是电子邮件服务器安全性专家、并提供了更新修复程序。 这将为许多客户带来巨大的好处。
    5. 我们已经下载了 CC3200 SDK-1.5.0、并开始查看电子邮件示例代码、以了解我们是否可以看到任何增强功能或已经做出的增强功能、以移植回 CC3100。
    6. 是否已验证 CC3200 SDK-1.5.0电子邮件示例在2023年2月1日、Gmail、AOL、Outlook.com 后仍然有效 Soho 等电子邮件服务安全更新? 是否有任何电子邮件服务最近被证明仍然有效、所有客户都可以使用。
    7. iPhone、智能手机、PC 仍可以通过 Gmail、AOL、Outlook.com、SOHO 等电子邮件服务发送电子邮件。 他们有什么作用? 这是否无法合并到 TI WiFi 电子邮件中、或者代码大小和处理能力要求是否超出了微控制器的处理能力要求? TI 正在推动物联网发展、即使对于非常小的器件也是如此、因此我们认为有一个有效的"发送电子邮件示例"对 TI 来说将是非常有益的。 我们知道它将被限制为64字节与多兆字节,但对于物联网来说,只需要发送测量/可变状态的能力,而不是文本的行/段落或大型数据文件。

     

    PS 如果可能、我们始终优先专注于 TI 器件、因此我们希望 TI 取得成功。 很高兴与您合作制定解决方案。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    SMTP 协议是一个相当简单的,创建自己的实施是几天的工作. 我认为 CC3100 + MSP430FR6989仍然可以与大多数 SMTP 服务器配合使用、除非需要 TLS 1.3、STARTTLS 加密或 OAuth 2。 我知道 outlook.com 可能会提供 STARTTLS 支持。 要使用不带 OAuth 2.0的 Gmail、需要启用2FA 和应用密码。

    如果您想拥有 SMTP 的功能性实施、您可以自行完成。 这确实不是一项艰巨的任务。 如果您仔细阅读 SMTP 的 RFC、您就会发现、在这种情况下 TI 不应该是问题所在。

    我使用具有自己 SMTP 实现的 CC3220SF 器件、该器件适用于大多数 SMTP 服务器。 我无法向您提供我的 SMTP 代码、但如果您决定实施 SMTP 代码、我可以回答您的问题。

    1月

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    CC3200 SDK 中没有针对该应用程序的更新。

    主机驱动程序中有一些修复(如果您希望 从最新的 CC3200 SDK 1.5.0移植代码)、但这些修复与您的问题无关。

    正如 Jan 提到的、您可以从 SDK 中修复参考 SMTP 代码或在 CC3100套接字之上使用不同的 SMTP 实现。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢 Jan 和 Kobi 的回复。 我与其他几位开发人员交谈过、他们认为要支持当前电子邮件服务的增强安全性、可能需要比 FR6989所提供的更多内存和处理能力。 对 CC3200 SKD 1.5.0电子邮件示例的分析显示了电子邮件代码和安全代码、看起来与 CC3100 SDK-1.3.0相同。 我确信 CC3200电子邮件示例也不再起作用。

    如果您或此表单上的某个人能够发布适用于 Gmail 的安全代码的有效示例、将于2023年2月1日之后发布、那这将是非常棒的。 您无需发布整个 SMTP 电子邮件示例、即使是处理安全性的代码也是如此。

     

    我们要调查的另一个选项是 IFTTT ("如果是这样、那就")服务 https://ifttt.com/  

    我们正在研究如何使用此示例作为一个框架来创建带有 CC3100的 FR6989以发送电子邮件状态。

    Arduino 使用以太网盾通过 IFTTT 发送电子邮件(microcontrollerslab.com)

    可以向 https://maker.ifttt.com 发布 HTTP POST。该服务具有所有电子邮件证书/安全性、使其能够向定义的电子邮件地址发送电子邮件。

    maker.ifttt.com/.../XXXXXXXXXXXXXXXXXXXXX

    记得改变  将_替换为_您的_事件_名称  以及您设置的事件名称和  xxxxxxxxxxxxxxxxxxxxx  使用 Webhooks 私钥

    在本例中、我们使用以下 URL:   maker.ifttt.com/.../SEND email/with/key/gkb_HtIpE-FeOWMH20 ************* ?value1=31.2

    如果/当我们成功完成此操作时、我们很高兴在 E2E 表单上与其他用户共享该代码。 如果某些其他用户已经拥有此工作经验、如果您可以发布一个工作示例、我们将不胜感激。

    Lorne

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Lorne:

    我不确定 CC3100与 CC3x20相比支持的密码套件数量是否较少。 但如果不是、那么具有 MSP430FR6989的 CC3100与通过 smtp.gmail.com:465 (TLS)发送包含启用应用程序密码的电子邮件无关、这不是明显的原因。 您需要意识到 TLS 是在 CC3100内部完成的、而不是在 MSP430内部完成。

    我已重新测试我的实现、CC3220SF 未出现以下问题:

    • smtp.gmail.com :465 (TLS): 587 (STARTTLS)
    • smtp-mail.outlook.com :587 (STARTTLS)
    • smtp.mail.yahoo.com :465 (TLS): 587 (STARTTLS)
    • smtp.aol.com :465 (TLS): 587 (STARTTLS)
    • mail.gmx.com :465 (TLS): 587 (STARTTLS)
    • smtp.seznam.cz :465 (TLS): 587 (STARTTLS): 25 (AUTH 登录纯文本)
    • smtp.centrum.cz :465 (TLS):587 (STARTTLS ): 25 (AUTH login in plain text)

    如果 CC3100中的过时密码套件有问题、您将无法将 CC3100与 Gmail 配合使用。 但是、如果没有技术原因表明 、无论其他开发人员告诉您、CC3100 + MSP430FR6989都不应工作。 当然、您需要找出 SMTP 库不兼容的原因。 但这对您来说是可行的。 我不想花时间玩 CC3100……

    1月

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢 Jan 的此次更新。

    我们在465端口和587端口上试用了 SSL 和 TLS Gmail、Outlook 和 Yahoo 都失败。

    我们尚未更改 TI CC3100电子邮件示例安全方法或 Cypher Suit。

    安全方法: SL_SO_SEC_METHOD_SSLv3_TLSv1_2

    密码套件: SL_SEC_MASK_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256

       eMailServerSetting.IP = SL_IPV4_VAL (74、125、129、108);

       eMailServerSeting.SecurityMethod = SL_SO_SEC_METHO_TLSv1_2;//将原有的2014年1月更改成了2023年1月、该方法工作起来非常完美

       eMailServerSetting.SecurityCypher = SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA;//从2014年1月至2023年1月的最初版本可以完美地工作

    **** 然后,我们尝试了每一个 TLS Cypher 套装,所有这些都失败了。 ******

     

    这一步复制自:"" CC3100/CC3200 SimpleLink Wi-Fi Internet-on-a-Chip 用户指南"、  SWRU368x–2014年4月–2018年5月修订

    标题既有 CC3100、也有 CC3200系列

    9.2.2.1选择方法

    手动定义 SSL 方法。 SimpleLink WiFi 器件支持 SSLv3 TLSv 1.0/1.1/1.2。 SlSockSecureMethod method;method.secureMethod =选择以下定义之一:

    • SL_SO_SEC_METHOD_SSLv3
    • SL_SO_SEC_METHOD_TLSv1中所示
    • SL_SO_SEC_METHOD_TLSv1_1
    • SL_SO_SEC_METHOD_TLSv1_2
    • SL_SO_SEC_METHOD_SSLv3_TLSv1_2
    • SL_SO_SEC_METHOD_DLSV1 SL_SetSockOpt (sockID、SL_SOL_SOCKET、SL_SO_SECMETHOD、&METHOD、sizeof (SlSockSecureMethod));

     

    您输入了什么来使用 STARTTLS?  这不是被记录为"支持"的选项。

     

    9.2.2.2选择密码套件

    手动定义 SSL 连接和握手安全算法、也称为密码套件。 SlSockSecureMask Mask;mask.secureMask =在以下项之间选择逻辑或:

    • SL_SEC_MASK_SSL_RSA_WITH_RC4_128_SHA
    • SL_SEC_MASK_SSL_RSA_WITH_RC4_128_MD5
    • SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA
    • SL_SEC_MASK_TLS_DHE_RSA_WITH_AES_256_CBC_SHA
    • SL_SEC_MASK_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
    • SL_SEC_MASK_TLS_ECDHE_RSA_WITH_RC4_128_SHA
    • SL_SEC_MASK_TLS_RSA_WITH_AES_128_CBC_SHA256
    • SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA256
    • SL_SEC_MASK_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
    • SL_SEC_MASK_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256

    sl_SetSockOpt (sockID、sl_SOL_SOCKET、SL_SO_SECMETHOD、&mask、sizeof (SlSockSecureMask))

     

    如您所见、STARTTLS 并不是 CC3100或 CC3200支持的选项、可能受支持且并未覆盖。

    您输入了什么来使用 STARTTLS?  这不是被记录为"支持"的选项。

    问题和帮助

    1. 您正在使用什么安全方法?
    2. 您正在使用什么 Cypher 西装?
    3. 请仅发布代码来处理 STARTTLS?

       我们知道、像您一样非常聪明的 SMTP 和安全专家、他们可能已经在 SMTP 和安全代码方面工作多年、这非常简单。 对于一般的电气工程师和软件开发人员来说、尽管我们拥有数十年的经验、并编写了数万行应用 C 代码、因为这不是我们的主要专业知识领域、有助于获得非常宝贵的线索和示例代码。 如果有了 SDK、我有信心就能弄清楚如何将其与现有的 TI CC31000 SDK-1.3.0 WiFi 套件集成。 我确信我们已完成了所需工作的95%、这样便可再次使用 TI 发送电子邮件示例。

    附件中包含了完整的 TI CC3100 WiFi 代码、其中仅集成了我们的应用功能调用。 **这是所有 TI 代码中的95%,而不是我们的代码***。

    展望您的 STARTTLS 代码子集。

    谢谢。

    Lorne 和团队

    emailAndGetTime.c  99% TI WiFi 代码、带应用函数调用

    /*LH created file to merge both Send Email and Get Time
     * Identical file for F5529, FR5969, and FR6989
     * Major changes to make it work with function calls from main
     * Commented out almost all Loop Forever which just hangs my whole application
     *
     * email.c - function implementation to send email
     *
     * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
     *
     *
     * All rights reserved. Property of Texas Instruments Incorporated.
     * Restricted rights to use, duplicate or disclose this code are
     * granted through contract.
     *
     * The program may not be used without the written permission of
     * Texas Instruments Incorporated or against the terms and conditions
     * stipulated in the agreement under which this program has been supplied,
     * and under no circumstances can it be used with non-TI connectivity device.
     *
     */
    
    /*
     * Protocol Name     -  Simple Mail Transfer Protocol
     * Protocol Overview -  The objective of the Simple Mail Transfer Protocol (SMTP) is to
     *                      transfer mail reliably and efficiently.SMTP is independent of the
     *                      particular transmission subsystem and requires only a reliable
     *                      ordered data stream channel.
     *                      Refer: www.ietf.org/.../rfc2821.txt
     */
    volatile unsigned short usiEmail1OrTime2 = 0; //In the function call set to 1 for email, set to 2 for get-time
    //Same function call can be used but inside the function the specific statements are for email or get time
    //I do not want to create a similar function with a different name as I do not know where else in simplelink it may be calling these functions
    
    #include <emailAndGetTime.h>
    #include "base64.h"
    #include "config.h"
    #include "sl_common.h"
    
    #include "myGPIO.h" //8-23-2020 LH added
    
    /*NetApp Email protocol types */
    #define SL_NET_APP_SMTP_PROTOCOL        (1)
    #define INVALID_SOCKET_DESC             0xFFFFFFFF
    
    /* Strings used to configure the Email msg in proper format */
    const _u8 smtp_helo[] = {'H','E','L','O','\0'};
    const _u8 smtp_mail_from[]={'M','A','I','L',' ','F','R','O','M',':',' ','\0'};
    const _u8 smtp_rcpt[] = {'R','C','P','T',' ','T','O',':',' ','\0'};
    const _u8 smtp_data[] = "DATA";
    const _u8 smtp_crlf[] = "\r\n";
    const _u8 smtp_dcrlf[] = "\r\n\r\n";
    const _u8 smtp_subject[] = "Subject: ";
    const _u8 smtp_to[] = "To: ";
    const _u8 smtp_from[] = "From: ";
    /* <CRLF>.<CRLF> Terminates the data portion */
    const _u8 smtp_data_end[] = {'\r','\n','.','\r','\n','\0'};
    const _u8 smtp_quit[] = {'Q','U','I','T','\r','\n','\0'};
    
    /* Return Codes */
    const _u8 smtp_code_ready[] = {'2','2','0','\0'};
    const _u8 smtp_ok_reply[] = {'2','5','0','\0'};
    const _u8 smtp_intermed_reply[] = {'3','5','4','\0'};
    const _u8 smtp_auth_reply[] = {'3','3','4','\0'};
    const _u8 smtp_auth_success[] = {'2','3','5','\0'};
    
    /* states for smtp state machine */
    typedef enum
    {
        smtpINACTIVE = 0,
        smtpINIT,
        smtpHELO,
        smtpAUTH,
        smtpFROM,
        smtpRCPT,
        smtpDATA,
        smtpMESSAGE,
        smtpQUIT,
        smtpERROR
    }_SlsmtpStatus_e;
    
    /* Initialize SMTP State Machine */
    _u16 g_smtpStatus = smtpINIT;
    
    _u16 g_EmailSetStatus = 0;
    
    /* error handling flags for smtp state machine */
    typedef enum
    {
        smtpNOERROR = 0,
        atINIT,
        atHELO,
        atAUTH,
        atFROM,
        atRCPT,
        atDATA,
        atMESSAGE,
        atQUIT
    }_SlsmtpERROR_e;
    
    /* Initialize Error handling flag */
    _u16 g_smtpErrorInfo = smtpNOERROR;
    _i32 smtpSocket;
    _u8 g_cmdBuf[SMTP_BUF_LEN];
    _u8 buf[SMTP_BUF_LEN];
    _u8 basekey1[BASEKEY_LEN];
    _u8 basekey2[BASEKEY_LEN];
    _u8 message[MAX_MESSAGE_LEN];
    
    SlNetAppEmailOpt_t g_EmailOpt;
    SlNetAppSourceEmail_t g_Email;
    SlNetAppSourcePassword_t g_SourcePass;
    SlNetAppDestination_t g_Destination;
    SlNetAppEmailSubject_t g_Subject;
    
    _u8 email_rfc[MAX_EMAIL_RCF_LEN];
    
    static _i32 _smtpConnect(void);
    static _i32 _smtpSend(void);
    static void _smtpHandleERROR(_u8 * servermessage);
    static _i32 _sendSMTPCommand(_i32 socket, _u8 * cmd, _u8 * cmdparam, _u8 * respBuf);
    static void _generateBase64Key(_u8 * basekey1, _u8 * basekey2);
    
    
    /*!
        \brief This function sets the email parameters
    
        \param[in]      command -   Command send for processing
        \param[in]      pValueLen - Length of data to be processed
        \param[in]      pValue -     Data to be processed
    
        \return         0 for success, -1 otherwise
    
        \note
    
        \warning
    */
    _i32 sl_NetAppEmailSet(_u8 command ,_u8 pValueLen,
                          _u8 *pValue)
    {
    
        SlNetAppEmailOpt_t* pEmailOpt = 0;
        SlNetAppSourceEmail_t* pSourceEmail = NULL;
        SlNetAppSourcePassword_t* pSourcePassword = NULL;
        SlNetAppDestination_t* pDestinationEmail = NULL;
        SlNetAppEmailSubject_t* pSubject = NULL;
    
        switch (command)
        {
          case NETAPP_ADVANCED_OPT:
            pEmailOpt = (SlNetAppEmailOpt_t*)pValue;
    
            g_EmailOpt.Port = pEmailOpt->Port;
            g_EmailOpt.Family = pEmailOpt->Family;
            g_EmailOpt.SecurityMethod = pEmailOpt->SecurityMethod;
            g_EmailOpt.SecurityCypher = pEmailOpt->SecurityCypher;
            g_EmailOpt.Ip = pEmailOpt->Ip;
    
            g_EmailSetStatus+=1;
            CLI_Write(" Line 159 email port, security \n\r"); //2-16-2023 added
    //        CLI_Write(" \n Line 159 email port: %d\n\", Port); //Gives errors
            break;
    // See Thermostat Controller code in mytimers.c; works there but not here
    //    printf("\nMessage Body is: %d\n", usiGMTOffsetHrSet); //%d is an integer
    //    CLI_Write("\nMessage Body is: %s\n", LHemailBody);
          case NETAPP_SOURCE_EMAIL:
            pSourceEmail = (SlNetAppSourceEmail_t*)pValue;
            pal_Memset(g_Email.Username, '\0', MAX_USERNAME_LEN);
            pal_Memcpy(g_Email.Username, pSourceEmail->Username, pValueLen);
    
            g_EmailSetStatus+=2;
            CLI_Write(" Line 171 email Username \n\r"); //2-16-2023 added
            break;
    
          case NETAPP_PASSWORD:
            pSourcePassword = (SlNetAppSourcePassword_t*)pValue;
            pal_Memset(g_SourcePass.Password, '\0', MAX_PASSWORD_LEN);
            pal_Memcpy(g_SourcePass.Password, pSourcePassword->Password, pValueLen);
    
            g_EmailSetStatus+=4;
            CLI_Write(" Line 180 email Password \n\r"); //2-16-2023 added
            break;
    
          case NETAPP_DEST_EMAIL:
            pDestinationEmail=(SlNetAppDestination_t*)pValue;
            pal_Memset(g_Destination.Email, '\0', MAX_DEST_EMAIL_LEN);
            pal_Memcpy(g_Destination.Email, pDestinationEmail->Email, pValueLen);
    
            g_EmailSetStatus+=8;
            CLI_Write(" Line 189 email Destination \n\r"); //2-16-2023 added
            break;
    
          case NETAPP_SUBJECT:
            pSubject=(SlNetAppEmailSubject_t*)pValue;
            pal_Memset(g_Subject.Value, '\0', MAX_SUBJECT_LEN);
            pal_Memcpy(g_Subject.Value, pSubject->Value, pValueLen);
    
            g_EmailSetStatus+=16;
            CLI_Write(" Line 198 email Subject \n\r"); //2-16-2023 added
            break;
    
          case NETAPP_MESSAGE:
            if(pValueLen > (MAX_MESSAGE_LEN - 1))
            {
                ASSERT_ON_ERROR(EMAIL_SET_INVALID_MESSAGE);
            }
            pal_Memset(message, '\0', MAX_MESSAGE_LEN);
            pal_Memcpy(message ,pValue, pValueLen);
            CLI_Write(" Line 208 email Message Body \n\r"); //2-16-2023 added
            break;
    
          default:
            CLI_Write((_u8*)"\n\rLine209 Error:Default case\n\r");
            ASSERT_ON_ERROR(EMAIL_SET_INVALID_CASE);
        }
    
        return SUCCESS;
    }
    
    /*!
        \brief Create a secure socket and connects to SMTP server
    
        \param[in]      none
        \return         0 if success and negative in case of error
        \note
        \warning
    */
    _i32 sl_NetAppEmailConnect()
    {
        if (!(g_EmailSetStatus >= 0x07))
        {
            CLI_Write((_u8*)"\n\rLine231 Error:Email and Subject is not configured\n\r");
            ASSERT_ON_ERROR(EMAIL_CONNECT_INVALID_CONFIURATION);
        }
    
        return _smtpConnect();
    }
    
    /*!
        \brief Check the connection status and sends the Email
    
        \param[in]      none
    
        \return         0 if success otherwise -1
    
        \note
    
        \warning
    */
    _i32 sl_NetAppEmailSend()
    {
        _i32 retVal = -1;
        retVal = _smtpSend();
        if(retVal < 0)
            sl_Close(smtpSocket);
    
        return retVal;
    }
    
    
    /*!
        \brief Creates a secure socket and connects to SMTP server
    
        \param[in]      none
    
        \return         0 if success and negative in case of error
    
        \note
    
        \warning
    */
    static _i32 _smtpConnect(void)
    {
        SlSockAddrIn_t  LocalAddr;
        SlTimeval_t     tTimeout;
        _i32           cipher = 0;
        _i32           LocalAddrSize = 0;
        _i8            method = 0;
        _i32            Status = 0;
    
        LocalAddr.sin_family = g_EmailOpt.Family;
        LocalAddr.sin_port = sl_Htons(g_EmailOpt.Port);
        LocalAddr.sin_addr.s_addr = sl_Htonl(g_EmailOpt.Ip);
        LocalAddrSize = sizeof(SlSockAddrIn_t);
    
        /* If TLS is required */
        if(g_EmailOpt.SecurityMethod <= 5)
        {
            /* Create secure socket */
            smtpSocket = sl_Socket(SL_AF_INET, SL_SOCK_STREAM, SL_SEC_SOCKET);
            ASSERT_ON_ERROR(smtpSocket);
    
            tTimeout.tv_sec = 10;
            tTimeout.tv_usec = 90000;
            Status = sl_SetSockOpt(smtpSocket, SOL_SOCKET, SL_SO_RCVTIMEO,
                                   &tTimeout, sizeof(SlTimeval_t));
            ASSERT_ON_ERROR(Status);
    
            method = g_EmailOpt.SecurityMethod;
            cipher = g_EmailOpt.SecurityCypher;
    
            CLI_Write(" Line 301 In _smtpConnect after if TLS create secure socket \n\r");
    
            /* Set Socket Options that were just defined */
            Status = sl_SetSockOpt(smtpSocket, SL_SOL_SOCKET, SL_SO_SECMETHOD,
                                   &method, sizeof(method));
            CLI_Write(" Line 306 In _smtpConnect Set Socket \n\r");
            if( Status < 0 )
            {
                sl_Close(smtpSocket);
                ASSERT_ON_ERROR(Status);
                CLI_Write(" Line 311 In _smtpConnect sl_Close smtpSocket step 1 \n\r");
            }
            Status = sl_SetSockOpt(smtpSocket, SL_SOL_SOCKET, SL_SO_SECURE_MASK,
                                   &cipher, sizeof(cipher));
            if( Status < 0 )
            {
                sl_Close(smtpSocket);
                ASSERT_ON_ERROR(Status);
                CLI_Write(" Line 319 In _smtpConnect sl_Close smtpSocket step 2 \n\r");
            }
        }
        /* If no TLS required */
        else
        {
            /* Create socket */
            smtpSocket = sl_Socket(SL_AF_INET, SL_SOCK_STREAM, SL_IPPROTO_TCP);
            ASSERT_ON_ERROR(smtpSocket);
    
            CLI_Write(" Line 329 In _smtpConnect after if NO TLS required create socket \n\r");
        }
    
        /* connect to socket */
        CLI_Write(" Line 333 In _smtpConnect before connect to Socket \n\r");
        Status = sl_Connect(smtpSocket, (SlSockAddr_t *)&LocalAddr, LocalAddrSize);
        CLI_Write(" Line 335 In _smtpConnect after connect to Socket \n\r"); //2-16-2023 this prints
    
        if((Status < 0) && (SL_ESECSNOVERIFY != Status))
        {
            CLI_Write(" Line 339 In _smtpConnect if Status < 0 && SL_ESECSNOVERIFY != Status \n\r");  //2-16-2023 this prints
    // **************************************************************
    // Jan 30, 2023 I do get the above CLI write, but then no more
    // Appears that Connect to Socket is NOT successful
    // Next write I get is at line 914
    // **************************************************
    
            ASSERT_ON_ERROR(Status);
            CLI_Write(" Line 347 In _smtpConnect Status after connect to socket \n\r"); //2-16-2023 do not get this
        }
        CLI_Write(" Line 349 In _smtpConnect right before return SUCCESS \n\r"); //2-16-2023 do not get this
        return SUCCESS;
    }
    
    /*!
        \brief This function will send the email
    
        \param[in]      none
    
        \return         0 if success otherwise -1
    
        \note
    
        \warning
    */
    static _i32 _smtpSend(void)
    {
        _i16 exit = 0;
        _i32 retVal = -1;
    
        /* If socket has been opened, check for acknowledge from SMTP server */
        while(exit == 0)
        {
            switch(g_smtpStatus)
            {
                /*
                 * An SMTP session is initiated when a client opens a connection to
                 * a server and the server responds with an opening message.
                 */
                case smtpINIT:
                    /* Create buffer, Read so we can check for 220 'OK' from server */
                    pal_Memset(buf, 0, SMTP_BUF_LEN);
    
                    retVal = sl_Recv(smtpSocket, buf, sizeof(buf), 0);
                    if(retVal <= 0)
                    {
                        ASSERT_ON_ERROR(TCP_RECV_ERROR);
                    }
    
                    /* If buffer has 220, set state to HELO */
                    if(buf[0] == smtp_code_ready[0] &&
                       buf[1] == smtp_code_ready[1] &&
                       buf[2] == smtp_code_ready[2])
                    {
                        g_smtpStatus = smtpHELO;
                    }
                    /* Else error, set state to ERROR */
                    else
                    {
                        g_smtpStatus = smtpERROR;
                        g_smtpErrorInfo = atINIT;
                    }
                break;
    
                /*
                 * The client normally sends the EHLO command to the
                 * server, indicating the client's identity.  In addition to opening the
                 * session, use of EHLO indicates that the client is able to process
                 * service extensions and requests that the server provide a list of the
                 * extensions it supports.
                 */
                case smtpHELO:
                    retVal = _sendSMTPCommand(smtpSocket, "HELO localhost", NULL, buf);
                    ASSERT_ON_ERROR(retVal);
    
                    /* If response has 250, set state to AUTH */
                    if(buf[0] == smtp_ok_reply[0] &&
                       buf[1] == smtp_ok_reply[1] &&
                       buf[2] == smtp_ok_reply[2])
                    {
                        g_smtpStatus = smtpAUTH;
                    }
                    /* Else error, set state to ERROR */
                    else
                    {
                        g_smtpStatus = smtpERROR;
                        g_smtpErrorInfo = atHELO;
                    }
                break;
    
                /* The client sends the AUTH command with SASL mechanism to use with */
                case smtpAUTH:
                    /*
                     * SASL PLain - Authentication with server username and password
                     * Refer - www.ietf.org/.../rfc4616.txt
                     */
                    _generateBase64Key((_u8*)g_Email.Username, basekey1);
                    _generateBase64Key((_u8*)g_SourcePass.Password, basekey2);
    
                    /* Send request to server for authentication */
                    retVal = _sendSMTPCommand(smtpSocket, "AUTH LOGIN", NULL, buf);
                    ASSERT_ON_ERROR(retVal);
                    /* If response has 334, give username in base64 */
                    if(buf[0] == smtp_auth_reply[0] &&
                       buf[1] == smtp_auth_reply[1] &&
                       buf[2] == smtp_auth_reply[2])
                    {
                        retVal = _sendSMTPCommand(smtpSocket, basekey1, NULL, buf);
                        ASSERT_ON_ERROR(retVal);
                        /* If response has 334, give password in base64 */
                        if(buf[0] == smtp_auth_reply[0] &&
                           buf[1] == smtp_auth_reply[1] &&
                           buf[2] == smtp_auth_reply[2])
                        {
                            retVal = _sendSMTPCommand(smtpSocket, basekey2, NULL, buf);
                            ASSERT_ON_ERROR(retVal);
                        }
                    }
    
                    if(buf[0] == smtp_auth_success[0] &&
                       buf[1] == smtp_auth_success[1] &&
                       buf[2] == smtp_auth_success[2])
                    {
                        /* Authentication was successful, set state to FROM */
                        g_smtpStatus = smtpFROM;
                    }
                    /* Else error, set state to ERROR */
                    else
                    {
                        g_smtpStatus = smtpERROR;
                        g_smtpErrorInfo = atAUTH;
                    }
                break;
    
                /*
                 * The SMTP transaction starts with a MAIL command which includes the
                 * sender information
                 * MAIL FROM:<reverse-path> [SP <mail-parameters> ] <CRLF>
                 */
                case smtpFROM:
                    retVal = _sendSMTPCommand(smtpSocket, (_u8 *)smtp_mail_from,
                                     (_u8 *)g_Email.Username, buf);
                    ASSERT_ON_ERROR(retVal);
    
                    /* If response has 250, set state to RCPT */
                    if(buf[0] == smtp_ok_reply[0] &&
                       buf[1] == smtp_ok_reply[1] &&
                       buf[2] == smtp_ok_reply[2])
                    {
                        g_smtpStatus = smtpRCPT;
                    }
                    else
                    {
                        pal_Memset(email_rfc,'\0',MAX_EMAIL_RCF_LEN);
                        pal_Memcpy(email_rfc,"<",1);
                        pal_Memcpy(&email_rfc[1], g_Email.Username,
                               pal_Strlen(g_Email.Username));
                        pal_Memcpy(&email_rfc[1+pal_Strlen(g_Email.Username)],">",1);
    
                        retVal = _sendSMTPCommand(smtpSocket, (_u8 *)smtp_mail_from,
                                         email_rfc, buf);
                        ASSERT_ON_ERROR(retVal);
    
                        if(buf[0] == smtp_ok_reply[0] &&
                           buf[1] == smtp_ok_reply[1] &&
                           buf[2] == smtp_ok_reply[2])
                        {
                            g_smtpStatus = smtpRCPT;
                        }
                        else
                        {
                            g_smtpStatus = smtpERROR;
                            g_smtpErrorInfo = atFROM;
                        }
                    }
                break;
    
                /* Send the destination email to the smtp server
                 * RCPT TO:<forward-path> [ SP <rcpt-parameters> ] <CRLF>
                 */
                case smtpRCPT:
                    retVal = _sendSMTPCommand(smtpSocket, (_u8 *)smtp_rcpt,
                                     (_u8 *)g_Destination.Email, buf);
                    ASSERT_ON_ERROR(retVal);
    
                    /* If response has 250, set state to DATA */
                    if(buf[0] == smtp_ok_reply[0] &&
                       buf[1] == smtp_ok_reply[1] &&
                       buf[2] == smtp_ok_reply[2])
                    {
                        g_smtpStatus = smtpDATA;
                    }
                    else
                    {
                        pal_Memset(email_rfc,'\0',MAX_EMAIL_RCF_LEN);
                        pal_Memcpy(email_rfc,"<",1);
                        pal_Memcpy(&email_rfc[1], g_Destination.Email,
                               pal_Strlen(g_Destination.Email));
                        pal_Memcpy(&email_rfc[1+pal_Strlen(g_Destination.Email)],">",1);
                        retVal = _sendSMTPCommand(smtpSocket, (_u8 *)smtp_rcpt,email_rfc, buf);
                        ASSERT_ON_ERROR(retVal);
                        /* If response has 250, set state to DATA */
                        if(buf[0] == smtp_ok_reply[0] &&
                           buf[1] == smtp_ok_reply[1] &&
                           buf[2] == smtp_ok_reply[2])
                        {
                            g_smtpStatus = smtpDATA;
                        }
                        else
                        {
                            g_smtpStatus = smtpERROR;
                            g_smtpErrorInfo = atRCPT;
                        }
                    }
                break;
    
                /*Send the "DATA" message to the server, indicates client is ready
                * to construct the body of the email
                * DATA <CRLF>
                */
                case smtpDATA:
                    retVal = _sendSMTPCommand(smtpSocket, (_u8 *)smtp_data, NULL, buf);
                    ASSERT_ON_ERROR(retVal);
                    /* If Response has 250, set state to MESSAGE */
                    if(buf[0] == smtp_intermed_reply[0] &&
                    buf[1] == smtp_intermed_reply[1] && buf[2] == smtp_intermed_reply[2])
                    {
                        g_smtpStatus = smtpMESSAGE;
                    }
                    else
                    {
                        g_smtpStatus = smtpERROR;
                        g_smtpErrorInfo = atDATA;
                    }
                break;
    
                case smtpMESSAGE:
                    /* Send actual Message, preceded by FROM, TO and Subject */
    
                    /* Start with E-Mail's "Subject:" field */
                    retVal = _sendSMTPCommand(smtpSocket, (_u8 *)smtp_subject,
                                                    (_u8 *)g_Subject.Value, NULL);
                    ASSERT_ON_ERROR(retVal);
    
                    /* Add E-mail's "To:" field */
                    retVal = _sendSMTPCommand(smtpSocket, (_u8 *)smtp_to,
                                                (_u8 *)g_Destination.Email, NULL);
                    ASSERT_ON_ERROR(retVal);
    
                    /* Add E-mail's "From:" field */
                    retVal = _sendSMTPCommand(smtpSocket, (_u8 *)smtp_from,
                                                    (_u8 *)g_Email.Username, NULL);
                    ASSERT_ON_ERROR(retVal);
    
                    /* Send CRLF */
                    retVal = sl_Send(smtpSocket,smtp_crlf,pal_Strlen(smtp_crlf),0);
                    if(retVal <= 0)
                        ASSERT_ON_ERROR(TCP_SEND_ERROR);
    
                    /* Send body of message */
                    retVal = _sendSMTPCommand(smtpSocket, message, NULL, NULL);
                    ASSERT_ON_ERROR(retVal);
    
                    /* End Message */
                    retVal = _sendSMTPCommand(smtpSocket,(_u8 *)smtp_data_end,NULL,buf);
                    ASSERT_ON_ERROR(retVal);
    
                    /* Server will send 250 for successful. Move into QUIT state. */
                    if(buf[0] == smtp_ok_reply[0] && buf[1] == smtp_ok_reply[1] &&
                                                            buf[2] == smtp_ok_reply[2])
                    {
                        /* Disconnect from server by sending QUIT command */
                        retVal = sl_Send(smtpSocket,smtp_quit,pal_Strlen(smtp_quit),0);
                        if(retVal <= 0)
                            ASSERT_ON_ERROR(TCP_SEND_ERROR);
    
                        /* Close socket and reset */
                        retVal = sl_Close(smtpSocket);
                        smtpSocket = INVALID_SOCKET_DESC;
                        /* Reset the state machine */
                        g_smtpStatus = smtpINIT;
                        exit = 1;
                    }
                    else
                    {
                        g_smtpStatus = smtpERROR;
                        g_smtpErrorInfo = atMESSAGE;
                    }
                break;
    
                case smtpERROR:
                    /* Error Handling for SMTP */
                    _smtpHandleERROR(buf);
                    /* Close socket and reset */
                    retVal = sl_Close(smtpSocket);
                    /*Reset the state machine */
                    g_smtpStatus = smtpINIT;
    
                    ASSERT_ON_ERROR(SMTP_ERROR);
    
                default:
                    ASSERT_ON_ERROR(SMTP_INVALID_CASE);
            }
        }
    
        return SUCCESS;
    }
    
    /*!
        \brief This function converts the string to Base64 format needed for
               authentication
    
        \param[in]      input - pointer to string to be converted
        \param[out]     basekey1 - Pointer to string for base64 converted output
    
        \return         None
    
        \note
    
        \warning
    */
    static void _generateBase64Key(_u8 *input, _u8 *basekey1)
    {
        _u8 *pIn = input;
    
        /* Convert to base64 format  */
        ConvertToBase64(basekey1, (void *)pIn, pal_Strlen(input));
    }
    
    /*!
        \brief Performs Error Handling for SMTP State Machine
    
        \param[in]      servermessage - server response message
    
        \return         None
    
        \note
    
        \warning
    */
    static void _smtpHandleERROR(_u8 *servermessage)
    {
        /* Errors are handled using flags set in the smtpStateMachine */
        switch(g_smtpErrorInfo)
        {
            case atINIT:
                /* Server connection could not be established */
                CLI_Write((_u8*)"Line 686 Server connection error.\r\n");
                CLI_Write((_u8*)servermessage);
            break;
    
            case atHELO:
                /* Server did not accept the HELO command from server */
                CLI_Write((_u8*)"Line 692 Server did not accept HELO:\r\n");
                CLI_Write((_u8*)servermessage);
            break;
    
            case atAUTH:
                /* Server did not accept authorization credentials */
                CLI_Write((_u8*)"Line 698 Authorization unsuccessful, ");
                CLI_Write((_u8*)"Line 699 check username/password.\r\n");
                CLI_Write((_u8*)servermessage);
            break;
    
            case atFROM:
                /* Server did not accept source email. */
                CLI_Write((_u8*)"Line 705 Email of sender not accepted by server.\r\n");
                CLI_Write((_u8*)servermessage);
            break;
    
            case atRCPT:
                /* Server did not accept destination email */
                CLI_Write((_u8*)"Line 711 Email of recipient not accepted by server.\r\n");
                CLI_Write((_u8*)servermessage);
            break;
    
            case atDATA:
                /* 'DATA' command to server was unsuccessful */
                CLI_Write((_u8*)"Line 717 smtp 'DATA' command not accepted by server.\r\n");
                CLI_Write((_u8*)servermessage);
            break;
    
            case atMESSAGE:
                /* Message body could not be sent to server */
                CLI_Write((_u8*)"Line 723 Email Message was not accepted by the server.\r\n");
                CLI_Write((_u8*)servermessage);
            break;
    
            case atQUIT:
                /* Message could not be finalized */
                CLI_Write((_u8*)"Line 729 Connection could not be properly closed.");
                CLI_Write((_u8*)" Line 730 Message not sent.\r\n");
                CLI_Write((_u8*)servermessage);
            break;
        }
    }
    
    /*!
        \brief  Sends the SMTP command and receives the server response.
                If cmd and cmd parameter are NULL, it will only send <CR><LF>
    
        \param[in]      socket - Socket Descriptor
        \param[in]      cmd -    command to be send to server
        \param[in]      cmdparam - command parameter to be send
        \param[in]      respBuf -    Pointer to buffer for SMTP server response
    
        \return         None
    
        \note
    
        \warning
    */
    static _i32 _sendSMTPCommand(_i32 socket, _u8 *cmd, _u8 * cmdparam, _u8 *respBuf)
    {
        _i16 sendLen = 0;
        _i32 retVal = -1;
    
        pal_Memset(g_cmdBuf, 0, sizeof(g_cmdBuf));
    
        if(cmd != NULL)
        {
            sendLen = pal_Strlen(cmd);
            pal_Memcpy(g_cmdBuf,cmd,pal_Strlen(cmd));
        }
    
        if(cmdparam != NULL)
        {
            pal_Memcpy(&g_cmdBuf[sendLen], cmdparam, pal_Strlen(cmdparam));
            sendLen += pal_Strlen(cmdparam);
        }
    
        pal_Memcpy(&g_cmdBuf[sendLen], smtp_crlf, pal_Strlen(smtp_crlf));
        sendLen += pal_Strlen(smtp_crlf);
        retVal = sl_Send(socket, g_cmdBuf,sendLen,0);
        if(retVal <= 0)
            ASSERT_ON_ERROR(TCP_SEND_ERROR);
    
        if(respBuf != NULL)
        {
            pal_Memset(respBuf,0,SMTP_BUF_LEN);
            retVal = sl_Recv(socket, respBuf,SMTP_BUF_LEN,0);
            if(retVal <= 0)
                ASSERT_ON_ERROR(TCP_RECV_ERROR);
        }
    
        return SUCCESS;
    }
    
    //***************************************************************************
    // End of Original Email file
    //***************************************************************************
    
    
    
    
    //***************************************************************************
    // Start of Email cut and paste from Main
    //***************************************************************************
    //LH These 3 defines already in email.c, so copy from main not needed here
    //#include "email.h"
    //#include "config.h"
    //#include "sl_common.h"
    
    #define APPLICATION_VERSION "1.3.0"
    
    #define SL_STOP_TIMEOUT        0xFF
    
    /*
     * GLOBAL VARIABLES -- Start
     */
    _u32  g_Status = 0;
    /*
     * GLOBAL VARIABLES -- End
     */
    
    volatile unsigned short usiEmailDummy = 0;
    
    /*
     * STATIC FUNCTION DEFINITIONS -- Start
     */
    static _i32 establishConnectionWithAP();
    static _i32 disconnectFromAP();
    static _i32 configureSimpleLinkToDefaultState();
    
    static _i32 initializeAppVariables();
    static void  displayBanner();
    
    static _i32 setEmail();
    static _i32 sendEmail();
    /*
     * STATIC FUNCTION DEFINITIONS -- End
     */
    
    //***************************************
    // Start of function int LHSendEmail()
    //***************************************
    /*
     * Application's entry point
     */
    //void LHSendEmail (void)
    int LHSendEmail()
    {
        usiEmailDummy = 0;
        usiEmail1OrTime2 = 1; //In the function call set to 1 for email, set to 2 for get-time
    
    
        _i32 retVal = -1;
    
        retVal = initializeAppVariables();
        ASSERT_ON_ERROR(retVal);
    
    //    /* Stop WDT and initialize the system-clock of the MCU */
    //    stopWDT();
    //    initClk();
    
        /* Configure command line interface */
        CLI_Configure();
    
        displayBanner();
    
        /*
         * Following function configures the device to default state by cleaning
         * the persistent settings stored in NVMEM (viz. connection profiles &
         * policies, power policy etc)
         *
         * Applications may choose to skip this step if the developer is sure
         * that the device is in its default state at start of application
         *
         * Note that all profiles and persistent settings that were done on the
         * device will be lost
         */
        retVal = configureSimpleLinkToDefaultState();
        if(retVal < 0)
        {
            if (DEVICE_NOT_IN_STATION_MODE == retVal)
                CLI_Write(" Line 874 Failed to configure the device in its default state \n\r");
    
    // 5-24-2020, I don't see the value of LOOP_FOREVER(); as this just hangs the program forever at this point
            //I think better to move on, as already printed out the failure, maybe some time later it will work
    //        LOOP_FOREVER();
        }
    
        CLI_Write(" Line 881 Device is configured in default state \n\r");
    
        /*
         * Initializing the CC3100 device
         * Assumption is that the device is configured in station mode already
         * and it is in its default state
         */
        retVal = sl_Start(0, 0, 0);
        if ((retVal < 0) ||
            (ROLE_STA != retVal) )
        {
            CLI_Write(" Line 892 Failed to start the device \n\r");
    // 5-24-2020, I don't see the value of LOOP_FOREVER(); as this just hangs the program forever at this point
            //I think better to move on, as already printed out the failure, maybe some time later it will work
    //       LOOP_FOREVER();
        }
    
        CLI_Write(" Line 898 Device started as STATION \n\r");
    
        /* Configure the source email */
        retVal = setEmail();
        if(retVal < 0)
            LOOP_FOREVER();
    
        /* Connecting to WLAN AP */
        retVal = establishConnectionWithAP();
        if(retVal < 0)
        {
            CLI_Write(" Line 909 Failed to establish connection w/ an AP \n\r");
    // 5-24-2020, I don't see the value of LOOP_FOREVER(); as this just hangs the program forever at this point
            //I think better to move on, as already printed out the failure, maybe some time later it will work
    //        LOOP_FOREVER();
        }
    
        CLI_Write(" Line 915 Connection established w/ AP and IP is acquired \n\r");
    
        /* Configure and send the email */
        CLI_Write(" Line 918 Sending email... \n\r"); //Jan 30, 2023 successfully get this
        retVal = sendEmail();
        if (retVal < 0)
        {
            CLI_Write(" Line 922 Device couldn't send the email \n\r");
    // 5-24-2020, I don't see the value of LOOP_FOREVER(); as this just hangs the program forever at this point
            //I think better to move on, as already printed out the failure, maybe some time later it will work
    //        LOOP_FOREVER();
    //        LOOP_FOREVER(); // Jan 30, 2023 put this back in as get  Device couldn't send the email \n\r
            //Did not solve the problem of not sending email and just locks at this point
        }
        else
        {
            CLI_Write(" Line 931 Email Sent successfully \n\r");
        }
    
        /* Disconnect from AP */
        retVal = disconnectFromAP();
        if(retVal < 0)
        {
            CLI_Write(" Line 938 Failed to disconnect from the AP \n\r");
    // 5-24-2020, I don't see the value of LOOP_FOREVER(); as this just hangs the program forever at this point
            //I think better to move on, as already printed out the failure, maybe some time later it will work
    //        LOOP_FOREVER();
        }
    
        retVal = sl_Stop(SL_STOP_TIMEOUT);
    // 5-24-2020, I don't see the value of LOOP_FOREVER(); as this just hangs the program forever at this point
    //I think better to move on, as already printed out the failure, maybe some time later it will work
    //    if(retVal < 0)
    //        LOOP_FOREVER();
    
        return  0;
    } // Closing bracket for int LHSendEmail()
    
    
    //***************************************
    // End of function.....Start of function int LHSendEmail()
    //***************************************
    /*
     * ASYNCHRONOUS EVENT HANDLERS -- Start
     */
    
    /*!
        \brief This function handles WLAN events
    
        \param[in]      pWlanEvent is the event passed to the handler
    
        \return         None
    
        \note
    
        \warning
    */
    void SimpleLinkWlanEventHandler(SlWlanEvent_t *pWlanEvent)
    {
        if(pWlanEvent == NULL)
        {
            CLI_Write(" Line 976 [WLAN EVENT] NULL Pointer Error \n\r");
            return;
        }
    
        switch(pWlanEvent->Event)
        {
            case SL_WLAN_CONNECT_EVENT:
            {
                SET_STATUS_BIT(g_Status, STATUS_BIT_CONNECTION);
    
                /*
                 * Information about the connected AP (like name, MAC etc.) will be
                 * available in 'slWlanConnectAsyncResponse_t' - Applications
                 * can use it if required
                 *
                 * slWlanConnectAsyncResponse_t *pEventData = NULL;
                 * pEventData = &pWlanEvent->EventData.STAandP2PModeWlanConnected;
                 *
                 */
            }
            break;
    
            case SL_WLAN_DISCONNECT_EVENT:
            {
                slWlanConnectAsyncResponse_t*  pEventData = NULL;
    
                CLR_STATUS_BIT(g_Status, STATUS_BIT_CONNECTION);
                CLR_STATUS_BIT(g_Status, STATUS_BIT_IP_ACQUIRED);
    
                pEventData = &pWlanEvent->EventData.STAandP2PModeDisconnected;
    
        if (usiEmail1OrTime2 == 1){  //In the function call set to 1 for email, set to 2 for get-time
                /* If the user has initiated 'Disconnect' request, 'reason_code' is SL_USER_INITIATED_DISCONNECTION */
                if(SL_WLAN_DISCONNECT_USER_INITIATED_DISCONNECTION == pEventData->reason_code)
                {
                    CLI_Write(" Line 1011 Device disconnected from the AP on application's request \n\r");
                }
                else
                {
                    CLI_Write(" Line 1015 Device disconnected from the AP on an ERROR..!! \n\r");
                }
        }
         else if (usiEmail1OrTime2 == 2){  //In the function call set to 1 for email, set to 2 for get-time
                 /* If the user has initiated 'Disconnect' request, 'reason_code' is SL_USER_INITIATED_DISCONNECTION */
                 if(SL_WLAN_DISCONNECT_USER_INITIATED_DISCONNECTION == pEventData->reason_code)
                 {
                     CLI_Write((_u8 *)" Line 1022 Device disconnected from the AP on application's request \n\r"); //LH Line 11, last line
                 }
                 else
                 {
                     CLI_Write((_u8 *)" Line 1026 Device disconnected from the AP on an ERROR..!! \n\r");
                 }
    
         }
            }
            break;
    
            default:
            {
                CLI_Write(" Line 1035 [WLAN EVENT] Unexpected event \n\r");
            }
            break;
        }
    }
    
    /*!
        \brief This function handles events for IP address acquisition via DHCP
               indication
    
        \param[in]      pNetAppEvent is the event passed to the handler
    
        \return         None
    
        \note
    
        \warning
    */
    void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *pNetAppEvent)
    {
        if(pNetAppEvent == NULL)
        {
            CLI_Write(" Line 1057 [NETAPP EVENT] NULL Pointer Error \n\r");
            return;
        }
    
        switch(pNetAppEvent->Event)
        {
            case SL_NETAPP_IPV4_IPACQUIRED_EVENT:
            {
                SET_STATUS_BIT(g_Status, STATUS_BIT_IP_ACQUIRED);
    
                /*
                 * Information about the connected AP's IP, gateway, DNS etc.
                 * will be available in 'SlIpV4AcquiredAsync_t' - Applications
                 * can use it if required
                 *
                 * SlIpV4AcquiredAsync_t *pEventData = NULL;
                 * pEventData = &pNetAppEvent->EventData.ipAcquiredV4;
                 * <gateway_ip> = pEventData->gateway;
                 *
                 */
            }
            break;
    
            default:
            {
                CLI_Write(" Line 1082 [NETAPP EVENT] Unexpected event \n\r");
            }
            break;
        }
    }
    
    /*!
        \brief This function handles callback for the HTTP server events
    
        \param[in]      pHttpEvent - Contains the relevant event information
        \param[in]      pHttpResponse - Should be filled by the user with the
                        relevant response information
    
        \return         None
    
        \note
    
        \warning
    */
    void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *pHttpEvent,
                                      SlHttpServerResponse_t *pHttpResponse)
    {
        /*
         * This application doesn't work with HTTP server - Hence these
         * events are not handled/expected here
         */
        CLI_Write(" Line 1108 [HTTP EVENT] Unexpected event \n\r");
    }
    
    /*!
        \brief This function handles general error events indication
    
        \param[in]      pDevEvent is the event passed to the handler
    
        \return         None
    */
    void SimpleLinkGeneralEventHandler(SlDeviceEvent_t *pDevEvent)
    {
        /*
         * Most of the general errors are not FATAL are are to be handled
         * appropriately by the application
         */
        CLI_Write(" Line 1124 [GENERAL EVENT] \n\r");
    }
    
    /*!
        \brief This function handles socket events indication
    
        \param[in]      pSock is the event passed to the handler
    
        \return         None
    */
    void SimpleLinkSockEventHandler(SlSockEvent_t *pSock)
    {
        if(pSock == NULL)
        {
            CLI_Write(" Line 1138 [SOCK EVENT] NULL Pointer Error \n\r");
            return;
        }
    
        switch( pSock->Event )
        {
            case SL_SOCKET_TX_FAILED_EVENT:
            {
                /*
                * TX Failed
                *
                * Information about the socket descriptor and status will be
                * available in 'SlSockEventData_t' - Applications can use it if
                * required
                *
                * SlSockEventData_u *pEventData = NULL;
                * pEventData = & pSock->socketAsyncEvent;
                */
                switch( pSock->socketAsyncEvent.SockTxFailData.status )
                {
                    case SL_ECLOSE:
                        CLI_Write(" Line 1159[SOCK EVENT] Close socket operation failed to transmit all queued packets\n\r");
                    break;
    
    
                    default:
                        CLI_Write(" Line 1164 [SOCK EVENT] Unexpected event \n\r");
                    break;
                }
            }
            break;
    
            default:
                CLI_Write(" Line 1171 [SOCK EVENT] Unexpected event \n\r");
            break;
        }
    }
    /*
     * ASYNCHRONOUS EVENT HANDLERS -- End
     */
    
    
    
    
    /*!
        \brief This function configures the source email using parameters defined
               in "config.h" file
    
        \param[in]      none
    
        \return         none
    
        \note
    
        \warning
    */
    //Security Methods CC3100 SWRU368B User's Guide
    //    • SL_SO_SEC_METHOD_SSLV3
    //    • SL_SO_SEC_METHOD_TLSV1
    //    • SL_SO_SEC_METHOD_TLSV1_1
    //    • SL_SO_SEC_METHOD_TLSV1_2    //TI example use
    //    • SL_SO_SEC_METHOD_SSLv3_TLSV1_2
    
    //Security Cipher CC3100 SWRU368B User's Guide
    //    • SL_SEC_MASK_SSL_RSA_WITH_RC4_128_SHA
    //    • SL_SEC_MASK_SSL_RSA_WITH_RC4_128_MD5
    //    • SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA   //TI example uses
    //    • SL_SEC_MASK_TLS_DHE_RSA_WITH_AES_256_CBC_SHA
    //    • SL_SEC_MASK_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
    //    • SL_SEC_MASK_TLS_ECDHE_RSA_WITH_RC4_128_SHA
    //    • SL_SEC_MASK_TLS_RSA_WITH_AES_128_CBC_SHA256
    //    • SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA256
    //    • SL_SEC_MASK_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
    //    • SL_SEC_MASK_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
    
    static _i32 setEmail()
    {
        _i32 retVal = -1;
        SlNetAppSourceEmail_t sourceEmailId = {0};
        SlNetAppSourcePassword_t sourceEmailPwd = {0};
        SlNetAppEmailOpt_t eMailServerSetting = {0};
    
        pal_Memcpy(sourceEmailId.Username,USER,pal_Strlen(USER)+1);
        retVal = sl_NetAppEmailSet(NETAPP_SOURCE_EMAIL,pal_Strlen(USER)+1,
                          (_u8*)&sourceEmailId);
        ASSERT_ON_ERROR(retVal);
    
        pal_Memcpy(sourceEmailPwd.Password,PASS,pal_Strlen(PASS)+1);
        retVal = sl_NetAppEmailSet(NETAPP_PASSWORD,pal_Strlen(PASS)+1,
                          (_u8*)&sourceEmailPwd);
        ASSERT_ON_ERROR(retVal);
    
        eMailServerSetting.Family = AF_INET;
        eMailServerSetting.Port = GMAIL_HOST_PORT; //Line 27 in config.h    #define GMAIL_HOST_PORT         465
    //    eMailServerSetting.Port = OUTLOOK_HOST_PORT; //Line  i41n config.h    #define OUTLOOK_PORT         587
    //    eMailServerSetting.Port = ZOHO_HOST_PORT; //Line  i41n config.h    #define OUTLOOK_PORT         587
    //    eMailServerSetting.Port = VERIZON_HOST_PORT; //2-14-2023 changed to Verizon so can try abc2015NVR
        eMailServerSetting.Ip = SL_IPV4_VAL(74,125,129,108);
        eMailServerSetting.SecurityMethod = SL_SO_SEC_METHOD_TLSV1_2; //Original 2014 to Jan 2023
        eMailServerSetting.SecurityCypher = SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA; //Original 2014 to Jan 2023
    
    //  Gmail port 465 with SSL
    //  CC3100 SDK1.3.0 shows multiple Transport Security Options, Two with SSL
    //  SSLV3 SSL_RSA_WITH_RC4_128_SHA
    //  SSLV3 SSL_RSA_WITH_RC4_128_MD5
    //  eMailServerSetting.SecurityMethod = SL_SO_SEC_METHOD_SSLV3;
    //  eMailServerSetting.SecurityCypher = SL_SEC_MASK_SSL_RSA_WITH_RC4_128_SHA;
    //  eMailServerSetting.SecurityCypher = SL_SEC_MASK_SSL_RSA_WITH_RC4_128_MD5;
    
    
        retVal = sl_NetAppEmailSet(NETAPP_ADVANCED_OPT,sizeof(SlNetAppEmailOpt_t),
                          (_u8*)&eMailServerSetting);
        ASSERT_ON_ERROR(retVal);
    
        return SUCCESS;
    }
    
    /*!
        \brief Send the email to the preconfigured email ID
    
        \param[in]      none
    
        \return         0 for success , -1 otherwise
    
        \note
    
        \warning
    */
    static _i32 sendEmail()
    {
        _i32 Status = -1;
    
        Status = sl_NetAppEmailSet(NETAPP_DEST_EMAIL,
                                   pal_Strlen(DESTINATION_EMAIL),
                                   (_u8 *)DESTINATION_EMAIL);
        ASSERT_ON_ERROR(Status);
        CLI_Write(" Line 1253 After...DESTINATION_EMAIL \n\r"); //Jan 30, 2023 added this
    //    Status = sl_NetAppEmailSet(NETAPP_SUBJECT,
    //                               pal_Strlen(EMAIL_SUBJECT),
    //                               (_u8 *)EMAIL_SUBJECT);
    
    //LH added 5-20-2020 to use my character array for the email subject
        Status = sl_NetAppEmailSet(NETAPP_SUBJECT,
                                   pal_Strlen(LHemailSubject),
                                   (_u8 *)LHemailSubject);
    
    
        ASSERT_ON_ERROR(Status);
        CLI_Write(" Line 1265 After...LHemailSubject \n\r"); //Jan 30, 2023 added, this is printed
    
    //    Status = sl_NetAppEmailSet(NETAPP_MESSAGE,
    //                               pal_Strlen(EMAIL_MESSAGE),
    //                               (_u8 *)EMAIL_MESSAGE);
    
    //LH added 5-20-2020 to use my character array for the email message
        Status = sl_NetAppEmailSet(NETAPP_MESSAGE,
                                   pal_Strlen(LHemailBody),
                                   (_u8 *)LHemailBody);
    
    
        ASSERT_ON_ERROR(Status);
        CLI_Write(" Line 1278 After...LHemailBody \n\r"); //Jan 30, 2023 added this, this IS printed
    
        Status = sl_NetAppEmailConnect(); //2-16-2022 looks like this function does not complete
        CLI_Write(" Line 1281 After...Status = sl_NetAppEmailConnect() \n\r"); //2-16-2022, this is NOT printed
        ASSERT_ON_ERROR(Status);
        CLI_Write(" Line 1283 After...sl_NetAppEmailConnect \n\r"); //Jan 30, 2023 added this, this is NOT printed
    
        Status = sl_NetAppEmailSend();
        ASSERT_ON_ERROR(Status);
        CLI_Write(" Line 1287 After...sl_NetAppEmailSend \n\r"); //Jan 30, 2023 added, this is NOT printed
        return SUCCESS;
    }
    
    /*!
        \brief This function configure the SimpleLink device in its default state. It:
               - Sets the mode to STATION
               - Configures connection policy to Auto and AutoSmartConfig
               - Deletes all the stored profiles
               - Enables DHCP
               - Disables Scan policy
               - Sets Tx power to maximum
               - Sets power policy to normal
               - Unregisters mDNS services
               - Remove all filters
        \param[in]      none
    
        \return         On success, zero is returned. On error, negative is returned
    */
    static _i32 configureSimpleLinkToDefaultState()
    {
        SlVersionFull   ver = {0};
        _WlanRxFilterOperationCommandBuff_t  RxFilterIdMask = {0};
    
        _u8           val = 1;
        _u8           configOpt = 0;
        _u8           configLen = 0;
        _u8           power = 0;
    
        _i32          retVal = -1;
        _i32          mode = -1;
    
        mode = sl_Start(0, 0, 0);
        ASSERT_ON_ERROR(mode);
    
        /* If the device is not in station-mode, try configuring it in station-mode */
        if (ROLE_STA != mode)
        {
            if (ROLE_AP == mode)
            {
                /* If the device is in AP mode, we need to wait for this event before doing anything */
                while(!IS_IP_ACQUIRED(g_Status)) { _SlNonOsMainLoopTask(); }
            }
    
            /* Switch to STA role and restart */
            retVal = sl_WlanSetMode(ROLE_STA);
            ASSERT_ON_ERROR(retVal);
    
            retVal = sl_Stop(SL_STOP_TIMEOUT);
            ASSERT_ON_ERROR(retVal);
    
            retVal = sl_Start(0, 0, 0);
            ASSERT_ON_ERROR(retVal);
    
            /* Check if the device is in station again */
            if (ROLE_STA != retVal)
            {
                /* We don't want to proceed if the device is not coming up in station-mode */
                ASSERT_ON_ERROR(DEVICE_NOT_IN_STATION_MODE);
            }
        }
    
        /* Get the device's version-information */
        configOpt = SL_DEVICE_GENERAL_VERSION;
        configLen = sizeof(ver);
        retVal = sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION, &configOpt, &configLen, (_u8 *)(&ver));
        ASSERT_ON_ERROR(retVal);
    
        /* Set connection policy to Auto + SmartConfig (Device's default connection policy) */
        retVal = sl_WlanPolicySet(SL_POLICY_CONNECTION, SL_CONNECTION_POLICY(1, 0, 0, 0, 1), NULL, 0);
        ASSERT_ON_ERROR(retVal);
    
        /* Remove all profiles */
        retVal = sl_WlanProfileDel(0xFF);
        ASSERT_ON_ERROR(retVal);
    
        /*
         * Device in station-mode. Disconnect previous connection if any
         * The function returns 0 if 'Disconnected done', negative number if already disconnected
         * Wait for 'disconnection' event if 0 is returned, Ignore other return-codes
         */
        retVal = sl_WlanDisconnect();
        if(0 == retVal)
        {
            /* Wait */
            while(IS_CONNECTED(g_Status)) { _SlNonOsMainLoopTask(); }
        }
    
        /* Enable DHCP client*/
        retVal = sl_NetCfgSet(SL_IPV4_STA_P2P_CL_DHCP_ENABLE,1,1,&val);
        ASSERT_ON_ERROR(retVal);
    
        /* Disable scan */
        configOpt = SL_SCAN_POLICY(0);
        retVal = sl_WlanPolicySet(SL_POLICY_SCAN , configOpt, NULL, 0);
        ASSERT_ON_ERROR(retVal);
    
        /* Set Tx power level for station mode
           Number between 0-15, as dB offset from max power - 0 will set maximum power */
        power = 0;
        retVal = sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_STA_TX_POWER, 1, (_u8 *)&power);
        ASSERT_ON_ERROR(retVal);
    
        /* Set PM policy to normal */
        retVal = sl_WlanPolicySet(SL_POLICY_PM , SL_NORMAL_POLICY, NULL, 0);
        ASSERT_ON_ERROR(retVal);
    
        /* Unregister mDNS services */
        retVal = sl_NetAppMDNSUnRegisterService(0, 0);
        ASSERT_ON_ERROR(retVal);
    
        /* Remove  all 64 filters (8*8) */
        pal_Memset(RxFilterIdMask.FilterIdMask, 0xFF, 8);
        retVal = sl_WlanRxFilterSet(SL_REMOVE_RX_FILTER, (_u8 *)&RxFilterIdMask,
                           sizeof(_WlanRxFilterOperationCommandBuff_t));
        ASSERT_ON_ERROR(retVal);
    
        retVal = sl_Stop(SL_STOP_TIMEOUT);
        ASSERT_ON_ERROR(retVal);
    
        retVal = initializeAppVariables();
        ASSERT_ON_ERROR(retVal);
    
        return retVal; /* Success */
    }
    
    /*!
        \brief Connecting to a WLAN Access point
    
        This function connects to the required AP (SSID_NAME).
        The function will return once we are connected and have acquired IP address
    
        \param[in]  None
    
        \return     0 on success, negative error-code on error
    
        \note
    
        \warning    If the WLAN connection fails or we don't acquire an IP address,
                    We will be stuck in this function forever.
    */
    static _i32 establishConnectionWithAP()
    {
        if (usiEmail1OrTime2 == 1){  //In the function call set to 1 for email, set to 2 for get-time
    
        SlSecParams_t secParams = {0};
        _i32 retVal = 0;
    
        secParams.Key = PASSKEY;
        secParams.KeyLen = PASSKEY_LEN;
        secParams.Type = SEC_TYPE;
    
        retVal = sl_WlanConnect(SSID_NAME, pal_Strlen(SSID_NAME), 0, &secParams, 0);
        ASSERT_ON_ERROR(retVal);
    
        /* Wait */
        while((!IS_CONNECTED(g_Status)) || (!IS_IP_ACQUIRED(g_Status))) { _SlNonOsMainLoopTask(); }
    
    //    return SUCCESS;
        }
        else if (usiEmail1OrTime2 == 2){  //In the function call set to 1 for email, set to 2 for get-time
        SlSecParams_t secParams = {0};
         _i32 retVal = 0;
    
         secParams.Key = PASSKEY;
         secParams.KeyLen = pal_Strlen(secParams.Key);
         secParams.Type = SEC_TYPE;
    
         retVal = sl_WlanConnect(SSID_NAME, pal_Strlen(SSID_NAME), 0, &secParams, 0);
         ASSERT_ON_ERROR(retVal);
    
         /* Wait */
         while((!IS_CONNECTED(g_Status)) || (!IS_IP_ACQUIRED(g_Status))) { _SlNonOsMainLoopTask(); }
    
    //     return SUCCESS;
        }
        return SUCCESS;
    }
    
    /*!
        \brief Disconnecting from a WLAN Access point
    
        This function disconnects from the connected AP
    
        \param[in]      None
    
        \return         none
    
        \note
    
        \warning        If the WLAN disconnection fails, we will be stuck in this function forever.
    */
    static _i32 disconnectFromAP()
    {
        _i32 retVal = -1;
    
        /*
         * The function returns 0 if 'Disconnected done', negative number if already disconnected
         * Wait for 'disconnection' event if 0 is returned, Ignore other return-codes
         */
        retVal = sl_WlanDisconnect();
        CLI_Write(" Line 1488  in _i32 disconnectFromAP() after retVal = sl_WlanDisconnect(); \n\r");
        if(0 == retVal)
        CLI_Write(" Line 1490  in _i32 disconnectFromAP() after if(0 == retVal) \n\r");
        {
            /* Wait */
            while(IS_CONNECTED(g_Status)) { _SlNonOsMainLoopTask(); }
        }
    
        return SUCCESS;
    }
    
    /*!
        \brief This function initializes the application variables
    
        \param[in]  None
    
        \return     0 on success, negative error-code on error
    */
    static _i32 initializeAppVariables()
    {
        if (usiEmail1OrTime2 == 1){  //In the function call set to 1 for email, set to 2 for get-time
        g_Status = 0;
    
    //    return SUCCESS;
        }
        else if (usiEmail1OrTime2 == 2){  //In the function call set to 1 for email, set to 2 for get-time
        g_Status = 0;
        pal_Memset(&appData, 0, sizeof(appData)); //This line not in email wifi call
    
    //    return SUCCESS;
        }
        return SUCCESS;
    }
    
    /*!
        \brief This function displays the application's banner
    
        \param      None
    
        \return     None
    */
    static void displayBanner()
    {
        usiEmailDummy = 0;
        if (usiEmail1OrTime2 == 1){  //In the function call set to 1 for email, set to 2 for get-time
        CLI_Write("\n\r\n\r");
        CLI_Write(" Email application - Version ");
        CLI_Write(APPLICATION_VERSION);
        CLI_Write("\n\r*******************************************************************************\n\r");
        }
        else if (usiEmail1OrTime2 == 2){  //In the function call set to 1 for email, set to 2 for get-time
            usiEmailDummy = 0;
            CLI_Write((_u8 *)"\n\r\n\r");           //LH Line 0 = blank
            CLI_Write((_u8 *)" Get time application - Version ");   //LH line 1
            CLI_Write(APPLICATION_VERSION); //LH last half of line 1
            CLI_Write((_u8 *)"\n\r*******************************************************************************\n\r"); //LH Line 2 *** under top line
    
        }
    }
    
    
    //*********************************************************************************************
    //****get-timeLH****get-timeLH****get-timeLH****get-timeLH****get-timeLH****get-timeLH
    //****get-timeLH****get-timeLH****get-timeLH****get-timeLH****get-timeLH****get-timeLH
    //****get-timeLH****get-timeLH****get-timeLH****get-timeLH****get-timeLH****get-timeLH
    //*********************************************************************************************
    
    /*
     * get-time-LH.c
     *
     *  Created on: Jul 30, 2020
     *      Author: lorne
     */
    
    /*
     * Application Name     -   Get time
     * Application Overview -   This sample application demonstrates how
     *                          to connect to an SNTP server and request for time
     *                          information. The application processes the received
     *                          data and displays the time on console
     * Application Details  -   processors.wiki.ti.com/.../CC31xx_Get_Time_Application
     *                          doc\examples\get_time.pdf
     */
    
    //#include "simplelink.h"  //8-1-2020 comment out as duplicate with email file above
    //#include "sl_common.h"   //8-1-2020 comment out as duplicate with email file above
    //#include "email.h"
    //#include "get-time-LH.h"
    //#include "base64.h"
    //#include "config.h"
    //#include "sl_common.h"
    #include <stdio.h> //For printf function
    
    #define APPLICATION_VERSION "1.3.0"
    
    #define SL_STOP_TIMEOUT        0xFF
    
    #define MAX_BUF_SIZE    48
    
    #define TIME2013        3566160000       /* 43 years + 13 days of leap years */ //LH try adding 2 more days of leap years seconds
    //This gives the correct date number but as expected the Day of the week is then 2 days advanced in error
    //I do not use the Day of the week at this time, so OK
    
    //#define TIME2013        3565987200       /* 43 years + 11 days of leap years */ //LH 7-29-2020; Date # is 2 days advanced
    #define YEAR2013        2013
    #define SEC_IN_MIN      60
    #define SEC_IN_HOUR     3600
    #define SEC_IN_DAY      86400
    
    /*
     * Values for below macros shall be modified for setting the time-zone
     */
    
    signed short GMT_TIME_ZONE_HR = -5;
    //#define GMT_TIME_ZONE_HR    -5    //****Note that our time zone needs to be entered as a negative number
    #define GMT_TIME_ZONE_MIN   00
    
    /* Application specific status/error codes */
    //LH 8-2-2020 added these to config.h line 70 otherwise this typedef define twice
    //typedef enum{
    //    DEVICE_NOT_IN_STATION_MODE = -0x7D0,        /* Choosing this number to avoid overlap w/ host-driver's error codes */
    //    SNTP_SEND_ERROR = DEVICE_NOT_IN_STATION_MODE - 1,
    //    SNTP_RECV_ERROR = SNTP_SEND_ERROR - 1,
    //    SNTP_SERVER_RESPONSE_ERROR = SNTP_RECV_ERROR - 1,
    //
    //    STATUS_CODE_MAX = -0xBB8
    //}e_AppStatusCodes;
    
    /*
     * GLOBAL VARIABLES -- Start
     */
    //_u32  g_Status = 0; //8-1-2020 comment out as duplicate with email file above
    
    //LH 8-2-2020 getting errors that appData is not defined so try pasting it in email.h, I added the word typedef in front to make it the same
    // Doing that generates 100's of errors, every place appData was used; took word typdef off and get a clean compile????
    //struct{
    //    _u32   DestinationIP;
    //    _u32   elapsedSec;
    //    _u32   uGeneralVar;
    //    _u32   uGeneralVar1;
    //
    //    _u16   ccLen;
    //
    //    _i32   SockID;
    //    _i32   sGeneralVar;
    //
    //    _u8 time[30];  //LH time is a structure with 30 elements so it can display a string like this Tue Oct 10 2018 11:26:13
    //    _u8 *ccPtr;
    //
    //}appData;
    
    volatile unsigned short usiBreakDummy = 0;
    volatile unsigned short usiYearGetTime = 0;
    volatile unsigned short usiMonthOfYearGetTime = 0;
    volatile unsigned short usiDayOfMonthGetTime = 0;
    volatile unsigned short usiDayOfWeekGetTime = 0;
    volatile unsigned short usiHrsGetTime = 0;
    volatile unsigned short usiMinutesGetTime = 0;
    volatile unsigned short usiSecondsGetTime = 0;
    
     char ChrHrTens = '\0';   //Initialized to null
    
    /*
     * GLOBAL VARIABLES -- End
     */
    
    
    /*
     * CONTSTANT -- Start
     */
    /*! ######################### List of SNTP servers ############################
     *! ##
     *! ##          hostname         |        IP        |       location
     *! ## ------------------------------------------------------------------------
     *! ## time-a.nist.gov           | 129.6.15.28      | NIST, Gaithersburg, Maryland
     *! ## time-b.nist.gov           | 129.6.15.29      | NIST, Gaithersburg, Maryland
     *! ## time-c.nist.gov           | 129.6.15.30      | NIST, Gaithersburg, Maryland
     *! ## nist1-macon.macon.ga.us   | 98.175.203.200   | Macon, Georgia
     *! ## 0.in.pool.ntp.org         | 123.108.225.6    | India
    
     *! ## For more SNTP server link visit 'tf.nist.gov/.../servers.cgi'
     *! ###########################################################################
     */
    //8-31-2022 did not find a, b, or c server worked any better to get the time
     const _u8 SNTPserver[30] = "time-a.nist.gov"; /* Add any one of the above servers */
    //const _u8 SNTPserver[30] = "time-b.nist.gov"; /* Add any one of the above servers */
    //const _u8 SNTPserver[30] = "time-c.nist.gov"; /* Add any one of the above servers */
    //const _u8 SNTPserver[30] = "nist1-macon.macon.ga.us"; /* Add any one of the above servers */ //LH-7-29-2020 never got a reply
    
    /* Tuesday is the 1st day in 2013 - the relative year */
    const _u8 daysOfWeek2013[7][3] = {{"Tue"},
                                       {"Wed"},
                                       {"Thu"},
                                       {"Fri"},
                                       {"Sat"},
                                       {"Sun"},
                                       {"Mon"}};
    
    const _u8 monthOfYear[12][3] = {{"Jan"},
                                     {"Feb"},
                                     {"Mar"},
                                     {"Apr"},
                                     {"May"},
                                     {"Jun"},
                                     {"Jul"},
                                     {"Aug"},
                                     {"Sep"},
                                     {"Oct"},
                                     {"Nov"},
                                     {"Dec"}};
    
    const _u8 numOfDaysPerMonth[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
    
    const _u8 digits[] = "0123456789";
    /*
     * CONTSTANT -- End
     */
    
    
    /*
     * STATIC FUNCTION DEFINITIONS -- Start
     */
    //static _i32 establishConnectionWithAP();  //Already defined at around line 700
    //static _i32 disconnectFromAP();             //Already defined at line 792
    //static _i32 configureSimpleLinkToDefaultState();
    
    //static _i32 initializeAppVariables(); //Already defined at around line 795
    //static void  displayBanner(); //Already defined at line 796
    
    //LH even in the original code these functions are not in the get-time file, must be in sl-common or some other WiFi library
    static _i32 getHostIP();
    static _i32 createConnection();
    static _i32 getSNTPTime(_i16 gmt_hr, _i16 gmt_min);
    static _u16 itoa(_i16 cNum, _u8 *cString);
    
    /*
     * STATIC FUNCTION DEFINITIONS -- End
     */
    
    
    
    /*
     * Application's entry point
     */
    int LHGetTime ()
    //int main(int argc, char** argv)
    {
        //usiGMTOffsetHrSet is set in mode = Settings, so End user can set GMT for their Time zone and Day light saving time
        GMT_TIME_ZONE_HR = (-1 * usiGMTOffsetHrSet);
    
        usiEmail1OrTime2 = 2; //In the function call set to 1 for email, set to 2 for get-time
        _i32 retVal = -1;
    
        retVal = initializeAppVariables();
        ASSERT_ON_ERROR(retVal);
    
        /* Stop WDT and initialize the system-clock of the MCU */
    //    stopWDT();
    //    initClk();
    
        /* Configure command line interface */
        CLI_Configure();
    
        displayBanner();
    
        /*
         * Following function configures the device to default state by cleaning
         * the persistent settings stored in NVMEM (viz. connection profiles &
         * policies, power policy etc)
         *
         * Applications may choose to skip this step if the developer is sure
         * that the device is in its default state at start of application
         *
         * Note that all profiles and persistent settings that were done on the
         * device will be lost
         */
        retVal = configureSimpleLinkToDefaultState();
        if(retVal < 0)
        {
            if (DEVICE_NOT_IN_STATION_MODE == retVal)
                CLI_Write((_u8 *)" Line 1757 Failed to configure the device in its default state \n\r");
            // 5-24-2020, I don't see the value of LOOP_FOREVER(); as this just hangs the program forever at this point
                    //I think better to move on, as already printed out the failure, maybe some time later it will work
            //LOOP_FOREVER();
        }
    
        CLI_Write((_u8 *)" Line 1774 Device is configured in default state \n\r");    //LH line 3
    
        /*
         * Initializing the CC3100 device
         * Assumption is that the device is configured in station mode already
         * and it is in its default state
         */
        retVal = sl_Start(0, 0, 0);
        if ((retVal < 0) ||
            (ROLE_STA != retVal) )
        {
            CLI_Write((_u8 *)" Line 1785 Failed to start the device \n\r");
            // 5-24-2020, I don't see the value of LOOP_FOREVER(); as this just hangs the program forever at this point
                    //I think better to move on, as already printed out the failure, maybe some time later it will work
            //LOOP_FOREVER();
        }
    
        CLI_Write((_u8 *)" Line 1791 Device started as STATION \n\r"); //LH line 4
    
        /* Connecting to WLAN AP */
        retVal = establishConnectionWithAP();
        if(retVal < 0)
        {
            CLI_Write((_u8 *)" Line 1797 Failed to establish connection w/ an AP \n\r");
            // 5-24-2020, I don't see the value of LOOP_FOREVER(); as this just hangs the program forever at this point
                    //I think better to move on, as already printed out the failure, maybe some time later it will work
            //LOOP_FOREVER();
        }
    
        CLI_Write(" Line 1803 Connection established w/ AP and IP is acquired \n\r"); //LH Line 5
    
    //8-2-2020 8:30 PM Does complete the above statement, then no further
    
        retVal = getHostIP();
        CLI_Write(" Line 1808 LH Just after get HostIP \n\r");
    
        if(retVal < 0)
        {
            CLI_Write((_u8 *)" Line 1812 Unable to get host IP\n\r\n\r");
            // 5-24-2020, I don't see the value of LOOP_FOREVER(); as this just hangs the program forever at this point
                    //I think better to move on, as already printed out the failure, maybe some time later it will work
            //LOOP_FOREVER();
        }
        appData.SockID = createConnection();
        CLI_Write(" Line 1818 LH Just after createConnection \n\r");
    
    // 5-24-2020, I don't see the value of LOOP_FOREVER(); as this just hangs the program forever at this point
    //I think better to move on, as already printed out the failure, maybe some time later it will work
    //    if(appData.SockID < 0)
            //LOOP_FOREVER();
    
            CLI_Write(" Line 1825 LH Just BEFORE getSNTPTTime... \n\r");
    
        retVal = getSNTPTime(GMT_TIME_ZONE_HR,GMT_TIME_ZONE_MIN);
    
           CLI_Write(" Line 1829 LH Just AFTER getSNTPTTime... \n\r");
    
    // 5-24-2020, I don't see the value of LOOP_FOREVER(); as this just hangs the program forever at this point
    //I think better to move on, as already printed out the failure, maybe some time later it will work
    //    if(retVal < 0)
            //LOOP_FOREVER();
    
        usiBreakDummy = 0;
        retVal = sl_Close(appData.SockID);
    
    // 5-24-2020, I don't see the value of LOOP_FOREVER(); as this just hangs the program forever at this point
    //I think better to move on, as already printed out the failure, maybe some time later it will work
    //    if(retVal < 0)
            //LOOP_FOREVER();
    
        usiBreakDummy = 0;
        retVal = disconnectFromAP();
        if(retVal < 0)
        {
            CLI_Write((_u8 *)" Line 1848 Failed to disconnect from the AP \n\r");
            // 5-24-2020, I don't see the value of LOOP_FOREVER(); as this just hangs the program forever at this point
                    //I think better to move on, as already printed out the failure, maybe some time later it will work
            //LOOP_FOREVER();
        }
    
    //LH added 7-31-2020
        usiBreakDummy = 0;
        retVal = sl_Stop(SL_STOP_TIMEOUT);
    
        return 0;
    }
    
    
    //******End of Application Function called from main*************
    
    
    
    
    /*
     * ASYNCHRONOUS EVENT HANDLERS -- Start
     */
    //LH-8-1-2020 copied from get-time-LH, duplicate in email.c above
    ///*!
    //    \brief This function handles WLAN events
    //
    //    \param[in]      pWlanEvent is the event passed to the handler
    //
    //    \return         None
    //
    //    \note
    //
    //    \warning
    //*/
    //void SimpleLinkWlanEventHandler(SlWlanEvent_t *pWlanEvent)
    //{
    //    if(pWlanEvent == NULL)
    //    {
    //        CLI_Write(" [WLAN EVENT] NULL Pointer Error \n\r");
    //        return;
    //    }
    //
    //    switch(pWlanEvent->Event)
    //    {
    //        case SL_WLAN_CONNECT_EVENT:
    //        {
    //            SET_STATUS_BIT(g_Status, STATUS_BIT_CONNECTION);
    //
    //            /*
    //             * Information about the connected AP (like name, MAC etc) will be
    //             * available in 'slWlanConnectAsyncResponse_t' - Applications
    //             * can use it if required
    //             *
    //             * slWlanConnectAsyncResponse_t *pEventData = NULL;
    //             * pEventData = &pWlanEvent->EventData.STAandP2PModeWlanConnected;
    //             *
    //             */
    //        }
    //        break;
    //
    //        case SL_WLAN_DISCONNECT_EVENT:
    //        {
    //            slWlanConnectAsyncResponse_t*  pEventData = NULL;
    //
    //            CLR_STATUS_BIT(g_Status, STATUS_BIT_CONNECTION);
    //            CLR_STATUS_BIT(g_Status, STATUS_BIT_IP_ACQUIRED);
    //
    //            pEventData = &pWlanEvent->EventData.STAandP2PModeDisconnected;
    //
    //            /* If the user has initiated 'Disconnect' request, 'reason_code' is SL_USER_INITIATED_DISCONNECTION */
    //            if(SL_WLAN_DISCONNECT_USER_INITIATED_DISCONNECTION == pEventData->reason_code)
    //            {
    //                CLI_Write((_u8 *)" Device disconnected from the AP on application's request \n\r"); //LH Line 11, last line
    //            }
    //            else
    //            {
    //                CLI_Write((_u8 *)" Device disconnected from the AP on an ERROR..!! \n\r");
    //            }
    //        }
    //        break;
    //
    //        default:
    //        {
    //            CLI_Write((_u8 *)" [WLAN EVENT] Unexpected event \n\r");
    //        }
    //        break;
    //    }
    //}
    
    
    //LH-8-1-2020 copied from get-time-LH, duplicate in email.c above
    ///*!
    //    \brief This function handles events for IP address acquisition via DHCP
    //           indication
    //
    //    \param[in]      pNetAppEvent is the event passed to the handler
    //
    //    \return         None
    //
    //    \note
    //
    //    \warning
    //*/
    //void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *pNetAppEvent)
    //{
    //    if(pNetAppEvent == NULL)
    //    {
    //        CLI_Write(" [NETAPP EVENT] NULL Pointer Error \n\r");
    //        return;
    //    }
    //
    //    switch(pNetAppEvent->Event)
    //    {
    //        case SL_NETAPP_IPV4_IPACQUIRED_EVENT:
    //        {
    //            SET_STATUS_BIT(g_Status, STATUS_BIT_IP_ACQUIRED);
    //
    //            /*
    //             * Information about the connected AP's IP, gateway, DNS etc
    //             * will be available in 'SlIpV4AcquiredAsync_t' - Applications
    //             * can use it if required
    //             *
    //             * SlIpV4AcquiredAsync_t *pEventData = NULL;
    //             * pEventData = &pNetAppEvent->EventData.ipAcquiredV4;
    //             * <gateway_ip> = pEventData->gateway;
    //             *
    //             */
    //        }
    //        break;
    //
    //        default:
    //        {
    //            CLI_Write((_u8 *)" [NETAPP EVENT] Unexpected event \n\r");
    //        }
    //        break;
    //    }
    //}
    
    //LH-8-1-2020 copied from get-time-LH, duplicate in email.c above
    ///*!
    //    \brief This function handles callback for the HTTP server events
    //
    //    \param[in]      pHttpEvent - Contains the relevant event information
    //    \param[in]      pHttpResponse - Should be filled by the user with the
    //                    relevant response information
    //
    //    \return         None
    //
    //    \note
    //
    //    \warning
    //*/
    //void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *pHttpEvent,
    //                                  SlHttpServerResponse_t *pHttpResponse)
    //{
    //    /*
    //     * This application doesn't work with HTTP server - Hence these
    //     * events are not handled here
    //     */
    //    CLI_Write((_u8 *)" [HTTP EVENT] Unexpected event \n\r");
    //}
    
    //LH-8-1-2020 copied from get-time-LH, duplicate in email.c above
    ///*!
    //    \brief This function handles general error events indication
    //
    //    \param[in]      pDevEvent is the event passed to the handler
    //
    //    \return         None
    //*/
    //void SimpleLinkGeneralEventHandler(SlDeviceEvent_t *pDevEvent)
    //{
    //    /*
    //     * Most of the general errors are not FATAL are to be handled
    //     * appropriately by the application
    //     */
    //    CLI_Write((_u8 *)" [GENERAL EVENT] \n\r");
    //}
    
    //LH-8-1-2020 copied from get-time-LH, duplicate in email.c above
    ///*!
    //    \brief This function handles socket events indication
    //
    //    \param[in]      pSock is the event passed to the handler
    //
    //    \return         None
    //*/
    //void SimpleLinkSockEventHandler(SlSockEvent_t *pSock)
    //{
    //    if(pSock == NULL)
    //    {
    //        CLI_Write(" [SOCK EVENT] NULL Pointer Error \n\r");
    //        return;
    //    }
    //
    //    switch( pSock->Event )
    //    {
    //        case SL_SOCKET_TX_FAILED_EVENT:
    //        {
    //            /*
    //            * TX Failed
    //            *
    //            * Information about the socket descriptor and status will be
    //            * available in 'SlSockEventData_t' - Applications can use it if
    //            * required
    //            *
    //            * SlSockEventData_u *pEventData = NULL;
    //            * pEventData = & pSock->socketAsyncEvent;
    //            */
    //            switch( pSock->socketAsyncEvent.SockTxFailData.status )
    //            {
    //                case SL_ECLOSE:
    //                    CLI_Write((_u8 *)" [SOCK EVENT] Close socket operation failed to transmit all queued packets\n\r");
    //                break;
    //
    //
    //                default:
    //                    CLI_Write((_u8 *)" [SOCK EVENT] Unexpected event \n\r");
    //                break;
    //            }
    //        }
    //        break;
    //
    //        default:
    //            CLI_Write((_u8 *)" [SOCK EVENT] Unexpected event \n\r");
    //        break;
    //    }
    //}
    /*
     * ASYNCHRONOUS EVENT HANDLERS -- End
     */
    
    
    
    /*!
        \brief Convert integer to ASCII in decimal base
    
        \param[in]      cNum - integer number to convert
    
        \param[OUT]     cString - output string
    
        \return         number of ASCII characters
    
        \warning
    */
    static _u16 itoa(_i16 cNum, _u8 *cString)
    {
        _u16 length = 0;
        _u8* ptr = NULL;
        _i16 uTemp = cNum;
    
        /* value 0 is a special case */
        if (cNum == 0)
        {
            length = 1;
            *cString = '0';
    
            return length;
        }
    
        /* Find out the length of the number, in decimal base */
        length = 0;
        while (uTemp > 0)
        {
            uTemp /= 10;
            length++;
        }
    
        /* Do the actual formatting, right to left */
        uTemp = cNum;
        ptr = cString + length;
        while (uTemp > 0)
        {
            --ptr;
            *ptr = digits[uTemp % 10];
            uTemp /= 10;
        }
    
        return length;
    }
    
    /*!
        \brief Get the required data from the server.
    
        \param[in]      gmt_hr - GMT offset hours
    
        \param[in]      gmt_min - GMT offset minutes
    
        \return         0 on success, -ve otherwise
    
        \warning
    */
    static _i32 getSNTPTime(_i16 gmt_hr, _i16 gmt_min)
    {
        /*
                                    NTP Packet Header:
    
    
               0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9  0  1
              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
              |LI | VN  |Mode |    Stratum    |     Poll      |   Precision    |
              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
              |                          Root  Delay                           |
              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
              |                       Root  Dispersion                         |
              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
              |                     Reference Identifier                       |
              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
              |                                                                |
              |                    Reference Time-stamp (64)                    |
              |                                                                |
              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
              |                                                                |
              |                    Originate Time-stamp (64)                    |
              |                                                                |
              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
              |                                                                |
              |                     Receive Time-stamp (64)                     |
              |                                                                |
              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
              |                                                                |
              |                     Transmit Time-stamp (64)                    |
              |                                                                |
              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
              |                 Key Identifier (optional) (32)                 |
              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
              |                                                                |
              |                                                                |
              |                 Message Digest (optional) (128)                |
              |                                                                |
              |                                                                |
              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        */
    
        SlSockAddrIn_t  LocalAddr;
        SlSockAddr_t Addr;
    
        _u8    dataBuf[MAX_BUF_SIZE];
        _i32     retVal = -1;
        _i16     AddrSize = 0;
    
        /* For time zone with negative GMT value, change minutes to negative for
         * computation */
        if(gmt_hr < 0 && gmt_min > 0)
            gmt_min = gmt_min * (-1);
    
        sl_Memset(dataBuf, 0, sizeof(dataBuf));
        dataBuf[0] = '\x1b';
    
        Addr.sa_family = AF_INET;
        /* the source port */
        Addr.sa_data[0] = 0x00;
        Addr.sa_data[1] = 0x7B;    /* 123 */
        Addr.sa_data[2] = (_u8)((appData.DestinationIP >> 24) & 0xff);
        Addr.sa_data[3] = (_u8)((appData.DestinationIP >> 16) & 0xff);
        Addr.sa_data[4] = (_u8)((appData.DestinationIP >> 8) & 0xff);
        Addr.sa_data[5] = (_u8) (appData.DestinationIP & 0xff);
    
        retVal = sl_SendTo(appData.SockID, dataBuf, sizeof(dataBuf), 0,
                         &Addr, sizeof(Addr));
        if (retVal != sizeof(dataBuf))
        {
            /* could not send SNTP request */
            CLI_Write((_u8 *)" Line 2211 Device couldn't send SNTP request\n\r\n\r");
            ASSERT_ON_ERROR(SNTP_SEND_ERROR);
        }
    
        AddrSize = sizeof(SlSockAddrIn_t);
        LocalAddr.sin_family = SL_AF_INET;
        LocalAddr.sin_port = 0;
        LocalAddr.sin_addr.s_addr = 0;
    
        retVal = sl_Bind(appData.SockID,(SlSockAddr_t *)&LocalAddr, AddrSize);
        if(retVal < 0)
            ASSERT_ON_ERROR(retVal);
    
        retVal = sl_RecvFrom(appData.SockID, dataBuf, sizeof(dataBuf), 0,
                           (SlSockAddr_t *)&LocalAddr,  (SlSocklen_t*)&AddrSize);
        if (retVal <= 0)
        {
            CLI_Write((_u8 *)" Line 2228 Device couldn't receive time information \n\r");
            ASSERT_ON_ERROR(SNTP_RECV_ERROR);
        }
    
        if ((dataBuf[0] & 0x7) != 4)    /* expect only server response */
        {
            /* MODE is not server, abort */
            CLI_Write((_u8 *)" Line 2235 Device is expecting response from server only!\n\r");
            ASSERT_ON_ERROR(SNTP_SERVER_RESPONSE_ERROR);
        }
        else
        {
            _u8 index;
    
            appData.elapsedSec = dataBuf[40];
            appData.elapsedSec <<= 8;
            appData.elapsedSec += dataBuf[41];
            appData.elapsedSec <<= 8;
            appData.elapsedSec += dataBuf[42];
            appData.elapsedSec <<= 8;
            appData.elapsedSec += dataBuf[43];
    
            appData.elapsedSec -= TIME2013;
    
            /* correct the time zone */
            appData.elapsedSec += (gmt_hr * SEC_IN_HOUR);
            appData.elapsedSec += (gmt_min * SEC_IN_MIN);
    
            appData.ccPtr = &appData.time[0];
    
            /* day */
    //        appData.sGeneralVar = appData.elapsedSec/SEC_IN_DAY;
            appData.sGeneralVar = (appData.elapsedSec + 172800) /SEC_IN_DAY; //LH Day of week 2 days behind due to leap years
    
            //This fixed the Day of week, but then re-broke the Date number
            pal_Memcpy(appData.ccPtr, daysOfWeek2013[appData.sGeneralVar%7], 3);
    //Day of the week
            usiDayOfWeekGetTime = appData.sGeneralVar%7;
    /* Tuesday is the 1st day in 2013 - the relative year */
    //const _u8 daysOfWeek2013[7][3] = {{"Tue"},    // 0 = Tuesday
    //                                   {"Wed"},   // 1 = Wednesday
    //                                   {"Thu"},   // 2 = Thursday
    //                                   {"Fri"},   // 3 = Friday
    //                                   {"Sat"},   // 4 = Saturday
    //                                   {"Sun"},   // 5 = Sunday
    //                                   {"Mon"}};  // 6 = Monday
            appData.sGeneralVar = appData.elapsedSec /SEC_IN_DAY; //LH restore the sGeneralVar so date calculates correctly
    
            appData.ccPtr += 3;
            *appData.ccPtr++ = '\x20';
    
            /* month */
            appData.sGeneralVar %= 365;
            for (index = 0; index < 12; index++)
            {
                appData.sGeneralVar -= numOfDaysPerMonth[index];
                if (appData.sGeneralVar < 0)
                    break;
            }
    
            pal_Memcpy(appData.ccPtr, monthOfYear[index], 3);
    //Month of the Year
            usiMonthOfYearGetTime = index + 1; //See Reference table at top of Get time section, Array starts at zero, so if want normal mth # add 1
            appData.ccPtr += 3;
            *appData.ccPtr++ = '\x20';
    
            /* date */
            /* restore the day in current month*/
            appData.sGeneralVar += numOfDaysPerMonth[index];
            appData.ccLen = itoa(appData.sGeneralVar + 1, appData.ccPtr); //Calls function itoa integer to ASCII decimal
            //LH Convert integer to ASCII in decimal base; param[in] cNum - integer number to convert
            //param[OUT] cString - output string; \return  number of ASCII characters
            //So at this point uGeneralVar must be a 2 digit integer that contains the day of the month
    //Day of the Month
            usiDayOfMonthGetTime = appData.sGeneralVar +1; //note this is s not u  GeneralVar; Had to add the +1 like above, not sure why but do
            usiBreakDummy = 0;
    
            appData.ccPtr += appData.ccLen;
            *appData.ccPtr++ = '\x20';
    
            /* year */
            /* number of days since beginning of 2013 */
            appData.uGeneralVar = appData.elapsedSec/SEC_IN_DAY;
            appData.uGeneralVar /= 365;
            appData.ccLen = itoa(YEAR2013 + appData.uGeneralVar , appData.ccPtr); //So this would be 2013 + 7 = 2020, so uGeneralVar must = # incr yr after 2013
            appData.ccPtr += appData.ccLen;
            *appData.ccPtr++ = '\x20';
    //Year
            usiYearGetTime = YEAR2013 + appData.uGeneralVar;
    
            /* time */
            appData.uGeneralVar = appData.elapsedSec%SEC_IN_DAY;
            /* number of seconds per hour */
            appData.uGeneralVar1 = appData.uGeneralVar%SEC_IN_HOUR;
            appData.uGeneralVar /= SEC_IN_HOUR;               /* number of hours */
            appData.ccLen = itoa(appData.uGeneralVar, appData.ccPtr);   //LH believe Hrs to Char
            //So at this point uGeneralVar must be a 2 digit integer that contains hours
            usiBreakDummy = 0;
    //Hours
            usiHrsGetTime = appData.uGeneralVar;
            usiBreakDummy = 0;
    
            appData.ccPtr += appData.ccLen;
            *appData.ccPtr++ = ':';                                     //LH believe colon between Hr and Min
            /* number of minutes per hour */
            appData.uGeneralVar = appData.uGeneralVar1/SEC_IN_MIN;
            /* number of seconds per minute */
            appData.uGeneralVar1 %= SEC_IN_MIN;
            appData.ccLen = itoa(appData.uGeneralVar, appData.ccPtr);   //LH believe minutes to Char
            //So at this point uGeneralVar must be a 2 digit integer that contains minutes
    //Minutes
            usiMinutesGetTime = appData.uGeneralVar;
            usiBreakDummy = 0;
    
            appData.ccPtr += appData.ccLen;
            *appData.ccPtr++ = ':';                                     //LH believe colon between Min and Sec
            appData.ccLen = itoa(appData.uGeneralVar1, appData.ccPtr);  //LH believe seconds to Char
            //So at this point uGeneralVar1 must be a 2 digit integer that contains seconds
    //Seconds
            usiSecondsGetTime = appData.uGeneralVar1;
            usiBreakDummy = 0;
    
            appData.ccPtr += appData.ccLen;
            *appData.ccPtr++ = '\x20';
    
            *appData.ccPtr++ = '\0';
    
            CLI_Write((_u8 *)"\r\n Server "); //LH Line 7
            CLI_Write((_u8 *)SNTPserver);
            CLI_Write((_u8 *)" Line 2346 has responded with time information");
            CLI_Write((_u8 *)"\n\r\r\n ");  //LH Line 8 which is blank
            CLI_Write((_u8 *)appData.time);  //LH when look at time structure it only uses 23 of the 30 elements in the structure; Line 9 with the time
            CLI_Write((_u8 *)"\n\r\r\n");   //LH line 10 which is a blank line
    
            //time element 16 HrTens, element 17 HrUnits; element 19 MinTens, element 20 MinUnits, element 22 SecTens, element 23 SecUnits
            //LH added 7-31-2020
            //CLI is set up for characters, so it prints the characters but not the integers
    //        CLI_Write((_u8 *)"\r\n usiDayOfMonth:  ");
    //        CLI_Write((_u8 *)usiDayOfMonth);
    //        CLI_Write((_u8 *)"\r\n usiHrs:  ");
    //        CLI_Write((_u8 *)usiHrs);
    //        CLI_Write((_u8 *)"\r\n usiMinutes:  ");
    //        CLI_Write((_u8 *)usiMinutes);
    //        CLI_Write((_u8 *)"\r\n usiDayOfMonth:  ");
    //        CLI_Write((_u8 *)usiSeconds);
    //printf compiles and runs but no seen on the console, not sure were it has gone to
    //        printf("\r\n usiDayOfMonth: %d", usiDayOfMonth);
    //        printf("\r\n usiHrs: %d", usiHrs);
    //        printf("\r\n usiMinutes: %d", usiMinutes);
    //        printf("\r\n usiSeconds: %d", usiSeconds);
    
        }
    
        return SUCCESS;
    }
    
    /*!
        \brief Create UDP socket to communicate with server.
    
        \param[in]      none
    
        \return         Socket descriptor for success otherwise negative
    
        \warning
    */
    static _i32 createConnection()
    {
        _i32 sd = 0;
    
        sd = sl_Socket(SL_AF_INET, SL_SOCK_DGRAM, IPPROTO_UDP);
        if( sd < 0 )
        {
            CLI_Write((_u8 *)"Error creating socket\n\r\n\r");
        }
    
        return sd;
    }
    
    /*!
        \brief Gets the Server IP address
    
        \param[in]      none
    
        \return         zero for success and -1 for error
    
        \warning
    */
    static _i32 getHostIP()
    {
        _i32 status = 0;
        appData.DestinationIP = 0;
    
        status = sl_NetAppDnsGetHostByName((_i8*)SNTPserver, pal_Strlen(SNTPserver),
                                           &appData.DestinationIP, SL_AF_INET);
        ASSERT_ON_ERROR(status);
    
        return SUCCESS;
    }

    电子邮件 GetTime.h 99% TI WiFi 代码、增添了应用功能调用

    /* L Hinz Group LLC
     * email.h - email header file
     *
     * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
     *
     *
     * All rights reserved. Property of Texas Instruments Incorporated.
     * Restricted rights to use, duplicate or disclose this code are
     * granted through contract.
     *
     * The program may not be used without the written permission of
     * Texas Instruments Incorporated or against the terms and conditions
     * stipulated in the agreement under which this program has been supplied,
     * and under no circumstances can it be used with non-TI connectivity device.
     *
     */
    
    #include "simplelink.h"
    
    #ifndef __EMAIL_H__
    #define __EMAIL_H__
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    /* SMTP defines */
    #define SMTP_BUF_LEN               100
    
    /* NetApp Email set/get options */
    #define NETAPP_ADVANCED_OPT        (1)
    #define NETAPP_SOURCE_EMAIL        (2)
    #define NETAPP_PASSWORD            (3)
    #define NETAPP_DEST_EMAIL          (4)
    #define NETAPP_SUBJECT             (5)
    #define NETAPP_MESSAGE             (6)
    
    #define MAX_DEST_EMAIL_LEN         30
    #define MAX_USERNAME_LEN           30
    #define MAX_PASSWORD_LEN           30
    //5-28-2020 LH Change Max subject length to 64
    //#define MAX_SUBJECT_LEN            30
    #define MAX_SUBJECT_LEN            64
    #define MAX_MESSAGE_LEN            64
    #define BASEKEY_LEN                128
    
    #define MAX_EMAIL_RCF_LEN        (MAX_DEST_EMAIL_LEN + 2)
    
    /* NetApp Email protocol types */
    #define SL_NET_APP_SMTP_PROTOCOL    (1)
    typedef struct
    {
        _u32  ProtocolSubType;
        _u32  Port;
        _u32  Family;
        _u32  SecurityMethod;
        _u32  SecurityCypher;
        _u32  Ip;                     /* IPv4 address or IPv6 first 4 bytes */
        _u32  Ip1OrPaadding;
        _u32  Ip2OrPaadding;
        _u32  Ip3OrPaadding;
    }SlNetAppEmailOpt_t;
    
    typedef struct
    {
        _u8 Username[MAX_USERNAME_LEN];
    }SlNetAppSourceEmail_t;
    
    typedef struct
    {
        _u8 Password[MAX_PASSWORD_LEN];
    }SlNetAppSourcePassword_t;
    
    typedef struct
    {
        _u8 Email[MAX_DEST_EMAIL_LEN];
    }SlNetAppDestination_t;
    
    typedef struct
    {
        _u8 Value[MAX_SUBJECT_LEN];
    }SlNetAppEmailSubject_t;
    
    //LH 8-2-2020 getting errors that appData is not defined so try pasting it here, I added the word typedef in front to make it the same
    //typedef struct{
    //Taking the word typedef off gave a clean compile.....why do not know
    struct{
        _u32   DestinationIP;
        _u32   elapsedSec;
        _u32   uGeneralVar;
        _u32   uGeneralVar1;
    
        _u16   ccLen;
    
        _i32   SockID;
        _i32   sGeneralVar;
    
        _u8 time[30];  //LH time is a structure with 30 elements so it can display a string like this Tue Oct 10 2018 11:26:13
        _u8 *ccPtr;
    
    }appData;
    
    
    
    
    /*!
        \brief          This function handles WLAN events
    
        \param[in]      command -   Command sent for processing
        \param[in]      pValueLen - Length of data to be processed
        \param[in]      pValue -    Data to be processed
    
        \return         0 for success, -1 otherwise
    
        \note
    
        \warning
    */
    _i32 sl_NetAppEmailSet(_u8 command, _u8 pValueLen,
                          _u8 *pValue);
    
    /*!
        \brief          Create a secure socket and connects to SMTP server
    
        \param[in]      none
    
        \return         0 if success and negative in case of error
    
        \note
    
        \warning
    */
    _i32 sl_NetAppEmailConnect();
    
    /*!
        \brief          Checks the connection status and sends the Email
    
        \param[in]      none
    
        \return         0 if success otherwise -1
    
        \note
    
        \warning
    */
    _i32 sl_NetAppEmailSend();
    
    //LH added
    
    //void LHSendEmail (void);
    int LHSendEmail ();
    int LHGetTime (); //8-1-2020
    
    //From main
    extern volatile signed short usiGMTOffsetHrSet;
    
    //From myTimers
    extern char LHemailSubject[64];
    extern char LHemailBody[64];
    
    
    //End of ...//LH added
    
    #ifdef  __cplusplus
    }
    #endif /* __cplusplus */
    
    #endif /* __NETAPP_H__ */

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    不能对 CC3100或 CC3200使用 STARTTLS SMTP 命令。 这些第1代器件缺少可将打开的非 TLS 套接字(纯 TCP 套接字)升级至 TLS 套接字的功能支持。 因此、您无法在 CC3100中使用 STARTTLS 命令。 StartTLS 是一个在升级到 TLS 之前发送的 SMTP 命令。 唯一方法是在 MSP430上使用 TLS 堆栈。 这可能很难实现。 不是来自资源不足、这是因为有些 MSP430具有更大的存储器(例如 MSP430F5/6)、而 MSP430是16位 MCU。 几乎所有 SSL/TLS 堆栈都是针对32位 MCU 设计的。 将 TLS 代码从32位重写至16位架构需要大量的加密专业知识。 我使用第二代器件 CC3220。 此器件支持将套接字从不安全升级到安全(TLS)。 因此、我在将 STARTLS 用于 SMTP 时没有问题。

    1rst 与第二代器件之间的重要差异(供您参考)包括:

    • CC3x00不支持将套接字从不安全升级到安全
    • CC3x20支持更多的密码套件

    在我的 SMTP 实现中、我仅设置 TLS 1.2模式(SL_SO_SEC_METHOD_TLSv1_2)、对于密码套件、我使用默认掩码。 我不确定您的问题是否可能是 CC3100不支持的密码套件造成的(这在上面的日志中未明确说明)。 这是您需要确定的关键事项。 这意味着您是否能够打开与 Gmail 服务器的 TLS 连接(从 sl_Connect ()返回代码) 。 如果您将能够打开 TLS 连接、您的问题将缩小到 SMTP 库代码或 Gmail 帐户设置。 但是、如果您将无法建立开放 TLS 连接、那就不会有简单的解决方案。

    以下是我不认为您的问题与 CC3100支持的密码套件相关的原因。 CC3100支持 SL_SEC_MASK_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA根据此 Gmail 支持页面(2023年3月)、支持 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA 和 TLS_RSA_WITH_AES_256_CBC_SHA。 这意味着根据 Google 文档、CC3100应为密码套件提供支持。

    BTW:您是否已在您的 GOOLE 帐户中正确配置安全-这意味着配置了应用程序密码?

    1月

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    -感谢 Jan 我们真诚地感谢您的帮助。

    -我们也认为此次对话会使我确信遇到同样问题的其他 TI 客户受益。

    -谢谢 正在确认 而对于 Gmail,我们使用的是正确的 "安全方法" " Cypher Suite"。

    - 是的、我们使用的是 Gmail AP 密码。 这是我们在2022年进行的更新、"发送电子邮件"再次起作用。

    -如下所述,我相信您的问题的答案是 sl_connect 不成功,因为我们得到了返回代码-111。

    -最重要的问题:

    "TI 发送电子邮件"代码已在多个微控制器和应用程序领域工作了9年以上。 所以我们并不是在尝试修复从未奏效的代码。 什么更改了? 我们知道 Gmail 和其他电子邮件服务已宣布不再支持不太安全的 APPS. 我们知道去年的应用密码允许 TI CC3100和微控制器继续工作。 2023年1月、Gmail 显然作出了一项未知更改、现在阻止 CC3100发送电子邮件。 我们知道、您可以使用较新的设备、并且仍然可以通过 Gmail 发送电子邮件。 问题是:是否可以对 TI CC3100 SDK-1.3.0代码进行更改、该更改也使其能够正常工作?

    以下是包含内联评论的三个附件、但我先将摘要粘贴到此处、以便我的评论不会丢失在较长的附加文本中。 我的上一篇文章中附有完整的 TI"emailAndGetTime.c"和"emailAndGetTime.h"。 这些是在代码运行时向您显示变量值的提取。  

    附件1: Tera Term CLI 该输出显示通过 TI 代码发送电子邮件

    我们添加了许多 CLI 行、因此我们可以清楚地看到"发送电子邮件"逐步执行所有 TI Simplelink 代码。 五颗星 工作时间超过9年的 TI 示例代码、而不是我们的代码****。

     

    附件2: sl_NetAppEmailSet () 停止。

    第159行 电子邮件端口为587 并且所有电子邮件参数均设置为预期/指定值。

    五颗星 注:端口是********587 **** 注:端口是********587 **** 注意端口是***** 587***

    附件3: smtpConnect()

    接下来、代码转至 smtpConnect。

    为什么现在使用端口80? 或者端口80只是服务器的 SMTP 通用端口,然后它告诉它比它想使用电子邮件端口587吗?

    状态返回代码为-111

     

    研究

    当连接远程 SMTP 服务器时出现问题时、会出现 SMTP 111错误。 例如、您可能会遇到该错误 无效的发件人域或防火墙问题。

    此外、由于登录凭据无效或电子邮件发送端口被收件人阻止、您可能会遇到111错误。

    解决方案-以下是解决方法

    1. 首先、确保您要向其发送电子邮件的电子邮件地址拼写正确(尤其是域名)。 例如、如果您将电子邮件发送到 Gmail 域、请确保该域为" gmail.com.""
    2. 然后,确保为 SMTP 身份验证提供了正确的用户名和密码。
    3. 最后,请确保电子邮件发送端口可供您使用,并确保该端口在收件人端被接受

    多个应用程序工作多年、因此上述所有内容都必须正确无误、从当天开始就被阻止了。

     

    附件1: Tera Term CLI 该输出显示通过 TI 代码发送电子邮件

     

    电子邮件应用程序-版本1.3.0

    **

     第881行器件配置为默认状态

     线路898设备已作为药柜启动

     第171行电子邮件用户名

     第180行电子邮件密码

     第159行电子邮件端口、安全性

     采集使用 AP 和 IP 建立的线路915连接

     线路918正在发送电子邮件...

     第189行电子邮件目标

     第1253行、位于...destination_email 后面

     第198行电子邮件主题

     第1265行... LHemailSubject 之后

     第208行:电子邮件正文

     行1278在...LHemailBody 之后

     如果 TLS 创建安全套接字、则_smtpConnect 中的第301行

     smtpConnect 套接字中的第306行

     连接到套接字之前、_smtpConnect 中的333行

     socket.c、_sl_Connect 中的第513行

     socket.c、_sl_BuildAddress 中的第95行

     socket.c 中的第554行_sl_Connect Verify_RET_OK

     连接到套接字后、_smtpConnect 中的行335

     如果 Status < 0 && SL_ESECSNOVERIFY!= Status、则_smtpConnect 中的第339行

     行1281在...Status = sl_NetAppEmailConnect ()之后

     第922行设备无法发送电子邮件

      RetVal = sl_WlanDisconnect ()之后_i32 disconnectFromAP ()中的第1488行;

      在 if (0 == RetVal)后面的_i32 disconnectFromAP ()中的第1490行

     应应用程序的请求、断开线路1011器件与 AP 的连接

     

    附文2.

    sl_NetAppEmailSet () 停止。

    第159行的 Email 端口为587、所有 Email 参数均设置为预期/指定值。

     

    _i32. sl_NetAppEmailSet (_u8命令、_u8 pValueLen、

                         _u8 *pValue)

       SlNetAppEmailOpt_t* pEmailOpt = 0;

       SlNetAppSourceEmail_t* pSourceEmail = NULL;

       SlNetAppSourcePassword_t* pSourcePassword = NULL;

       SlNetAppDestination_t* pDestinationEmail = NULL;

       SlNetAppEmailSubject_t* pSubject = NULL;

       开关 (命令)

       {

         情形 NETAPP_ADVANCED_OPT:

           pEmailOpt =(SlNetAppEmailOpt_t*) pValue;

           G_EmailOpt.Port = pEmailOpt->Port;

           G_EmailOpt.Family = pEmailOpt->Family;

           G_EmailOpt.SecurityMethod = pEmailOpt->SecurityMethod;

           G_EmailOpt.SecurityCypher = pEmailOpt->SecurityCypher;

           G_EmailOpt.IP = pEmailOpt->IP;

           G_EmailSetStatus++= 1;

           CLI_Write ("第159行电子邮件端口、安全性\n\r\n");//2-16-2023已添加并打印此文件

           中断

     

    附文3.

    smtpConnect()

    接下来、代码转至 smtpConnect。

    为什么现在使用端口80? 或者端口80只是服务器的 SMTP 通用端口,然后它告诉它比它想使用电子邮件端口587吗?

    状态返回代码为-111

     

    静态 _i32. _smtpConnect ( 空隙 )

       SlSockAddrIn_t LocalAddr;

       SlTimeval_t    tTimeout;

       _i32          密码= 0;

       _i32          LocalAddrSize = 0;

       i8           方法= 0;

       _i32           状态= 0;

     

       LocalAddr.sin_family = g_EmailOpt.Family;

       LocalAddr.sin_port = sl_Htons (g_EmailOpt.Port);

       LocalAddr.sin_addr.s_addr = sl_Htonl (g_EmailOpt.ip);

       LocalAddrSize = 大小 (SlSockAddrIn_t);

     

       /*如果需要 TLS */

       如果 (G_EmailOpt.SecurityMethod <= 5)

       {

           /*创建安全套接字*/

    smtpSocket 已= 80

           smtpSocket = SL_Socket (SL_AF_INET、SL_SOCK_STREAM、SL_SEC_SOCKET);

    smtpSocket 仍然 = 80

           assert_on_error (smtpSocket);

           tTimeout.tv_sec = 10;

           tTimeout.tv_usec = 90000;

           状态= sl_SetSockOpt (smtpsocket、SOL_SOCKET、SL_SO_RCVTIMEO、

                                  tTimeout (&T)、 大小 (SlTimeval_t));

           ASSERT_ON_ERROR (状态);

           方法= g_EmailOpt.SecurityMethod;

           cipher = g_EmailOpt.SecurityCypher;

           CLI_Write ("如果 TLS 创建安全套接字\n\r"、则_smtpConnect 中的第301行);

           /*设置刚刚定义的套接字选项*/

    smtpSocket = 80

           状态= SL_SetSockOpt (smtpsocket、SL_SOL_SOCKET、SL_SO_SECMETHOD、

                                  方法(&M)、 大小 (方法);

           CLI_Write ("_smtpConnect Set Socket 中的第306行\n\r");

    状态=-111

           如果 (状态<0)

           {

               sl_Close (smtpSocket);

               ASSERT_ON_ERROR (状态);

               CLI_Write ("_smtpConnect sl_Close smtpSocket 步骤1 \n\r\n"中的第311行);

           }

           状态= SL_SetSockOpt (smtpsocket、SL_SOL_SOCKET、SL_SO_SECURE_MASK、

                                  密码(&C)、 大小 (密码);

           如果 (状态<0)

           {

               sl_Close (smtpSocket);

               ASSERT_ON_ERROR (状态);

               CLI_Write ("_smtpConnect sl_Close smtpSocket 步骤2\n\r\n 中的第319行);

           }

       }

       /*如果不需要 TLS */

       方案

       {

           /*创建套接字*/

           smtpSocket = SL_Socket (SL_AF_INET、SL_SOCK_STREAM、SL_IPPROTO_TCP);

           assert_on_error (smtpSocket);

     

           CLI_Write ("在不需要 TLS 的情况下创建套接字\n\r"后、_smtpConnect 中的第329行);

       }

     

       /*连接至套接字*/

       CLI_Write ("连接到套接字前,_smtpConnect 中的第333行\n\r\n);

       状态= sl_Connect (smtpsocket、(SlSockAddr_t *)&LocalAddr、LocalAddrSize);

       CLI_Write ("连接到套接字后_smtpConnect 中的第335行\n\r\n);//2-16-2023可以打印此内容

     

       如果 (((Status < 0)&&(SL_ESECSNOVERIFY!= Status))

       {

           cli_Write ("_smtpConnect 中的第339行(如果 Status < 0 && SL_ESECSNOVERIFY!= Status \n\r\n); //2-16-2023打印此页

    //

    // 2023年1月30日,我得到了上面的 CLI 写入,但没有更多

    //显示连接到套接字不成功

    //下一个写我得到的是在914行

    //  

           ASSERT_ON_ERROR (状态);

           CLI_Write ("连接到套接字后_smtpConnect 状态中的第347行"\n");//2-16-2023不会执行此操作

       }

       CLI_Write ("在返回成功前,_smtpConnect 中的第349行\n\r\n");//2-16-2023不能执行此操作

       返回 成功;

    }

    我们希望这清楚地显示了 TI 发送电子邮件被阻止的位置。

     

    谢谢 Lorne

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Lorne:

    sl_Connet()中的错误-111通常意味着 CC3100无法打开 TCP (TLS)连接。 产生这个误差的原因可能很多。 一些线索可能会为您提供使用网络监听器(Wireshark 或成套)捕获的通信信息。 可能原因如下:

    • 基础设施(防火墙)或 ISP 连接问题
    • 远程服务器未响应或服务器域或端口设置错误
    • 代码中 TLS 或密码套件设置错误
    • Gmail 支持页面出现错误(不支持密码 TLS_RSA_WITH_AES_256_CBC_SHA)
    • CC3100与 TLS 连接存在某种兼容性问题

    重要提醒:

    • 您不能将端口587用于 Gmail ,因为此端口用于 STARTTLS。 您需要为 SSL/TLS - 465使用端口。 当您需要将 TLS 与使用普通 TCP 连接的端口(如端口587)一起使用时、很可能会出现错误代码-111。
    • 您是否已在 CC3100中上传最新 ServicePack?

    如需进一步调查、监听器需要捕获通信数据。 这一说法中的 NWP 日志可能也很有用。 但对于 NWP 日志的解码、您需要等待 TI 回答(我没有用于解码此日志的工具)。

    1月

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢 Jan 的回复、

    您非常乐于助人。 我希望这次对话能对很多其他的 TI 客户/用户有所帮助。

    我使用 Port 465和 TLS 已超过9年。 我尝试了587但感谢纠正我,我不应该尝试那个端口。

    使用端口465时、我得到了相同的误差-111。

    实际上、自昨天以来、我一直在想知道是否是 服务包级别可能是问题所在。 因此、在过去的24小时里、我一直在研究如何检查 Service Pack 级别、然后进行升级。

    我正在测试 CC3100BOOST、制造日期为2019年5月28日。 我看到有2021年服务包、所以确实需要升级。

    我已下载服务包 CC3100/CC3200服务包图像  

    版本:              1.0.1.15-2.14.0.0

    日期:                   2021年5月11日

    文件:

    - servicepack_1.0.1.15-2.14.0.0.bin

     

    此服务包映像仅可与生产器件配合使用。

    与此 ServicePack 兼容的芯片列表包括:

     CC3100R1

     CC3200R1

     

    1. 此服务包 0.1.15-2.14.0.0 应该的 与 CC3100BOOST 兼容、因为它具有 CC3100R1芯片。
    2. 可以从 Code Composer Studio 或仅从 CCS UniFlash 读取 CC3100BOOST 服务包级别吗?
    3. 我发现 UniFlash 8.2.0不支持 CC3100/CC3200、建议使用版本3.x
    4. 我已安装 CCS UniFlash 3.4中的变化。 然后会启动、我可以选择 CC3100、这样会打开一个编程 GUI。
    5. 通过 Google、我找到了 UniFlash v3快速入门指南(TI.com)
    6. 我已将 CC3100BOOST 安装在 CC3XXEMUBOOST 上、并且电源跳线已按规定设置。
    7. USB 连接到 CCXXEMUBOOST J6 USB 端口。 我在器件 COM 端口 CC3100BP 端口10、7、8和9下看到。 我认为 J6是正确的 USB 端口 。 我还尝试了 J5、相同的误差。
    8. 端口都是9、600波特、尝试19、200、但这也不起作用。 以上指南当然不提供这些信息。 我发现一个谷歌网站建议921600 ,但这也不起作用。
    9. 所需的波特率和其它端口设置是多少?

    我尝试了" 获取版本 "、"" 服务包编程 "、"" 列出文件系统 "所有这些都给出了错误

    [20:27:45]致命:--无法连接到设备! ——

    [20:27:47]致命错误:连接到设备时出错。 请检查 COM 端口设置。 错误代码:1.

     

    1. 我进行了广泛研究、但找不到详细的 CC31XXEMUBOOST 用户指南、因此我可以阅读 CC3100BOOST 服务包级别、然后将服务包更新到最新版本。

    有关如何使用 CC31XXEMUBOOST 的信息极其有限。

    1. 请确认以更新 CC3100服务包:
      1. 必须在 CCXXEMUBOOST 上安装 CC3100
      2. 使用 CCXXEMUBOOST 上的 J6 USB 连接器
      3. COM 端口波特率??? 和其它设置????
      4. CCS UNIFLASH 3.4是检查版本和更新 CC3100服务包的正确应用程序

    TI 的某些站点上必须提供有关如何阅读服务包级别和更新 CC3100上的服务包的分步指南。 USB 连接、端口配置、分步 GUI 步骤。

    这应该是如此简单………但显然我还没有找到正确的信息。

    我同意将 CC3100BOOST 加载到最新的服务包是要实现的第一个最重要的步骤。

    谢谢

    Lorne

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Lorne:

    在没有正确更新服务包的情况下使用 CC31xx 器件不是最好的做法。 器件可能会受到安全威胁和其他错误的影响。 即使您的 CC3100BOOST 是在2019年5月制造的、我也认为它会包含旧得多的 ServicePack、因为 TI 不会随附 CC3100BOOST 和最新的服务包。 更新服务包是最终用户的责任。

    • 要更新服务包、您需要使用 Uniflash 3.4版
    • 您可以通过 sl_ API 读取的服务包版本- sl_DevGet (SL_DEVICE_GENERAL_CONFIGURATION... 有关更多详细信息、请参阅SimpleLink CC3100/CC3200主机驱动程序指南中的说明可能还有另一个选项使用网页并获取 _ SL_G_V.A 等标签 Uniflash 命令"获取版本"不读取服务包的版本(仅读取硬件版本)。
    • 您将在此处找到 Uniflash 与 CC3100/CC3200器件的使用指南
    • 使用 CC3100BOOST + CC3XXEMUBOOST 是更新服务包的最直接方式。 您可以在此处找到一些详细信息
    • 我很久以前使用了 Uniflash 3.4、但我认为没有必要在任何地方设置波特率。 您只需设置正确的 COM 端口号。

    1月

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    大家好、Jan、再次感谢您的全力帮助。

    我本来应该考虑提前检查 Service Pack 级别、但我们当时希望这可以成为使 CC3100仍能发送电子邮件的解决方案。

    非常感谢提供指向其他文档的链接、以提供有关如何升级 Service Pack 的提示。

    我终于成功了 将最新服务包成功加载到2个不同的 CC3100BOOST 器件。

    ***不幸的是, CC3100仍然无法发送电子邮件。***我只在 Gmail 端口465上使用 TLS 测试过它。

    我认为、使用 TI CC3100器件发送电子邮件已不再可行、也无法解决。

    当然、仍然愿意接受您、TI 的其他人或其他客户/用户提出的任何其他想法、这些想法仍将使之成为可能。

    下面随附了2个大附件:1) CC3100的重要文档列表、2)关于如何升级 CC3100或 CC3200上的服务包的分步操作。

     

    1. 为帮助其他 TI 客户和用户、此处列出了 CC3100和 CC3100服务包更新的关键参考文档。

     

    CC3100服务包加载重要文档和重要数据项

    1. 《CC3100 SimpleLink WIFI 和物联网解决方案 BoosterPack 硬件用户指南》

    SWRU371B 2015年1月

    CC3100 SimpleLink Wi-Fi 和 IoT 解决方案 BoosterPack 硬件(修订版 B)

     

    -第7页: 8兆位 串行闪存、SO 1MB 串行闪存

    -第8页:按钮、LED、跳线设置; SW3、用于刷写固件

    -第15页: J6 (右侧 USB)端口, 端口3用于闪存编程

    -第16页: 列表中的第一个端口用于闪存编程

    -第16页:J5端口仅用于 TI 内部调试

    -第17页:为 CC3100BOOST 供电的 CCXXEMUBOOST 跳线

    -第19页:使用 FRAM Launchpad 供电的跳线和 USB

     

    1. SimpleLink WiFi CC3100、CC3200 UniFlash

    SWRU588 2020年6月

     《SimpleLink Wi-FiRegisteredCC3100、CC3200 UniFlash 用户指南》(TI.com)

     

    -第4页:刷写 CC3100BP 所需的 CC31XXEMUBOOST

    -第12页:仅波特率921600

    -第12页:表1:CC3100 Booster Pack 预闪存 FTDI

    # COM 端口= 2.

    COM 端口的读数= 下部 COM 端口

    编写上表: "理想情况下、评估板上的所有 FTDI 芯片组均已预闪存。"

    - 因此应该只看到2个 COM 端口并使用较低的端口。

    - Future Technology Devices International Limited 是一家苏格兰私营半导体设备公司,专门从事通用串行总线(USB)技术。 FTDI。 类型。 FTDI 芯片在 USB 适配器中用于连接到 RS232和并行 FIFO 硬件接口。

    -第12页:表1:CC3100 Booster Pack 非闪存 FTDI、

    # COM Ports =4,

    # of COM Port for Flashing =第三个 COM 端口

    -第13页:格式:请参阅 SWRU371B 第7页、CC3100 8Mbit、 1MB、因此选择1M 字节

    -第16页:服务包编程,列出4个简单的步骤

    -注意 COM 端口必须先输入

     

    1. 应用报告 CC3X00生产线指南

    SWRA658 Jan 2021

    https://www.ti.com/lit/an/swra658/swra658.pdf

    CC3x00量产线指南

    -第5页:CC3100编程选项

    -第6页: CC3100MOD 编程选项

    -第10页:通过 UART CC3100编程,使用 CC3100 UART 引脚

    -波特率: 921 600

    数据位: 8位

    -流量控制:无

    -奇偶校验:无

    -停止位: 1.

    -极性:正极

    -第13页:使用 UniFlash CC3100进行编程,使用 CC31XXEMUBOOST 的结构

     -***** UniFlash 启动时,它将提示用户重新启动设备*****

    -使用 CC3XXEMUBOOST USB J6,板的右侧

     

    1. 《CC3100 SimpleLink WiFi 和物联网解决方案入门指南》

    SWRU375 2018年5月

    CC3100 SimpleLink Wi-Fi 和 IoT 解决方案入门指南(修订版 D)

    -第6页和第7页:CC3XXEMUBOOST 和 CC3100跳线和连接

    -第8页: Windows 设备管理器显示4个 COM 端口

    -第13页:已移动跳线 J8、连接到 MSP430F5529时第一个引脚可见

     

    1. 《CC3100 CC3200 SimpleLink WiFi 网络处理器子系统编程人员指南》

    SWRU368 2014年6月

    CC3100/CC3200 SimpleLink Wi-Fi Internet-on-a-Chip 用户指南(修订版 C)(TI.com)

     

    -not key for Service Pack programming、但找到了另一个重要的 CC3100文档

     

     

    1. 为帮助其他 TI 客户和用户、此处提供了升级 CC3100服务包的分步方法。
    2. 下载并安装 CCS UniFlash 3.4、 UniFlash 8.2.0不支持 CC3100/CC3200、

         UNIFLASH 软件编程工具| TI.com

     

    1. 下载 CC3100服务包

    CC3100SDK 软件开发套件(SDK)| TI.com

    版本:      1.0.1.15-2.14.0.0

    日期:2021年5月11日

    文件:- servicepack_1.0.1.15-2.14.0.0.bin

     

    此服务包映像仅可与生产器件配合使用。

    与此 ServicePack 兼容的芯片列表包括:

     CC3100R1

     CC3200R1

     

    1. 配置 CC3XXEMUBOOST 和 CC31000BOOST 跳线并与器件配对

    -请参阅上面的文档1 "CC3100 SimpleLink WIFI 和物联网解决方案 BoosterPack 硬件用户指南"、SWRU371B 2015年1月

     

    1. 启动/启动 CCS UniFlash 3.4
      1. 点击"New Target Configuration"
      2. 从下拉列表中选择"CC3x Serial (UART) Interface"
      3. "Board or Device"(板或设备)将自动填充"SimpleLink Wifi CC3100/CC3200"
      4. 按 OK 这将打开 CC31xx/CC32xx 闪存设置和控制的 GUI
      5. 将显示:
        1. Comm 端口
        2. 格式
    • 工程师
    1. 服务包编程
    2. 图像编程
    3. 获取版本
    • 添加文件
    • 列出文件系统

     

    1. 从 CC3XXEMUBOOST J6端口连接 USB 电缆 (右侧)连接到您的 PC
    2. PC Windows 设置、设备管理器、端口

    -我想出了4个港口

               - CC3100BP 端口(COM10)

               - CC3100BP 端口(COM7)

               - CC3100BP 端口(COM8)

               - CC3100BP 端口(COM9)

    -下面的 TI 文档2显示要使用第三个端口。

    -我发现第3个端口不工作,我不得不使用第4个端口 COM9

    单击第4行,然后单击"Port Settings (端口设置)"选项卡

    -**** 将波特率更改为921、600、 和下文文件3所示的其他设置****

    -波特率: 921 600

    数据位: 8位

    -流量控制:无

    -奇偶校验:无

    -停止位: 1.

    -极性:正极

    -***** 对于确保完成并接受上述更改至关重要。 即在将其设置回并重新验证之后执行该操作。

    1. 返回到 CCS UniFlash GUI 屏幕、输入 COM 端口以匹配您的 COM 端口、在本例中为9
    2. CCS UniFlash GUI、单击"Format"
      1. 我发现它已设置为1 MB
      2. 请参阅 SWRU371B 2015第7页下面的文档1;是的、1MB 是正确的
    3. 单击"获取版本"
      1. 此步骤主要是确认与 CC3100BOOST 的连接正常工作

    [17:11:05]开始 getversion 的操作。

    [17:11:06]信息:>正在执行操作:连接

    [17:11:08]信息:设置中断信号

    [17:11:09] INFO:Detecting FTDI for device reset

    [17:11:10]信息:连接成功

    [17:11:10]信息:正在获取存储列表

    [17:11:10]信息:>正在执行操作: getversion

    [17:11:10]信息:阅读版本信息

    [17:11:10]信息:> 引导加载程序版本:2.0.4.0

    [17:11:10]信息:>正在执行操作:断开连接

    [17:11:10]操作已返回 getversion。

    1. 点击"Service Pack 编程"

    浏览到 Service Pack Bin 文件: servicepack_1.0.1.15-2.14.0.0.bin

    然后点击"OK"

    [17:41:26]开始 ServicePackProgramming 操作。

    [17:41:26]信息:>正在执行操作:连接

    [17:41:28]信息:设置中断信号

    [17:41:29] INFO:正在检测用于器件复位的 FTDI

    [17:41:30]信息:连接成功

    [17:41:30]信息:正在获取存储列表

    [17:41:30]信息:>正在执行操作: ServicePackProgramming

    [17:41:30] INFO:服务包文件的路径:C:/ti/CC3100_CC3200_ServicePack_1.0.1.15-2.14.0.0/servicepack_1.0.1.15-2.14.0.0.bin

    [17:41:30]信息:正在阅读版本信息

    [17:41:30] INFO:CC3100R Device Detected (检测到 CC3100R 设备)。

    [17:41:30] INFO:NWP/MAC/PHY 从 Service Pack 中下载的版本:

    [17:41:30]信息:  NWP 补丁版本:2.14.0.0

    [17:41:30]信息:  MAC 修补程序版本:1.6.0.2

    [17:41:30]信息:  PHY 补丁版本:1.0.3.37

    [17:41:30]信息:正在阅读版本信息

    [17:41:30]信息:器件 CC3100 ES1.33

    [17:41:30]信息:正在阅读版本信息

    [17:41:32]信息:正在下载大小为38868的文件"/sys/servicepack.ucf "

    [17:41:34]信息:

     

    新令牌为0x0

    [17:41:34]信息: 下载完成

    [17:41:34]信息:>正在执行操作:断开连接

    [17:41:34]操作 ServicePackProgramming 返回。

    1. 单击 ListFileSystem

    - 升级服务包不需要此步骤。 此处显示的目的是显示我的器件返回了什么。

    [17:16:36]开始 ListFileSystem 运行。

    [17:16:36] INFO:>正在执行操作:连接

    [17:16:38]信息:设置中断信号

    [17:16:39] INFO:正在检测用于器件复位的 FTDI

    [17:16:40]信息:连接成功

    [17:16:40]信息:正在获取存储列表

    [17:16:40]信息:>正在执行操作:初始化

    [17:16:40]信息:阅读版本信息

    [17:16:40]信息:器件 CC3100 ES1.33

    [17:16:40]信息:阅读版本信息

    [17:16:42] info:>正在执行操作: ListFileSystem

    [17:16:42]信息:正在提取文件系统信息...

    [17:16:42] INFO:串行闪存块大小:4096字节

    [17:16:42] INFO:串行闪存容量:        256块

     

    [17:16:42] INFO:文件 开始大小 失败 总大小文件 名

    [17:16:42] info:索引块[blks]     安全[blks]  

    [17:16:42] info:------------------

    [17:16:42] INFO:N/A  0    5 N/A 5                FATFS

    [17:16:42] info: 4    5    33   yes  66        /sys/servicepack.ucf

    [17:16:42] info: 6    71   5    yes  10         /tmp/phy.cal

    [17:16:42] info: 7    81   1    yes  2          /sys/stacfg.ini

    [17:16:42] info: 8    83   3    no 3            www/safe/about.html

    [17:16:42] info: 9    86   1    no 1            www/safe/overview.html

    [17:16:42] info: 10   87   2    no 2            www/safe/portal.html

    [17:16:42] info: 11   89   4    no 4            www/safe/setup.html

    [17:16:42] info: 12   93   1    no 1            www/safe/index.html

    [17:16:42] info: 13   94   1    no 1            www/safe/param_about.html

    [17:16:42] info: 14   95   1    no 1            www/safe/param_config.html

    [17:16:42] info: 15   96   1    no 1            www/safe/param_online.html

    [17:16:42] info: 16   97   1    no 1            www/safe/js/com.ti.tokenpoller.js.

    [17:16:42] info: 17   98   24   no 24           www/safe/js/jQuery-1.8.3.min.js.

    [17:16:42] info: 18   122  1    no 1            www/safe/js/jQuery.rwdimagemaps.min.js.

    [17:16:42] info: 19   123  1    no 1            www/safe/js/page-actions.js.

    [17:16:42] info: 20   124  1    no 1            www/safe/images/ti-logo.png

    [17:16:42] info: 21   125  1    no 1            www/safe/images/icon_l_html_a.png

    [17:16:42] info: 22   126  1    no 1            www/safe/images/tab-line.gif

    [17:16:42] info: 23   127  1    no 1            www/safe/images/ticom3-tab-left.gif

    [17:16:42] info: 24   128  1    no 1            www/safe/images/ticom3-tab-right.gif

    [17:16:42] info: 26   129  4    no 4            www/safe/images/hw-sbd.gif

    [17:16:42] info: 27   133  4    no 4            www/safe/images/sw-sbd.gif

    [17:16:42] info: 28   137  3    no 3            www/safe/css/style.css

    [17:16:42]信息:

    [17:16:42]信息:闪存使用

    [17:16:42] info:-------

    [17:16:42]信息:已用空间:140 块

    [17:16:42]信息:可用空间:116 块

    [17:16:42] info: Memory hole :[140-255]

    [17:16:42]信息:>正在执行操作:断开连接

    [17:16:43]操作列表文件系统返回。

     

    结束  

    Lorne

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    很遗憾、您无法使用电子邮件应用程序。

    111非常奇怪。 您似乎遇到了端口问题。

    如果您可以安排监听器日志、我们可以对此有更好的了解。

    如果主机上有足够的存储器、您可以在主机上添加 TLS 堆栈(例如 mbedTLS)、以避免旧器件的安全限制(如果这是阻止连接的原因、则-111与此无关)。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢 Kobi 的答复。

    这对 TI 和我的公司来说都没有带来很高的生产效率。  我们并不是在尝试调试我的代码。 我们正在尝试获取已使用了9年以上的 TI CC3100 SDK-1.3.0"发送电子邮件示例"来再次使用。

    我对100%的 TI 代码进行代码跟踪并将其发送给您和 TI 的其他人感到可笑。

    TI 需要使用 CC3100BOOST 将其安装在 F5529 Launch Pad 或 FR6989 Launch Pad 上、然后加载并运行 TI 电子邮件应用示例 。 您将看到以下输出。

     

    电子邮件应用程序-版本1.3.0

    ***

     行483 main.c confireSimpleLinkToDefaultState

     器件配置为默认状态

     器件作为工作站启动

     获取通过 AP 和 IP 建立的连接。

     正在发送电子邮件...

     第185行:email.c After...NETAPP_SUBJECT

     设备无法发送电子邮件

     

    然后、TI 电子邮件代码专家需要进行他们希望的所有跟踪、最终结果是两个选项之一:

    修复示例代码、以便现在可以再次发送电子邮件。 在此处发布修订后的代码、并更新 CC3100 SDK-1.3.0示例代码。

    或 B.如果从技术上讲、无法使用此器件、请将 CC3100网页和文档升级到状态 无法再发送电子邮件 。  (停止虚假广告)

    规格的更多信息 "如果这样、那就"、IFTTT.com 命令。 早期测试代码显示、使用附加 URL 中的数据执行 http PUT 会导致发送电子邮件。 在我们使其充分运行后、我们很高兴分享如何操作以及 CC3100的 http 代码。

     

    我们希望 TI 纠正您的发送电子邮件示例、但这种可信度正在持续到目前为止、TI 没有人实际运行您当前发布的电子邮件示例。

    Lorne

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    如果我正确理解,则问题是服务器拒绝的 SMTP 端口连接(-111)。 如果您看到其他情况、请告诉我。

    如果您可以提供空气监听器日志(显示连接尝试)和/或 NWP 日志(/cfs-file/__key/communityserver-discussions-components-files/968/CC3100-_2600_-CC3200-Capture-NWP-Logs-_2D00_-Texas-Instruments-Wiki.pdf)、我们可以验证是出现了这种情况还是其他因素阻止了连接。 这可能使我们能够提供修复。

    如前所述、我们不再支持 SMTP 示例。 从我看到的情况来看、CC3100似乎仍然支持连接框架(套接字和 TLS)、只需要更新电子邮件应用程序或 SMTP 堆栈。 正如 Jan 提到的、SMTP 相对简单(尽管我们在这里没有电子邮件代码专家)、如果您能找到其他堆栈实施、应该可以将其移植到 CC3100套接字上。 这是一个选项。 您的替代方法也同样好。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢 Kobi 的回复,

    因此、您的组织或产品组织中没有人拥有物理 CC3100BOOST 来对您的 TI 发送电子邮件示例进行物理测试和调试? TI Store 现已推出!

    正如我在上一篇文章中所述、对于 TI 工程师来说 、最高效的行动是采用物理 CC3100BOOST、将其安装在 F5529 Launch Pad 上并运行您的 TI CC-1.3.0 Send Email 示例、尝试向 Gmail、Outlook、任何其他免费的电子邮件服务发送电子邮件、 并收集您需要的所有日志。

    我可以尝试帮助您调试您的 TI 电子邮件示例。 (要求客户调试一个 TI 发布的示例、……奇怪的……、但愿意提供帮助。)

    我已下载上面列出的文档。 我有一个 CC3100BOOST 和一个 CC3XXEMUBOOST。 问题是、CC3XEMUBOOST 中没有要加载的 TI 示例代码来运行发送电子邮件示例、因此无法获取 NWP 日志。

    如果可以通过某种方法将 TI 发送电子邮件示例加载到 CCXXEMUBOOST 并运行、请建议执行此操作的详细步骤。

    是否有方法可以使用 F5529 LaunchPad 捕获 NWP 日志、请提供有关如何执行此操作的详细分步过程。

     

    谢谢

    Lorne

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我们乐意帮助调试有关现有代码的新问题(例如您面临的问题)。 但我们不会保留这个旧示例、也不计划通过修复来更新 SDK。

    我刚才向您发送了用于捕获 NWP 日志的指令。 您只需接收来自 CC3100的 UART 调试(引脚62)线路、进入 PC 上的终端应用程序(使用串行转 USB 转换器、例如 您可以使用 https://www.ti.com/tool/CC31XXEMUBOOST)。