Enables logging data asynchronously to a mobile app.
In Pebble OS, data logging is a data storage and transfer subsystem that allows watchapps to save data on non-volatile storage devices when the phone is not available to process it. The API provides your watchapp with a mechanism for short-term data buffering for asynchronous data transmission to a mobile app.
Using this API, your Pebble watchapp can create an arbitrary number of logs, but you’re limited in the amount of storage space you can use. Note that approximately 640K is available for data logging, which is shared among all watchapps that use it. This value is subject to change in the future. When the data spool is full, an app will start overwriting its own data. An app cannot overwrite another apps's data. However, the other app might have 0 bytes for data logging.
Your app can log data to a session, either creating, adding or deleting data to that session. The data is then sent to the associated phone application at the earliest convenience. If a phone is available, the data is sent directly to the phone. Otherwise, it is saved to the watch storage until the watch is connected to a phone.
To create a data logging session for 4-byte unsigned integers with a tag of 0x1234, you would do this:
For code samples, refer to Examples/data-logging-demo.
Create a new data logging session.
|tag||A tag associated with the logging session.|
|item_type||The type of data stored in this logging session|
|item_length||The size of a single data item in bytes|
|resume||True if we want to look for a logging session of the same tag and resume logging to it. If this is false and a session with the specified tag exists, that session will be closed and a new session will be opened.|
Delete a data logging_session. Logging data is kept until it has successfully been transferred over to the phone, but no data may be added to the session after this function is called.
|logging_session||a reference to the data logging session previously allocated using data_logging_create|
|const void *||data,|
Add data to the data logging session. If a phone is available, the data is sent directly to the phone. Otherwise, it is saved to the watch storage until the watch is connected to a phone.
|logging_session||a reference to the data logging session you want to add the data to|
|data||a pointer to the data buffer that contains multiple items|
|num_items||the number of items to log. This means data must be at least (num_items * item_length) long in bytes|
The different types of session data that Pebble supports. This type describes the type of a singular item in the data session. Every item in a given session is the same type and size.
Array of bytes. Remember that this is the type of a single item in the logging session, so using this type means you'll be logging multiple byte arrays (each a fixed length described by item_length) for the duration of the session.
Unsigned integer. This may be a 1, 2, or 4 byte integer depending on the item_length parameter.
Signed integer. This may be a 1, 2, or 4 byte integer depending on the item_length parameter.
Someone else is writing to this logging session.
No more space to save data.
The logging session does not exist.
The logging session was made inactive.
An invalid parameter was passed to one of the functions.