Warning: This is a development version. The latest stable version is Version 4.0.0.

Code Example: Hello World

This simple example can be used for checking whether your build system has been successfully setup to use the otacast library.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python
# encoding: utf-8

"""A simple hello world example."""

# License for Commercial Usage
# Distributed under the "OTACAST EVALUATION LICENSE 1.3"
# Licensees holding a valid commercial license may use this project in
# accordance with the standard license agreement terms provided with the
# Software (see accompanying file LICENSE.rst or
# https://www.steinwurf.com/license), unless otherwise different terms and
# conditions are agreed in writing between Licensee and Steinwurf ApS in which
# case the license will be regulated by that separate written agreement.
# License for Non-Commercial Usage
# Distributed under the "OTACAST RESEARCH LICENSE 1.2"
# Licensees holding a valid research license may use this project in accordance
# with the license agreement terms provided with the Software
# See accompanying file LICENSE.rst or https://www.steinwurf.com/license

import otacast


def main():
    # Print the version of the library used
    print(otacast.__version__)

    # Create the encoder object with a specific finite field
    encoder = otacast.Encoder()

    block_bytes = 1024 * 1000  # 1 MB
    symbol_bytes = 1500
    width = otacast.CodecWidth._32

    encoder.configure(width, block_bytes, symbol_bytes)

    print("block_bytes:  {}".format(encoder.block_bytes))
    print("symbol_bytes: {}".format(encoder.symbol_bytes))
    print("width:        {}".format(encoder.width))
    print("symbols       {}".format(encoder.symbols))


if __name__ == "__main__":
    main()
Versions
4.0.0
3.2.0
3.1.0
3.0.0
2.0.0
1.0.1
Development
latest