void MQTT_Connect(char *username, char *password)
{
? ? MQTTPacket_connectData data = MQTTPacket_connectData_initializer;
? ? u32 len;
? ? u8 buf[200];
? ? data.clientID.cstring = "ch32v307";
? ? data.keepAliveInterval = 2000;
? ? data.cleansession = 1;
? ? data.username.cstring = username;
? ? data.password.cstring = password;
? ? len = MQTTSerialize_connect(buf,sizeof(buf),&data);
? ? Transport_SendPacket(buf,len);
}
熱門產(chǎn)品 :
CH397: 高集成度、低功耗USB網(wǎng)卡芯片