Tutorial for writing subghz protocol

I’m looking at the subghz protocol source code files. Is there a tutorial or example that explains each step? I know the format of the protocol.

I’m a software developer but not well-versed in radio. Will I need to analyze how long a particular value is 0 or 1 to create a protocol? Or is there a helper that will do that for me and generate a string with some amount of error.

1 Like
const SubGhzProtocolDecoder subghz_protocol_princeton_decoder = {
    .alloc = subghz_protocol_decoder_princeton_alloc,
    .free = subghz_protocol_decoder_princeton_free,

    .feed = subghz_protocol_decoder_princeton_feed,
    .reset = subghz_protocol_decoder_princeton_reset,

    .get_hash_data = subghz_protocol_decoder_princeton_get_hash_data,
    .serialize = subghz_protocol_decoder_princeton_serialize,
    .deserialize = subghz_protocol_decoder_princeton_deserialize,
    .get_string = subghz_protocol_decoder_princeton_get_string,

I think get_string is most useful for what I want to do?

Serialize is for encoding, deserialize for decoding sub files. Am I on the right track?

it is enough to open any protocol implemented in the flipper and possibly known to you. and look at the implementation, if you think a little, everything will immediately fall into place and it will be very simple, the only thing is that the input decoder (feed) receives sequences of durations and signal levels in microseconds

1 Like

Flipper has enough employees to write documentation. The Flipper is for a more mass market audience than past tools and will make a lot more money than other projects. They can afford to hire someone to make tutorials and write documentation.

Imagine if no companies had documentation and told employees and customers to just “think a little, everything will immediately fall into place and it will be very simple”

Maybe easy for you! :rofl:
Some of us have to work a little harder. I’m learning new things about the Flipper every day such as the limitation of RC5 vs RC5X and having to reverse the HEX when using CLI. It can be a challenge for us to figure out.

+1. Lack of docs on sources is probably fine, but some user-facing parts, including CLI, are really under-documented too.

You’re a bit too harsh on them. They have a big job ahead. The firmware isn’t even v1.0 yet. The Flipper should be considered a work in progress meant for early adopters, hackers, and makers. It isn’t the device people portray on Tik-Tok. I consider this hardware an appetizer for the full SDR version coming at a later date.

1 Like

With the number of units sold, I respectfully disagree. And I’m asking for basic explanations of how the API works and some examples of what works and known caveats.

The reason given by the Flipper employee is completely at odds with your statement. They believe that code is self documenting and therefore documentation is unnecessary. This is not an opinion shared by all software developers.

I did not say that the code itself is documented, I said that the code is written in such a way that a person versed in programming can read it. the code is very clear. if you do not agree, then you have not seen incomprehensible code. the firmware is not yet the final version and is constantly changing, and the documentation that will be written now will stop working after a couple of releases and there will be even more dissatisfied. and even more so, there is no tutorial on writing protocols for a subgig, each manufacturer tries to dodge so that his code is not hacked. and the approach to each system is individual.


If you want an example of how to analyze the protocol, go to the main section in the documentation, there is a topic where I partially described it.
Want an example of how to add here is a simple protocol
[FL-3092] SubGhz: add DOOYA protocol by Skorpionm · Pull Request #2178 · flipperdevices/flipperzero-firmware · GitHub
Feel the strength in yourself, here is an example more complicated
[FL-3091] SubGhz: add protocol Alutech at-4n by Skorpionm · Pull Request #2352 · flipperdevices/flipperzero-firmware · GitHub

Let me know what you can do

1 Like