Extract bit range processor

Anthony Pépin Updated by Anthony Pépin

This processor is not available by default. Please contact Opendatasoft support team if you want this processor to be activated in your domain.

The Extract bit range processor extracts an arbitrary bit range from an hexadecimal or binary content, and converts it into one of the following data types: integer, unsigned integer, or float.

And example of when you might use this processor is when processing data coming from a network of sensors, as sensors often encode their payloads as hexadecimal content.

Setting the processor

To set the parameters of the Extract bit range processor, follow the indications from the table below.

Label

Description

Mandatory

Example

Field

Field containing the hexadecimal or binary content

Yes

column_a

Input type

Type of the content: hexadecimal or binary.

If this parameter is not set, the content is considered hexadecimal by default.

No

Either hexadecimal or binary

Start bit offset

Starting offset corresponding to the position of the first bit. It starts at 0.

Yes

0, 8, 16, ...

Stop bit offset

Ending offset corresponding to the position of the last bit. Must be greater than the starting offset.

Yes

7, 15, 31, ...

Convert to

Wanted format to output and convert the data

Yes

Either int (integer), uint (unsigned integer) or float

Output field

Field where the extracted bit range will be displayed. It can be an existing field chosen from the list, or a new field created for that purpose (in that case, choose "Input text" from the list and write the name of the new field in the text area below).

Yes

result

Example

A temperature sensor sends an hexadecimal value.

hexadecimal value : 0x1649

This hexadecimal value (two bytes) contains:

  • a decimal value encoded on the first byte
  • the sensor identifier encoded on the first four bits of the second byte
  • a set of flags representing the sensor configuration, encoded on the remaining four bits
hexadecimal value : 0x1649          <- information sent by the sensor in hexadecimal
binary value : 00010110 01001001 <- same information in binary

  • the first byte '00010110' is the temperature in degrees
  • the next four bits '0100' is the sensor identifier
  • the next four bits '1001' is the sensor configuration, but we only want the first bit

Therefore, the processing pipeline will contains three Extract bit range processors

  • one Extract bit range from 0 to 8 to convert into signed integer (int) -> int_temperature
  • one Extract bit range from 8 to 12 to convert into unsigned integer (uint) -> sensor_identifier
  • one Extract bit range from 12 to 13 to convert into unsigned integer, 0 meaning "Not OK" and 1 meaning "OK" (uint) -> status

Extract bit range 1

00010110 -> 22

Extract bit range 2

0100 -> 4

Extract bit range 3

1 -> OK

Final result:

Temperature : 22 °C
Identifier : 4
Sensor : OK

How did we do?

Extract URLs processor

Extract from JSON processor

Contact

Powered by HelpDocs (opens in a new tab)