Skip to content
anthonyrowe edited this page Oct 30, 2017 · 7 revisions

This is an OpenChirp service that translates raw byte streams from devices into meaningful transducer values. It is capable of deconstructing transmitted arrays of primitive C types.

There are two directions for data between the device and OpenChirp. Incoming data is from device to OpenChirp, outgoing data is data originating from OpenChirp destined for the device. For each direction, you need to specify names and types for each data field you expect to be transmitted over the channel. The position of the names and types in the comma separated list both correspond to the position of the data fields in the raw data chunk that is sent or received.

Supported Types

  • uint8, uint16, uint32, uint64
  • int8, int16, int32, int64
  • float32, float64

Byte Translator Service Source

Simple Example

Byte Translator simply translates the elements in a binary array into decimal values and maps them to a transducer name. So for example, if you send the following three values:

uint8_t array[4];
uint8_t light;
uint16_t temp;
uint8_t humidity;

in C you might send them in an array like this:

array[0]=light;
array[1]= temp >> 8;
array[2]= temp & 0xFF;
array[3] = humidity;
status=lora_send(array,sizeof(array));

If you add the ByteTranslator Service, you can decode this with the following:

Byte Translator

You can also transmit downstream data by creating a rawtx transducer. This expects base64 encoded data similar to what arrives in rawrx. This data will be transmitted to your node as a standard byte array. You can either write directly to rawtx or link it in a similar manner to transducers the way we did for the upstream data.