Skip to content

Commit 50972f1

Browse files
committed
Applying code formatting to satisfy CI requirements
1 parent cf3c1be commit 50972f1

File tree

6 files changed

+57
-64
lines changed

6 files changed

+57
-64
lines changed

examples/ArduinoIoTCloud_ESP8266/ArduinoIoTCloud_ESP8266.ino

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/*
2-
* Minimal demo example how to connect with the
3-
* Arduino IoT Cloud and a ESP8266 based WiFi board.
4-
*/
1+
/*
2+
Minimal demo example how to connect with the
3+
Arduino IoT Cloud and a ESP8266 based WiFi board.
4+
*/
55

66
#include "arduino_secrets.h"
77
#include "thingProperties.h"
@@ -12,17 +12,17 @@
1212
void setup() {
1313

1414
pinMode(LED_BUILTIN, OUTPUT);
15-
15+
1616
Serial.begin(115200);
17-
17+
1818
/* Wait up to 5 seconds for user to open serial port */
1919
unsigned long serialBeginTime = millis();
2020
while (!Serial && (millis() - serialBeginTime > 5000));
2121

2222
initProperties();
23-
23+
2424
setDebugMessageLevel(DBG_INFO);
25-
25+
2626
ArduinoCloud.begin(ArduinoIoTPreferredConnection, ARDUINO_CLOUD_DEVICE_ID, ARDUINO_CLOUD_DEVICE_PASS);
2727
}
2828

src/ArduinoIoTCloud.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
#include <ArduinoIoTCloud.h>
1919

2020
#ifdef BOARD_HAS_ECCX08
21-
#include "utility/ECCX08Cert.h"
22-
#include <ArduinoECCX08.h>
21+
#include "utility/ECCX08Cert.h"
22+
#include <ArduinoECCX08.h>
2323
#elif defined(BOARD_ESP)
24-
#include "utility/Certificate.h"
24+
#include "utility/Certificate.h"
2525
#endif
2626

2727
#ifdef ARDUINO_ARCH_SAMD
@@ -30,10 +30,10 @@
3030
#endif
3131

3232
#ifdef BOARD_HAS_ECCX08
33-
const static int keySlot = 0;
34-
const static int compressedCertSlot = 10;
35-
const static int serialNumberAndAuthorityKeyIdentifierSlot = 11;
36-
const static int deviceIdSlot = 12;
33+
const static int keySlot = 0;
34+
const static int compressedCertSlot = 10;
35+
const static int serialNumberAndAuthorityKeyIdentifierSlot = 11;
36+
const static int deviceIdSlot = 12;
3737
#endif
3838

3939
const static int CONNECT_SUCCESS = 1;
@@ -61,9 +61,9 @@ ArduinoIoTCloudClass::ArduinoIoTCloudClass() :
6161
_connection(NULL),
6262
_thing_id(""),
6363
_sslClient(NULL),
64-
#ifdef BOARD_ESP
64+
#ifdef BOARD_ESP
6565
_certificate(MQTTS_UP_ARDUINO_CC_CERTIFICATE),
66-
#endif
66+
#endif
6767
_mqttClient(NULL),
6868
_lastSyncRequestTickTime(0),
6969
_stdinTopic(""),
@@ -93,7 +93,7 @@ ArduinoIoTCloudClass::~ArduinoIoTCloudClass() {
9393

9494
int ArduinoIoTCloudClass::begin(ConnectionHandler & connection,
9595
String device_id,
96-
String password,
96+
String password,
9797
String brokerAddress,
9898
uint16_t brokerPort) {
9999
_connection = &connection;
@@ -119,7 +119,7 @@ int ArduinoIoTCloudClass::begin(Client& net, String brokerAddress, uint16_t brok
119119
_brokerAddress = brokerAddress;
120120
_brokerPort = brokerPort;
121121

122-
#ifdef BOARD_HAS_ECCX08
122+
#ifdef BOARD_HAS_ECCX08
123123
byte deviceIdBytes[72];
124124
if (!ECCX08.begin()) {
125125
Debug.print(DBG_ERROR, "Cryptography processor failure. Make sure you have a compatible board.");
@@ -149,30 +149,30 @@ int ArduinoIoTCloudClass::begin(Client& net, String brokerAddress, uint16_t brok
149149
}
150150

151151
ArduinoBearSSL.onGetTime(getTime);
152-
#endif /* BOARD_HAS_ECCX08 */
152+
#endif /* BOARD_HAS_ECCX08 */
153153

154154
if (_sslClient) {
155155
delete _sslClient;
156156
_sslClient = NULL;
157157
}
158158

159-
#ifdef BOARD_HAS_ECCX08
159+
#ifdef BOARD_HAS_ECCX08
160160
if (_connection != NULL) {
161161
_sslClient = new BearSSLClient(_connection->getClient());
162162
} else {
163163
_sslClient = new BearSSLClient(*_net);
164164
}
165165
_sslClient->setEccSlot(keySlot, ECCX08Cert.bytes(), ECCX08Cert.length());
166-
#elif defined(BOARD_ESP)
166+
#elif defined(BOARD_ESP)
167167
_sslClient = new WiFiClientSecure();
168168
_sslClient->setTrustAnchors(&_certificate);
169-
#endif
169+
#endif
170170

171171
_mqttClient = new MqttClient(*_sslClient);
172172

173-
#ifdef BOARD_ESP
173+
#ifdef BOARD_ESP
174174
_mqttClient->setUsernamePassword(_device_id, _password);
175-
#endif
175+
#endif
176176

177177
mqttClientBegin();
178178

@@ -203,7 +203,7 @@ void ArduinoIoTCloudClass::mqttClientBegin() {
203203
}
204204

205205
int ArduinoIoTCloudClass::connect() {
206-
206+
207207
if (!_mqttClient->connect(_brokerAddress.c_str(), _brokerPort)) {
208208
return CONNECT_FAILURE;
209209
}

src/ArduinoIoTCloud.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,12 @@ class ArduinoIoTCloudClass {
214214

215215
ArduinoCloudThing Thing;
216216

217-
#ifdef BOARD_HAS_ECCX08
217+
#ifdef BOARD_HAS_ECCX08
218218
BearSSLClient *_sslClient;
219-
#elif defined(BOARD_ESP)
219+
#elif defined(BOARD_ESP)
220220
WiFiClientSecure *_sslClient;
221221
X509List _certificate;
222-
#endif
222+
#endif
223223

224224
MqttClient *_mqttClient;
225225
int _lastSyncRequestTickTime;

src/CloudSerial.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020

2121
#include <Arduino.h>
2222
#if defined(ARDUINO_ESP8266_ESP12) || defined(ARDUINO_ARCH_ESP32) || defined(ESP8266)
23-
#include "utility/RingBuffer.h"
23+
#include "utility/RingBuffer.h"
2424
#else
25-
#include <RingBuffer.h>
25+
#include <RingBuffer.h>
2626
#endif
2727

2828
#define CLOUD_SERIAL_TX_BUFFER_SIZE 64

src/utility/Certificate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
#ifndef BOARD_HAS_ECCX08
2424

25-
static const char MQTTS_UP_ARDUINO_CC_CERTIFICATE[] = \
25+
static const char MQTTS_UP_ARDUINO_CC_CERTIFICATE[] = \
2626
"-----BEGIN CERTIFICATE-----\n" \
2727
"MIIFqzCCBJOgAwIBAgIQBG1R1P7yNtWlrHgjD6LbzDANBgkqhkiG9w0BAQsFADBG\n" \
2828
"MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRUwEwYDVQQLEwxTZXJ2ZXIg\n" \

src/utility/RingBuffer.h

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,15 @@
3131
#define SERIAL_BUFFER_SIZE 64
3232

3333
template <int N>
34-
class RingBufferN
35-
{
34+
class RingBufferN {
3635
public:
3736
uint8_t _aucBuffer[N] ;
3837
volatile int _iHead ;
3938
volatile int _iTail ;
4039

4140
public:
42-
RingBufferN( void ) ;
43-
void store_char( uint8_t c ) ;
41+
RingBufferN(void) ;
42+
void store_char(uint8_t c) ;
4443
void clear();
4544
int read_char();
4645
int available();
@@ -56,40 +55,36 @@ typedef RingBufferN<SERIAL_BUFFER_SIZE> RingBuffer;
5655

5756

5857
template <int N>
59-
RingBufferN<N>::RingBufferN( void )
60-
{
61-
memset( _aucBuffer, 0, N ) ;
62-
clear();
58+
RingBufferN<N>::RingBufferN(void) {
59+
memset(_aucBuffer, 0, N) ;
60+
clear();
6361
}
6462

6563
template <int N>
66-
void RingBufferN<N>::store_char( uint8_t c )
67-
{
64+
void RingBufferN<N>::store_char(uint8_t c) {
6865
int i = nextIndex(_iHead);
6966

7067
// if we should be storing the received character into the location
7168
// just before the tail (meaning that the head would advance to the
7269
// current location of the tail), we're about to overflow the buffer
7370
// and so we don't write the character or advance the head.
74-
if ( i != _iTail )
75-
{
71+
if (i != _iTail) {
7672
_aucBuffer[_iHead] = c ;
7773
_iHead = i ;
7874
}
7975
}
8076

8177
template <int N>
82-
void RingBufferN<N>::clear()
83-
{
78+
void RingBufferN<N>::clear() {
8479
_iHead = 0;
8580
_iTail = 0;
8681
}
8782

8883
template <int N>
89-
int RingBufferN<N>::read_char()
90-
{
91-
if(_iTail == _iHead)
84+
int RingBufferN<N>::read_char() {
85+
if (_iTail == _iHead) {
9286
return -1;
87+
}
9388

9489
uint8_t value = _aucBuffer[_iTail];
9590
_iTail = nextIndex(_iTail);
@@ -98,43 +93,41 @@ int RingBufferN<N>::read_char()
9893
}
9994

10095
template <int N>
101-
int RingBufferN<N>::available()
102-
{
96+
int RingBufferN<N>::available() {
10397
int delta = _iHead - _iTail;
10498

105-
if(delta < 0)
99+
if (delta < 0) {
106100
return N + delta;
107-
else
101+
} else {
108102
return delta;
103+
}
109104
}
110105

111106
template <int N>
112-
int RingBufferN<N>::availableForStore()
113-
{
114-
if (_iHead >= _iTail)
107+
int RingBufferN<N>::availableForStore() {
108+
if (_iHead >= _iTail) {
115109
return N - 1 - _iHead + _iTail;
116-
else
110+
} else {
117111
return _iTail - _iHead - 1;
112+
}
118113
}
119114

120115
template <int N>
121-
int RingBufferN<N>::peek()
122-
{
123-
if(_iTail == _iHead)
116+
int RingBufferN<N>::peek() {
117+
if (_iTail == _iHead) {
124118
return -1;
119+
}
125120

126121
return _aucBuffer[_iTail];
127122
}
128123

129124
template <int N>
130-
int RingBufferN<N>::nextIndex(int index)
131-
{
125+
int RingBufferN<N>::nextIndex(int index) {
132126
return (uint32_t)(index + 1) % N;
133127
}
134128

135129
template <int N>
136-
bool RingBufferN<N>::isFull()
137-
{
130+
bool RingBufferN<N>::isFull() {
138131
return (nextIndex(_iHead) == _iTail);
139132
}
140133

0 commit comments

Comments
 (0)