Skip to content

Commit

Permalink
Anjay-freertos-client 21.10
Browse files Browse the repository at this point in the history
Features:
 * Updated Anjay to version 2.14.0:
  - Used pre-implemented event loop.
  - Provided threading compatibility sources.
  - Used IPSO Objects API to implement sensors and push button.
 * Changed displayed sensor units.
  • Loading branch information
micholek committed Oct 7, 2021
1 parent 62df6ab commit 294b851
Show file tree
Hide file tree
Showing 54 changed files with 15,809 additions and 16,224 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
Projects/*/.cproject
Projects/*/.mxproject
Projects/*/.project
__pycache__/
48 changes: 31 additions & 17 deletions Application/Inc/anjay/anjay_config.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2021 AVSystem <[email protected]>
* Copyright 2020-2021 AVSystem <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -81,7 +81,7 @@
*
* Only meaningful if <c>ANJAY_WITH_LOGS</c> is enabled.
*/
//#define ANJAY_WITH_TRACE_LOGS
/* #undef ANJAY_WITH_TRACE_LOGS */

/**
* Enable core support for Access Control mechanisms.
Expand All @@ -91,7 +91,7 @@
* <c>ANJAY_WITH_MODULE_ACCESS_CONTROL</c>, or a custom application-provided one
* may be used.
*/
#define ANJAY_WITH_ACCESS_CONTROL
/* #undef ANJAY_WITH_ACCESS_CONTROL */

/**
* Enable support for the <c>anjay_download()</c> API.
Expand Down Expand Up @@ -148,6 +148,28 @@
*/
#define ANJAY_WITH_OBSERVATION_STATUS

/**
* Enable guarding of all accesses to <c>anjay_t</c> with a mutex.
*/
/* #undef ANJAY_WITH_THREAD_SAFETY */

/**
* Enable standard implementation of an event loop.
*
* Requires C11 <c>stdatomic.h</c> header to be available, and either a platform
* that provides a BSD-compatible socket API, or a compatibility layer file (see
* <c>AVS_COMMONS_POSIX_COMPAT_HEADER</c> in <c>avs_commons_config.h</c>). This
* is designed to best work with the defalt implementation of avs_net sockets
* (see <c>AVS_COMMONS_NET_WITH_POSIX_AVS_SOCKET</c>), but alternative socket
* implementations can also be used.
*
* The event loop is most useful when thread safety features
* (@ref ANJAY_WITH_THREAD_SAFETY and <c>AVS_COMMONS_SCHED_THREAD_SAFE</c>) are
* enabled as well, but this is not a hard requirement. See the documentation
* for <c>anjay_event_loop_run()</c> for details.
*/
#define ANJAY_WITH_EVENT_LOOP

/**
* Enable support for features new to LwM2M protocol version 1.1.
*
Expand Down Expand Up @@ -319,18 +341,6 @@
*/
#define ANJAY_MAX_PK_OR_IDENTITY_SIZE 256

/**
* Maximum size in bytes supported for the "Server Public Key" resource in the
* LwM2M Security object.
*
* If editing this file manually, <c>256</c> shall
* be replaced with a positive integer literal.
*
* The default value defined in CMake build scripts is 2048.
* Minimal suggested setting for low-resource builds is 256.
*/
#define ANJAY_MAX_SERVER_PK_OR_IDENTITY_SIZE 256

/**
* Maximum size in bytes supported for the "Secret Key" resource in the LwM2M
* Security Object.
Expand Down Expand Up @@ -428,11 +438,15 @@

/**
* Enable fw_update module (implementation of the Firmware Update object).
*
* Requires <c>ANJAY_WITH_DOWNLOADER</c> to be enabled.
*/
#define ANJAY_WITH_MODULE_FW_UPDATE

/**
* Enables ipso_objects module (generic implementation of the following kinds of
* the basic sensor and three axis sensor IPSO objects).
*/
#define ANJAY_WITH_MODULE_IPSO_OBJECTS

/**
* Enable at_sms module (implementation of an SMS driver for AT modem devices).
*
Expand Down
12 changes: 6 additions & 6 deletions Application/Inc/avsystem/coap/avs_coap_config.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2021 AVSystem <[email protected]>
* Copyright 2020-2021 AVSystem <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -52,14 +52,14 @@
* In the repository, this file is provided as <c>avs_coap_config.h.in</c>,
* intended to be processed by CMake. If editing this file manually, please copy
* or rename it to <c>avs_coap_config.h</c> and for each of the
* <c>#cmakedefine</c> directives, please either replace it with regular
* <c>#define</c> to enable it, or comment it out to disable. You may also need
* <c>\#cmakedefine</c> directives, please either replace it with regular
* <c>\#define</c> to enable it, or comment it out to disable. You may also need
* to replace variables wrapped in <c>\@</c> signs with concrete values. Please
* refer to the comments above each of the specific definition for details.
*
* If you are editing a file previously generated by CMake, these
* <c>#cmakedefine</c>s will be already replaced by either <c>#define</c> or
* commented out <c>#undef</c> directives.
* <c>\#cmakedefine</c>s will be already replaced by either <c>\#define</c> or
* commented out <c>\#undef</c> directives.
*/

/**
Expand Down Expand Up @@ -161,7 +161,7 @@
/**
* Enable poisoning of unwanted symbols when compiling avs_coap.
*
* Requires a compiler that supports #pragma GCC poison.
* Requires a compiler that supports <c>\#pragma GCC poison</c>.
*
* This is mostly useful during development, to ensure that avs_commons do not
* attempt to call functions considered harmful in this library, such as printf.
Expand Down
95 changes: 78 additions & 17 deletions Application/Inc/avsystem/commons/avs_commons_config.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2021 AVSystem <[email protected]>
* Copyright 2020-2021 AVSystem <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -217,7 +217,7 @@
* This implementation is usually very inefficient, and requires C11 stdatomic.h
* header to be available.
*/
#define AVS_COMMONS_COMPAT_THREADING_WITH_ATOMIC_SPINLOCK
/* #undef AVS_COMMONS_COMPAT_THREADING_WITH_ATOMIC_SPINLOCK */

/**
* Enable implementation based on the POSIX Threads library.
Expand Down Expand Up @@ -258,6 +258,16 @@
#define AVS_COMMONS_WITH_MBEDTLS
/* #undef AVS_COMMONS_WITH_OPENSSL */
/* #undef AVS_COMMONS_WITH_TINYDTLS */

/**
* Enable support for custom TLS socket implementation.
*
* If enabled, the user needs to provide their own implementations of
* <c>_avs_net_create_ssl_socket()</c>, <c>_avs_net_create_dtls_socket()</c>,
* <c>_avs_net_initialize_global_ssl_state() and
* <c>_avs_net_cleanup_global_ssl_state()</c>.
*/
/* #undef AVS_COMMONS_WITH_CUSTOM_TLS */
/**@}*/

/**
Expand All @@ -266,7 +276,8 @@
/**@{*/
/**
* Enable AEAD and HKDF support in avs_crypto. Requires MbedTLS in version at
* least 2.14.0 or OpenSSL in version at least 1.1.0.
* least 2.14.0, OpenSSL in version at least 1.1.0, or custom implementation in
* case of <c>AVS_COMMONS_WITH_CUSTOM_TLS</c>.
*/
/* #undef AVS_COMMONS_WITH_AVS_CRYPTO_ADVANCED_FEATURES */

Expand All @@ -292,8 +303,9 @@
* generating and managing keys and certificates via external engines.
*
* An actual implementation is required to use this feature. In the commercial
* version, you may use one of the default ones utilizing the PKCS#11 API (see
* @ref AVS_COMMONS_WITH_MBEDTLS_PKCS11_ENGINE and
* version, you may use one of the default ones (see
* @ref AVS_COMMONS_WITH_MBEDTLS_PKCS11_ENGINE,
* @ref AVS_COMMONS_WITH_MBEDTLS_PSA_ENGINE and
* @ref AVS_COMMONS_WITH_OPENSSL_PKCS11_ENGINE) or provide your own.
*
* The functions that need to be provided in case of a custom implementation:
Expand All @@ -314,7 +326,7 @@
* - <c>_avs_crypto_openssl_engine_load_crls()</c>
* - <c>_avs_crypto_openssl_engine_load_private_key()</c>
*
* External engines are supported only in OpenSSL and Mbed TLS backends.
* External engines are NOT supported in the TinyDTLS backend.
*/
/* #undef AVS_COMMONS_WITH_AVS_CRYPTO_ENGINE */

Expand All @@ -324,13 +336,58 @@
*
* Requires @ref AVS_COMMONS_WITH_AVS_CRYPTO_ENGINE to be enabled.
*
* NOTE: Query string format for this engine is a subset of the PKCS#11 URI
* scheme (see RFC 7512), modelled after the format accepted by libp11 OpenSSL
* engine.
*
* NOTE: The unit tests for this feature depend on SoftHSM and pkcs11-tool.
* These must be installed for the tests to pass.
*
* IMPORTANT: Only available in the commercial version. Ignored in the open
* source version. */
* source version.
*/
/* #undef AVS_COMMONS_WITH_MBEDTLS_PKCS11_ENGINE */

/**
* Enables the default implementation of avs_crypto engine, based on Mbed TLS
* and Platform Security Architecture (PSA).
*
* Requires @ref AVS_COMMONS_WITH_AVS_CRYPTO_ENGINE to be enabled.
*
* NOTE: Query string format for this engine is:
*
* <pre>
* kid=<key_ID>[,lifetime=<lifetime>]|uid=<persistent_storage_UID>
* </pre>
*
* The values are parsed using strtoull() with base=0, so may be in decimal,
* 0-prefixed octal or 0x-prefixed hexadecimal. On key generation and
* certificate storage, the specified lifetime will be used, or lifetime 1
* (default persistent storage) will be used if not. On key or certificate use,
* the lifetime of the actual key will be verified if present on the query
* string and the key will be rejected if different.
*
* Certificates are stored as PSA_KEY_TYPE_RAW_DATA key entries containing
* X.509 DER data. Alternatively, the PSA Protected Storage API can be used if
* @ref AVS_COMMONS_WITH_MBEDTLS_PSA_ENGINE_PROTECTED_STORAGE is enabled, by
* using the <c>uid=...</c> syntax.
*
* IMPORTANT: Only available in the commercial version. Ignored in the open
* source version.
*/
/* #undef AVS_COMMONS_WITH_MBEDTLS_PSA_ENGINE */

/**
* Enables support for the PSA Protected Storage API in the PSA-based avs_crypto
* engine.
*
* Requires @ref AVS_COMMONS_WITH_MBEDTLS_PSA_ENGINE to be enabled.
*
* IMPORTANT: Only available in the commercial version. Ignored in the open
* source version.
*/
/* #undef AVS_COMMONS_WITH_MBEDTLS_PSA_ENGINE_PROTECTED_STORAGE */

/**
* Is the <c>dlsym()</c> function available?
*
Expand All @@ -352,11 +409,16 @@
*
* Requires @ref AVS_COMMONS_WITH_AVS_CRYPTO_ENGINE to be enabled.
*
* NOTE: Query string format for this engine is a subset of the PKCS#11 URI
* scheme (see RFC 7512), modelled after the format accepted by libp11 OpenSSL
* engine.
*
* NOTE: The unit tests for this feature depend on SoftHSM and pkcs11-tool.
* These must be installed for the tests to pass.
*
* IMPORTANT: Only available in the commercial version. Ignored in the open
* source version. */
* source version.
*/
/* #undef AVS_COMMONS_WITH_OPENSSL_PKCS11_ENGINE */
/**@}*/

Expand Down Expand Up @@ -440,6 +502,13 @@
* components.
*/
/* #undef AVS_COMMONS_WITH_INTERNAL_TRACE */

/**
* Enables external implementation of logger subsystem with provided header.
*
* Default logger implementation can be found in avs_log_impl.h
*/
/* #undef AVS_COMMONS_WITH_EXTERNAL_LOGGER_HEADER */
/**@}*/

/**
Expand Down Expand Up @@ -573,14 +642,6 @@
*/
/* #undef AVS_COMMONS_NET_POSIX_AVS_SOCKET_HAVE_INET_NTOP */

/**
* Is the <c>inet_pton()</c> function available?
*
* Disabling this flag will cause an internal implementation of this function
* adapted from BIND 4.9.4 to be used instead.
*/
/* #undef AVS_COMMONS_NET_POSIX_AVS_SOCKET_HAVE_INET_PTON */

/**
* Is the <c>poll()</c> function available?
*
Expand All @@ -606,7 +667,7 @@
* Makes all scheduler accesses synchronized and thread-safe, at the cost of
* requiring avs_compat_threading to be enabled, and higher resource usage.
*/
/* #undef AVS_COMMONS_SCHED_THREAD_SAFE */
#define AVS_COMMONS_SCHED_THREAD_SAFE

/**
* Enable support for file I/O in avs_stream.
Expand Down
1 change: 0 additions & 1 deletion Application/Inc/avsystem/commons/lwip-posix-compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@

#if LWIP_VERSION_MAJOR >= 2
# define AVS_COMMONS_NET_POSIX_AVS_SOCKET_HAVE_INET_NTOP
# define AVS_COMMONS_NET_POSIX_AVS_SOCKET_HAVE_INET_PTON
#endif // LWIP_VERSION_MAJOR >= 2

typedef int sockfd_t;
Expand Down
39 changes: 0 additions & 39 deletions Application/Inc/basic_sensor_object.h

This file was deleted.

2 changes: 0 additions & 2 deletions Application/Inc/lwm2m.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,4 @@ void lwm2m_init(void);

void lwm2m_start(void);

void lwm2m_notify_start(void);

#endif // LWM2M_H
3 changes: 0 additions & 3 deletions Application/Inc/plf/plf_custom_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
#define LWM2M_THREAD_STACK_SIZE (12288U)
#define LWM2M_THREAD_PRIO osPriorityNormal

#define LWM2M_NOTIFY_THREAD_STACK_SIZE (512U)
#define LWM2M_NOTIFY_THREAD_PRIO osPriorityNormal

#define BOARD_BUTTONS_THREAD_STACK_SIZE (256U)
#define BOARD_BUTTONS_THREAD_PRIO osPriorityBelowNormal

Expand Down
Loading

0 comments on commit 294b851

Please sign in to comment.