Protocol decoder:ook_gen

From sigrok
Jump to navigation Jump to search
Ook gen.png
Name OOK Generator
Description On Off Keying Generator
Status possible candidate
License GPLv2+
Source code decoders/ook_gen
Input logic
Output ook
Probes none
Optional probes
Options type

The ook_gen protocol decoder takes data from one or more lines from file and generates ook signal(s) from it.


It is provided to help test decoders that use the output generated by the ook decoder without having the capture files and supplies ook in the same way to stacked decoders.

It will also allow you to test the Oregon hex codes posted in various places online. The format that Oregon capturing programs use varies, some of them re-order the Nibbles. There are examples of a number of these in the file

At the moment it only works with Pulseview and Linux sigrok-cli.


The ook_vis decoder has one option

{ 'id': 'type', 'desc': 'OOK Type', 'default': 'Oregon', 'values': ('None','Oregon',) }

If the Oregon option is selected (only one available for now) then it will generate ook for the ook_oregon Oregon decoder.

Selecting the Oregon type produces three lines of decode. The first line displays the comment or info that goes with the code. The second is the Hex that was generated from the code while the third displays the ook bits.

if you uncomment the following line from the

['198408E000C70040034','WGR800 Av Speed 0.4m/s Gusts 0.7m/s  Direction: N ','v3'],

then it will generate the ook to simulate a WGR800 wind sensor

You can show the available options with the --show command:

$ sigrok-cli -P ook_gen --show

sigrok-cli examples

To decode the example WGR800 uncomment the line in and then run. The trace belongs to a real Oregon v3 rain sensor model PCR800 and is needed to run the ook_gen although the contents of the sr file are pretty much ignored.

sigrok-cli -P ook_gen,ook_oregon -i -A ook_oregon
ook_oregon-1: Oregon v3 Preamble
ook_oregon-1: Sync
ook_oregon-1: SensorID: 1984
ook_oregon-1: Ch: 0
ook_oregon-1: RollingCode: 8e
ook_oregon-1: Flags1: 0
ook_oregon-1: 0
ook_oregon-1: 0
ook_oregon-1: c
ook_oregon-1: 7
ook_oregon-1: 0
ook_oregon-1: 0
ook_oregon-1: 4
ook_oregon-1: 0
ook_oregon-1: 0
ook_oregon-1: 3
ook_oregon-1: 4
ook_oregon-1: WGR800 - Wind
ook_oregon-1: Ch 0
ook_oregon-1: Batt Ok
ook_oregon-1: N (0°)
ook_oregon-1: Gust 0.7 m/s
ook_oregon-1: Speed 0.4 m/s
ook_oregon-1: Checksum OK Calc 43 Rx 43