How linux-mobile-broadband/libqmi works
Major Components
• Library Layer:
– libqmi-glib (located in src/libqmi-glib) forms the core library for communication with QMI devices. It provides public APIs for the rest of the tools.
– Common modules (e.g., src/common) with shared QMI functionality.
• Tools / Client Applications:
– qmicli (src/qmicli): a command-line client that uses the libqmi API to send QMI commands.
– qmi-network (found under utils/qmi-network or similar): a tool for network management.
– qmi-firmware-update (src/qmi-firmware-update): which handles firmware updates over QMI.
– qmi-proxy (src/qmi-proxy): for proxying functions if needed.
• Gobi API Integration:
– Directories like gobi-api and its versions indicate application-specific integrations supporting specific modems (e.g., Gobi devices).
• Build and Code Generation Tools:
– The build-aux directory, which contains scripts and code generators (qmi-codegen and mkenums), as well as a set of templates.
• Data Definitions:
– The data directory with various JSON files (e.g., qmi-common.json, qmi-service-*.json), which likely feed into code generators or document supported protocols.
• Documentation and Examples:
– docs, examples, and test directories provide usage examples and verification of functionality.
Relationships and Interactions
• The command-line tools (qmicli, qmi-network, etc.) depend on and invoke routines from the library (libqmi-glib).
• The library itself leverages the lower-level common modules and possibly hardware-specific integrations (as seen in the Gobi API directories).
• Build and code generation scripts (in build-aux) are used in creating parts of the library (such as enum and flag definitions) using data from the JSON files in the data directory.
• There is a clear separation between the core protocol handling and the vendor-specific extensions (Gobi API) that abstract hardware-specific communication.
• The meson.build files scattered throughout illustrate the build system dependency: each component is built and linked together during the compilation process.
Architectural Patterns and Principles
• Modular Design: Separation between the core library (libqmi-glib) and the tools that use it.
• Layered Architecture: Application layer (command-line tools) above the library layer, which then interfaces with lower-level hardware interfacing.
• Extensibility: The use of code generation and templating (e.g., in build-aux and data directories) suggests that many parts of the API are autogenerated to ease updates and integration.
• Vendor-Specific Extensions: The multiple versions of Gobi API implementations indicate that the project is built to support different vendor devices through modular inclusions.
Relevant Technologies
• Glib (since it is glib-based).
• C for the core libraries and tools (as indicated by the .c and .h files).
• Meson build system (meson.build files indicate the chosen build configuration).
• Python (via some scripts in the build-aux/qmi-codegen directory and utilities under utils/qmidb).