diff --git a/AdvancedTopics.html b/AdvancedTopics.html index ec2bf88c..ba4717b6 100644 --- a/AdvancedTopics.html +++ b/AdvancedTopics.html @@ -1,18 +1,23 @@
LwM2M Client may be connected to more than one LwM2M Server. In such situation, restricting Server access to some part of the data model may be required.
In a multi-server environment every Object Instance (except Instances of the Access Control Object) has associated Access Control Instance:
Resource
Resource ID
ACL Resource of the Access Control Object Instance is populated with pairs of form (Short Server ID, Access mask). Access mask is a combination of the following access flags (combined by bitwise OR operator):
Access flag
Allowed LwM2M Operations
Access Control Object also helps in managing Object Instance lifetime. Whenever some Object Instance is orphaned (i.e. no LwM2M Server is an Access Control Owner of the Access Control Instance associated with this Object Instance) it @@ -203,7 +202,7 @@
In this example, we are going to setup multiple-server environment. We will assign LwM2M Server with SSID 1 the Create permission on the Test Object developed in another tutorial.
The Write Attributes and Discover operations, as well as the Information Reporting interface, use a concept of Attributes that may be set for Resources, Object Instances or Objects.
As the cases described above are very common and generic – and as such, usually implemented in exactly the same manner for all objects in the code base, the library includes a subsystem that implements all the attribute-related handlers @@ -128,7 +137,7 @@
To facilitate storing attribute values between executions of the program, the Attribute Storage subsystem contains a persistence code, that can be used to serialize and deserialize all the stored attributes to some kind of external diff --git a/AdvancedTopics/AT-Certificates.html b/AdvancedTopics/AT-Certificates.html index bb39de5b..16495a17 100644 --- a/AdvancedTopics/AT-Certificates.html +++ b/AdvancedTopics/AT-Certificates.html @@ -1,18 +1,23 @@
In Enabling secure communication section you learned how to use PSK to enable secure connection in Anjay using DTLS. In this section, we will show how to use certificates instead of PSK.
The anjay_event_loop_run() function that is used in other examples carries out all the tasks necessary to handle events related to LwM2M. However, there are scenarios in which you might not want to use this function, including:
anjay_event_loop_run()
UDP sockets that Anjay uses to communicate with LwM2M Servers are accessible via the anjay_get_sockets() call. All the used sockets are returned as an AVS_LIST (implemented and documented in the AVSystem Commons Library).
anjay_get_sockets()
AVS_LIST
Anjay uses an internal scheduler for executing a number of tasks, including automated sending of Registration Updates and notifications, among others.
During runtime, Anjay schedules jobs with specific deadlines, and @@ -156,7 +165,7 @@
Taking into account previous subsections we could modify the event loop presented before as follows:
Run the scheduler by calling anjay_sched_run() to execute any outstanding jobs.
anjay_sched_run()
So, it could be written like this:
#include <anjay/anjay.h> #include <anjay/security.h> @@ -340,7 +349,7 @@ 5.9.1. Incoming network packets -5.9.4. anjay_serve_any() +5.9.4. anjay_serve_any() anjay_serve_any() is a simplified API that allows writing a simple event loop that the user retains control of. diff --git a/AdvancedTopics/AT-CustomObjects.html b/AdvancedTopics/AT-CustomObjects.html index fac4b28c..acc1a32f 100644 --- a/AdvancedTopics/AT-CustomObjects.html +++ b/AdvancedTopics/AT-CustomObjects.html @@ -1,18 +1,23 @@ - + - 5.4. Custom LwM2M objects — Anjay 3.4.1 documentation + 5.4. Custom LwM2M objects — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,9 +96,9 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects + + 5. Advanced topics + 5.4. Custom LwM2M objects @@ -99,7 +108,7 @@ -5.4. Custom LwM2M objects +5.4. Custom LwM2M objects Note This section describes in details the implementation of custom Objects in diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO1_SingleInstanceReadOnly.html b/AdvancedTopics/AT-CustomObjects/AT_CO1_SingleInstanceReadOnly.html index 661aea3c..3de8d5c5 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO1_SingleInstanceReadOnly.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO1_SingleInstanceReadOnly.html @@ -1,19 +1,24 @@ - + - Redirection — Anjay 3.4.1 documentation + Redirection — Anjay 3.5.0 documentation + + + @@ -24,15 +29,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -64,8 +73,8 @@ - » - Redirection + + Redirection @@ -75,7 +84,7 @@ -↳ Single-instance read-only object +↳ Single-instance read-only object diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO2_SingleInstanceExecutableAndReadOnly.html b/AdvancedTopics/AT-CustomObjects/AT_CO2_SingleInstanceExecutableAndReadOnly.html index 8c492640..250527c8 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO2_SingleInstanceExecutableAndReadOnly.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO2_SingleInstanceExecutableAndReadOnly.html @@ -1,19 +1,24 @@ - + - Redirection — Anjay 3.4.1 documentation + Redirection — Anjay 3.5.0 documentation + + + @@ -24,15 +29,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -64,8 +73,8 @@ - » - Redirection + + Redirection @@ -75,7 +84,7 @@ -↳ Single-instance read-only object with an executable resource +↳ Single-instance read-only object with an executable resource diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO3_MultiInstanceReadOnlyFixed.html b/AdvancedTopics/AT-CustomObjects/AT_CO3_MultiInstanceReadOnlyFixed.html index 258636b6..1400d952 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO3_MultiInstanceReadOnlyFixed.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO3_MultiInstanceReadOnlyFixed.html @@ -1,19 +1,24 @@ - + - Redirection — Anjay 3.4.1 documentation + Redirection — Anjay 3.5.0 documentation + + + @@ -24,15 +29,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -64,8 +73,8 @@ - » - Redirection + + Redirection @@ -75,7 +84,7 @@ -↳ Multi-instance read-only object with fixed number of instances +↳ Multi-instance read-only object with fixed number of instances diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO4_FixedInstanceWritable.html b/AdvancedTopics/AT-CustomObjects/AT_CO4_FixedInstanceWritable.html index f96e060e..69272557 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO4_FixedInstanceWritable.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO4_FixedInstanceWritable.html @@ -1,19 +1,24 @@ - + - Redirection — Anjay 3.4.1 documentation + Redirection — Anjay 3.5.0 documentation + + + @@ -24,15 +29,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -64,8 +73,8 @@ - » - Redirection + + Redirection @@ -75,7 +84,7 @@ -↳ Multi-instance writable object with fixed number of instances +↳ Multi-instance writable object with fixed number of instances diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO5_MultiInstanceDynamic.html b/AdvancedTopics/AT-CustomObjects/AT_CO5_MultiInstanceDynamic.html index 99de222b..e8c6c27d 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO5_MultiInstanceDynamic.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO5_MultiInstanceDynamic.html @@ -1,19 +1,24 @@ - + - Redirection — Anjay 3.4.1 documentation + Redirection — Anjay 3.5.0 documentation + + + @@ -24,15 +29,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -64,8 +73,8 @@ - » - Redirection + + Redirection @@ -75,7 +84,7 @@ -↳ Multi-instance writable object with dynamic number of instances +↳ Multi-instance writable object with dynamic number of instances diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO6_MultipleResourceInstances.html b/AdvancedTopics/AT-CustomObjects/AT_CO6_MultipleResourceInstances.html index 86baf72b..a7b6abc5 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO6_MultipleResourceInstances.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO6_MultipleResourceInstances.html @@ -1,19 +1,24 @@ - + - Redirection — Anjay 3.4.1 documentation + Redirection — Anjay 3.5.0 documentation + + + @@ -24,15 +29,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -64,8 +73,8 @@ - » - Redirection + + Redirection @@ -75,7 +84,7 @@ -↳ Objects with Multiple Instance Resources +↳ Objects with Multiple Instance Resources diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO7_BootstrapAwareness.html b/AdvancedTopics/AT-CustomObjects/AT_CO7_BootstrapAwareness.html index d321ba30..1065060d 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO7_BootstrapAwareness.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO7_BootstrapAwareness.html @@ -1,19 +1,24 @@ - + - Redirection — Anjay 3.4.1 documentation + Redirection — Anjay 3.5.0 documentation + + + @@ -24,15 +29,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -64,8 +73,8 @@ - » - Redirection + + Redirection @@ -75,7 +84,7 @@ -↳ Bootstrap awareness +↳ Bootstrap awareness diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_BootstrapAwareness.html b/AdvancedTopics/AT-CustomObjects/AT_CO_BootstrapAwareness.html index 9f462998..0ee541cf 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_BootstrapAwareness.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_BootstrapAwareness.html @@ -1,18 +1,23 @@ - + - 5.4.7. Bootstrap awareness — Anjay 3.4.1 documentation + 5.4.7. Bootstrap awareness — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.7. Bootstrap awareness + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.7. Bootstrap awareness @@ -100,11 +109,11 @@ -5.4.7. Bootstrap awareness +5.4.7. Bootstrap awareness In this tutorial you will learn how to setup Resources writable only by the LwM2M Bootstrap Server. -5.4.7.1. Handling LwM2M Bootstrap Server +5.4.7.1. Handling LwM2M Bootstrap Server LwM2M Bootstrap Server is an unusual entity: it is allowed to modify Instances and Resources not accessible to “regular” LwM2M Servers. That is useful for setting up sensitive data that servers should not change (or even read) during @@ -127,16 +136,11 @@ 5.4.7.1. Handling LwM2M Bootstrap Server -5.4.7.2. Example: bootstrap-writable Resource +5.4.7.2. Example: bootstrap-writable Resource As an example, we will modify the Test Object from Multi-instance writable object with fixed number of instances to prevent changing the value of Label Resource by non-bootstrap servers: - - - - - Name Object ID @@ -152,14 +156,6 @@ 5.4.7.2. Example: bootstrap-writable Res Each Object Instance has two Resources: - - - - - - - - Name Resource ID diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_FixedInstanceWritable.html b/AdvancedTopics/AT-CustomObjects/AT_CO_FixedInstanceWritable.html index 8c50a233..5bbd92af 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_FixedInstanceWritable.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_FixedInstanceWritable.html @@ -1,18 +1,23 @@ - + - 5.4.4. Multi-instance writable object with fixed number of instances — Anjay 3.4.1 documentation + 5.4.4. Multi-instance writable object with fixed number of instances — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.4. Multi-instance writable object with fixed number of instances + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.4. Multi-instance writable object with fixed number of instances @@ -100,7 +109,7 @@ -5.4.4. Multi-instance writable object with fixed number of instances +5.4.4. Multi-instance writable object with fixed number of instances Note This section describes in details the implementation of custom Objects in @@ -121,11 +130,6 @@ 5.4.4. Multi-instance writable object wi Implemented object is based on Multi-instance read-only object with fixed number of instances, but this time accepts Write requests. - - - - - Name Object ID @@ -141,14 +145,6 @@ 5.4.4. Multi-instance writable object wi Each Object Instance has two Resources: - - - - - - - - Name Resource ID @@ -176,7 +172,7 @@ 5.4.4. Multi-instance writable object wi -5.4.4.1. Simple variant +5.4.4.1. Simple variant The test_instance_t needs to be able to store arbitrary data. Let us set an arbitrary limit of 32 characters in length (including terminating nullbyte): typedef struct test_instance { @@ -278,7 +274,7 @@ 5.4.4.1. Simple variant -5.4.4.1.1. LwM2M Write operation modes +5.4.4.1.1. LwM2M Write operation modes A LwM2M Server may perform a Write on the entire Object Instance. Two variants of such requests are available - both replace values of Instance Resources with received values, but they differ in what happens to Resources @@ -304,7 +300,7 @@ 5.4.4.1.1. LwM2M Write operation modes -5.4.4.1.2. Anjay transaction handlers +5.4.4.1.2. Anjay transaction handlers In some cases, like LwM2M Write requests targeting an Object Instance, Anjay calls multiple handlers modifying the data model to perform a single atomic operation. In such case, transactions ensure that data model is not left @@ -359,7 +355,7 @@ 5.4.4.1.2. Anjay transaction handlers -5.4.4.2. Transactional variant +5.4.4.2. Transactional variant Knowing all about different LwM2M Write variants and Anjay transaction handlers, we can start implementing a transaction-aware client capable of handling all LwM2M Write requests. diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceDynamic.html b/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceDynamic.html index 17aa45aa..cf4f22e6 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceDynamic.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceDynamic.html @@ -1,18 +1,23 @@ - + - 5.4.5. Multi-instance writable object with dynamic number of instances — Anjay 3.4.1 documentation + 5.4.5. Multi-instance writable object with dynamic number of instances — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.5. Multi-instance writable object with dynamic number of instances + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.5. Multi-instance writable object with dynamic number of instances @@ -100,7 +109,7 @@ -5.4.5. Multi-instance writable object with dynamic number of instances +5.4.5. Multi-instance writable object with dynamic number of instances Note This section describes in details the implementation of custom Objects in @@ -120,11 +129,6 @@ 5.4.5. Multi-instance writable object wi Implemented object will be roughly based on Multi-instance writable object with fixed number of instances. - - - - - Name Object ID @@ -140,14 +144,6 @@ 5.4.5. Multi-instance writable object wi As before, each Object Instance has two Resources: - - - - - - - - Name Resource ID @@ -178,7 +174,7 @@ 5.4.5. Multi-instance writable object wi yet in this chapter all Test object related code was moved to separate files to keep everything clean. -5.4.5.1. Updating the object structure +5.4.5.1. Updating the object structure First of all, we have to update our test_object_t structure to support storing multiple object instances. For that, we need some kind of dynamically sized container. We could choose plain-old, manually managed C arrays, but @@ -222,11 +218,11 @@ 5.4.5.1. Updating the object structure -5.4.5.2. Initialization and cleanup +5.4.5.2. Initialization and cleanup We must reconsider the way our Test object is being initialized. Up to this point it was allocated on stack and required no cleanup. Again, times have changed, and we won’t be able to proceed further without allocating memory on demand. - + + To achieve proper control over object lifetime and initialization, we are going to introduce two functions, namely create_test_object: const anjay_dm_object_def_t **create_test_object(void) { @@ -255,11 +251,11 @@ 5.4.5.2. Initialization and cleanup} - + + and delete_test_object: void delete_test_object(const anjay_dm_object_def_t **obj) { if (!obj) { @@ -289,7 +285,7 @@ 5.4.5.2. Initialization and cleanup -5.4.5.3. Updating old, already implemented handlers to use AVS_LIST +5.4.5.3. Updating old, already implemented handlers to use AVS_LIST To simplify matters, we have to agree upon one contract: We establish a natural Instance ordering on their Instance IDs, exploiting @@ -343,7 +339,7 @@ 5.4.5.3. Updating old, already implement on your own, especially remember about updating transaction handlers. -5.4.5.4. instance_create handler +5.4.5.4. instance_create handler Let’s have a look on anjay_dm_instance_create_t handler type signature: typedef int anjay_dm_instance_create_t(anjay_t *anjay, @@ -398,7 +394,7 @@ 5.4.5.4. -5.4.5.5. instance_remove handler +5.4.5.5. instance_remove handler instance_remove handler does not have to perform anything other than removing the instance from our list. static int test_instance_remove(anjay_t *anjay, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html b/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html index f76229b9..7f7e6805 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html @@ -1,18 +1,23 @@ - + - 5.4.3. Multi-instance read-only object with fixed number of instances — Anjay 3.4.1 documentation + 5.4.3. Multi-instance read-only object with fixed number of instances — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.3. Multi-instance read-only object with fixed number of instances + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.3. Multi-instance read-only object with fixed number of instances @@ -100,7 +109,7 @@ -5.4.3. Multi-instance read-only object with fixed number of instances +5.4.3. Multi-instance read-only object with fixed number of instances Note This section describes in details the implementation of custom Objects in @@ -116,11 +125,6 @@ 5.4.3. Multi-instance read-only object w The implemented Object will look as in Single-instance read-only object, but will now support multiple Object Instances: - - - - - Name Object ID @@ -136,14 +140,6 @@ 5.4.3. Multi-instance read-only object w Each Object Instance has two Resources: - - - - - - - - Name Resource ID @@ -226,14 +222,14 @@ 5.4.3. Multi-instance read-only object w order. - + + Having done that, resource_read handler needs to be slightly modified to correctly handle requests to different Object Instance IDs. static int test_resource_read(anjay_t *anjay, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html b/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html index a39ec8a1..2ef43f4a 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html @@ -1,18 +1,23 @@ - + - 5.4.6. Objects with Multiple Instance Resources — Anjay 3.4.1 documentation + 5.4.6. Objects with Multiple Instance Resources — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.6. Objects with Multiple Instance Resources + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.6. Objects with Multiple Instance Resources @@ -100,7 +109,7 @@ -5.4.6. Objects with Multiple Instance Resources +5.4.6. Objects with Multiple Instance Resources Note This section describes in details the implementation of custom Objects in @@ -119,7 +128,7 @@ 5.4.6. Objects with Multiple Instance Re We will extend the Test object from previous tutorial by allowing Value Resource to contain multiple values. -5.4.6.1. API for Multiple Instance Resources management +5.4.6.1. API for Multiple Instance Resources management Dealing with Multiple Instance Resources in the data model requires implementing additional handlers. The most important in the list_resource_instances handler: @@ -153,7 +162,7 @@ 5.4.6.1. API for Multiple Instance Resou ignoring, is used to determine the Resource Instance that is targeted. -5.4.6.2. Preparing Test object for Multiple Instance Resources +5.4.6.2. Preparing Test object for Multiple Instance Resources First of all, we need to update the List Resources handler so that the library knows that Resource 1 now has multiple instances: static int test_list_resources(anjay_t *anjay, @@ -192,15 +201,15 @@ 5.4.6.2. Preparing Test object for Multi } test_instance_t; - + + -5.4.6.3. Implementing the List Resource Instances handler +5.4.6.3. Implementing the List Resource Instances handler Here is how the List Resource Instances is implemented for our test object: static int test_list_resource_instances(anjay_t *anjay, @@ -231,7 +240,7 @@ 5.4.6.3. Implementing the List Resource implementation satisfies this contract. -5.4.6.4. Handling Multiple Instance Resources in Read operation +5.4.6.4. Handling Multiple Instance Resources in Read operation resource_read handler is being called by Anjay for each Resource Instance referenced by the server, giving the control to the user. Thus, the read handler could look like this: @@ -261,8 +270,8 @@ 5.4.6.4. Handling Multiple Instance Reso -5.4.6.5. Implementing the Resource Reset handler - +5.4.6.5. Implementing the Resource Reset handler + + The above means that the Resource Reset handler is rather simple to implement, as it only needs to clear the resource: static int test_resource_reset(anjay_t *anjay, @@ -297,7 +306,7 @@ 5.4.6.5. Implementing the Resource Reset -5.4.6.6. Handling Multiple Instance Resources in Write operation +5.4.6.6. Handling Multiple Instance Resources in Write operation Now we are ready to actually implement the write operation. We will create a helper function for actually updating the Resource Instance list with a newly written value. diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html index fbd5deb9..90fff740 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html @@ -1,18 +1,23 @@ - + - 5.4.2. Single-instance read-only object with an executable resource — Anjay 3.4.1 documentation + 5.4.2. Single-instance read-only object with an executable resource — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.2. Single-instance read-only object with an executable resource + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.2. Single-instance read-only object with an executable resource @@ -100,7 +109,7 @@ -5.4.2. Single-instance read-only object with an executable resource +5.4.2. Single-instance read-only object with an executable resource Note This section describes in details the implementation of custom Objects in @@ -120,11 +129,6 @@ 5.4.2. Single-instance read-only object The implemented Object will be be based on the previous tutorial Single-instance read-only object, but with additional executable resource: - - - - - Name Object ID @@ -140,14 +144,6 @@ 5.4.2. Single-instance read-only object Each Object Instance has three Resources: - - - - - - - - Name Resource ID @@ -185,7 +181,7 @@ 5.4.2. Single-instance read-only object storing the result in the Value resource. The integers are to be specified as arguments to the LwM2M Execute operation. -5.4.2.1. LwM2M Execute arguments +5.4.2.1. LwM2M Execute arguments The LwM2M specification defines a syntax of the Execute argument list as a formal ABNF grammar. @@ -230,7 +226,7 @@ 5.4.2.1. LwM2M Execute argumentsThey will greatly simplify parsing process, as you will see in the next section. -5.4.2.2. Implementation +5.4.2.2. Implementation We start with adding our Resource to the list of supported Resources: static int test_list_resources(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html index 1955871c..a575b8f1 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html @@ -1,18 +1,23 @@ - + - 5.4.1. Single-instance read-only object — Anjay 3.4.1 documentation + 5.4.1. Single-instance read-only object — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.1. Single-instance read-only object + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.1. Single-instance read-only object @@ -100,7 +109,7 @@ -5.4.1. Single-instance read-only object +5.4.1. Single-instance read-only object Note This section describes in details the implementation of custom Objects in @@ -113,11 +122,6 @@ 5.4.1. Single-instance read-only object< This is the simplest possible case. Let us implement following custom Object: - - - - - Name Object ID @@ -133,14 +137,6 @@ 5.4.1. Single-instance read-only object< With two simple Resources: - - - - - - - - Name Resource ID @@ -279,7 +275,7 @@ 5.4.1. Single-instance read-only object< }; - + + When the Object Definition is ready, the only thing left to do is registering it in the library: int main(int argc, char *argv[]) { diff --git a/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html b/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html index a0635b6f..14766a6a 100644 --- a/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html +++ b/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html @@ -1,18 +1,23 @@ - + - <no title> — Anjay 3.4.1 documentation + <no title> — Anjay 3.5.0 documentation + + + @@ -23,15 +28,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -63,8 +72,8 @@ - » - <no title> + + <no title> diff --git a/AdvancedTopics/AT-EventLoopNotes.html b/AdvancedTopics/AT-EventLoopNotes.html index e0781575..7d564336 100644 --- a/AdvancedTopics/AT-EventLoopNotes.html +++ b/AdvancedTopics/AT-EventLoopNotes.html @@ -1,18 +1,23 @@ - + - 5.10. Notes on event loop APIs — Anjay 3.4.1 documentation + 5.10. Notes on event loop APIs — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ -
anjay_serve_any() is a simplified API that allows writing a simple event loop that the user retains control of.
Note
This section describes in details the implementation of custom Objects in diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO1_SingleInstanceReadOnly.html b/AdvancedTopics/AT-CustomObjects/AT_CO1_SingleInstanceReadOnly.html index 661aea3c..3de8d5c5 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO1_SingleInstanceReadOnly.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO1_SingleInstanceReadOnly.html @@ -1,19 +1,24 @@
In this tutorial you will learn how to setup Resources writable only by the LwM2M Bootstrap Server.
LwM2M Bootstrap Server is an unusual entity: it is allowed to modify Instances and Resources not accessible to “regular” LwM2M Servers. That is useful for setting up sensitive data that servers should not change (or even read) during @@ -127,16 +136,11 @@
As an example, we will modify the Test Object from Multi-instance writable object with fixed number of instances to prevent changing the value of Label Resource by non-bootstrap servers:
Label
Name
Object ID
Each Object Instance has two Resources:
This section describes in details the implementation of custom Objects in @@ -121,11 +130,6 @@
Implemented object is based on Multi-instance read-only object with fixed number of instances, but this time accepts Write requests.
The test_instance_t needs to be able to store arbitrary data. Let us set an arbitrary limit of 32 characters in length (including terminating nullbyte):
test_instance_t
typedef struct test_instance { @@ -278,7 +274,7 @@ 5.4.4.1. Simple variant -5.4.4.1.1. LwM2M Write operation modes +5.4.4.1.1. LwM2M Write operation modes A LwM2M Server may perform a Write on the entire Object Instance. Two variants of such requests are available - both replace values of Instance Resources with received values, but they differ in what happens to Resources @@ -304,7 +300,7 @@ 5.4.4.1.1. LwM2M Write operation modes -5.4.4.1.2. Anjay transaction handlers +5.4.4.1.2. Anjay transaction handlers In some cases, like LwM2M Write requests targeting an Object Instance, Anjay calls multiple handlers modifying the data model to perform a single atomic operation. In such case, transactions ensure that data model is not left @@ -359,7 +355,7 @@ 5.4.4.1.2. Anjay transaction handlers -5.4.4.2. Transactional variant +5.4.4.2. Transactional variant Knowing all about different LwM2M Write variants and Anjay transaction handlers, we can start implementing a transaction-aware client capable of handling all LwM2M Write requests. diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceDynamic.html b/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceDynamic.html index 17aa45aa..cf4f22e6 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceDynamic.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceDynamic.html @@ -1,18 +1,23 @@ - + - 5.4.5. Multi-instance writable object with dynamic number of instances — Anjay 3.4.1 documentation + 5.4.5. Multi-instance writable object with dynamic number of instances — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.5. Multi-instance writable object with dynamic number of instances + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.5. Multi-instance writable object with dynamic number of instances @@ -100,7 +109,7 @@ -5.4.5. Multi-instance writable object with dynamic number of instances +5.4.5. Multi-instance writable object with dynamic number of instances Note This section describes in details the implementation of custom Objects in @@ -120,11 +129,6 @@ 5.4.5. Multi-instance writable object wi Implemented object will be roughly based on Multi-instance writable object with fixed number of instances. - - - - - Name Object ID @@ -140,14 +144,6 @@ 5.4.5. Multi-instance writable object wi As before, each Object Instance has two Resources: - - - - - - - - Name Resource ID @@ -178,7 +174,7 @@ 5.4.5. Multi-instance writable object wi yet in this chapter all Test object related code was moved to separate files to keep everything clean. -5.4.5.1. Updating the object structure +5.4.5.1. Updating the object structure First of all, we have to update our test_object_t structure to support storing multiple object instances. For that, we need some kind of dynamically sized container. We could choose plain-old, manually managed C arrays, but @@ -222,11 +218,11 @@ 5.4.5.1. Updating the object structure -5.4.5.2. Initialization and cleanup +5.4.5.2. Initialization and cleanup We must reconsider the way our Test object is being initialized. Up to this point it was allocated on stack and required no cleanup. Again, times have changed, and we won’t be able to proceed further without allocating memory on demand. - + + To achieve proper control over object lifetime and initialization, we are going to introduce two functions, namely create_test_object: const anjay_dm_object_def_t **create_test_object(void) { @@ -255,11 +251,11 @@ 5.4.5.2. Initialization and cleanup} - + + and delete_test_object: void delete_test_object(const anjay_dm_object_def_t **obj) { if (!obj) { @@ -289,7 +285,7 @@ 5.4.5.2. Initialization and cleanup -5.4.5.3. Updating old, already implemented handlers to use AVS_LIST +5.4.5.3. Updating old, already implemented handlers to use AVS_LIST To simplify matters, we have to agree upon one contract: We establish a natural Instance ordering on their Instance IDs, exploiting @@ -343,7 +339,7 @@ 5.4.5.3. Updating old, already implement on your own, especially remember about updating transaction handlers. -5.4.5.4. instance_create handler +5.4.5.4. instance_create handler Let’s have a look on anjay_dm_instance_create_t handler type signature: typedef int anjay_dm_instance_create_t(anjay_t *anjay, @@ -398,7 +394,7 @@ 5.4.5.4. -5.4.5.5. instance_remove handler +5.4.5.5. instance_remove handler instance_remove handler does not have to perform anything other than removing the instance from our list. static int test_instance_remove(anjay_t *anjay, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html b/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html index f76229b9..7f7e6805 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html @@ -1,18 +1,23 @@ - + - 5.4.3. Multi-instance read-only object with fixed number of instances — Anjay 3.4.1 documentation + 5.4.3. Multi-instance read-only object with fixed number of instances — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.3. Multi-instance read-only object with fixed number of instances + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.3. Multi-instance read-only object with fixed number of instances @@ -100,7 +109,7 @@ -5.4.3. Multi-instance read-only object with fixed number of instances +5.4.3. Multi-instance read-only object with fixed number of instances Note This section describes in details the implementation of custom Objects in @@ -116,11 +125,6 @@ 5.4.3. Multi-instance read-only object w The implemented Object will look as in Single-instance read-only object, but will now support multiple Object Instances: - - - - - Name Object ID @@ -136,14 +140,6 @@ 5.4.3. Multi-instance read-only object w Each Object Instance has two Resources: - - - - - - - - Name Resource ID @@ -226,14 +222,14 @@ 5.4.3. Multi-instance read-only object w order. - + + Having done that, resource_read handler needs to be slightly modified to correctly handle requests to different Object Instance IDs. static int test_resource_read(anjay_t *anjay, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html b/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html index a39ec8a1..2ef43f4a 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html @@ -1,18 +1,23 @@ - + - 5.4.6. Objects with Multiple Instance Resources — Anjay 3.4.1 documentation + 5.4.6. Objects with Multiple Instance Resources — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.6. Objects with Multiple Instance Resources + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.6. Objects with Multiple Instance Resources @@ -100,7 +109,7 @@ -5.4.6. Objects with Multiple Instance Resources +5.4.6. Objects with Multiple Instance Resources Note This section describes in details the implementation of custom Objects in @@ -119,7 +128,7 @@ 5.4.6. Objects with Multiple Instance Re We will extend the Test object from previous tutorial by allowing Value Resource to contain multiple values. -5.4.6.1. API for Multiple Instance Resources management +5.4.6.1. API for Multiple Instance Resources management Dealing with Multiple Instance Resources in the data model requires implementing additional handlers. The most important in the list_resource_instances handler: @@ -153,7 +162,7 @@ 5.4.6.1. API for Multiple Instance Resou ignoring, is used to determine the Resource Instance that is targeted. -5.4.6.2. Preparing Test object for Multiple Instance Resources +5.4.6.2. Preparing Test object for Multiple Instance Resources First of all, we need to update the List Resources handler so that the library knows that Resource 1 now has multiple instances: static int test_list_resources(anjay_t *anjay, @@ -192,15 +201,15 @@ 5.4.6.2. Preparing Test object for Multi } test_instance_t; - + + -5.4.6.3. Implementing the List Resource Instances handler +5.4.6.3. Implementing the List Resource Instances handler Here is how the List Resource Instances is implemented for our test object: static int test_list_resource_instances(anjay_t *anjay, @@ -231,7 +240,7 @@ 5.4.6.3. Implementing the List Resource implementation satisfies this contract. -5.4.6.4. Handling Multiple Instance Resources in Read operation +5.4.6.4. Handling Multiple Instance Resources in Read operation resource_read handler is being called by Anjay for each Resource Instance referenced by the server, giving the control to the user. Thus, the read handler could look like this: @@ -261,8 +270,8 @@ 5.4.6.4. Handling Multiple Instance Reso -5.4.6.5. Implementing the Resource Reset handler - +5.4.6.5. Implementing the Resource Reset handler + + The above means that the Resource Reset handler is rather simple to implement, as it only needs to clear the resource: static int test_resource_reset(anjay_t *anjay, @@ -297,7 +306,7 @@ 5.4.6.5. Implementing the Resource Reset -5.4.6.6. Handling Multiple Instance Resources in Write operation +5.4.6.6. Handling Multiple Instance Resources in Write operation Now we are ready to actually implement the write operation. We will create a helper function for actually updating the Resource Instance list with a newly written value. diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html index fbd5deb9..90fff740 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html @@ -1,18 +1,23 @@ - + - 5.4.2. Single-instance read-only object with an executable resource — Anjay 3.4.1 documentation + 5.4.2. Single-instance read-only object with an executable resource — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.2. Single-instance read-only object with an executable resource + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.2. Single-instance read-only object with an executable resource @@ -100,7 +109,7 @@ -5.4.2. Single-instance read-only object with an executable resource +5.4.2. Single-instance read-only object with an executable resource Note This section describes in details the implementation of custom Objects in @@ -120,11 +129,6 @@ 5.4.2. Single-instance read-only object The implemented Object will be be based on the previous tutorial Single-instance read-only object, but with additional executable resource: - - - - - Name Object ID @@ -140,14 +144,6 @@ 5.4.2. Single-instance read-only object Each Object Instance has three Resources: - - - - - - - - Name Resource ID @@ -185,7 +181,7 @@ 5.4.2. Single-instance read-only object storing the result in the Value resource. The integers are to be specified as arguments to the LwM2M Execute operation. -5.4.2.1. LwM2M Execute arguments +5.4.2.1. LwM2M Execute arguments The LwM2M specification defines a syntax of the Execute argument list as a formal ABNF grammar. @@ -230,7 +226,7 @@ 5.4.2.1. LwM2M Execute argumentsThey will greatly simplify parsing process, as you will see in the next section. -5.4.2.2. Implementation +5.4.2.2. Implementation We start with adding our Resource to the list of supported Resources: static int test_list_resources(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html index 1955871c..a575b8f1 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html @@ -1,18 +1,23 @@ - + - 5.4.1. Single-instance read-only object — Anjay 3.4.1 documentation + 5.4.1. Single-instance read-only object — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.1. Single-instance read-only object + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.1. Single-instance read-only object @@ -100,7 +109,7 @@ -5.4.1. Single-instance read-only object +5.4.1. Single-instance read-only object Note This section describes in details the implementation of custom Objects in @@ -113,11 +122,6 @@ 5.4.1. Single-instance read-only object< This is the simplest possible case. Let us implement following custom Object: - - - - - Name Object ID @@ -133,14 +137,6 @@ 5.4.1. Single-instance read-only object< With two simple Resources: - - - - - - - - Name Resource ID @@ -279,7 +275,7 @@ 5.4.1. Single-instance read-only object< }; - + + When the Object Definition is ready, the only thing left to do is registering it in the library: int main(int argc, char *argv[]) { diff --git a/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html b/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html index a0635b6f..14766a6a 100644 --- a/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html +++ b/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html @@ -1,18 +1,23 @@ - + - <no title> — Anjay 3.4.1 documentation + <no title> — Anjay 3.5.0 documentation + + + @@ -23,15 +28,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -63,8 +72,8 @@ - » - <no title> + + <no title> diff --git a/AdvancedTopics/AT-EventLoopNotes.html b/AdvancedTopics/AT-EventLoopNotes.html index e0781575..7d564336 100644 --- a/AdvancedTopics/AT-EventLoopNotes.html +++ b/AdvancedTopics/AT-EventLoopNotes.html @@ -1,18 +1,23 @@ - + - 5.10. Notes on event loop APIs — Anjay 3.4.1 documentation + 5.10. Notes on event loop APIs — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ -
A LwM2M Server may perform a Write on the entire Object Instance. Two variants of such requests are available - both replace values of Instance Resources with received values, but they differ in what happens to Resources @@ -304,7 +300,7 @@
In some cases, like LwM2M Write requests targeting an Object Instance, Anjay calls multiple handlers modifying the data model to perform a single atomic operation. In such case, transactions ensure that data model is not left @@ -359,7 +355,7 @@
Knowing all about different LwM2M Write variants and Anjay transaction handlers, we can start implementing a transaction-aware client capable of handling all LwM2M Write requests.
This section describes in details the implementation of custom Objects in @@ -120,11 +129,6 @@
Implemented object will be roughly based on Multi-instance writable object with fixed number of instances.
As before, each Object Instance has two Resources:
First of all, we have to update our test_object_t structure to support storing multiple object instances. For that, we need some kind of dynamically sized container. We could choose plain-old, manually managed C arrays, but @@ -222,11 +218,11 @@
test_object_t
We must reconsider the way our Test object is being initialized. Up to this point it was allocated on stack and required no cleanup. Again, times have changed, and we won’t be able to proceed further without allocating memory on demand.
To achieve proper control over object lifetime and initialization, we are going to introduce two functions, namely create_test_object:
create_test_object
const anjay_dm_object_def_t **create_test_object(void) { @@ -255,11 +251,11 @@ 5.4.5.2. Initialization and cleanup}
and delete_test_object:
delete_test_object
void delete_test_object(const anjay_dm_object_def_t **obj) { if (!obj) { @@ -289,7 +285,7 @@ 5.4.5.2. Initialization and cleanup -5.4.5.3. Updating old, already implemented handlers to use AVS_LIST +5.4.5.3. Updating old, already implemented handlers to use AVS_LIST To simplify matters, we have to agree upon one contract: We establish a natural Instance ordering on their Instance IDs, exploiting @@ -343,7 +339,7 @@ 5.4.5.3. Updating old, already implement on your own, especially remember about updating transaction handlers. -5.4.5.4. instance_create handler +5.4.5.4. instance_create handler Let’s have a look on anjay_dm_instance_create_t handler type signature: typedef int anjay_dm_instance_create_t(anjay_t *anjay, @@ -398,7 +394,7 @@ 5.4.5.4. -5.4.5.5. instance_remove handler +5.4.5.5. instance_remove handler instance_remove handler does not have to perform anything other than removing the instance from our list. static int test_instance_remove(anjay_t *anjay, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html b/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html index f76229b9..7f7e6805 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html @@ -1,18 +1,23 @@ - + - 5.4.3. Multi-instance read-only object with fixed number of instances — Anjay 3.4.1 documentation + 5.4.3. Multi-instance read-only object with fixed number of instances — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.3. Multi-instance read-only object with fixed number of instances + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.3. Multi-instance read-only object with fixed number of instances @@ -100,7 +109,7 @@ -5.4.3. Multi-instance read-only object with fixed number of instances +5.4.3. Multi-instance read-only object with fixed number of instances Note This section describes in details the implementation of custom Objects in @@ -116,11 +125,6 @@ 5.4.3. Multi-instance read-only object w The implemented Object will look as in Single-instance read-only object, but will now support multiple Object Instances: - - - - - Name Object ID @@ -136,14 +140,6 @@ 5.4.3. Multi-instance read-only object w Each Object Instance has two Resources: - - - - - - - - Name Resource ID @@ -226,14 +222,14 @@ 5.4.3. Multi-instance read-only object w order. - + + Having done that, resource_read handler needs to be slightly modified to correctly handle requests to different Object Instance IDs. static int test_resource_read(anjay_t *anjay, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html b/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html index a39ec8a1..2ef43f4a 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html @@ -1,18 +1,23 @@ - + - 5.4.6. Objects with Multiple Instance Resources — Anjay 3.4.1 documentation + 5.4.6. Objects with Multiple Instance Resources — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.6. Objects with Multiple Instance Resources + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.6. Objects with Multiple Instance Resources @@ -100,7 +109,7 @@ -5.4.6. Objects with Multiple Instance Resources +5.4.6. Objects with Multiple Instance Resources Note This section describes in details the implementation of custom Objects in @@ -119,7 +128,7 @@ 5.4.6. Objects with Multiple Instance Re We will extend the Test object from previous tutorial by allowing Value Resource to contain multiple values. -5.4.6.1. API for Multiple Instance Resources management +5.4.6.1. API for Multiple Instance Resources management Dealing with Multiple Instance Resources in the data model requires implementing additional handlers. The most important in the list_resource_instances handler: @@ -153,7 +162,7 @@ 5.4.6.1. API for Multiple Instance Resou ignoring, is used to determine the Resource Instance that is targeted. -5.4.6.2. Preparing Test object for Multiple Instance Resources +5.4.6.2. Preparing Test object for Multiple Instance Resources First of all, we need to update the List Resources handler so that the library knows that Resource 1 now has multiple instances: static int test_list_resources(anjay_t *anjay, @@ -192,15 +201,15 @@ 5.4.6.2. Preparing Test object for Multi } test_instance_t; - + + -5.4.6.3. Implementing the List Resource Instances handler +5.4.6.3. Implementing the List Resource Instances handler Here is how the List Resource Instances is implemented for our test object: static int test_list_resource_instances(anjay_t *anjay, @@ -231,7 +240,7 @@ 5.4.6.3. Implementing the List Resource implementation satisfies this contract. -5.4.6.4. Handling Multiple Instance Resources in Read operation +5.4.6.4. Handling Multiple Instance Resources in Read operation resource_read handler is being called by Anjay for each Resource Instance referenced by the server, giving the control to the user. Thus, the read handler could look like this: @@ -261,8 +270,8 @@ 5.4.6.4. Handling Multiple Instance Reso -5.4.6.5. Implementing the Resource Reset handler - +5.4.6.5. Implementing the Resource Reset handler + + The above means that the Resource Reset handler is rather simple to implement, as it only needs to clear the resource: static int test_resource_reset(anjay_t *anjay, @@ -297,7 +306,7 @@ 5.4.6.5. Implementing the Resource Reset -5.4.6.6. Handling Multiple Instance Resources in Write operation +5.4.6.6. Handling Multiple Instance Resources in Write operation Now we are ready to actually implement the write operation. We will create a helper function for actually updating the Resource Instance list with a newly written value. diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html index fbd5deb9..90fff740 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html @@ -1,18 +1,23 @@ - + - 5.4.2. Single-instance read-only object with an executable resource — Anjay 3.4.1 documentation + 5.4.2. Single-instance read-only object with an executable resource — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.2. Single-instance read-only object with an executable resource + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.2. Single-instance read-only object with an executable resource @@ -100,7 +109,7 @@ -5.4.2. Single-instance read-only object with an executable resource +5.4.2. Single-instance read-only object with an executable resource Note This section describes in details the implementation of custom Objects in @@ -120,11 +129,6 @@ 5.4.2. Single-instance read-only object The implemented Object will be be based on the previous tutorial Single-instance read-only object, but with additional executable resource: - - - - - Name Object ID @@ -140,14 +144,6 @@ 5.4.2. Single-instance read-only object Each Object Instance has three Resources: - - - - - - - - Name Resource ID @@ -185,7 +181,7 @@ 5.4.2. Single-instance read-only object storing the result in the Value resource. The integers are to be specified as arguments to the LwM2M Execute operation. -5.4.2.1. LwM2M Execute arguments +5.4.2.1. LwM2M Execute arguments The LwM2M specification defines a syntax of the Execute argument list as a formal ABNF grammar. @@ -230,7 +226,7 @@ 5.4.2.1. LwM2M Execute argumentsThey will greatly simplify parsing process, as you will see in the next section. -5.4.2.2. Implementation +5.4.2.2. Implementation We start with adding our Resource to the list of supported Resources: static int test_list_resources(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html index 1955871c..a575b8f1 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html @@ -1,18 +1,23 @@ - + - 5.4.1. Single-instance read-only object — Anjay 3.4.1 documentation + 5.4.1. Single-instance read-only object — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.1. Single-instance read-only object + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.1. Single-instance read-only object @@ -100,7 +109,7 @@ -5.4.1. Single-instance read-only object +5.4.1. Single-instance read-only object Note This section describes in details the implementation of custom Objects in @@ -113,11 +122,6 @@ 5.4.1. Single-instance read-only object< This is the simplest possible case. Let us implement following custom Object: - - - - - Name Object ID @@ -133,14 +137,6 @@ 5.4.1. Single-instance read-only object< With two simple Resources: - - - - - - - - Name Resource ID @@ -279,7 +275,7 @@ 5.4.1. Single-instance read-only object< }; - + + When the Object Definition is ready, the only thing left to do is registering it in the library: int main(int argc, char *argv[]) { diff --git a/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html b/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html index a0635b6f..14766a6a 100644 --- a/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html +++ b/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html @@ -1,18 +1,23 @@ - + - <no title> — Anjay 3.4.1 documentation + <no title> — Anjay 3.5.0 documentation + + + @@ -23,15 +28,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -63,8 +72,8 @@ - » - <no title> + + <no title> diff --git a/AdvancedTopics/AT-EventLoopNotes.html b/AdvancedTopics/AT-EventLoopNotes.html index e0781575..7d564336 100644 --- a/AdvancedTopics/AT-EventLoopNotes.html +++ b/AdvancedTopics/AT-EventLoopNotes.html @@ -1,18 +1,23 @@ - + - 5.10. Notes on event loop APIs — Anjay 3.4.1 documentation + 5.10. Notes on event loop APIs — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ -
To simplify matters, we have to agree upon one contract:
We establish a natural Instance ordering on their Instance IDs, exploiting @@ -343,7 +339,7 @@
instance_create
Let’s have a look on anjay_dm_instance_create_t handler type signature:
anjay_dm_instance_create_t
typedef int anjay_dm_instance_create_t(anjay_t *anjay, @@ -398,7 +394,7 @@ 5.4.5.4. -5.4.5.5. instance_remove handler +5.4.5.5. instance_remove handler instance_remove handler does not have to perform anything other than removing the instance from our list. static int test_instance_remove(anjay_t *anjay, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html b/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html index f76229b9..7f7e6805 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html @@ -1,18 +1,23 @@ - + - 5.4.3. Multi-instance read-only object with fixed number of instances — Anjay 3.4.1 documentation + 5.4.3. Multi-instance read-only object with fixed number of instances — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.3. Multi-instance read-only object with fixed number of instances + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.3. Multi-instance read-only object with fixed number of instances @@ -100,7 +109,7 @@ -5.4.3. Multi-instance read-only object with fixed number of instances +5.4.3. Multi-instance read-only object with fixed number of instances Note This section describes in details the implementation of custom Objects in @@ -116,11 +125,6 @@ 5.4.3. Multi-instance read-only object w The implemented Object will look as in Single-instance read-only object, but will now support multiple Object Instances: - - - - - Name Object ID @@ -136,14 +140,6 @@ 5.4.3. Multi-instance read-only object w Each Object Instance has two Resources: - - - - - - - - Name Resource ID @@ -226,14 +222,14 @@ 5.4.3. Multi-instance read-only object w order. - + + Having done that, resource_read handler needs to be slightly modified to correctly handle requests to different Object Instance IDs. static int test_resource_read(anjay_t *anjay, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html b/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html index a39ec8a1..2ef43f4a 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html @@ -1,18 +1,23 @@ - + - 5.4.6. Objects with Multiple Instance Resources — Anjay 3.4.1 documentation + 5.4.6. Objects with Multiple Instance Resources — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.6. Objects with Multiple Instance Resources + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.6. Objects with Multiple Instance Resources @@ -100,7 +109,7 @@ -5.4.6. Objects with Multiple Instance Resources +5.4.6. Objects with Multiple Instance Resources Note This section describes in details the implementation of custom Objects in @@ -119,7 +128,7 @@ 5.4.6. Objects with Multiple Instance Re We will extend the Test object from previous tutorial by allowing Value Resource to contain multiple values. -5.4.6.1. API for Multiple Instance Resources management +5.4.6.1. API for Multiple Instance Resources management Dealing with Multiple Instance Resources in the data model requires implementing additional handlers. The most important in the list_resource_instances handler: @@ -153,7 +162,7 @@ 5.4.6.1. API for Multiple Instance Resou ignoring, is used to determine the Resource Instance that is targeted. -5.4.6.2. Preparing Test object for Multiple Instance Resources +5.4.6.2. Preparing Test object for Multiple Instance Resources First of all, we need to update the List Resources handler so that the library knows that Resource 1 now has multiple instances: static int test_list_resources(anjay_t *anjay, @@ -192,15 +201,15 @@ 5.4.6.2. Preparing Test object for Multi } test_instance_t; - + + -5.4.6.3. Implementing the List Resource Instances handler +5.4.6.3. Implementing the List Resource Instances handler Here is how the List Resource Instances is implemented for our test object: static int test_list_resource_instances(anjay_t *anjay, @@ -231,7 +240,7 @@ 5.4.6.3. Implementing the List Resource implementation satisfies this contract. -5.4.6.4. Handling Multiple Instance Resources in Read operation +5.4.6.4. Handling Multiple Instance Resources in Read operation resource_read handler is being called by Anjay for each Resource Instance referenced by the server, giving the control to the user. Thus, the read handler could look like this: @@ -261,8 +270,8 @@ 5.4.6.4. Handling Multiple Instance Reso -5.4.6.5. Implementing the Resource Reset handler - +5.4.6.5. Implementing the Resource Reset handler + + The above means that the Resource Reset handler is rather simple to implement, as it only needs to clear the resource: static int test_resource_reset(anjay_t *anjay, @@ -297,7 +306,7 @@ 5.4.6.5. Implementing the Resource Reset -5.4.6.6. Handling Multiple Instance Resources in Write operation +5.4.6.6. Handling Multiple Instance Resources in Write operation Now we are ready to actually implement the write operation. We will create a helper function for actually updating the Resource Instance list with a newly written value. diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html index fbd5deb9..90fff740 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html @@ -1,18 +1,23 @@ - + - 5.4.2. Single-instance read-only object with an executable resource — Anjay 3.4.1 documentation + 5.4.2. Single-instance read-only object with an executable resource — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.2. Single-instance read-only object with an executable resource + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.2. Single-instance read-only object with an executable resource @@ -100,7 +109,7 @@ -5.4.2. Single-instance read-only object with an executable resource +5.4.2. Single-instance read-only object with an executable resource Note This section describes in details the implementation of custom Objects in @@ -120,11 +129,6 @@ 5.4.2. Single-instance read-only object The implemented Object will be be based on the previous tutorial Single-instance read-only object, but with additional executable resource: - - - - - Name Object ID @@ -140,14 +144,6 @@ 5.4.2. Single-instance read-only object Each Object Instance has three Resources: - - - - - - - - Name Resource ID @@ -185,7 +181,7 @@ 5.4.2. Single-instance read-only object storing the result in the Value resource. The integers are to be specified as arguments to the LwM2M Execute operation. -5.4.2.1. LwM2M Execute arguments +5.4.2.1. LwM2M Execute arguments The LwM2M specification defines a syntax of the Execute argument list as a formal ABNF grammar. @@ -230,7 +226,7 @@ 5.4.2.1. LwM2M Execute argumentsThey will greatly simplify parsing process, as you will see in the next section. -5.4.2.2. Implementation +5.4.2.2. Implementation We start with adding our Resource to the list of supported Resources: static int test_list_resources(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html index 1955871c..a575b8f1 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html @@ -1,18 +1,23 @@ - + - 5.4.1. Single-instance read-only object — Anjay 3.4.1 documentation + 5.4.1. Single-instance read-only object — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.1. Single-instance read-only object + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.1. Single-instance read-only object @@ -100,7 +109,7 @@ -5.4.1. Single-instance read-only object +5.4.1. Single-instance read-only object Note This section describes in details the implementation of custom Objects in @@ -113,11 +122,6 @@ 5.4.1. Single-instance read-only object< This is the simplest possible case. Let us implement following custom Object: - - - - - Name Object ID @@ -133,14 +137,6 @@ 5.4.1. Single-instance read-only object< With two simple Resources: - - - - - - - - Name Resource ID @@ -279,7 +275,7 @@ 5.4.1. Single-instance read-only object< }; - + + When the Object Definition is ready, the only thing left to do is registering it in the library: int main(int argc, char *argv[]) { diff --git a/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html b/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html index a0635b6f..14766a6a 100644 --- a/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html +++ b/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html @@ -1,18 +1,23 @@ - + - <no title> — Anjay 3.4.1 documentation + <no title> — Anjay 3.5.0 documentation + + + @@ -23,15 +28,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -63,8 +72,8 @@ - » - <no title> + + <no title> diff --git a/AdvancedTopics/AT-EventLoopNotes.html b/AdvancedTopics/AT-EventLoopNotes.html index e0781575..7d564336 100644 --- a/AdvancedTopics/AT-EventLoopNotes.html +++ b/AdvancedTopics/AT-EventLoopNotes.html @@ -1,18 +1,23 @@ - + - 5.10. Notes on event loop APIs — Anjay 3.4.1 documentation + 5.10. Notes on event loop APIs — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ -
-5.4.5.5. instance_remove handler +5.4.5.5. instance_remove handler instance_remove handler does not have to perform anything other than removing the instance from our list. static int test_instance_remove(anjay_t *anjay, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html b/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html index f76229b9..7f7e6805 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html @@ -1,18 +1,23 @@ - + - 5.4.3. Multi-instance read-only object with fixed number of instances — Anjay 3.4.1 documentation + 5.4.3. Multi-instance read-only object with fixed number of instances — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.3. Multi-instance read-only object with fixed number of instances + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.3. Multi-instance read-only object with fixed number of instances @@ -100,7 +109,7 @@ -5.4.3. Multi-instance read-only object with fixed number of instances +5.4.3. Multi-instance read-only object with fixed number of instances Note This section describes in details the implementation of custom Objects in @@ -116,11 +125,6 @@ 5.4.3. Multi-instance read-only object w The implemented Object will look as in Single-instance read-only object, but will now support multiple Object Instances: - - - - - Name Object ID @@ -136,14 +140,6 @@ 5.4.3. Multi-instance read-only object w Each Object Instance has two Resources: - - - - - - - - Name Resource ID @@ -226,14 +222,14 @@ 5.4.3. Multi-instance read-only object w order. - + + Having done that, resource_read handler needs to be slightly modified to correctly handle requests to different Object Instance IDs. static int test_resource_read(anjay_t *anjay, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html b/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html index a39ec8a1..2ef43f4a 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html @@ -1,18 +1,23 @@ - + - 5.4.6. Objects with Multiple Instance Resources — Anjay 3.4.1 documentation + 5.4.6. Objects with Multiple Instance Resources — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.6. Objects with Multiple Instance Resources + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.6. Objects with Multiple Instance Resources @@ -100,7 +109,7 @@ -5.4.6. Objects with Multiple Instance Resources +5.4.6. Objects with Multiple Instance Resources Note This section describes in details the implementation of custom Objects in @@ -119,7 +128,7 @@ 5.4.6. Objects with Multiple Instance Re We will extend the Test object from previous tutorial by allowing Value Resource to contain multiple values. -5.4.6.1. API for Multiple Instance Resources management +5.4.6.1. API for Multiple Instance Resources management Dealing with Multiple Instance Resources in the data model requires implementing additional handlers. The most important in the list_resource_instances handler: @@ -153,7 +162,7 @@ 5.4.6.1. API for Multiple Instance Resou ignoring, is used to determine the Resource Instance that is targeted. -5.4.6.2. Preparing Test object for Multiple Instance Resources +5.4.6.2. Preparing Test object for Multiple Instance Resources First of all, we need to update the List Resources handler so that the library knows that Resource 1 now has multiple instances: static int test_list_resources(anjay_t *anjay, @@ -192,15 +201,15 @@ 5.4.6.2. Preparing Test object for Multi } test_instance_t; - + + -5.4.6.3. Implementing the List Resource Instances handler +5.4.6.3. Implementing the List Resource Instances handler Here is how the List Resource Instances is implemented for our test object: static int test_list_resource_instances(anjay_t *anjay, @@ -231,7 +240,7 @@ 5.4.6.3. Implementing the List Resource implementation satisfies this contract. -5.4.6.4. Handling Multiple Instance Resources in Read operation +5.4.6.4. Handling Multiple Instance Resources in Read operation resource_read handler is being called by Anjay for each Resource Instance referenced by the server, giving the control to the user. Thus, the read handler could look like this: @@ -261,8 +270,8 @@ 5.4.6.4. Handling Multiple Instance Reso -5.4.6.5. Implementing the Resource Reset handler - +5.4.6.5. Implementing the Resource Reset handler + + The above means that the Resource Reset handler is rather simple to implement, as it only needs to clear the resource: static int test_resource_reset(anjay_t *anjay, @@ -297,7 +306,7 @@ 5.4.6.5. Implementing the Resource Reset -5.4.6.6. Handling Multiple Instance Resources in Write operation +5.4.6.6. Handling Multiple Instance Resources in Write operation Now we are ready to actually implement the write operation. We will create a helper function for actually updating the Resource Instance list with a newly written value. diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html index fbd5deb9..90fff740 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html @@ -1,18 +1,23 @@ - + - 5.4.2. Single-instance read-only object with an executable resource — Anjay 3.4.1 documentation + 5.4.2. Single-instance read-only object with an executable resource — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.2. Single-instance read-only object with an executable resource + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.2. Single-instance read-only object with an executable resource @@ -100,7 +109,7 @@ -5.4.2. Single-instance read-only object with an executable resource +5.4.2. Single-instance read-only object with an executable resource Note This section describes in details the implementation of custom Objects in @@ -120,11 +129,6 @@ 5.4.2. Single-instance read-only object The implemented Object will be be based on the previous tutorial Single-instance read-only object, but with additional executable resource: - - - - - Name Object ID @@ -140,14 +144,6 @@ 5.4.2. Single-instance read-only object Each Object Instance has three Resources: - - - - - - - - Name Resource ID @@ -185,7 +181,7 @@ 5.4.2. Single-instance read-only object storing the result in the Value resource. The integers are to be specified as arguments to the LwM2M Execute operation. -5.4.2.1. LwM2M Execute arguments +5.4.2.1. LwM2M Execute arguments The LwM2M specification defines a syntax of the Execute argument list as a formal ABNF grammar. @@ -230,7 +226,7 @@ 5.4.2.1. LwM2M Execute argumentsThey will greatly simplify parsing process, as you will see in the next section. -5.4.2.2. Implementation +5.4.2.2. Implementation We start with adding our Resource to the list of supported Resources: static int test_list_resources(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html index 1955871c..a575b8f1 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html @@ -1,18 +1,23 @@ - + - 5.4.1. Single-instance read-only object — Anjay 3.4.1 documentation + 5.4.1. Single-instance read-only object — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.1. Single-instance read-only object + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.1. Single-instance read-only object @@ -100,7 +109,7 @@ -5.4.1. Single-instance read-only object +5.4.1. Single-instance read-only object Note This section describes in details the implementation of custom Objects in @@ -113,11 +122,6 @@ 5.4.1. Single-instance read-only object< This is the simplest possible case. Let us implement following custom Object: - - - - - Name Object ID @@ -133,14 +137,6 @@ 5.4.1. Single-instance read-only object< With two simple Resources: - - - - - - - - Name Resource ID @@ -279,7 +275,7 @@ 5.4.1. Single-instance read-only object< }; - + + When the Object Definition is ready, the only thing left to do is registering it in the library: int main(int argc, char *argv[]) { diff --git a/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html b/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html index a0635b6f..14766a6a 100644 --- a/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html +++ b/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html @@ -1,18 +1,23 @@ - + - <no title> — Anjay 3.4.1 documentation + <no title> — Anjay 3.5.0 documentation + + + @@ -23,15 +28,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -63,8 +72,8 @@ - » - <no title> + + <no title> diff --git a/AdvancedTopics/AT-EventLoopNotes.html b/AdvancedTopics/AT-EventLoopNotes.html index e0781575..7d564336 100644 --- a/AdvancedTopics/AT-EventLoopNotes.html +++ b/AdvancedTopics/AT-EventLoopNotes.html @@ -1,18 +1,23 @@ - + - 5.10. Notes on event loop APIs — Anjay 3.4.1 documentation + 5.10. Notes on event loop APIs — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ -
instance_remove
instance_remove handler does not have to perform anything other than removing the instance from our list.
static int test_instance_remove(anjay_t *anjay, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html b/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html index f76229b9..7f7e6805 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_MultiInstanceReadOnlyFixed.html @@ -1,18 +1,23 @@ - + - 5.4.3. Multi-instance read-only object with fixed number of instances — Anjay 3.4.1 documentation + 5.4.3. Multi-instance read-only object with fixed number of instances — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.3. Multi-instance read-only object with fixed number of instances + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.3. Multi-instance read-only object with fixed number of instances @@ -100,7 +109,7 @@ -5.4.3. Multi-instance read-only object with fixed number of instances +5.4.3. Multi-instance read-only object with fixed number of instances Note This section describes in details the implementation of custom Objects in @@ -116,11 +125,6 @@ 5.4.3. Multi-instance read-only object w The implemented Object will look as in Single-instance read-only object, but will now support multiple Object Instances: - - - - - Name Object ID @@ -136,14 +140,6 @@ 5.4.3. Multi-instance read-only object w Each Object Instance has two Resources: - - - - - - - - Name Resource ID @@ -226,14 +222,14 @@ 5.4.3. Multi-instance read-only object w order. - + + Having done that, resource_read handler needs to be slightly modified to correctly handle requests to different Object Instance IDs. static int test_resource_read(anjay_t *anjay, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html b/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html index a39ec8a1..2ef43f4a 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html @@ -1,18 +1,23 @@ - + - 5.4.6. Objects with Multiple Instance Resources — Anjay 3.4.1 documentation + 5.4.6. Objects with Multiple Instance Resources — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.6. Objects with Multiple Instance Resources + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.6. Objects with Multiple Instance Resources @@ -100,7 +109,7 @@ -5.4.6. Objects with Multiple Instance Resources +5.4.6. Objects with Multiple Instance Resources Note This section describes in details the implementation of custom Objects in @@ -119,7 +128,7 @@ 5.4.6. Objects with Multiple Instance Re We will extend the Test object from previous tutorial by allowing Value Resource to contain multiple values. -5.4.6.1. API for Multiple Instance Resources management +5.4.6.1. API for Multiple Instance Resources management Dealing with Multiple Instance Resources in the data model requires implementing additional handlers. The most important in the list_resource_instances handler: @@ -153,7 +162,7 @@ 5.4.6.1. API for Multiple Instance Resou ignoring, is used to determine the Resource Instance that is targeted. -5.4.6.2. Preparing Test object for Multiple Instance Resources +5.4.6.2. Preparing Test object for Multiple Instance Resources First of all, we need to update the List Resources handler so that the library knows that Resource 1 now has multiple instances: static int test_list_resources(anjay_t *anjay, @@ -192,15 +201,15 @@ 5.4.6.2. Preparing Test object for Multi } test_instance_t; - + + -5.4.6.3. Implementing the List Resource Instances handler +5.4.6.3. Implementing the List Resource Instances handler Here is how the List Resource Instances is implemented for our test object: static int test_list_resource_instances(anjay_t *anjay, @@ -231,7 +240,7 @@ 5.4.6.3. Implementing the List Resource implementation satisfies this contract. -5.4.6.4. Handling Multiple Instance Resources in Read operation +5.4.6.4. Handling Multiple Instance Resources in Read operation resource_read handler is being called by Anjay for each Resource Instance referenced by the server, giving the control to the user. Thus, the read handler could look like this: @@ -261,8 +270,8 @@ 5.4.6.4. Handling Multiple Instance Reso -5.4.6.5. Implementing the Resource Reset handler - +5.4.6.5. Implementing the Resource Reset handler + + The above means that the Resource Reset handler is rather simple to implement, as it only needs to clear the resource: static int test_resource_reset(anjay_t *anjay, @@ -297,7 +306,7 @@ 5.4.6.5. Implementing the Resource Reset -5.4.6.6. Handling Multiple Instance Resources in Write operation +5.4.6.6. Handling Multiple Instance Resources in Write operation Now we are ready to actually implement the write operation. We will create a helper function for actually updating the Resource Instance list with a newly written value. diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html index fbd5deb9..90fff740 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html @@ -1,18 +1,23 @@ - + - 5.4.2. Single-instance read-only object with an executable resource — Anjay 3.4.1 documentation + 5.4.2. Single-instance read-only object with an executable resource — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.2. Single-instance read-only object with an executable resource + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.2. Single-instance read-only object with an executable resource @@ -100,7 +109,7 @@ -5.4.2. Single-instance read-only object with an executable resource +5.4.2. Single-instance read-only object with an executable resource Note This section describes in details the implementation of custom Objects in @@ -120,11 +129,6 @@ 5.4.2. Single-instance read-only object The implemented Object will be be based on the previous tutorial Single-instance read-only object, but with additional executable resource: - - - - - Name Object ID @@ -140,14 +144,6 @@ 5.4.2. Single-instance read-only object Each Object Instance has three Resources: - - - - - - - - Name Resource ID @@ -185,7 +181,7 @@ 5.4.2. Single-instance read-only object storing the result in the Value resource. The integers are to be specified as arguments to the LwM2M Execute operation. -5.4.2.1. LwM2M Execute arguments +5.4.2.1. LwM2M Execute arguments The LwM2M specification defines a syntax of the Execute argument list as a formal ABNF grammar. @@ -230,7 +226,7 @@ 5.4.2.1. LwM2M Execute argumentsThey will greatly simplify parsing process, as you will see in the next section. -5.4.2.2. Implementation +5.4.2.2. Implementation We start with adding our Resource to the list of supported Resources: static int test_list_resources(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html index 1955871c..a575b8f1 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html @@ -1,18 +1,23 @@ - + - 5.4.1. Single-instance read-only object — Anjay 3.4.1 documentation + 5.4.1. Single-instance read-only object — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.1. Single-instance read-only object + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.1. Single-instance read-only object @@ -100,7 +109,7 @@ -5.4.1. Single-instance read-only object +5.4.1. Single-instance read-only object Note This section describes in details the implementation of custom Objects in @@ -113,11 +122,6 @@ 5.4.1. Single-instance read-only object< This is the simplest possible case. Let us implement following custom Object: - - - - - Name Object ID @@ -133,14 +137,6 @@ 5.4.1. Single-instance read-only object< With two simple Resources: - - - - - - - - Name Resource ID @@ -279,7 +275,7 @@ 5.4.1. Single-instance read-only object< }; - + + When the Object Definition is ready, the only thing left to do is registering it in the library: int main(int argc, char *argv[]) { diff --git a/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html b/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html index a0635b6f..14766a6a 100644 --- a/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html +++ b/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html @@ -1,18 +1,23 @@ - + - <no title> — Anjay 3.4.1 documentation + <no title> — Anjay 3.5.0 documentation + + + @@ -23,15 +28,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -63,8 +72,8 @@ - » - <no title> + + <no title> diff --git a/AdvancedTopics/AT-EventLoopNotes.html b/AdvancedTopics/AT-EventLoopNotes.html index e0781575..7d564336 100644 --- a/AdvancedTopics/AT-EventLoopNotes.html +++ b/AdvancedTopics/AT-EventLoopNotes.html @@ -1,18 +1,23 @@ - + - 5.10. Notes on event loop APIs — Anjay 3.4.1 documentation + 5.10. Notes on event loop APIs — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ -
This section describes in details the implementation of custom Objects in @@ -116,11 +125,6 @@
The implemented Object will look as in Single-instance read-only object, but will now support multiple Object Instances:
Having done that, resource_read handler needs to be slightly modified to correctly handle requests to different Object Instance IDs.
resource_read
static int test_resource_read(anjay_t *anjay, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html b/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html index a39ec8a1..2ef43f4a 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_MultipleResourceInstances.html @@ -1,18 +1,23 @@ - + - 5.4.6. Objects with Multiple Instance Resources — Anjay 3.4.1 documentation + 5.4.6. Objects with Multiple Instance Resources — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.6. Objects with Multiple Instance Resources + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.6. Objects with Multiple Instance Resources @@ -100,7 +109,7 @@ -5.4.6. Objects with Multiple Instance Resources +5.4.6. Objects with Multiple Instance Resources Note This section describes in details the implementation of custom Objects in @@ -119,7 +128,7 @@ 5.4.6. Objects with Multiple Instance Re We will extend the Test object from previous tutorial by allowing Value Resource to contain multiple values. -5.4.6.1. API for Multiple Instance Resources management +5.4.6.1. API for Multiple Instance Resources management Dealing with Multiple Instance Resources in the data model requires implementing additional handlers. The most important in the list_resource_instances handler: @@ -153,7 +162,7 @@ 5.4.6.1. API for Multiple Instance Resou ignoring, is used to determine the Resource Instance that is targeted. -5.4.6.2. Preparing Test object for Multiple Instance Resources +5.4.6.2. Preparing Test object for Multiple Instance Resources First of all, we need to update the List Resources handler so that the library knows that Resource 1 now has multiple instances: static int test_list_resources(anjay_t *anjay, @@ -192,15 +201,15 @@ 5.4.6.2. Preparing Test object for Multi } test_instance_t; - + + -5.4.6.3. Implementing the List Resource Instances handler +5.4.6.3. Implementing the List Resource Instances handler Here is how the List Resource Instances is implemented for our test object: static int test_list_resource_instances(anjay_t *anjay, @@ -231,7 +240,7 @@ 5.4.6.3. Implementing the List Resource implementation satisfies this contract. -5.4.6.4. Handling Multiple Instance Resources in Read operation +5.4.6.4. Handling Multiple Instance Resources in Read operation resource_read handler is being called by Anjay for each Resource Instance referenced by the server, giving the control to the user. Thus, the read handler could look like this: @@ -261,8 +270,8 @@ 5.4.6.4. Handling Multiple Instance Reso -5.4.6.5. Implementing the Resource Reset handler - +5.4.6.5. Implementing the Resource Reset handler + + The above means that the Resource Reset handler is rather simple to implement, as it only needs to clear the resource: static int test_resource_reset(anjay_t *anjay, @@ -297,7 +306,7 @@ 5.4.6.5. Implementing the Resource Reset -5.4.6.6. Handling Multiple Instance Resources in Write operation +5.4.6.6. Handling Multiple Instance Resources in Write operation Now we are ready to actually implement the write operation. We will create a helper function for actually updating the Resource Instance list with a newly written value. diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html index fbd5deb9..90fff740 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceExecutableAndReadOnly.html @@ -1,18 +1,23 @@ - + - 5.4.2. Single-instance read-only object with an executable resource — Anjay 3.4.1 documentation + 5.4.2. Single-instance read-only object with an executable resource — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.2. Single-instance read-only object with an executable resource + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.2. Single-instance read-only object with an executable resource @@ -100,7 +109,7 @@ -5.4.2. Single-instance read-only object with an executable resource +5.4.2. Single-instance read-only object with an executable resource Note This section describes in details the implementation of custom Objects in @@ -120,11 +129,6 @@ 5.4.2. Single-instance read-only object The implemented Object will be be based on the previous tutorial Single-instance read-only object, but with additional executable resource: - - - - - Name Object ID @@ -140,14 +144,6 @@ 5.4.2. Single-instance read-only object Each Object Instance has three Resources: - - - - - - - - Name Resource ID @@ -185,7 +181,7 @@ 5.4.2. Single-instance read-only object storing the result in the Value resource. The integers are to be specified as arguments to the LwM2M Execute operation. -5.4.2.1. LwM2M Execute arguments +5.4.2.1. LwM2M Execute arguments The LwM2M specification defines a syntax of the Execute argument list as a formal ABNF grammar. @@ -230,7 +226,7 @@ 5.4.2.1. LwM2M Execute argumentsThey will greatly simplify parsing process, as you will see in the next section. -5.4.2.2. Implementation +5.4.2.2. Implementation We start with adding our Resource to the list of supported Resources: static int test_list_resources(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html index 1955871c..a575b8f1 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html @@ -1,18 +1,23 @@ - + - 5.4.1. Single-instance read-only object — Anjay 3.4.1 documentation + 5.4.1. Single-instance read-only object — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.1. Single-instance read-only object + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.1. Single-instance read-only object @@ -100,7 +109,7 @@ -5.4.1. Single-instance read-only object +5.4.1. Single-instance read-only object Note This section describes in details the implementation of custom Objects in @@ -113,11 +122,6 @@ 5.4.1. Single-instance read-only object< This is the simplest possible case. Let us implement following custom Object: - - - - - Name Object ID @@ -133,14 +137,6 @@ 5.4.1. Single-instance read-only object< With two simple Resources: - - - - - - - - Name Resource ID @@ -279,7 +275,7 @@ 5.4.1. Single-instance read-only object< }; - + + When the Object Definition is ready, the only thing left to do is registering it in the library: int main(int argc, char *argv[]) { diff --git a/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html b/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html index a0635b6f..14766a6a 100644 --- a/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html +++ b/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html @@ -1,18 +1,23 @@ - + - <no title> — Anjay 3.4.1 documentation + <no title> — Anjay 3.5.0 documentation + + + @@ -23,15 +28,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -63,8 +72,8 @@ - » - <no title> + + <no title> diff --git a/AdvancedTopics/AT-EventLoopNotes.html b/AdvancedTopics/AT-EventLoopNotes.html index e0781575..7d564336 100644 --- a/AdvancedTopics/AT-EventLoopNotes.html +++ b/AdvancedTopics/AT-EventLoopNotes.html @@ -1,18 +1,23 @@ - + - 5.10. Notes on event loop APIs — Anjay 3.4.1 documentation + 5.10. Notes on event loop APIs — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ -
This section describes in details the implementation of custom Objects in @@ -119,7 +128,7 @@
We will extend the Test object from previous tutorial by allowing Value Resource to contain multiple values.
Dealing with Multiple Instance Resources in the data model requires implementing additional handlers. The most important in the list_resource_instances handler:
list_resource_instances
First of all, we need to update the List Resources handler so that the library knows that Resource 1 now has multiple instances:
static int test_list_resources(anjay_t *anjay, @@ -192,15 +201,15 @@ 5.4.6.2. Preparing Test object for Multi } test_instance_t;
Here is how the List Resource Instances is implemented for our test object:
static int test_list_resource_instances(anjay_t *anjay, @@ -231,7 +240,7 @@ 5.4.6.3. Implementing the List Resource implementation satisfies this contract. -5.4.6.4. Handling Multiple Instance Resources in Read operation +5.4.6.4. Handling Multiple Instance Resources in Read operation resource_read handler is being called by Anjay for each Resource Instance referenced by the server, giving the control to the user. Thus, the read handler could look like this: @@ -261,8 +270,8 @@ 5.4.6.4. Handling Multiple Instance Reso
resource_read handler is being called by Anjay for each Resource Instance referenced by the server, giving the control to the user. Thus, the read handler could look like this:
The above means that the Resource Reset handler is rather simple to implement, as it only needs to clear the resource:
static int test_resource_reset(anjay_t *anjay, @@ -297,7 +306,7 @@ 5.4.6.5. Implementing the Resource Reset
Now we are ready to actually implement the write operation. We will create a helper function for actually updating the Resource Instance list with a newly written value.
The implemented Object will be be based on the previous tutorial Single-instance read-only object, but with additional executable resource:
Each Object Instance has three Resources:
The LwM2M specification defines a syntax of the Execute argument list as a formal ABNF grammar.
We start with adding our Resource to the list of supported Resources:
static int test_list_resources(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, diff --git a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html index 1955871c..a575b8f1 100644 --- a/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html +++ b/AdvancedTopics/AT-CustomObjects/AT_CO_SingleInstanceReadOnly.html @@ -1,18 +1,23 @@ - + - 5.4.1. Single-instance read-only object — Anjay 3.4.1 documentation + 5.4.1. Single-instance read-only object — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -87,10 +96,10 @@ - » - 5. Advanced topics » - 5.4. Custom LwM2M objects » - 5.4.1. Single-instance read-only object + + 5. Advanced topics + 5.4. Custom LwM2M objects + 5.4.1. Single-instance read-only object @@ -100,7 +109,7 @@ -5.4.1. Single-instance read-only object +5.4.1. Single-instance read-only object Note This section describes in details the implementation of custom Objects in @@ -113,11 +122,6 @@ 5.4.1. Single-instance read-only object< This is the simplest possible case. Let us implement following custom Object: - - - - - Name Object ID @@ -133,14 +137,6 @@ 5.4.1. Single-instance read-only object< With two simple Resources: - - - - - - - - Name Resource ID @@ -279,7 +275,7 @@ 5.4.1. Single-instance read-only object< }; - + + When the Object Definition is ready, the only thing left to do is registering it in the library: int main(int argc, char *argv[]) { diff --git a/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html b/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html index a0635b6f..14766a6a 100644 --- a/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html +++ b/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html @@ -1,18 +1,23 @@ - + - <no title> — Anjay 3.4.1 documentation + <no title> — Anjay 3.5.0 documentation + + + @@ -23,15 +28,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -63,8 +72,8 @@ - » - <no title> + + <no title> diff --git a/AdvancedTopics/AT-EventLoopNotes.html b/AdvancedTopics/AT-EventLoopNotes.html index e0781575..7d564336 100644 --- a/AdvancedTopics/AT-EventLoopNotes.html +++ b/AdvancedTopics/AT-EventLoopNotes.html @@ -1,18 +1,23 @@ - + - 5.10. Notes on event loop APIs — Anjay 3.4.1 documentation + 5.10. Notes on event loop APIs — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ -
This section describes in details the implementation of custom Objects in @@ -113,11 +122,6 @@
This is the simplest possible case. Let us implement following custom Object:
With two simple Resources:
When the Object Definition is ready, the only thing left to do is registering it in the library:
int main(int argc, char *argv[]) { diff --git a/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html b/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html index a0635b6f..14766a6a 100644 --- a/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html +++ b/AdvancedTopics/AT-CustomObjects/Anjay_codegen_note.html @@ -1,18 +1,23 @@ - + - <no title> — Anjay 3.4.1 documentation + <no title> — Anjay 3.5.0 documentation + + + @@ -23,15 +28,19 @@ - - + + + + + + - 3.4.1 + 3.5.0 - + @@ -63,8 +72,8 @@ - » - <no title> + + <no title> diff --git a/AdvancedTopics/AT-EventLoopNotes.html b/AdvancedTopics/AT-EventLoopNotes.html index e0781575..7d564336 100644 --- a/AdvancedTopics/AT-EventLoopNotes.html +++ b/AdvancedTopics/AT-EventLoopNotes.html @@ -1,18 +1,23 @@ - + - 5.10. Notes on event loop APIs — Anjay 3.4.1 documentation + 5.10. Notes on event loop APIs — Anjay 3.5.0 documentation + + + @@ -25,15 +30,19 @@ -