Coder Social home page Coder Social logo

getInt and setInt about firebase-esp8266 HOT 4 CLOSED

mobizt avatar mobizt commented on May 24, 2024
getInt and setInt

from firebase-esp8266.

Comments (4)

mobizt avatar mobizt commented on May 24, 2024

All Firebase call functions return the operation status (boolean), true for success and false for failed.

To get data, you can use firebaseData.intData().

Check this example, for basic useage.

from firebase-esp8266.

MarijoVidovic avatar MarijoVidovic commented on May 24, 2024

So i have to use something like this for every int i read?

if (Firebase.getInt(firebaseData, path + "/Double/Data" + (i + 1))) { Serial.println("PASSED"); Serial.println("PATH: " + firebaseData.dataPath()); Serial.println("TYPE: " + firebaseData.dataType()); Serial.println("ETag: " + firebaseData.ETag()); Serial.print("VALUE: "); if (firebaseData.dataType() == "int") Serial.println(firebaseData.intData()); else if (firebaseData.dataType() == "float") Serial.println(firebaseData.floatData(), 5); else if (firebaseData.dataType() == "double") printf("%.9lf\n", firebaseData.doubleData()); else if (firebaseData.dataType() == "boolean") Serial.println(firebaseData.boolData() == 1 ? "true" : "false"); else if (firebaseData.dataType() == "string") Serial.println(firebaseData.stringData()); else if (firebaseData.dataType() == "json") Serial.println(firebaseData.jsonData()); Serial.println("------------------------------------"); Serial.println(); }

for my usage would be

if (Firebase.getInt(firebaseData, "DomeLED/Color/r" ){
if (firebaseData.dataType() == "int")
        R = (firebaseData.intData());
}

I have a bit hard time understanding this library :)
Sorry for obviously dumb question

from firebase-esp8266.

mobizt avatar mobizt commented on May 24, 2024

Yes, you can check the data type before get its value which ensure that you will not mis the resolution of numeric data in case of int, float and double.

In addition, the usual function e.g. myValue = MyFunction(); as in other Firebase library that returns the data directly is not good practice when it processes the http request and response tasks inside the function which can be failed, unreachable, invalid request or many error reasons which user will get undesired and questionable value from that function.

from firebase-esp8266.

MarijoVidovic avatar MarijoVidovic commented on May 24, 2024

Yes, you can check the data type before get its value which ensure that you will not mis the resolution of numeric data in case of int, float and double.

In addition, the usual function e.g. myValue = MyFunction(); as in other Firebase library that returns the data directly is not good practice when it processes the http request and response tasks inside the function which can be failed, unreachable, invalid request or many error reasons which user will get undesired and questionable value from that function.

Thank you i think i figure it out. It need a little effort but its good now. I wanted to avoid fingerprint so i used this library. Nice work and keep it up :)

from firebase-esp8266.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.