Skip to content

Implement modem (attempt 3) #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
cb7f768
Merge pull request #83 from ed7coyne/modem-impl2
ed7coyne Apr 15, 2016
1c693cc
add travis
proppy Apr 16, 2016
44f561a
travis: language cpp + container
proppy Apr 16, 2016
b9388b6
travis: bump gcc to 4.9
proppy Apr 16, 2016
704dc4e
travis: add compiler
proppy Apr 16, 2016
842b869
travis: add matrix
proppy Apr 16, 2016
9555b2d
travis: add script
proppy Apr 16, 2016
3450993
travis: fix env
proppy Apr 16, 2016
3139edf
travis: run test
proppy Apr 16, 2016
d74c0b7
travis: before script export
proppy Apr 16, 2016
6df8233
Merge pull request #85 from proppy/travis
proppy Apr 16, 2016
051d325
Revert "Implement modem (attempt 2)"
proppy Apr 16, 2016
7c7c57d
Merge pull request #86 from googlesamples/revert-83-modem-impl2
proppy Apr 16, 2016
3c9e58f
Revert "add travis integration"
proppy Apr 16, 2016
bc5c40e
Merge pull request #87 from googlesamples/revert-85-travis
proppy Apr 16, 2016
57362d4
travis: build esp8266
proppy Apr 16, 2016
161882f
travis: list home dir
proppy Apr 16, 2016
ea8ae54
travis: list arduino dir
proppy Apr 16, 2016
47af6e7
travis: switch to arduino-builder
proppy Apr 16, 2016
1316cbe
travis: fix env
proppy Apr 16, 2016
9d6324a
travis: remove hardcoded version
proppy Apr 16, 2016
a8a616a
travis: fetch esp core
proppy Apr 16, 2016
f571d1d
travis: fix esp8266 get.py invocation
proppy Apr 16, 2016
e224bb0
travis: remove after_install
proppy Apr 16, 2016
733d4ac
travis: fix libraries symlinks
proppy Apr 16, 2016
450565f
travis: fix cwd
proppy Apr 16, 2016
451d0f1
travis: add staging and nightly
proppy Apr 16, 2016
ee9644c
Merge pull request #88 from proppy/travis-esp
proppy Apr 16, 2016
24d0f82
firebase: fix ctors
proppy Apr 16, 2016
e1bc354
Merge pull request #89 from proppy/fix-ctor
proppy Apr 19, 2016
8e81a0e
Imported all from modem-impl2
ed7coyne Apr 22, 2016
ecbefd2
Copied over Firebase.{cc,h} changes
ed7coyne Apr 22, 2016
1128e67
Added back auth() and fixed begin-command to use new Firebase constru…
ed7coyne Apr 22, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: c
sudo: false
env:
- ARDUINO_VERSION=1.6.8 ARDUINO_ESP8266_VERSION=2.1.0 ARDUINO_ROOT=${HOME}/arduino-${ARDUINO_VERSION} ARDUINO_ESP8266_ROOT=${ARDUINO_ROOT}/hardware/esp8266com/esp8266 ARDUINO_HOME=${HOME}/Arduino
- ARDUINO_VERSION=1.6.8 ARDUINO_ESP8266_VERSION=2.2.0-rc1 ARDUINO_ROOT=${HOME}/arduino-${ARDUINO_VERSION} ARDUINO_ESP8266_ROOT=${ARDUINO_ROOT}/hardware/esp8266com/esp8266 ARDUINO_HOME=${HOME}/Arduino
- ARDUINO_VERSION=nightly ARDUINO_ESP8266_VERSION=master ARDUINO_ROOT=${HOME}/arduino-${ARDUINO_VERSION} ARDUINO_ESP8266_ROOT=${ARDUINO_ROOT}/hardware/esp8266com/esp8266 ARDUINO_HOME=${HOME}/Arduino
install:
- ( cd ${HOME} && curl -O https://downloads.arduino.cc/arduino-${ARDUINO_VERSION}-linux64.tar.xz && tar xvf arduino-${ARDUINO_VERSION}-linux64.tar.xz )
- git clone --branch ${ARDUINO_ESP8266_VERSION} https://github.com/esp8266/Arduino.git ${ARDUINO_ESP8266_ROOT}
- ( cd ${ARDUINO_ESP8266_ROOT}/tools && python get.py )
before_script:
- mkdir -p ${ARDUINO_HOME}/libraries
- ( cd ${ARDUINO_HOME}/libraries && ln -s ${TRAVIS_BUILD_DIR} firebase-arduino && ln -s ${TRAVIS_BUILD_DIR}/src/third-party/arduino-json-5.1.1 ArduinoJson )
script:
- ${ARDUINO_ROOT}/arduino-builder -verbose -hardware ${ARDUINO_ROOT}/hardware/ -tools ${ARDUINO_ESP8266_ROOT}/tools/ -tools ${ARDUINO_ROOT}/tools-builder/ -fqbn esp8266com:esp8266:nodemcuv2 -libraries ${ARDUINO_HOME}/libraries/ -prefs build.flash_ld=${ARDUINO_ESP8266_ROOT}/tools/sdk/ld/eagle.flash.4m.ld -prefs build.flash_freq=40 -prefs build.flash_size=4M examples/FirebasePush_ESP8266/FirebasePush_ESP8266.ino
4 changes: 2 additions & 2 deletions examples/FirebasePush_ESP8266/FirebasePush_ESP8266.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include <Firebase.h>

// create firebase client.
Firebase fbase = Firebase("example.firebaseio.com")
.auth("secret_or_token");
Firebase fbase("example.firebaseio.com", "secret_or_token");

void setup() {
Serial.begin(9600);

Expand Down
11 changes: 3 additions & 8 deletions src/Firebase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,12 @@ String makeFirebaseURL(const String& path, const String& auth) {

} // namespace

Firebase::Firebase(const String& host) : host_(host) {
Firebase::Firebase(const String& host, const String& auth) : host_(host), auth_(auth) {
http_.reset(FirebaseHttpClient::create());
http_->setReuseConnection(true);
}

Firebase& Firebase::auth(const String& auth) {
auth_ = auth;
return *this;
}

const String& Firebase::auth() {
const String& Firebase::auth() const {
return auth_;
}

Expand Down Expand Up @@ -168,7 +163,7 @@ FirebasePush::FirebasePush(const String& host, const String& auth,
FirebaseHttpClient* http)
: FirebaseCall(host, auth, "POST", path, value, http) {
if (!error()) {
//name_ = json()["name"].as<const char*>();
name_ = json()["name"].as<const char*>();
}
}

Expand Down
9 changes: 2 additions & 7 deletions src/Firebase.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,9 @@ class FirebaseStream;
// Firebase REST API client.
class Firebase {
public:
explicit Firebase(const String& host);
Firebase& auth(const String& auth);
virtual ~Firebase() = default;
Firebase(const String& host, const String& auth = "");

Firebase(const Firebase&) = delete;

// Fetch auth string back.
const String& auth();
const String& auth() const;

// Fetch json encoded `value` at `path`.
FirebaseGet get(const String& path);
Expand Down
5 changes: 1 addition & 4 deletions src/modem/begin-command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ bool BeginCommand::execute(const String& command,
return false;
}

new_firebase_.reset(new Firebase(host));
if (auth.length() != 0) {
new_firebase_->auth(auth);
}
new_firebase_.reset(new Firebase(host, auth));

out->println("+OK");
return true;
Expand Down