Skip to content

Commit

Permalink
[TerkinTelemetry] Renovations
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Jun 4, 2023
1 parent d734efa commit 36d417c
Show file tree
Hide file tree
Showing 19 changed files with 750 additions and 247 deletions.
1 change: 1 addition & 0 deletions doc/source/TerkinTelemetry
1 change: 1 addition & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Hiveeyes Arduino Firmwares
firmware/overview
BERadio/README
TerkinData/README
TerkinTelemetry/README
firmware-builder
project/index

Expand Down
3 changes: 2 additions & 1 deletion libraries/OpenHive/OpenHiveTemperatureArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
*
**/
#include "OpenHiveTemperatureArray.h"
#include "TerkinData.h"

using namespace OpenHive;

Expand Down Expand Up @@ -108,7 +109,7 @@ JsonObject& OpenHiveTemperatureArray::read_demo() {
// inside the data container for each frame
const char * OpenHiveTemperatureArray::get_name(int frame_number) {
/* Frame name builder, e.g. "frame-42" */
return (String("frame-") + String(frame_number)).c_str();
return (std::string("frame-") + TerkinUtil::to_string(frame_number)).c_str();
}

// Create the data container root object
Expand Down
1 change: 0 additions & 1 deletion libraries/Terkin/Terkin.h

This file was deleted.

166 changes: 0 additions & 166 deletions libraries/Terkin/TerkinTelemetry.h

This file was deleted.

10 changes: 0 additions & 10 deletions libraries/TerkinData/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -329,16 +329,6 @@ Dependencies
- `ArduinoJSON`_ by Benoît Blanchon.


*******
Backlog
*******

.. todo::

- Add :ref:`BERadio` serialization format.
- Spin off into separate repository https://github.com/daq-tools/terkin.


*********
Etymology
*********
Expand Down
2 changes: 1 addition & 1 deletion libraries/TerkinData/TerkinData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ std::string DataManager::json_data(Measurement& measurement) {
this->map_fields(measurement);

// Container object for JSON data elements
StaticJsonBuffer<512> jsonBuffer;
StaticJsonBuffer<2048> jsonBuffer;
JsonObject& json = jsonBuffer.createObject();

// Iterate header field names
Expand Down
14 changes: 14 additions & 0 deletions libraries/TerkinData/backlog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# TerkinData backlog

## Iteration +1
- [o] SQL serializer / interface
- https://registry.platformio.org/libraries/khoih-prog/MySQL_MariaDB_Generic
- https://registry.platformio.org/libraries/mustafakemalgilor/tdslite

- https://github.com/platformio/platform-espressif32
- https://github.com/bxparks/EpoxyDuino#PlatformIO
- https://github.com/TawalMc/TinyDatabase_Arduino

## Iteration +2
- Add [BERadio] serialization format.
- Spin off into separate repository https://github.com/daq-tools/terkin.
132 changes: 132 additions & 0 deletions libraries/TerkinTelemetry/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
.. include:: ../resources.rst

.. _lib-terkin-telemetry:

###################
TerkinTelemetry C++
###################

.. tip::

Please `continue reading this document on our documentation space
<https://hiveeyes.org/docs/arduino/TerkinTelemetry/README.html>`_,
all inline links will be working there.


*****
About
*****

TerkinTelemetry C++ provides an universal interface to user-space Arduino code, in order
to generalize interfacing with a range of telemetry backends.

TerkinTelemetry C++ provides backend drivers for supporting different telemetry communication
paths, similar to what RadioHead provides as adapters to different radio link hardware,
and TinyGSM provides as adapters to different modems. Examples: Generic JSON, CrateDB,
InfluxDB.

For collecting telemetry data, and for marshalling them into different output formats,
the library uses TerkinData C++.

The software is currently alpha quality. Here be dragons.


********
Synopsis
********

.. highlight:: cpp

Setup
=====
::

// The address of the data acquisition channel.
ChannelAddress* address = new ChannelAddress(CHANNEL_REALM, CHANNEL_OWNER, CHANNEL_SITE, CHANNEL_DEVICE);

// The actual transmitter element.
JsonHttpTransmitter* transmitter = new JsonHttpTransmitter(KOTORI_URL);

// The telemetry client.
telemetry = new TelemetryClient(transmitter, address);

Collect and transmit
====================
::

// Collect sensor data.
TerkinData::Measurement measurement;
measurement.data["temperature"] = 42.42;
measurement.data["humidity"] = 80;

// Transmit measurement to telemetry data collection server.
telemetry->transmit(measurement);


*****
Usage
*****

.. highlight:: bash

Build for embedded targets
==========================
::

# Acquire source code repository.
git clone https://github.com/hiveeyes/arduino

# Select firmware.
cd arduino/libraries/TerkinTelemetry/examples

# Build examples for all designated platforms.
make

Build individual programs::

PLATFORMIO_SRC_DIR=http-cratedb pio run --environment=esp32

Build and run on POSIX
======================
Build and run all examples on your workstation::

make run

Run individual examples::

make http-cratedb
make http-kotori



********
Download
********

| Please download a recent version from GitHub:
| https://github.com/hiveeyes/arduino/tree/main/libraries/TerkinTelemetry

************
Dependencies
************

- `ArduinoSTL`_ by Mike Matera.
- `ArduinoJSON`_ by Benoît Blanchon.
- `TerkinData`_ and `Terrine`_ by Andreas Motl.


*********
Etymology
*********

Terkin
======
| Epitomizes the greatest, the most immenense, the supreme and the paramount one.
| Basically, the fundamental individual.
|
| -- http://www.urbandictionary.com/define.php?term=Terkin

.. _ArduinoJSON: https://github.com/bblanchon/ArduinoJson
.. _ArduinoSTL: https://github.com/mike-matera/ArduinoSTL
Loading

0 comments on commit 36d417c

Please sign in to comment.