Code documentation¶
This is the temporary code documentation.
-
zeta.zeta.Channel : public object Represents a channel written on YAML file.
-
zeta.zeta.Config : public object Public Functions
-
__init__()¶
-
-
union
data¶ - #include <zeta.template.h>
Public Members
-
zt_data_int16_t
s16¶
-
zt_data_int32_t
s32¶
-
zt_data_int64_t
s64¶
-
zt_data_bytes_t
bytes¶
-
zt_data_int16_t
-
zeta.zeta_cli.FileFactory : public object Represents a generic class responsible to generate a file-based in a template and your respective substitutions.
Subclassed by HeaderFileFactory, SourceFileFactory, ZetaConf
Public Functions
-
__init__()¶
-
create_substitutions(self)¶ The function that will be implemented by classes inherited. :returns: None :rtype: None
-
generate_file(self)¶ Writes the output file with the respective substitutions assigned in create_substitutions function. :returns: None :rtype: None
-
run(self)¶ Runs the routine responsible for assigns substitutions and write the output file. :returns: None :rtype: None
-
-
union
flag_data¶ - #include <zeta.template.h>
Define pendent options that a channel can have.
Public Members
-
uint8_t
pend_persistent¶ Active represent that channel must be saved in flash by zeta_thread_nvs
-
uint8_t
pend_callback¶ Active represent that services callbacks from subscribers must be called by zeta_thread
-
uint8_t
on_changed¶ Active represent that the service callback will be called on change and not on update
-
uint8_t
source_serial_isc¶ When active indicates the channel was changed by the serial isc (some host process) instead of a target service
-
uint8_t
data¶ Raw data
-
uint8_t
-
zeta.zeta_cli.HeaderFileFactory : public FileFactory Represents a generic class for creation of header files that will be used by Zeta.
Subclassed by ZetaHeader
Public Functions
-
__init__()¶
-
-
class
zeta.zeta_isc.IPC¶
-
class
zeta.zeta_isc.IPCChannel¶
-
zeta.zeta_pkt.IPCHeader : public LittleEndianStructure struct zt_isc_header { uint8_t channel : 8; /**!> 256 channels available*/ uint8_t op : 3; /**!> 0: read, 1: write, 2: read response, 3: write response, 4: update */ uint8_t status : 4; /**!> 0: ok, 1: failed */ uint8_t has_data : 1; /**!> 0: no data, 1: contains data */ };
-
zeta.zeta_pkt.IPCHeaderDataInfo : public LittleEndianStructure struct zt_isc_header_data_info { uint8_t crc : 8; /**!> CCITT 8, polynom 0x07, initial value 0x00 */ uint8_t size : 8; /**!> data size */ };
-
zeta.zeta_pkt.IPCPacket : public LittleEndianStructure Public Functions
-
__init__(self, args, kwargs)¶
-
set_data()¶
-
set_data_with_struct(self, struct)¶
-
clear_data(self)¶
-
from_bytes(cls, raw_data)¶
-
to_bytes(self)¶
-
data(self)¶
-
set_header()¶
-
set_data_info()¶
-
set_header_from_bytes()¶
-
set_data_info_from_bytes()¶
-
header_to_bytes(self)¶
-
__repr__(self)¶
-
struct_contents(self, struct)¶
-
struct_contents_set(self, struct)¶
Public Static Attributes
-
OP_READ¶
-
OP_WRITE¶
-
OP_READ_RESPONSE¶
-
OP_WRITE_RESPONSE¶
-
OP_UPDATE¶
-
OP_DEBUG¶
-
DATA_UNAVALABLE¶
-
DATA_AVAILABLE¶
-
STATUS_OK¶
-
STATUS_FAILED¶
Private Members
-
__data¶
-
-
class
zeta.zeta.Message¶ This object represents the Message defined by the Zeta yaml file.
-
class
zeta.zeta_isc.SerialDataHandler¶
-
zeta.zeta.Service : public object Represents a service written on YAML file.
Public Functions
-
__init__()¶
-
-
zeta.zeta_cli.SourceFileFactory : public FileFactory Represents a generic class for creation of source files that will be used by Zeta.
Subclassed by ZetaSource
Public Functions
-
__init__()¶
-
-
zeta.messages.TestStringMethods : public TestCase
-
zeta.zeta.Zeta : public object Represents the Zeta object that has access to services, channels and config parameters specified in YAML file.
Public Functions
-
__init__()¶
Private Functions
-
__check_service_channel_relation(self)¶ Checks if the use of !ref is correct or is used some nonexistent channel. :returns: None :rtype: None :raise ZetaCLIError: Channel name doesn't exists in channel list.
-
__check_channel_message_relation(self)¶ Checks if the use of !ref is correct or is used some nonexistent channel. :returns: None :rtype: None :raise ZetaCLIError: Channel name doesn't exists in channel list.
-
__process_file()¶
-
-
zeta.zeta_cli.ZetaCLI : public object Represents the ZetaCLI and has all the callbacks that will be called when the user type zeta on the terminal.
Public Functions
-
__init__(self)¶ ZetaCLI constructor. :returns: None :rtype: None
-
init(self)¶ Called when the user type "zeta init" and is responsible for generates the minimum requirements in order to Zeta works properly. :returns: Exit code :rtype: int :raise ZetaCLIError: Error in zeta.cmake or zeta.yaml file path
-
version(self)¶ Called when the user type "zeta version" and is responsible for sends out the ZetaCLI version. :returns: Exit code :rtype: int
-
check_files(self)¶
-
check_code(self, src_dir)¶
-
check(self)¶ Called when the user type "zeta check" and is responsible for checks if the needed steps were made by user in order to Zeta works properly. :returns: Exit code :rtype: int
-
services(self)¶ Called when the user type "zeta services" and is responsible for generates files template-based with the services initialized. :returns: Exit code :rtype: int :raise ZetaCLIError: Error opening or reading files
-
gen(self)¶ Generate all the internal files that represents Zeta system like channels, Zeta threads, Zeta API, and others. :returns: Exit code :rtype: int
-
sniffer(self)¶ Generate all the internal files that represents Zeta system like channels, Zeta threads, Zeta API, and others. :returns: Exit code :rtype: int
-
isc(self)¶ Starts a high level ISC on the host. It takes all the yaml file details to run the proper environment. :returns: Exit code :rtype: int
-
-
zeta.zeta_errors.ZetaCLIError : public Exception Base class for exceptions in ZetaCLI
-
zeta.sniffer.ZetaCLIEventListWalker : public ListWalker Represents the event list. It is used by the ListBox to show the events occurred.
Public Functions
-
__init__()¶
-
create_table(self, title='[0/0]')¶ Create the event table. :param title: the table's title :returns: the table container (LineBox) :rtype: urwid.LineBox
-
__len__(self)¶ Len operator overloading :returns: the table number of lines :rtype: int
-
append(self, item)¶ Append method overloading :param item: dictionary with the data of the new item to be added :returns: None :rtype: None
-
create_data_viewer(self)¶ Create data detail viewer. :returns: the data viewer :rtype: urwid.Text
-
__getitem__(self, index)¶ Get item operator overloading :param index: index of the desired element :returns: the element at index :rtype: urwid.Columns
-
set_modified_callback(self, callback)¶ This function inherited from MonitoredList is not implemented in SimpleFocusListWalker. Use connect_signal(list_walker, "modified", ...) instead.
-
set_focus(self, position)¶ Set focus position.
-
next_position(self, position)¶ Return position after start_from.
-
prev_position(self, position)¶ Return position before start_from.
-
positions(self, reverse=False)¶ Optional method for returning an iterable of positions.
Private Functions
-
__create_table_header(self)¶ Create the table header. :param event_list: list of event items :returns: table header :rtype: urwid.AttrMap
-
-
zeta.zeta_cli.ZetaConf : public FileFactory
-
zeta.zeta_cli.ZetaHeader : public HeaderFileFactory Represents a class that generates the zeta.h file and has the goal to assigns all the substitutions needed to Zeta works properly.
-
class
zeta.messages.ZetaMessage¶ Represents the Message to zeta. It holds the messages' information for code generation
-
zeta.sniffer.ZetaSerialMonitor : public Protocol Class that handles the serial connection and updates the interface data related to the income information.
Public Functions
-
__init__()¶
-
connection_made(self, transport)¶ Method called when an connection is made
-
digest_isc_message(self, msg)¶ Digest the incoming encoded message to extract the message information.
-
data_received(self, data)¶ Method called when an a new data is available to be read. :param data: bytes received at the serial. :returns: None :rtype: None
-
connection_lost(self, exc)¶ Method called when the connection is lost
-
pause_writing(self)¶ Method called when the writing is paused
-
resume_writing(self)¶ Method called when the writing is resumed
-
send(self)¶ Send four newline-terminated messages, one byte at a time.
-
-
class
zeta.sniffer.ZetaSniffer¶ Class that encapsulates the sniffer execution function.
Public Functions
-
run(self, serial_port='', baudrate=115200)¶ Function used to execute the sniffer. It opens the serial at the specified baud rate passed as argument. :param serial_port: the serial port description. For example "/dev/ttyUSB0". :param baudrate: the communication frequency. For example 115200. :returns: None :rtype: None
-
-
zeta.zeta_cli.ZetaSource : public SourceFileFactory Represents a class that generates the zeta.c file and has the goal to assigns all the substitutions needed to Zeta works properly.
Public Functions
-
__init__()¶
-
gen_sems(self)¶ Responsible for assigns the channel semaphores. :returns: None :rtype: None
-
gen_creation(self)¶ Responsible for creates all the channels that will be used by Zeta. :returns: None :rtype: None
-
gen_nvs_config(self)¶ Responsible for assigns the nvs config. :returns: None :rtype: None
-
create_substitutions(self)¶ Responsible for assigns the needed substitutions to be written on the output file. :returns: None :rtype: None
-
-
zeta.zeta.ZetaYamlLoader : public SafeLoader Modifies the SafeLoader object and generates a correct dictionary-based in the YAML file.
Public Functions
-
__init__(self, stream)¶ YamlRefloader constructor. :param stream: default param used for yaml.SafeLoader :returns: None :rtype: None
-
ref(self, node)¶ Handles ref statements in YAML file and generate a valid reference :param node: Ref statement with the reference name :returns: Reference name :rtype: str
-
include(self, node)¶ Handles include statements in YAML file and generate a valid reference :param node: Include statement with the reference name :returns: Content of the file passed by include :rtype: dict
-
-
struct
zt_channel¶ - #include <zeta.template.h>
Define Zeta channel type.
Public Members
-
const char *
name¶ Channel name
-
uint8_t *
data¶ Channel raw data
-
uint8_t
read_only¶
-
uint8_t
size¶ Channel size
-
uint8_t
persistent¶ Persistent type
-
zt_channel_e
id¶ Channel Id
-
struct k_sem *
sem¶ Preserve shared-memory
-
zt_service_t **
publishers¶ Publishers
-
zt_service_t **
subscribers¶ Subscribers
-
const char *
-
struct
zt_data_bytes_t¶ - #include <zeta.template.h>
-
struct
zt_data_int16_t¶ - #include <zeta.template.h>
-
struct
zt_data_int32_t¶ - #include <zeta.template.h>
-
struct
zt_data_int64_t¶ - #include <zeta.template.h>
-
struct
zt_data_int8_t¶ - #include <zeta.template.h>
-
struct
zt_data_uint16_t¶ - #include <zeta.template.h>
-
struct
zt_data_uint32_t¶ - #include <zeta.template.h>
-
struct
zt_data_uint64_t¶ - #include <zeta.template.h>
-
struct
zt_data_uint8_t¶ - #include <zeta.template.h>
-
struct
zt_isc_net_pkt¶ Public Members
-
struct zt_isc_net_pkt_header
header¶
-
struct zt_isc_net_pkt_header_message_info
message_info¶
-
uint8_t *
message¶
-
struct zt_isc_net_pkt_header
-
struct
zt_isc_net_pkt_header¶
-
struct
zt_isc_net_pkt_header_message_info¶
-
struct
zt_isc_packet¶ - #include <zeta.template.h>
-
zeta.zeta_isc.ZT_MSG : public Union All the messages defined by the config file will be filled up here
-
struct
zt_service¶ - #include <zeta.template.h>
Define Zeta service type.
Public Members
-
zt_service_e
id¶ Service ID
-
const char *
name¶ Service name
-
struct k_thread
thread¶ Service RTOS thread
-
zt_callback_f
cb¶ Service callback
-
k_thread_entry_t
entry_point¶ Service thread function (entry point)
-
k_thread_stack_t *
stack¶ Service thread stack
-
size_t
stack_size¶ Service thread stack size
-
zt_service_e
-
module
zeta¶
-
module
__main__¶
-
module
zeta.messages¶ Variables
-
MsgType= namedtuple('MsgCode', "statement separator begin end sizable")¶
-
-
module
sniffer¶
-
module
zeta.zeta¶
-
module
zeta.zeta_cli¶ Functions
-
run()¶
Variables
-
ZETA_MODULE_DIR= "."¶
-
ZETA_TEMPLATES_DIR= "."¶
-
PROJECT_DIR= str(Path(".").resolve())¶
-
ZETA_DIR= "."¶
-
ZETA_SRC_DIR= "."¶
-
ZETA_INCLUDE_DIR= "."¶
-
OK_COLORED= "\033[0;42m \033[1;97mOK \033[0m"¶
-
FAIL_COLORED= "\033[0;41m \033[1;97mFAIL \033[0m"¶
-
WARNING_COLORED= "\033[1;43m \033[1;97mWARNING \033[0m"¶
-
-
module
zeta.zeta_errors¶
-
module
zeta.zeta_isc¶
-
module
zeta_pkt¶
-
file
__init__.py
-
file
__main__.py
-
file
_version.py
-
file
messages.py
-
file
sniffer.py
-
file
zeta.template.c - #include “zeta.h”#include <drivers/flash.h>#include <fs/nvs.h>#include <logging/log.h>#include <storage/flash_map.h>#include <string.h>#include <zephyr.h>#include “zt_serial_ipc.h”#include “devicetree_fixups.h”
Functions
-
LOG_MODULE_REGISTER(zeta, CONFIG_ZETA_LOG_LEVEL)¶
-
static void
__zt_monitor_thread(void)¶
-
K_THREAD_DEFINE (zt_monitor_thread_id, ZT_MONITOR_THREAD_STACK_SIZE, __zt_monitor_thread, NULL, NULL, NULL, ZT_MONITOR_THREAD_PRIORITY, 0, 0)
-
K_MSGQ_DEFINE (zt_channels_changed_msgq, sizeof(uint8_t), 30, 4)
-
const char *
zt_channel_name(zt_channel_e id, int *error)¶ Return the channel name.
- Parameters
id – Channel Id
error – Handle possible errors
- Returns
Channel name
-
size_t
zt_channel_size(zt_channel_e id, int *error)¶ Return the channel size.
- Parameters
id – Channel Id
error – Handle possible errors
- Returns
Channel size
-
int
zt_chan_read(zt_channel_e id, zt_data_t *channel_data)¶ Read channel value.
- Parameters
id – Channel Id
channel_data – pointer to a zt_data_t where the data will be retrieved.
- Returns -ENODATA
The channel was not found
- Returns -EFAULT
Channel value is NULL
- Returns -EPERM
Channel hasn’t read function implemented
- Returns -EINVAL
Size passed is different to channel size
- Returns
Error code
-
int
zt_chan_pub(zt_channel_e id, zt_data_t *channel_data)¶ Publish channel value.
- Parameters
id – Channel Id
channel_data – pointer to a zt_data_t where the data is.
- Returns -ENODATA
The channel was not found
- Returns -EACCESS
Current thread hasn’t permission to publish this channel
- Returns -EFAULT
Channel value is NULL
- Returns -EPERM
Channel is read only
- Returns -EINVAL
Size passed is different to channel size
- Returns -EAGAIN
Valid function returns false
- Returns
Error code
-
-
file
zeta.template.h - #include <stddef.h>#include <zephyr.h>#include <zephyr/types.h>
Defines
-
ZT_MONITOR_THREAD_STACK_SIZE¶ Stack size that is used in Zeta thread that manages channels callback calls.
-
ZT_STORAGE_SLEEP_TIME¶ Storage sleep time.
-
ZT_MONITOR_THREAD_PRIORITY¶ Channels thread priority.
-
ZT_SERVICE_DECLARE(_name, _task, _cb)¶ Declare a zeta service.
- Parameters
_name – Service name
_task – Task pointer function
_cb – Callback to be called when some subscribed channel change
-
ZT_SERVICE_RUN(_name)¶ Run a zeta service.
- Parameters
_name – Service name
-
ZT_VARIABLE_REF_SIZE(x)¶ Read variable reference and size easily \ to use in Zeta API. \ .
\
- Parameters
x – variable name \ \
-
ZT_CHECK_VAL(_p, _e, _err, ...)¶ Check if _v value is equal to _c, otherwise _err will be returned and a message will be sent to LOG.
- Parameters
_v – Value
_c – Condition
_err – Error code
-
ZT_CHECK(_p, _err, ...)¶ Check if _v is true, otherwise _err will be returned and a message will be sent to LOG.
- Parameters
_v – Value
_err – Error code
- Returns
-
ZT_DATA_S8(data)¶
-
ZT_DATA_U8(data)¶
-
ZT_DATA_S16(data)¶
-
ZT_DATA_U16(data)¶
-
ZT_DATA_S32(data)¶
-
ZT_DATA_U32(data)¶
-
ZT_DATA_S64(data)¶
-
ZT_DATA_U64(data)¶
-
ZT_DATA_BYTES(_size, data, ...)¶
Typedefs
-
typedef void (*
zt_callback_f)(zt_channel_e id)¶ zeta_callback_f define the callback function type of Zeta.
- Parameters
id – Channel Id.
-
typedef struct zt_service
zt_service_t¶
-
typedef struct zt_isc_packet
zt_isc_packet_t¶
-
typedef struct zt_channel
zt_channel_t¶
Functions
-
struct zt_isc_packet __attribute__ ((packed))
-
size_t
zt_channel_size(zt_channel_e id, int *error) Return the channel size.
- Parameters
id – Channel Id
error – Handle possible errors
- Returns
Channel size
-
const char *
zt_channel_name(zt_channel_e id, int *error) Return the channel name.
- Parameters
id – Channel Id
error – Handle possible errors
- Returns
Channel name
-
int
zt_chan_read(zt_channel_e id, zt_data_t *channel_data) Read channel value.
- Parameters
id – Channel Id
channel_data – pointer to a zt_data_t where the data will be retrieved.
- Returns -ENODATA
The channel was not found
- Returns -EFAULT
Channel value is NULL
- Returns -EPERM
Channel hasn’t read function implemented
- Returns -EINVAL
Size passed is different to channel size
- Returns
Error code
-
int
zt_chan_pub(zt_channel_e id, zt_data_t *channel_data) Publish channel value.
- Parameters
id – Channel Id
channel_data – pointer to a zt_data_t where the data is.
- Returns -ENODATA
The channel was not found
- Returns -EACCESS
Current thread hasn’t permission to publish this channel
- Returns -EFAULT
Channel value is NULL
- Returns -EPERM
Channel is read only
- Returns -EINVAL
Size passed is different to channel size
- Returns -EAGAIN
Valid function returns false
- Returns
Error code
-
-
file
zt_serial_ipc.h - #include <zephyr.h>#include “zeta.h”
-
file
zt_uart.h - #include <device.h>#include <zephyr.h>
-
file
zt_serial_ipc.c - #include “zt_serial_ipc.h”#include <string.h>#include <sys/crc.h>#include <sys/printk.h>#include <zephyr.h>#include <zt_uart.h>#include “devicetree.h”#include “kernel.h”#include “zeta.h”
Defines
-
UART_DEVICE_NAME¶ SPDX-License-Identifier: Apache-2.0
-
MAX_MESSAGE_LENGTH¶
-
ZT_ISC_PKT_ASSERT_EQ(actual, expected, ret)¶
-
ZT_ISC_PKT_ASSERT(cond, ret)¶
-
SELF_TEST_INIT()¶
-
SELF_TEST_ASSERT(cond)¶
-
SELF_TEST_FINISH()¶
-
NUMBER_OF_CHANNELS¶
-
ZT_ISC_NET_PKT_WITH_MSG_SIZE(_size)¶
Enums
Functions
-
K_MSGQ_DEFINE (__channel_updated_queue, 1, 16, 1)
-
void
zt_isc_net_pkt_clear(struct zt_isc_net_pkt *self)¶
-
void
zt_isc_net_pkt_send(struct zt_isc_net_pkt *self)¶
-
int
zt_isc_net_pkt_set_message(struct zt_isc_net_pkt *self, char *message, size_t message_size)¶
-
void
zt_isc_net_pkt_calc_crc(struct zt_isc_net_pkt *self)¶
-
uint8_t
zt_isc_net_pkt_header_is_valid(struct zt_isc_net_pkt_header *header)¶
-
uint8_t
zt_isc_net_pkt_message_is_valid(struct zt_isc_net_pkt *pkt)¶
-
int
digest_byte(uint8_t data, struct zt_isc_net_pkt *pkt)¶
-
uint64_t
digest_byte_test()¶
-
int
zt_serial_ipc_send_update_to_host(zt_channel_e id)
-
void
__zt_serial_ipc_tx_thread(void)¶
-
k_tid_t
zt_serial_ipc_thread()
-
void
__zt_serial_ipc_rx_thread(void)¶
-
K_THREAD_DEFINE (zt_serial_ipc_rx_id, ZT_SERIAL_IPC_RX_THREAD_STACK_SIZE, __zt_serial_ipc_rx_thread, NULL, NULL, NULL, ZT_SERIAL_RX_THREAD_PRIORITY, 0, 0)
-
K_THREAD_DEFINE (zt_serial_ipc_tx_id, ZT_SERIAL_IPC_TX_THREAD_STACK_SIZE, __zt_serial_ipc_tx_thread, NULL, NULL, NULL, ZT_SERIAL_TX_THREAD_PRIORITY, 0, 0)
Variables
-
static k_tid_t
__current_rx_thread¶
-
-
file
zt_uart.c - #include “zt_uart.h”#include <drivers/uart.h>#include <zephyr.h>
Functions
-
K_MSGQ_DEFINE (__input_msgq, sizeof(uint8_t), 512, 1)
-
K_MSGQ_DEFINE (__output_msgq, sizeof(uint8_t), 512, 1)
-
static void
uart_fifo_callback(const struct device *dev, void *user_data)¶
-
struct k_msgq *
uart_get_input_msgq()
-
struct k_msgq *
uart_get_output_msgq()
-
int
uart_open(char *dev_label)
-
int
uart_write(uint8_t *data, size_t size)
-
int
uart_write_str(char *str)
-
int
uart_write_byte(uint8_t *byte)
Variables
-
static const struct device *
__uart_dev= 0¶
-
const struct uart_config uart_cfg = {.baudrate = 115200,.parity = UART_CFG_PARITY_NONE,.stop_bits = UART_CFG_STOP_BITS_1,.data_bits = UART_CFG_DATA_BITS_8,.flow_ctrl = UART_CFG_FLOW_CTRL_NONE}
-
-
file
zeta.py
-
file
zeta_cli.py
-
file
zeta_errors.py
-
file
zeta_isc.py
-
file
zeta_pkt.py
-
dir
/home/docs/checkouts/readthedocs.org/user_builds/zeta-middleware/checkouts/latest/zeta/templates/zeta/include
-
dir
/home/docs/checkouts/readthedocs.org/user_builds/zeta-middleware/checkouts/latest/zeta/templates/zeta/src
-
dir
/home/docs/checkouts/readthedocs.org/user_builds/zeta-middleware/checkouts/latest/zeta/templates
-
dir
/home/docs/checkouts/readthedocs.org/user_builds/zeta-middleware/checkouts/latest/zeta/templates/zeta
-
dir
/home/docs/checkouts/readthedocs.org/user_builds/zeta-middleware/checkouts/latest/zeta