embedded_data – Embedded Data Pipe

Embedding data in console output for visualization

class codeair.embedded_data.ConsoleWriter[source]

A class to adapt console_bytes to the write method like a file.

class codeair.embedded_data.EmbeddedDataPipe[source]

Encode supported data types for output to selected destination.

Embedded Data Protocol:

C0DECAFE + LEN_4bytes_u32 + descriptor_16bytes + data – LEN is big endian – descriptor is object-dependent string (see EdataViewer.js)

destination

The destination for the encoded data.

Type:

file

MAGIC

The magic bytes to identify the protocol.

Type:

bytes

Initializes the EmbeddedDataPipe and sets the default destination.

chart(chart_name, value, series=None, chart_type='line')[source]

Send chart data. A unique chart_name will create a new chart. New series also work this way.

Parameters:
  • chart_name (str) – Identifies which chart we’re talking about (“temp”, “sensors”, etc.).

  • value (float or iterable) – The data to plot. Must be a single number or an iterable of (val, millisecond) points.

  • series (str, optional) – Optional string for labeling multiple data series in the same chart.

  • chart_type (str, optional) – Optional. Can support line vs. bar vs. scatter, etc. Defaults to “line”.

connect(destination=None)[source]

Connects to a new destination.

Parameters:

destination (file object) – The new destination. Defaults to console_writer.

image(bitmap)[source]

Send image to data panel. Only 16-bit RGB565 images are supported.

Parameters:

bitmap (Bitmap) – The bitmap image to send.

ping()[source]

Send a ping message to CodeSpace. Return True if connected and responding.

text(value)[source]

Send text message to data panel. This is a simple type, used primarily for testing the embedded data protocol.

Parameters:

value (str) – The text message to send.

Download Source