Open yangminglong opened 3 years ago
boolean AliyunIoTSDK::publishUser(const char *topicSuffix, const char *payload){ char topic[150]; strcpy(topic, ALINK_TOPIC_USER); return AliyunIoTSDK::publish(strcat(topic, topicSuffix), payload); } boolean AliyunIoTSDK::subscribeUser(const char *topicSuffix, poniter_fun fp){ char *topic = new char[150]; strcpy(topic, ALINK_TOPIC_USER); return AliyunIoTSDK::subscribe(strcat(topic, topicSuffix), fp); } boolean AliyunIoTSDK::unsubscribeUser(char *topicSuffix){ char *topic = new char[150]; strcpy(topic, ALINK_TOPIC_USER); return AliyunIoTSDK::unsubscribe(strcat(topic, topicSuffix)); }
new 是否需要 delete
void AliyunIoTSDK::begin(Client &espClient, const char *_productKey, const char *_deviceName, const char *_deviceSecret, const char *_region) { if (NULL != client) delete client; client = new PubSubClient(espClient); ... }
网络重连时,重新调用begin() 是否需要 delete client
if (NULL != client) delete client;
new 是否需要 delete
网络重连时,重新调用begin() 是否需要 delete client