1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-17 22:23:10 +03:00

Run new astyle formatter against libs Bridge, SpacebrewYun and Temboo

This commit is contained in:
Federico Fissore
2013-10-21 10:13:31 +02:00
parent b4c68b3dff
commit 00bdd3df03
19 changed files with 841 additions and 805 deletions

View File

@ -30,10 +30,14 @@ public:
// Methods to handle key/value datastore // Methods to handle key/value datastore
void put(const char *key, const char *value); void put(const char *key, const char *value);
void put(const String &key, const String &value) void put(const String &key, const String &value)
{ put(key.c_str(), value.c_str()); } {
put(key.c_str(), value.c_str());
}
unsigned int get(const char *key, uint8_t *buff, unsigned int size); unsigned int get(const char *key, uint8_t *buff, unsigned int size);
unsigned int get(const char *key, char *value, unsigned int maxlen) unsigned int get(const char *key, char *value, unsigned int maxlen)
{ get(key, reinterpret_cast<uint8_t *>(value), maxlen); } {
get(key, reinterpret_cast<uint8_t *>(value), maxlen);
}
// Trasnfer a frame (with error correction and response) // Trasnfer a frame (with error correction and response)
uint16_t transfer(const uint8_t *buff1, uint16_t len1, uint16_t transfer(const uint8_t *buff1, uint16_t len1,
@ -42,14 +46,20 @@ public:
uint8_t *rxbuff, uint16_t rxlen); uint8_t *rxbuff, uint16_t rxlen);
// multiple inline versions of the same function to allow efficient frame concatenation // multiple inline versions of the same function to allow efficient frame concatenation
uint16_t transfer(const uint8_t *buff1, uint16_t len1) uint16_t transfer(const uint8_t *buff1, uint16_t len1)
{ return transfer(buff1, len1, NULL, 0); } {
return transfer(buff1, len1, NULL, 0);
}
uint16_t transfer(const uint8_t *buff1, uint16_t len1, uint16_t transfer(const uint8_t *buff1, uint16_t len1,
uint8_t *rxbuff, uint16_t rxlen) uint8_t *rxbuff, uint16_t rxlen)
{ return transfer(buff1, len1, NULL, 0, rxbuff, rxlen); } {
return transfer(buff1, len1, NULL, 0, rxbuff, rxlen);
}
uint16_t transfer(const uint8_t *buff1, uint16_t len1, uint16_t transfer(const uint8_t *buff1, uint16_t len1,
const uint8_t *buff2, uint16_t len2, const uint8_t *buff2, uint16_t len2,
uint8_t *rxbuff, uint16_t rxlen) uint8_t *rxbuff, uint16_t rxlen)
{ return transfer(buff1, len1, buff2, len2, NULL, 0, rxbuff, rxlen); } {
return transfer(buff1, len1, buff2, len2, NULL, 0, rxbuff, rxlen);
}
static const int TRANSFER_TIMEOUT = 0xFFFF; static const int TRANSFER_TIMEOUT = 0xFFFF;

View File

@ -47,7 +47,9 @@ public:
size_t write(const uint8_t *buffer, size_t size); size_t write(const uint8_t *buffer, size_t size);
void flush(); void flush();
operator bool () { return connected(); } operator bool () {
return connected();
}
private: private:
BridgeClass &bridge; BridgeClass &bridge;

View File

@ -39,7 +39,9 @@ public:
unsigned int runShellCommand(const String &command); unsigned int runShellCommand(const String &command);
void runShellCommandAsynchronously(const String &command); void runShellCommandAsynchronously(const String &command);
operator bool () { return started; } operator bool () {
return started;
}
// Stream methods // Stream methods
// (read from process stdout) // (read from process stdout)

View File

@ -41,7 +41,9 @@ public:
virtual void flush(); virtual void flush();
// TODO: add optimized function for block write // TODO: add optimized function for block write
virtual operator bool () { return opened; } virtual operator bool () {
return opened;
}
YunClient& operator=(const YunClient &_x); YunClient& operator=(const YunClient &_x);

View File

@ -34,8 +34,12 @@ public:
virtual size_t write(uint8_t c); virtual size_t write(uint8_t c);
void listenOnLocalhost() { useLocalhost = true; } void listenOnLocalhost() {
void noListenOnLocalhost() { useLocalhost = false; } useLocalhost = true;
}
void noListenOnLocalhost() {
useLocalhost = false;
}
private: private:
uint16_t port; uint16_t port;

View File

@ -189,7 +189,9 @@ void SpacebrewYun::connect(String _server, int _port) {
if (_verbose) { if (_verbose) {
Serial.println(F("Brew started ")); Serial.println(F("Brew started "));
} }
while (!Console) { ; } while (!Console) {
;
}
} }
void SpacebrewYun::monitor() { void SpacebrewYun::monitor() {

View File

@ -44,8 +44,12 @@ class SpacebrewYun {
void addSubscribe(const String&, const String&); void addSubscribe(const String&, const String&);
void connect(String, int); void connect(String, int);
void connect() { connect(server, port); }; void connect() {
void connect(String _server) { connect(String(_server), port); }; connect(server, port);
};
void connect(String _server) {
connect(String(_server), port);
};
void monitor(); void monitor();
void onMessage(); void onMessage();
@ -54,11 +58,21 @@ class SpacebrewYun {
boolean connected(); boolean connected();
void send(const String&, const String&); void send(const String&, const String&);
void send(const String& name, char * value) { send(name, String(value)); } void send(const String& name, char * value) {
void send(const String& name, bool value){ send(name, (value ? String("true") : String("false"))); }; send(name, String(value));
void send(const String& name, int value) { send(name, String(value)); }; }
void send(const String& name, long value) { send(name, String(value)); }; void send(const String& name, bool value) {
void send(const String& name, float value) { send(name, String(value)); }; send(name, (value ? String("true") : String("false")));
};
void send(const String& name, int value) {
send(name, String(value));
};
void send(const String& name, long value) {
send(name, String(value));
};
void send(const String& name, float value) {
send(name, String(value));
};
void verbose(boolean); void verbose(boolean);