-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial release of Anjay 4 Alpha.
- Loading branch information
0 parents
commit 83000a9
Showing
124 changed files
with
35,451 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
BasedOnStyle: llvm | ||
AccessModifierOffset: -4 | ||
AlignEscapedNewlinesLeft: true | ||
AlignOperands: true | ||
AllowShortFunctionsOnASingleLine: Empty | ||
AlwaysBreakTemplateDeclarations: true | ||
AvoidMisleadingControlStatementContinuationIndent: true | ||
BinPackParameters: false | ||
BinPackArguments: true | ||
BreakBeforeBinaryOperators: NonAssignment | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
ConstructorInitializerIndentWidth: 8 | ||
ContinuationIndentWidth: 8 | ||
Cpp11BracedListStyle: false | ||
IndentWidth: 4 | ||
PenaltyBreakBeforeFirstCallParameter: 40 | ||
SpaceAfterCStyleCast: true | ||
TypenameMacros: ['AVS_LIST', 'AVS_RBTREE', 'AVS_RBTREE_ELEM', 'AVS_VECTOR', 'AVS_SORTED_SET', 'AVS_SORTED_SET_ELEM'] | ||
BreakDesignatedInitializers: true | ||
IndentPPDirectives: AfterHash | ||
CommentPragmas: "AVSYSTEM_ANJAY_COMMERCIAL.*" | ||
ExperimentalAutoDetectBinPacking: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
docs/diagrams/out | ||
|
||
# NetBeans Project | ||
nbproject | ||
|
||
# VSCode | ||
.vscode/ | ||
|
||
build/ | ||
site/ | ||
|
||
# make | ||
CMakeFiles/ | ||
anjay_basic_example | ||
cmake_install.cmake | ||
CMakeCache.txt | ||
libfluf.a | ||
libavs_commons.a | ||
Makefile | ||
|
||
/anjay_basic_with_dm_example | ||
/dm_tests | ||
/sdm_tests | ||
/example_coap_udp | ||
/fluf_tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "deps/avs_commons"] | ||
path = deps/avs_commons | ||
url = https://github.com/AVSystem/avs_commons.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
cmake_minimum_required(VERSION 3.4.0) | ||
|
||
add_compile_options(-std=c99 -pedantic -Wall -Wextra -Winit-self | ||
-Wmissing-declarations -Wc++-compat -Wsign-conversion | ||
-Wconversion -Wcast-qual -Wvla -Wno-variadic-macros | ||
-Wno-long-long -Wshadow -O0 -g3) | ||
#target_compile_options(fluf PUBLIC -O0 -g3 -Wall) | ||
|
||
#avs_commons | ||
project(avs_commons C) | ||
file(GLOB_RECURSE commons_src | ||
"${CMAKE_CURRENT_SOURCE_DIR}/deps/avs_commons/src/**/*.c" | ||
) | ||
|
||
add_library(avs_commons ${commons_src}) | ||
|
||
target_include_directories(avs_commons PUBLIC | ||
"${CMAKE_CURRENT_SOURCE_DIR}/linux_config" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/deps/avs_commons/include_public" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/deps/avs_commons/src" | ||
) | ||
target_link_libraries(avs_commons m pthread anl) | ||
|
||
|
||
#fluf | ||
project(fluf C) | ||
|
||
file(GLOB_RECURSE fluf_src | ||
"${CMAKE_CURRENT_SOURCE_DIR}/src/fluf/*.c" | ||
) | ||
add_library(fluf ${fluf_src}) | ||
|
||
target_compile_definitions(fluf PUBLIC | ||
-DFLUF_WITH_LWM2M11 | ||
-DFLUF_WITH_LWM2M12 | ||
-DFLUF_WITH_SENML_CBOR | ||
-DFLUF_WITH_LWM2M_CBOR | ||
-DFLUF_WITH_CBOR | ||
-DFLUF_WITH_CBOR_INDEFINITE_BYTES | ||
-DFLUF_WITH_CBOR_DECIMAL_FRACTIONS | ||
-DFLUF_WITH_CBOR_HALF_FLOAT | ||
-DFLUF_WITH_CBOR_STRING_TIME) | ||
|
||
target_include_directories(fluf PUBLIC | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include_public" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/deps/avs_commons/include_public" | ||
) | ||
target_link_libraries(fluf PUBLIC avs_commons) | ||
|
||
# anjay_basic example | ||
project(anjay_basic_example C) | ||
|
||
file(GLOB_RECURSE anjay_lite_src | ||
"${CMAKE_CURRENT_SOURCE_DIR}/src/anjay_lite/*.c" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/src/anj/sdm/*.c" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/src/anj/compat/posix/anj_time.c") | ||
|
||
add_executable(anjay_basic_example | ||
examples/anjay_basic/anjay_net_impl.c | ||
examples/anjay_basic/main.c | ||
${anjay_lite_src}) | ||
|
||
target_include_directories(anjay_basic_example PUBLIC | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include_public" | ||
) | ||
|
||
target_link_libraries(anjay_basic_example PUBLIC fluf) | ||
|
||
# anjay_basic_with_send example | ||
project(anjay_send_example C) | ||
|
||
add_executable(anjay_send_example | ||
examples/anjay_basic_with_send/anjay_net_impl.c | ||
examples/anjay_basic_with_send/main.c | ||
${anjay_lite_src}) | ||
|
||
target_include_directories(anjay_send_example PUBLIC | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include_public" | ||
) | ||
|
||
target_link_libraries(anjay_send_example PUBLIC fluf) | ||
|
||
# anjay_basic_with_firmware_update example | ||
project(anjay_firmware_update_example C) | ||
|
||
add_executable(anjay_firmware_update_example | ||
examples/anjay_basic_with_firmware_update/anjay_net_impl.c | ||
examples/anjay_basic_with_firmware_update/firmware_update.c | ||
examples/anjay_basic_with_firmware_update/main.c | ||
${anjay_lite_src}) | ||
|
||
target_include_directories(anjay_firmware_update_example PUBLIC | ||
"${CMAKE_CURRENT_SOURCE_DIR}/examples/anjay_basic_with_firmware_update" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include_public" | ||
) | ||
|
||
target_link_libraries(anjay_firmware_update_example PUBLIC fluf) | ||
|
||
|
||
#fluf_tests | ||
project(fluf_tests C) | ||
|
||
file(GLOB fluf_tests_sources | ||
"${CMAKE_CURRENT_SOURCE_DIR}/tests/fluf/*.c") | ||
|
||
add_executable(fluf_tests | ||
${fluf_tests_sources}) | ||
|
||
target_include_directories(fluf_tests PUBLIC | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include_public" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/deps/avs_commons/include_public" | ||
) | ||
target_link_libraries(fluf_tests PUBLIC fluf) | ||
|
||
target_compile_options(fluf_tests PUBLIC -Wno-pedantic -Wno-c++-compat) | ||
|
||
#dm_tests | ||
project(dm_tests C) | ||
|
||
file(GLOB dm_test_sources | ||
"${CMAKE_CURRENT_SOURCE_DIR}/src/anj/*.c" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/src/anj/dm/*.c" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/tests/anj/dm/*.c") | ||
|
||
add_executable(dm_tests | ||
${dm_test_sources}) | ||
|
||
target_compile_definitions(dm_tests PUBLIC | ||
-DUNIT_TESTING) | ||
|
||
target_include_directories(dm_tests PUBLIC | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include_public" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/deps/avs_commons/include_public" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/tests/anj/dm") | ||
|
||
target_link_libraries(dm_tests PUBLIC avs_commons) | ||
|
||
target_compile_options(dm_tests PUBLIC -Wno-pedantic -Wno-c++-compat) | ||
|
||
#sdm_tests | ||
project(sdm_tests C) | ||
|
||
file(GLOB sdm_test_sources | ||
"${CMAKE_CURRENT_SOURCE_DIR}/src/anj/sdm/*.c" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/tests/anj/sdm/*.c" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/src/anj/compat/posix/anj_time.c") | ||
|
||
add_executable(sdm_tests | ||
${sdm_test_sources}) | ||
|
||
target_compile_definitions(sdm_tests PUBLIC -DUNIT_TESTING) | ||
|
||
target_include_directories(sdm_tests PUBLIC | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include_public" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/deps/avs_commons/include_public") | ||
|
||
target_link_libraries(sdm_tests PUBLIC fluf) | ||
|
||
target_compile_options(sdm_tests PUBLIC -Wno-pedantic -Wno-c++-compat) | ||
|
||
#valgrind targets | ||
find_program(VALGRIND_EXECUTABLE valgrind) | ||
if(VALGRIND_EXECUTABLE) | ||
add_custom_target(fluf_tests_with_valgrind | ||
COMMAND ${VALGRIND_EXECUTABLE} --leak-check=full --track-origins=yes -q --error-exitcode=63 $<TARGET_FILE:fluf_tests>) | ||
add_custom_target(dm_tests_with_valgrind | ||
COMMAND ${VALGRIND_EXECUTABLE} --leak-check=full --track-origins=yes -q --error-exitcode=63 $<TARGET_FILE:dm_tests>) | ||
add_custom_target(sdm_tests_with_valgrind | ||
COMMAND ${VALGRIND_EXECUTABLE} --leak-check=full --track-origins=yes -q --error-exitcode=63 $<TARGET_FILE:sdm_tests>) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
AVSystem-5-clause License | ||
|
||
Copyright by AVSystem sp. z o.o. (AVSystem) 17th March 2022. | ||
All rights reserved. | ||
This software is licensed under the following conditions specified below. | ||
|
||
|
||
|
||
All materials referring to features or use of this software must display the | ||
following acknowledgement: | ||
|
||
"This product includes software developed by AVSystem" | ||
|
||
Redistribution and use of the software in source and binary code forms, with or | ||
without modification, are permitted only provided that the following conditions | ||
are met: | ||
|
||
1. Redistribution of source code must retain copyright notice and include the | ||
list of usage conditions and AVSystem's disclaimer. | ||
|
||
2. Redistribution in binary form, except as embedded in a physical device, must | ||
contain the above copyright notice, this list of conditions of use and the | ||
following disclaimer in the documentation and/or other materials provided | ||
with the software. | ||
|
||
3. Neither the name of the AVSystem nor its collaborators (if any) may be used | ||
to offer or promote products derived from this software without prior | ||
written consent of the owner. | ||
|
||
4. Commercial use of this software, with or without modifications, requires | ||
prior notification to AVSystem at [email protected] of such use. In case | ||
the software is used together with AVSystem's CoioteDM Platform, such | ||
notification is not required. | ||
|
||
5. Commercial use of the software is limited to 100.000 (one hundred thousand) | ||
devices, unless a separate agreement with AVSystem is made. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT OWNER "AS IS" AND ANY DIRECT OR | ||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND REGARDLESS OF THE SOURCE OF | ||
LIABILITY, WHETHER CONTRACT, DIRECT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Anjay LwM2M library [<img align="right" height="50px" src="https://avsystem.github.io/Anjay-doc/_images/avsystem_logo.png">](http://www.avsystem.com/) | ||
|
||
## ALPHA RELEASE NOTICE | ||
|
||
This is an alpha, work-in-progress release of Anjay 4. All APIs are a subject to | ||
change without any notice. | ||
|
||
### Currently supported features | ||
|
||
- no dynamic memory allocation | ||
- UDP binding | ||
- LwM2M 1.1 & 1.2 | ||
- TLV Content-Format for input operations | ||
- CBOR and SenML CBOR Content-Format for output operations | ||
- Static data model supporting all operations, except Composite operations | ||
- LwM2M Send support | ||
- Minimal implementations of Security (/0), Server (/1) and Device (/3) objects | ||
- Full implementation for Firmware Update (/5) object | ||
- Partial support for LwM2M Notify (only on resource level, with `pmin` and | ||
`pmax` attributes) | ||
|
||
## What is Anjay? | ||
|
||
Anjay is a C library that aims to be the reference implementation of the OMA | ||
Lightweight Machine-to-Machine (LwM2M) device management protocol. It eases | ||
development of fully-featured LwM2M client applications by taking care of | ||
protocol details, allowing the user to focus on device-specific aspects. | ||
|
||
The project has been created and is actively maintained by | ||
[AVSystem](https://www.avsystem.com). | ||
|
||
## Getting started | ||
|
||
> **__NOTE:__** Currently, the only supported OS that can run examples and tests | ||
> is Linux. | ||
### Building | ||
|
||
```sh | ||
mkdir build | ||
cd build | ||
cmake .. | ||
|
||
make -j all | ||
``` | ||
|
||
### Running examples | ||
|
||
There are 3 examples available: | ||
- `anjay_basic_example`, which is a minimal application that instantiates a | ||
simulated temperature sensor | ||
- `anjay_send_example`, which additionally periodicaly reports temperature | ||
readings using LwM2M Send method | ||
- `anjay_firmware_update_example`, which uses LwM2M Firmware Update object to | ||
download and run the downloaded binary | ||
|
||
```sh | ||
cd build | ||
./anjay_basic_example endpoint_name | ||
./anjay_send_example endpoint_name | ||
./anjay_firmware_update_example endpoint_name | ||
``` | ||
|
||
### Running tests | ||
|
||
```sh | ||
cd build | ||
./dm_tests | ||
./fluf_tests | ||
./sdm_tests | ||
``` | ||
|
||
Additionally, these tests can be run with Valgrind: | ||
|
||
```sh | ||
cd build | ||
make fluf_tests_with_valgrind | ||
make dm_tests_with_valgrind | ||
make sdm_tests_with_valgrind | ||
``` |
Submodule avs_commons
added at
ebcc5a
Oops, something went wrong.