Coder Social home page Coder Social logo

nrdg42 / coremqtt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from freertos/coremqtt

0.0 0.0 0.0 2 MB

Client implementation of the MQTT 3.1.1 specification for embedded devices

License: MIT License

CMake 2.55% C 89.09% Makefile 7.21% Python 1.15%

coremqtt's Introduction

coreMQTT Client Library

This repository contains the coreMQTT library that has been optimized for a low memory footprint. The coreMQTT library is fully compliant with the MQTT 3.1.1 standard. It has no dependencies on any additional libraries other than the standard C library, a customer-implemented network transport interface, and optionally a user-implemented platform time function. This library is distributed under the MIT Open Source License.

This library has gone through code quality checks including verification that no function has a GNU Complexity score over 8, and checks against deviations from mandatory rules in the MISRA coding standard. Deviations from the MISRA C:2012 guidelines are documented under MISRA Deviations. This library has also undergone both static code analysis from Coverity static analysis, and validation of memory safety and proof of functional correctness through the CBMC automated reasoning tool.

MQTT Config File

The MQTT client library exposes build configuration macros that are required for building the library. A list of all the configurations and their default values are defined in core_mqtt_config_defaults.h. To provide custom values for the configuration macros, a custom config file named core_mqtt_config.h can be provided by the application to the library.

By default, a core_mqtt_config.h custom config is required to build the library. To disable this requirement and build the library with default configuration values, provide MQTT_DO_NOT_USE_CUSTOM_CONFIG as a compile time preprocessor macro.

Thus, the MQTT library can be built by either:

  • Defining a core_mqtt_config.h file in the application, and adding it to the include directories list of the library
    OR
  • Defining the MQTT_DO_NOT_USE_CUSTOM_CONFIG preprocessor macro for the library build.

Building the Library

The mqttFilePaths.cmake file contains the information of all source files and the header include path required to build the MQTT library.

As mentioned in the previous section, either a custom config file (i.e. core_mqtt_config.h) OR MQTT_DO_NOT_USE_CUSTOM_CONFIG macro needs to be provided to build the MQTT library.

For a CMake example of building the MQTT library with the mqttFilePaths.cmake file, refer to the coverity_analysis library target in test/CMakeLists.txt file.

Building Unit Tests

Checkout CMock Submodule

By default, the submodules in this repository are configured with update=none in .gitmodules to avoid increasing clone time and disk space usage of other repositories (like amazon-freertos that submodule this repository.

To build unit tests, the submodule dependency of CMock is required. Use the following command to clone the submodule:

git submodule update --checkout --init --recursive test/unit-test/CMock

Platform Prerequisites

  • For running unit tests
    • C90 compiler like gcc
    • CMake 3.13.0 or later
    • Ruby 2.0.0 or later is additionally required for the CMock test framework (that we use).
  • For running the coverage target, gcov and lcov are additionally required.

Steps to build Unit Tests

  1. Go to the root directory of this repository. (Make sure that the CMock submodule is cloned as described above)

  2. Run the cmake command: cmake -S test -B build

  3. Run this command to build the library and unit tests: make -C build all

  4. The generated test executables will be present in build/bin/tests folder.

  5. Run cd build && ctest to execute all tests and view the test run summary.

Reference examples

The AWS IoT Embedded C-SDK repository contains demos of using the MQTT client library here on a POSIX platform. These can be used as reference examples for the library API.

Generating documentation

The Doxygen references were created using Doxygen version 1.8.20. To generate the Doxygen pages, please run the following command from the root of this repository:

doxygen docs/doxygen/config.doxyfile

coremqtt's People

Contributors

aggarw13 avatar muneebahmed10 avatar sarenameas avatar gordonwang0 avatar leegeth avatar abhidixi11 avatar yourslab avatar karkhaz avatar gkwicker avatar nateglims avatar dcgaws avatar feliperodri avatar yngki avatar cobusve avatar navinns avatar nrdg42 avatar ravibhagavandas avatar fbbotero-aws avatar markrtuttle avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.