登录MQTT服务器bool mqtt_connect(unsigned char *buf, unsigned int buflen)
{
u32 len = 0;
MQTTPacket_connectData data = MQTTPacket_connectData_initializer;
data.clientID.csting = "me";
data.keepAliveInterval = 20;
data.cleansession = 1;
data.username.cstring = "testuser";
data.password.cstring = "testpassword";
len = MQTTSerialize_connect(buf, buflen, &data);
if(!transport_sendPacketBuffer(buf, len))
{
return 0;
}
return 1;
}
|
———————————————— 版权声明:本文为CSDN博主「根号九九六」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/u012698938/article/details/129163156