aboutsummaryrefslogtreecommitdiff
path: root/apps/SoilMoisture.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/SoilMoisture.h')
-rw-r--r--apps/SoilMoisture.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/apps/SoilMoisture.h b/apps/SoilMoisture.h
index b5a8749..99b698d 100644
--- a/apps/SoilMoisture.h
+++ b/apps/SoilMoisture.h
@@ -7,6 +7,8 @@ namespace trygvis {
namespace sensor {
using namespace trygvis::bluetooth;
+template <typename T>
+using o = boost::optional<T>;
enum class sm_cmd_code : uint8_t {
SM_CMD_GET_SENSOR_COUNT = 1,
@@ -32,14 +34,21 @@ public:
string getName(uint8_t sensor);
+ bool hasTemperatureSensor();
+
+ o<double> readTemperature();
+
private:
- SoilMoisture(shared_ptr<BluetoothGatt> gatt, BluetoothGattService &s, BluetoothGattCharacteristic &c);
+ SoilMoisture(const shared_ptr<BluetoothGatt> &gatt, BluetoothGattService &s,
+ const BluetoothGattCharacteristic &soilMoistureCharacteristic,
+ const o<const BluetoothGattCharacteristic &> temperatureCharacteristic);
- ByteBuffer writeAndRead(ByteBuffer &requestBytes);
+ ByteBuffer writeAndRead(const BluetoothGattCharacteristic &c, ByteBuffer &requestBytes);
shared_ptr<BluetoothGatt> gatt;
BluetoothGattService &s;
- BluetoothGattCharacteristic &c;
+ const BluetoothGattCharacteristic &soilMoistureCharacteristic;
+ const o<const BluetoothGattCharacteristic &> temperatureCharacteristic;
};
}
}