cc

Dependencies:   MQTTPacket FP

Committer:
badri_rym
Date:
Fri Jun 10 12:51:45 2022 +0000
Revision:
50:3a01977eeebc
Parent:
47:24f2bf2819a5
cc

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mapellil 47:24f2bf2819a5 1
mapellil 47:24f2bf2819a5 2 #if !defined(MQTTWIFI_H)
mapellil 47:24f2bf2819a5 3 #define MQTTWIFI_H
mapellil 47:24f2bf2819a5 4
mapellil 47:24f2bf2819a5 5 #include "MQTTmbed.h"
mapellil 47:24f2bf2819a5 6 #include "WiFiInterface.h"
mapellil 47:24f2bf2819a5 7 #include "MQTTSocket.h"
mapellil 47:24f2bf2819a5 8
mapellil 47:24f2bf2819a5 9 class MQTTWiFi : public MQTTSocket
mapellil 47:24f2bf2819a5 10 {
mapellil 47:24f2bf2819a5 11 public:
mapellil 47:24f2bf2819a5 12 MQTTWiFi(SpwfSAInterface &WiFiIntf, const char *ssid, const char *pass, nsapi_security_t security = NSAPI_SECURITY_NONE) : WiFi(WiFiIntf)
mapellil 47:24f2bf2819a5 13 {
mapellil 47:24f2bf2819a5 14 // eth.init(); // Use DHCP
mapellil 47:24f2bf2819a5 15 WiFi.connect(ssid, pass, security);
mapellil 47:24f2bf2819a5 16 }
mapellil 47:24f2bf2819a5 17
mapellil 47:24f2bf2819a5 18 SpwfSAInterface& getWiFi()
mapellil 47:24f2bf2819a5 19 {
mapellil 47:24f2bf2819a5 20 return WiFi;
mapellil 47:24f2bf2819a5 21 }
mapellil 47:24f2bf2819a5 22
mapellil 47:24f2bf2819a5 23 /* void reconnect()
mapellil 47:24f2bf2819a5 24 {
mapellil 47:24f2bf2819a5 25 WiFi.connect(); // nothing I've tried actually works to reconnect
mapellil 47:24f2bf2819a5 26 }
mapellil 47:24f2bf2819a5 27 */
mapellil 47:24f2bf2819a5 28 private:
mapellil 47:24f2bf2819a5 29
mapellil 47:24f2bf2819a5 30 SpwfSAInterface& WiFi;
mapellil 47:24f2bf2819a5 31
mapellil 47:24f2bf2819a5 32 };
mapellil 47:24f2bf2819a5 33
mapellil 47:24f2bf2819a5 34
mapellil 47:24f2bf2819a5 35 #endif