Protobuf payloads of measurements or events sent to the phone.
More...
Protobuf payloads of measurements or events sent to the phone.
Samples are accumulated into a pebble_pipeline_Payload (schemas in fw/services/protobuf_log/proto) until it fills a record, which is then handed to the session's transport. The default transport logs each record, prefixed by a PLogMessageHdr and zero padded to PLOG_DLS_RECORD_SIZE, to a buffered Data logging session with tag DlsSystemTagProtobufLogSession.
Measurement sessions log samples with a fixed set of values, such as heart rate BPM and quality. Event sessions log pebble_pipeline_Event, such as activity sessions.
};
.measurements = { .num_types =
ARRAY_LENGTH(types), .types = types },
};
uint32_t values[] = { bpm, quality };
time_t rtc_get_time(void)
Get the current time.
void * ProtobufLogRef
Measurements log handle.
Definition activity_private.h:449
ProtobufLogType type
Payload type.
Definition protobuf_log.h:122
Session configuration.
Definition protobuf_log.h:120
pebble_pipeline_MeasurementSet_Type ProtobufLogMeasurementType
Measurement type.
Definition protobuf_log.h:51
bool protobuf_log_session_delete(ProtobufLogRef session)
Flush and free a session.
ProtobufLogRef protobuf_log_create(ProtobufLogConfig *config, ProtobufLogTransportCB transport, size_t max_encoded_msg_size)
Create a session.
#define ProtobufLogMeasurementType_BPM
Heart rate in beats per minute.
Definition protobuf_log.h:70
bool protobuf_log_session_add_measurements(ProtobufLogRef session, time_t sample_utc, uint32_t num_values, uint32_t *values)
Add a sample to a measurement session.
#define ProtobufLogMeasurementType_HRQuality
Heart rate signal quality.
Definition protobuf_log.h:80
@ ProtobufLogType_Measurements
Samples of a fixed set of measurements.
Definition protobuf_log.h:114
#define ARRAY_LENGTH(array)
Calculate the length of an array, based on the size of the element type.
Definition size.h:18
◆ ProtobufLogConfig
◆ ProtobufLogConfig.__unnamed74__
| union ProtobufLogConfig.__unnamed74__ |
◆ ProtobufLogConfig.__unnamed74__.measurements
| struct ProtobufLogConfig.__unnamed74__.measurements |
◆ ProtobufLogConfig.__unnamed74__.events
| struct ProtobufLogConfig.__unnamed74__.events |
◆ PLOG_DLS_RECORD_SIZE
Size of the data logging records, and maximum encoded message size.
◆ PLOG_MAX_SENDER_ID_LEN
| #define PLOG_MAX_SENDER_ID_LEN 64 |
Size of a buffer holding the payload sender ID, the watch serial number.
◆ PLOG_MAX_SENDER_TYPE_LEN
| #define PLOG_MAX_SENDER_TYPE_LEN 64 |
Size of a buffer holding the payload sender type.
◆ PLOG_MAX_SENDER_VERSION_PATCH_LEN
Size of a buffer holding the payload sender version patch string.
◆ PLOG_PAYLOAD_SENDER_TYPE
| #define PLOG_PAYLOAD_SENDER_TYPE "watch" |
◆ ProtobufLogActivityType_DeepNap
| #define ProtobufLogActivityType_DeepNap pebble_pipeline_ActivityType_InternalType_DeepNap |
◆ ProtobufLogActivityType_DeepSleep
| #define ProtobufLogActivityType_DeepSleep pebble_pipeline_ActivityType_InternalType_DeepSleep |
◆ ProtobufLogActivityType_Nap
| #define ProtobufLogActivityType_Nap pebble_pipeline_ActivityType_InternalType_Nap |
◆ ProtobufLogActivityType_Open
| #define ProtobufLogActivityType_Open pebble_pipeline_ActivityType_InternalType_Open |
◆ ProtobufLogActivityType_Run
| #define ProtobufLogActivityType_Run pebble_pipeline_ActivityType_InternalType_Run |
◆ ProtobufLogActivityType_Sleep
| #define ProtobufLogActivityType_Sleep pebble_pipeline_ActivityType_InternalType_Sleep |
◆ ProtobufLogActivityType_UnknownType
| #define ProtobufLogActivityType_UnknownType pebble_pipeline_ActivityType_InternalType_UnknownType |
◆ ProtobufLogActivityType_Walk
| #define ProtobufLogActivityType_Walk pebble_pipeline_ActivityType_InternalType_Walk |
◆ ProtobufLogMeasurementType_ActiveGCalories
| #define ProtobufLogMeasurementType_ActiveGCalories pebble_pipeline_MeasurementSet_Type_ActiveGCalories |
Active calories, in gram calories.
◆ ProtobufLogMeasurementType_BPM
| #define ProtobufLogMeasurementType_BPM pebble_pipeline_MeasurementSet_Type_BPM |
Heart rate in beats per minute.
◆ ProtobufLogMeasurementType_DistanceCM
| #define ProtobufLogMeasurementType_DistanceCM pebble_pipeline_MeasurementSet_Type_DistanceCM |
◆ ProtobufLogMeasurementType_HRQuality
| #define ProtobufLogMeasurementType_HRQuality pebble_pipeline_MeasurementSet_Type_HRQuality |
Heart rate signal quality.
◆ ProtobufLogMeasurementType_Light
| #define ProtobufLogMeasurementType_Light pebble_pipeline_MeasurementSet_Type_Light |
◆ ProtobufLogMeasurementType_Orientation
| #define ProtobufLogMeasurementType_Orientation pebble_pipeline_MeasurementSet_Type_Orientation |
◆ ProtobufLogMeasurementType_RestingGCalories
| #define ProtobufLogMeasurementType_RestingGCalories pebble_pipeline_MeasurementSet_Type_RestingGCalories |
Resting calories, in gram calories.
◆ ProtobufLogMeasurementType_RR
| #define ProtobufLogMeasurementType_RR pebble_pipeline_MeasurementSet_Type_RR |
Heart rate variability, peak to peak time in milliseconds.
◆ ProtobufLogMeasurementType_Steps
| #define ProtobufLogMeasurementType_Steps pebble_pipeline_MeasurementSet_Type_Steps |
◆ ProtobufLogMeasurementType_Temperature
| #define ProtobufLogMeasurementType_Temperature pebble_pipeline_MeasurementSet_Type_Temperature |
Watch temperature in kelvin.
◆ ProtobufLogMeasurementType_TimeMS
| #define ProtobufLogMeasurementType_TimeMS pebble_pipeline_MeasurementSet_Type_TimeMS |
◆ ProtobufLogMeasurementType_VMC
| #define ProtobufLogMeasurementType_VMC pebble_pipeline_MeasurementSet_Type_VMC |
Vector magnitude counts, a unitless measure of total activity.
◆ ProtobufLogActivityType
◆ ProtobufLogMeasurementType
◆ ProtobufLogRef
◆ ProtobufLogTransportCB
| typedef bool(* ProtobufLogTransportCB) (uint8_t *buffer, size_t buf_size) |
Transport sending an encoded record.
- Parameters
-
- Returns
- true on success.
◆ ProtobufLogType
Session payload type.
| Enumerator |
|---|
| ProtobufLogType_Measurements | Samples of a fixed set of measurements.
|
| ProtobufLogType_Events | pebble_pipeline_Event items.
|
◆ protobuf_log_create()
Create a session.
- Parameters
-
| config | Session configuration. |
| transport | Transport, or NULL to log to data logging. |
| max_encoded_msg_size | Maximum record size, at most PLOG_DLS_RECORD_SIZE. 0, the usual value, selects PLOG_DLS_RECORD_SIZE. |
- Returns
- Session, or NULL on error.
◆ protobuf_log_init()
| bool protobuf_log_init |
( |
void |
| ) |
|
Initialize the service.
- Returns
- true.
◆ protobuf_log_session_add_event()
| bool protobuf_log_session_add_event |
( |
ProtobufLogRef |
session_ref, |
|
|
pebble_pipeline_Event * |
event |
|
) |
| |
Add an event to an event session.
The accumulated data is encoded and sent once a record is full.
- Parameters
-
| session_ref | Session. |
| event | Event. |
- Returns
- true on success.
◆ protobuf_log_session_add_measurements()
| bool protobuf_log_session_add_measurements |
( |
ProtobufLogRef |
session, |
|
|
time_t |
sample_utc, |
|
|
uint32_t |
num_values, |
|
|
uint32_t * |
values |
|
) |
| |
Add a sample to a measurement session.
The accumulated data is encoded and sent once a record is full.
- Parameters
-
| session | Session. |
| sample_utc | Sample UTC time. |
| num_values | Number of entries in values, equal to the configured number of types. |
| values | Sample values, in the configured type order. |
- Returns
- true on success.
◆ protobuf_log_session_delete()
Flush and free a session.
- Parameters
-
| session | Session, may be NULL. |
- Returns
- true.
◆ protobuf_log_session_flush()
Encode and send the data accumulated so far.
The session is restarted even if sending fails.
- Parameters
-
- Returns
- true on success.