Skip to content

Commit 7ea6fc7

Browse files
committed
Add external serial logs for begin op
1 parent 93f0e7e commit 7ea6fc7

File tree

12 files changed

+64
-16
lines changed

12 files changed

+64
-16
lines changed

examples/ESP32/ActionsHandling/ActionsHandling.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ void setup() {
8181
syncTimeFromNtp();
8282

8383
// begin the bytebeam client
84-
Bytebeam.begin();
84+
if(!Bytebeam.begin()) {
85+
Serial.println("Bytebeam Client Initialization Failed.");
86+
} else {
87+
Serial.println("Bytebeam Client is Initialized Successfully.");
88+
}
8589

8690
// add the handler for hello world led action
8791
Bytebeam.addActionHandler(HelloWorld_Hanlder, "HelloWorld");

examples/ESP32/BasicOTA/BasicOTA.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ void setup() {
6161
syncTimeFromNtp();
6262

6363
// begin the bytebeam client
64-
Bytebeam.begin();
64+
if(!Bytebeam.begin()) {
65+
Serial.println("Bytebeam Client Initialization Failed.");
66+
} else {
67+
Serial.println("Bytebeam Client is Initialized Successfully.");
68+
}
6569

6670
// check if OTA is enabled or disabled for your device
6771
bool OTAStatus = Bytebeam.isOTAEnabled();

examples/ESP32/BasicOTA_GSM/BasicOTA_GSM.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,11 @@ void setup() {
130130
syncTimeFromNtp();
131131

132132
// begin the bytebeam client
133-
Bytebeam.begin(&modem);
133+
if(!Bytebeam.begin(&modem)) {
134+
Serial.println("Bytebeam Client Initialization Failed.");
135+
} else {
136+
Serial.println("Bytebeam Client is Initialized Successfully.");
137+
}
134138

135139
// check if OTA is enabled or disabled for your device
136140
bool OTAStatus = Bytebeam.isOTAEnabled();

examples/ESP32/CloudLogging/CloudLogging.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ void setup() {
9696
syncTimeFromNtp();
9797

9898
// begin the bytebeam client
99-
Bytebeam.begin();
99+
if(!Bytebeam.begin()) {
100+
Serial.println("Bytebeam Client Initialization Failed.");
101+
} else {
102+
Serial.println("Bytebeam Client is Initialized Successfully.");
103+
}
100104

101105
// check if cloud logging is enabled or disabled for your device
102106
bool cloudLoggingStatus = Bytebeam.isCloudLoggingEnabled();

examples/ESP32/EspTouch/EspTouch.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ void setup() {
132132
syncTimeFromNtp();
133133

134134
// begin the bytebeam client
135-
Bytebeam.begin();
135+
if(!Bytebeam.begin()) {
136+
Serial.println("Bytebeam Client Initialization Failed.");
137+
} else {
138+
Serial.println("Bytebeam Client is Initialized Successfully.");
139+
}
136140
}
137141

138142
void loop() {

examples/ESP32/PublishChipTemperature/PublishChipTemperature.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ void setup() {
132132
syncTimeFromNtp();
133133

134134
// begin the bytebeam client
135-
Bytebeam.begin();
135+
if(!Bytebeam.begin()) {
136+
Serial.println("Bytebeam Client Initialization Failed.");
137+
} else {
138+
Serial.println("Bytebeam Client is Initialized Successfully.");
139+
}
136140
}
137141

138142
void loop() {

examples/ESP32/PushData/PushData.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,11 @@ void setup() {
125125
syncTimeFromNtp();
126126

127127
// begin the bytebeam client
128-
Bytebeam.begin();
128+
if(!Bytebeam.begin()) {
129+
Serial.println("Bytebeam Client Initialization Failed.");
130+
} else {
131+
Serial.println("Bytebeam Client is Initialized Successfully.");
132+
}
129133
}
130134

131135
void loop() {

examples/ESP32/SetupClient/SetupClient.ino

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,13 @@ void setup() {
6868
//
6969

7070
// This method will initialize and start the bytebeam client
71-
// You can over-ride the default file system and file name options, if needed
72-
// eg. Bytebeam.begin(BytebeamArduino::LITTLEFS_FILE_SYSTEM, "/my_device_config.json")
73-
Bytebeam.begin();
71+
// You can over-ride the default file system, file name and library logging options, if needed
72+
// eg. Bytebeam.begin(BytebeamArduino::LITTLEFS_FILE_SYSTEM, "/my_device_config.json", BytebeamLogger::LOG_INFO)
73+
if(!Bytebeam.begin()) {
74+
Serial.println("Bytebeam Client Initialization Failed.");
75+
} else {
76+
Serial.println("Bytebeam Client is Initialized Successfully.");
77+
}
7478

7579
//
7680
// If above call is successfull then your bytebeam client is now configured for the use

examples/ESP32/SetupClient_GSM/SetupClient_GSM.ino

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,13 @@ void setup() {
137137
//
138138

139139
// This method will initialize and start the bytebeam client
140-
// You can over-ride the default file system and file name options, if needed
141-
// eg. Bytebeam.begin(&modem, BytebeamArduino::LITTLEFS_FILE_SYSTEM, "/my_device_config.json")
142-
Bytebeam.begin(&modem);
140+
// You can over-ride the default file system, file name and library logging options, if needed
141+
// eg. Bytebeam.begin(BytebeamArduino::LITTLEFS_FILE_SYSTEM, "/my_device_config.json", BytebeamLogger::LOG_INFO)
142+
if(!Bytebeam.begin(&modem)) {
143+
Serial.println("Bytebeam Client Initialization Failed.");
144+
} else {
145+
Serial.println("Bytebeam Client is Initialized Successfully.");
146+
}
143147

144148
//
145149
// If above call is successfull then your bytebeam client is now configured for the use

examples/ESP32/ToggleLED/ToggleLED.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,11 @@ void setup() {
169169
setupLED();
170170

171171
// begin the bytebeam client
172-
Bytebeam.begin();
172+
if(!Bytebeam.begin()) {
173+
Serial.println("Bytebeam Client Initialization Failed.");
174+
} else {
175+
Serial.println("Bytebeam Client is Initialized Successfully.");
176+
}
173177

174178
// add the handler for toggle led action
175179
Bytebeam.addActionHandler(ToggleLED_Hanlder, "ToggleLED");

0 commit comments

Comments
 (0)