-
Notifications
You must be signed in to change notification settings - Fork 1
/
credential.ino
41 lines (37 loc) · 1.78 KB
/
credential.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <Arduino.h>
#include <MAGELLAN_MQTT.h>
#include <MAGELLAN_WiFi_SETTING.h> //optional you can using wifi connect with your own function
#define REGEN_BY_CONDITION false
WiFiClient WiFi_client;
MAGELLAN_MQTT magel(WiFi_client);
String SSID = "set_your_ssid";
String PASS = "set_your_password";
int checkStatusUpdate = UNKNOWN;
void setup()
{
Serial.begin(115200);
WiFiSetting.SSID = SSID; //optional wifi connection
WiFiSetting.PASS = PASS; //optional wifi connection
connectWiFi(WiFiSetting); //optional wifi connection
magel.begin(setting);
Serial.println("# Read Credential 1st time");
Serial.println("ThingIdentifier: "+ magel.credential.getThingIdentifier());
Serial.println("ThingSecret: "+ magel.credential.getThingSecret());
Serial.println("# Regenerate Credential");
magel.credential.regenerate(REGEN_BY_CONDITION); // if set true == will regenerate only credential activated, false regenerate without condition
Serial.println("# Read Credential 2nd time (After Regenerate)");
Serial.println("ThingIdentifier: "+ magel.credential.getThingIdentifier());
Serial.println("ThingSecret: "+ magel.credential.getThingSecret());
Serial.println("PreviousThingIdentifier: "+ magel.credential.getPreviousThingIdentifier());
Serial.println("PreviousThingSecret: "+ magel.credential.getPreviousThingSecret());
Serial.println("# Recovery Credential(swarp credential old to current)");
magel.credential.recovery();
Serial.println("ThingIdentifier: "+ magel.credential.getThingIdentifier());
Serial.println("ThingSecret: "+ magel.credential.getThingSecret());
Serial.println("PreviousThingIdentifier: "+ magel.credential.getPreviousThingIdentifier());
Serial.println("PreviousThingSecret: "+ magel.credential.getPreviousThingSecret());
}
void loop()
{
magel.loop();
}