This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bluefruit.h> | |
// BLE | |
#define TX_POWER (4) // Transmission power in dBm (check bluefruit.h) | |
#define ENVIROMENTAL_SERVICE_UUID (0x181A) | |
#define HUMIDITY_CHARACTERISTIC_UUID (0x2A6F) | |
BLEDis bledis; // device information | |
BLEService bleEnvService = BLEService(ENVIROMENTAL_SERVICE_UUID); | |
BLECharacteristic bleHumidityC = BLECharacteristic(HUMIDITY_CHARACTERISTIC_UUID); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bluefruit.h> | |
#include <Arduino.h> | |
#include "Timer.h" | |
uint32_t vbat_pin = PIN_VBAT; // A7 for feather nRF52832, A6 for nRF52840 | |
int moistureSensorPin = A0; | |
const int IRRIGATION_VALVE_PIN = 12; | |
const int SENSOR_EN_PIN = 13; | |
#define DEBUG_MODE false // Enables or disable serial comunication |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env | |
var express = require('express'); | |
const http = require('http'); | |
var app = express(); | |
var exec = require('exec'); | |
const sensorMac = "<YOUR-DEVICE-MAC>"; | |
const batteryChar = "00002a19-0000-1000-8000-00805f9b34fb"; | |
const batteryHandler = "0x001b"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bluefruit.h> | |
#include <Adafruit_LittleFS.h> | |
#include <InternalFileSystem.h> | |
#include <Arduino.h> | |
uint32_t vbat_pin = PIN_VBAT; // A7 for feather nRF52832, A6 for nRF52840 | |
int moistureSensorPin = A0; | |
#define DEBUG_MODE true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline fun <reified FirebaseObject : FirebaseIdentifiableModel> FirebaseFirestore.getPaginatedFirebaseList( | |
path: String, | |
page: FirebasePage | |
): Single<List<FirebaseObject>> { | |
val firstDocumentMaybe = getFirstDocument(path, page) | |
return firstDocumentMaybe.isEmpty.flatMap { | |
return@flatMap if (it) { | |
Single.just(emptyList()) | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun FirebaseFirestore.getFirstDocument( | |
path: String, | |
page: FirebasePage | |
): Maybe<DocumentSnapshot> = Maybe.create { emitter -> | |
val collectionReference = collection(path) | |
.orderBy(page.orderBy, page.direction) | |
.limit(page.size * page.number + 1) | |
val listenerRegistration: ListenerRegistration = collectionReference.addSnapshotListener { querySnapshot, exception -> | |
querySnapshot?.run { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class MyFirebaseModel(val aProperty: Int):FirebaseIdentifiableModel() | |
firebaseFirestore.getFirebaseList<MyFirebaseModel>(path = "mymodel") | |
.map{ ... } // Maybe map to a non firebase specific model | |
.subscribeOn(...) | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline fun <reified FirebaseObject : FirebaseIdentifiableModel> FirebaseFirestore.getSimpleFirebaseList( | |
path: String | |
): Single<List<FirebaseObject>> = Single.create<List<FirebaseObject>> { emitter -> | |
val listenerRegistration: ListenerRegistration = collection(path).addSnapshotListener { querySnapshot, exception -> | |
querySnapshot?.run { | |
emitter.onSuccess(toFirebaseObjectList()) | |
} ?: exception?.run { | |
emitter.onError(this) | |
} ?: kotlin.run { emitter.onError(FirebaseUnexpectedException()) } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
... | |
def keys = new Properties() | |
file("../keys.properties").withInputStream { | |
stream -> keys.load(stream) | |
} | |
productFlavors { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
... | |
defaultConfig { | |
... | |
buildConfigField "String", "API_URL", "http://default-url.com" | |
buildConfigField "String", "THIRD_PARTY_API_KEY", "rAnDomKeYF0rS3rV1ce" | |
} | |
flavorDimensions "skin", "env" |