5 #ifndef HERALD_SIMPLE_PAYLOAD_DATA_SUPPLIER_H
6 #define HERALD_SIMPLE_PAYLOAD_DATA_SUPPLIER_H
8 #include "secret_key.h"
10 #include "../payload_data_supplier.h"
11 #include "../extended/extended_data.h"
12 #include "../../context.h"
13 #include "../../datatype/payload_timestamp.h"
14 #include "../../data/sensor_logger.h"
24 using namespace herald::payload::extended;
26 using MYUINT32 =
unsigned long;
34 template <
typename ContextT>
40 ctx(context), country(countryCode), state(stateCode), secretKey(sk), k(k),
41 commonPayloadHeader(), extended()
42 HLOGGERINIT(ctx,
"Sensor",
"ConcreteSimplePayloadDataSupplierV1")
44 commonPayloadHeader.append(std::uint8_t(0x10));
45 commonPayloadHeader.append(country);
46 commonPayloadHeader.append(state);
48 HTDBG(
"About to call matching keys");
50 HTDBG(
"Completed matching keys call");
55 ctx(context), country(countryCode), state(stateCode), secretKey(sk), k(k),
56 commonPayloadHeader(), extended(ext)
57 HLOGGERINIT(ctx,
"Sensor",
"ConcreteSimplePayloadDataSupplierV1")
59 commonPayloadHeader.append(std::uint8_t(0x10));
60 commonPayloadHeader.append(country);
61 commonPayloadHeader.append(state);
72 const int day = k.day(timestamp.value);
73 const int period = k.period(timestamp.value);
75 auto cid = k.contactIdentifier(secretKey,day,period);
79 if (extended.hasData()) {
80 p.
append(std::uint16_t(2 + extended.payload().size()));
82 p.
append(std::uint16_t(2));
87 if (extended.hasData()) {
88 p.
append(extended.payload());
95 const int day = k.day(timestamp.value);
96 const int period = k.period(timestamp.value);
98 auto cid = k.contactIdentifier(secretKey,day,period);
102 if (extended.hasData()) {
103 p.
append(std::uint16_t(2 + extended.payload().size()));
105 p.
append(std::uint16_t(2));
110 if (extended.hasData()) {
111 p.
append(extended.payload());
123 const uint16_t country;
124 const uint16_t state;
Generic abstraction of a particular local proximate device type.
Definition: device.h:27
The main data workhorse class of the Herald API.
Definition: data.h:33
void append(const DataRef &rawData, std::size_t offset, std::size_t length)
Copies another DataRef into this instance, expanding if required.
Definition: data.h:201
Definition: payload_data.h:13
Definition: extended_data.h:100
Definition: simple_payload_data_supplier.h:35
Definition: simple_payload_data_supplier.h:28
Contains all low-level Herald datatype implementations.
Definition: base64_string.h:14
Acts as a non-global memory arena for arbitrary classes.
Definition: aggregates.h:15
Definition: payload_timestamp.h:13