Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-client by
source/include/m2mnsdlinterface.h@4:ae5178938864, 2016-04-02 (annotated)
- Committer:
- Yogesh Pande
- Date:
- Sat Apr 02 00:31:13 2016 +0300
- Revision:
- 4:ae5178938864
- Parent:
- 1:79b6cc67d8b4
- Child:
- 5:e36098b177a4
Latest updated sources from Github and some trace group refactor.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Christopher Haster |
1:79b6cc67d8b4 | 1 | /* |
| Christopher Haster |
1:79b6cc67d8b4 | 2 | * Copyright (c) 2015 ARM Limited. All rights reserved. |
| Christopher Haster |
1:79b6cc67d8b4 | 3 | * SPDX-License-Identifier: Apache-2.0 |
| Christopher Haster |
1:79b6cc67d8b4 | 4 | * Licensed under the Apache License, Version 2.0 (the License); you may |
| Christopher Haster |
1:79b6cc67d8b4 | 5 | * not use this file except in compliance with the License. |
| Christopher Haster |
1:79b6cc67d8b4 | 6 | * You may obtain a copy of the License at |
| Christopher Haster |
1:79b6cc67d8b4 | 7 | * |
| Christopher Haster |
1:79b6cc67d8b4 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| Christopher Haster |
1:79b6cc67d8b4 | 9 | * |
| Christopher Haster |
1:79b6cc67d8b4 | 10 | * Unless required by applicable law or agreed to in writing, software |
| Christopher Haster |
1:79b6cc67d8b4 | 11 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
| Christopher Haster |
1:79b6cc67d8b4 | 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| Christopher Haster |
1:79b6cc67d8b4 | 13 | * See the License for the specific language governing permissions and |
| Christopher Haster |
1:79b6cc67d8b4 | 14 | * limitations under the License. |
| Christopher Haster |
1:79b6cc67d8b4 | 15 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 16 | #ifndef M2MNSDLINTERFACE_H |
| Christopher Haster |
1:79b6cc67d8b4 | 17 | #define M2MNSDLINTERFACE_H |
| Christopher Haster |
1:79b6cc67d8b4 | 18 | |
| Christopher Haster |
1:79b6cc67d8b4 | 19 | #include "mbed-client/m2mvector.h" |
| Christopher Haster |
1:79b6cc67d8b4 | 20 | #include "mbed-client/m2mconfig.h" |
| Christopher Haster |
1:79b6cc67d8b4 | 21 | #include "mbed-client/m2minterface.h" |
| Christopher Haster |
1:79b6cc67d8b4 | 22 | #include "mbed-client/m2mtimerobserver.h" |
| Christopher Haster |
1:79b6cc67d8b4 | 23 | #include "mbed-client/m2mobservationhandler.h" |
| Yogesh Pande |
4:ae5178938864 | 24 | #include "mbed-client/m2mbase.h" |
| Christopher Haster |
1:79b6cc67d8b4 | 25 | #include "include/nsdllinker.h" |
| Christopher Haster |
1:79b6cc67d8b4 | 26 | |
| Christopher Haster |
1:79b6cc67d8b4 | 27 | //FORWARD DECLARARTION |
| Christopher Haster |
1:79b6cc67d8b4 | 28 | class M2MSecurity; |
| Christopher Haster |
1:79b6cc67d8b4 | 29 | class M2MObject; |
| Christopher Haster |
1:79b6cc67d8b4 | 30 | class M2MObjectInstance; |
| Christopher Haster |
1:79b6cc67d8b4 | 31 | class M2MResource; |
| Christopher Haster |
1:79b6cc67d8b4 | 32 | class M2MResourceInstance; |
| Christopher Haster |
1:79b6cc67d8b4 | 33 | class M2MNsdlObserver; |
| Christopher Haster |
1:79b6cc67d8b4 | 34 | class M2MServer; |
| Christopher Haster |
1:79b6cc67d8b4 | 35 | class M2MTimer; |
| Christopher Haster |
1:79b6cc67d8b4 | 36 | |
| Christopher Haster |
1:79b6cc67d8b4 | 37 | typedef Vector<M2MObject *> M2MObjectList; |
| Christopher Haster |
1:79b6cc67d8b4 | 38 | |
| Christopher Haster |
1:79b6cc67d8b4 | 39 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 40 | * @brief M2MNsdlInterface |
| Christopher Haster |
1:79b6cc67d8b4 | 41 | * Class which interacts between mbed Client C++ Library and mbed-client-c library. |
| Christopher Haster |
1:79b6cc67d8b4 | 42 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 43 | class M2MNsdlInterface : public M2MTimerObserver, |
| Christopher Haster |
1:79b6cc67d8b4 | 44 | public M2MObservationHandler |
| Christopher Haster |
1:79b6cc67d8b4 | 45 | { |
| Christopher Haster |
1:79b6cc67d8b4 | 46 | private: |
| Christopher Haster |
1:79b6cc67d8b4 | 47 | // Prevents the use of assignment operator by accident. |
| Christopher Haster |
1:79b6cc67d8b4 | 48 | M2MNsdlInterface& operator=( const M2MNsdlInterface& /*other*/ ); |
| Christopher Haster |
1:79b6cc67d8b4 | 49 | |
| Christopher Haster |
1:79b6cc67d8b4 | 50 | // Prevents the use of copy constructor by accident |
| Christopher Haster |
1:79b6cc67d8b4 | 51 | M2MNsdlInterface( const M2MNsdlInterface& /*other*/ ); |
| Christopher Haster |
1:79b6cc67d8b4 | 52 | |
| Christopher Haster |
1:79b6cc67d8b4 | 53 | public: |
| Christopher Haster |
1:79b6cc67d8b4 | 54 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 55 | * @brief Constructor |
| Christopher Haster |
1:79b6cc67d8b4 | 56 | * @param observer, Observer to pass the event callbacks from nsdl library. |
| Christopher Haster |
1:79b6cc67d8b4 | 57 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 58 | M2MNsdlInterface(M2MNsdlObserver &observer); |
| Christopher Haster |
1:79b6cc67d8b4 | 59 | |
| Christopher Haster |
1:79b6cc67d8b4 | 60 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 61 | * @brief Destructor |
| Christopher Haster |
1:79b6cc67d8b4 | 62 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 63 | virtual ~M2MNsdlInterface(); |
| Christopher Haster |
1:79b6cc67d8b4 | 64 | |
| Christopher Haster |
1:79b6cc67d8b4 | 65 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 66 | * @brief Creates endpoint object for the nsdl stack. |
| Christopher Haster |
1:79b6cc67d8b4 | 67 | * @param endpoint_name, Endpoint name of the client. |
| Christopher Haster |
1:79b6cc67d8b4 | 68 | * @param endpoint_type, Endpoint type of the client. |
| Christopher Haster |
1:79b6cc67d8b4 | 69 | * @param life_time, Life time of the client in seconds |
| Christopher Haster |
1:79b6cc67d8b4 | 70 | * @param domain, Domain of the client. |
| Christopher Haster |
1:79b6cc67d8b4 | 71 | * @param mode, Binding mode of the client, default is UDP |
| Christopher Haster |
1:79b6cc67d8b4 | 72 | * @param context_address, Context address default is empty. |
| Christopher Haster |
1:79b6cc67d8b4 | 73 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 74 | void create_endpoint(const String &endpoint_name, |
| Christopher Haster |
1:79b6cc67d8b4 | 75 | const String &endpoint_type, |
| Christopher Haster |
1:79b6cc67d8b4 | 76 | const int32_t life_time, |
| Christopher Haster |
1:79b6cc67d8b4 | 77 | const String &domain, |
| Christopher Haster |
1:79b6cc67d8b4 | 78 | const uint8_t mode, |
| Christopher Haster |
1:79b6cc67d8b4 | 79 | const String &context_address); |
| Christopher Haster |
1:79b6cc67d8b4 | 80 | |
| Christopher Haster |
1:79b6cc67d8b4 | 81 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 82 | * @brief Deletes the endpoint. |
| Christopher Haster |
1:79b6cc67d8b4 | 83 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 84 | void delete_endpoint(); |
| Christopher Haster |
1:79b6cc67d8b4 | 85 | |
| Christopher Haster |
1:79b6cc67d8b4 | 86 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 87 | * @brief Creates the NSDL structure for the registered objectlist. |
| Christopher Haster |
1:79b6cc67d8b4 | 88 | * @param object_list, List of objects to be registered. |
| Christopher Haster |
1:79b6cc67d8b4 | 89 | * @return true if structure created successfully else false. |
| Christopher Haster |
1:79b6cc67d8b4 | 90 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 91 | bool create_nsdl_list_structure(const M2MObjectList &object_list); |
| Christopher Haster |
1:79b6cc67d8b4 | 92 | |
| Christopher Haster |
1:79b6cc67d8b4 | 93 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 94 | * @brief Removed the NSDL resource for the given resource. |
| Christopher Haster |
1:79b6cc67d8b4 | 95 | * @param resource_name, Resource name to be removed. |
| Christopher Haster |
1:79b6cc67d8b4 | 96 | * @return true if removed successfully else false. |
| Christopher Haster |
1:79b6cc67d8b4 | 97 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 98 | bool delete_nsdl_resource(const String &resource_name); |
| Christopher Haster |
1:79b6cc67d8b4 | 99 | |
| Christopher Haster |
1:79b6cc67d8b4 | 100 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 101 | * @brief Creates the bootstrap object. |
| Christopher Haster |
1:79b6cc67d8b4 | 102 | * @param address Bootstrap address. |
| Christopher Haster |
1:79b6cc67d8b4 | 103 | * @return true if created and sent successfully else false. |
| Christopher Haster |
1:79b6cc67d8b4 | 104 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 105 | bool create_bootstrap_resource(sn_nsdl_addr_s *address); |
| Christopher Haster |
1:79b6cc67d8b4 | 106 | |
| Christopher Haster |
1:79b6cc67d8b4 | 107 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 108 | * @brief Sends the register message to the server. |
| Christopher Haster |
1:79b6cc67d8b4 | 109 | * @param address M2MServer address. |
| Christopher Haster |
1:79b6cc67d8b4 | 110 | * @param port M2MServer port. |
| Christopher Haster |
1:79b6cc67d8b4 | 111 | * @param address_type IP Address type. |
| Christopher Haster |
1:79b6cc67d8b4 | 112 | * @return true if register sent successfully else false. |
| Christopher Haster |
1:79b6cc67d8b4 | 113 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 114 | bool send_register_message(uint8_t* address, |
| Christopher Haster |
1:79b6cc67d8b4 | 115 | const uint16_t port, |
| Christopher Haster |
1:79b6cc67d8b4 | 116 | sn_nsdl_addr_type_e address_type); |
| Christopher Haster |
1:79b6cc67d8b4 | 117 | |
| Christopher Haster |
1:79b6cc67d8b4 | 118 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 119 | * @brief Sends the update registration message to the server. |
| Christopher Haster |
1:79b6cc67d8b4 | 120 | * @param lifetime, Updated lifetime value in seconds. |
| Christopher Haster |
1:79b6cc67d8b4 | 121 | * @return true if sent successfully else false. |
| Christopher Haster |
1:79b6cc67d8b4 | 122 | * |
| Christopher Haster |
1:79b6cc67d8b4 | 123 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 124 | bool send_update_registration(const uint32_t lifetime = 0); |
| Christopher Haster |
1:79b6cc67d8b4 | 125 | |
| Christopher Haster |
1:79b6cc67d8b4 | 126 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 127 | * @brief Sends unregister message to the server. |
| Christopher Haster |
1:79b6cc67d8b4 | 128 | * @return true if unregister sent successfully else false. |
| Christopher Haster |
1:79b6cc67d8b4 | 129 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 130 | bool send_unregister_message(); |
| Christopher Haster |
1:79b6cc67d8b4 | 131 | |
| Christopher Haster |
1:79b6cc67d8b4 | 132 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 133 | * @brief Memory Allocation required for libCoap. |
| Christopher Haster |
1:79b6cc67d8b4 | 134 | * @param size, Size of memory to be reserved. |
| Christopher Haster |
1:79b6cc67d8b4 | 135 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 136 | void* memory_alloc(uint16_t size); |
| Christopher Haster |
1:79b6cc67d8b4 | 137 | |
| Christopher Haster |
1:79b6cc67d8b4 | 138 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 139 | * @brief Memory free functions required for libCoap |
| Christopher Haster |
1:79b6cc67d8b4 | 140 | * @param ptr, Object whose memory needs to be freed. |
| Christopher Haster |
1:79b6cc67d8b4 | 141 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 142 | void memory_free(void *ptr); |
| Christopher Haster |
1:79b6cc67d8b4 | 143 | |
| Christopher Haster |
1:79b6cc67d8b4 | 144 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 145 | * @brief Callback from nsdl library to inform the data is ready |
| Christopher Haster |
1:79b6cc67d8b4 | 146 | * to be sent to server. |
| Christopher Haster |
1:79b6cc67d8b4 | 147 | * @param nsdl_handle, Handler for the nsdl structure for this endpoint |
| Christopher Haster |
1:79b6cc67d8b4 | 148 | * @param protocol, Protocol format of the data |
| Christopher Haster |
1:79b6cc67d8b4 | 149 | * @param data, Data to be sent. |
| Christopher Haster |
1:79b6cc67d8b4 | 150 | * @param data_len, Size of the data to be sent |
| Christopher Haster |
1:79b6cc67d8b4 | 151 | * @param address, server address where data has to be sent. |
| Christopher Haster |
1:79b6cc67d8b4 | 152 | * @return 1 if successful else 0. |
| Christopher Haster |
1:79b6cc67d8b4 | 153 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 154 | uint8_t send_to_server_callback(struct nsdl_s * nsdl_handle, |
| Christopher Haster |
1:79b6cc67d8b4 | 155 | sn_nsdl_capab_e protocol, |
| Christopher Haster |
1:79b6cc67d8b4 | 156 | uint8_t *data, |
| Christopher Haster |
1:79b6cc67d8b4 | 157 | uint16_t data_len, |
| Christopher Haster |
1:79b6cc67d8b4 | 158 | sn_nsdl_addr_s *address); |
| Christopher Haster |
1:79b6cc67d8b4 | 159 | |
| Christopher Haster |
1:79b6cc67d8b4 | 160 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 161 | * @brief Callback from nsdl library to inform the data which is |
| Christopher Haster |
1:79b6cc67d8b4 | 162 | * received from server for the client has been converted to coap message. |
| Christopher Haster |
1:79b6cc67d8b4 | 163 | * @param nsdl_handle, Handler for the nsdl structure for this endpoint |
| Christopher Haster |
1:79b6cc67d8b4 | 164 | * @param coap_header, Coap message formed from data. |
| Christopher Haster |
1:79b6cc67d8b4 | 165 | * @param address, Server address from where the data is received. |
| Christopher Haster |
1:79b6cc67d8b4 | 166 | * @return 1 if successful else 0. |
| Christopher Haster |
1:79b6cc67d8b4 | 167 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 168 | uint8_t received_from_server_callback(struct nsdl_s * nsdl_handle, |
| Christopher Haster |
1:79b6cc67d8b4 | 169 | sn_coap_hdr_s *coap_header, |
| Christopher Haster |
1:79b6cc67d8b4 | 170 | sn_nsdl_addr_s *address); |
| Christopher Haster |
1:79b6cc67d8b4 | 171 | |
| Christopher Haster |
1:79b6cc67d8b4 | 172 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 173 | * @brief Callback from nsdl library to inform the data which is |
| Christopher Haster |
1:79b6cc67d8b4 | 174 | * received from server for the resources has been converted to coap message. |
| Christopher Haster |
1:79b6cc67d8b4 | 175 | * @param nsdl_handle, Handler for the nsdl resource structure for this endpoint.. |
| Christopher Haster |
1:79b6cc67d8b4 | 176 | * @param coap_header, Coap message formed from data. |
| Christopher Haster |
1:79b6cc67d8b4 | 177 | * @param address, Server address from where the data is received. |
| Christopher Haster |
1:79b6cc67d8b4 | 178 | * @param nsdl_capab, Protocol for the message, currently only coap is supported. |
| Christopher Haster |
1:79b6cc67d8b4 | 179 | * @return 1 if successful else 0. |
| Christopher Haster |
1:79b6cc67d8b4 | 180 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 181 | uint8_t resource_callback(struct nsdl_s *nsdl_handle, sn_coap_hdr_s *coap, |
| Christopher Haster |
1:79b6cc67d8b4 | 182 | sn_nsdl_addr_s *address, |
| Christopher Haster |
1:79b6cc67d8b4 | 183 | sn_nsdl_capab_e nsdl_capab); |
| Christopher Haster |
1:79b6cc67d8b4 | 184 | |
| Christopher Haster |
1:79b6cc67d8b4 | 185 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 186 | * @brief Callback when the bootstrap information is received from bootstrap server. |
| Christopher Haster |
1:79b6cc67d8b4 | 187 | * @param server_info, Server information received from bootstrap server. |
| Christopher Haster |
1:79b6cc67d8b4 | 188 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 189 | void bootstrap_done_callback(sn_nsdl_oma_server_info_t *server_info); |
| Christopher Haster |
1:79b6cc67d8b4 | 190 | |
| Christopher Haster |
1:79b6cc67d8b4 | 191 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 192 | * @brief Callback when there is data received from server and needs to be processed. |
| Christopher Haster |
1:79b6cc67d8b4 | 193 | * @param data, data received from server. |
| Christopher Haster |
1:79b6cc67d8b4 | 194 | * @param data_size, data size received from server. |
| Christopher Haster |
1:79b6cc67d8b4 | 195 | * @param addres, address structure of the server. |
| Christopher Haster |
1:79b6cc67d8b4 | 196 | * @return true if successfully processed else false. |
| Christopher Haster |
1:79b6cc67d8b4 | 197 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 198 | bool process_received_data(uint8_t *data, |
| Christopher Haster |
1:79b6cc67d8b4 | 199 | uint16_t data_size, |
| Christopher Haster |
1:79b6cc67d8b4 | 200 | sn_nsdl_addr_s *address); |
| Christopher Haster |
1:79b6cc67d8b4 | 201 | |
| Christopher Haster |
1:79b6cc67d8b4 | 202 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 203 | * @brief Stops all the timers in case there is any errors. |
| Christopher Haster |
1:79b6cc67d8b4 | 204 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 205 | void stop_timers(); |
| Christopher Haster |
1:79b6cc67d8b4 | 206 | |
| Christopher Haster |
1:79b6cc67d8b4 | 207 | protected: // from M2MTimerObserver |
| Christopher Haster |
1:79b6cc67d8b4 | 208 | |
| Christopher Haster |
1:79b6cc67d8b4 | 209 | virtual void timer_expired(M2MTimerObserver::Type type); |
| Christopher Haster |
1:79b6cc67d8b4 | 210 | |
| Christopher Haster |
1:79b6cc67d8b4 | 211 | protected: // from M2MObservationHandler |
| Christopher Haster |
1:79b6cc67d8b4 | 212 | |
| Yogesh Pande |
4:ae5178938864 | 213 | virtual void observation_to_be_sent(M2MBase *object, |
| Yogesh Pande |
4:ae5178938864 | 214 | uint16_t obs_number, |
| Yogesh Pande |
4:ae5178938864 | 215 | m2m::Vector<uint16_t> changed_instance_ids, |
| Yogesh Pande |
4:ae5178938864 | 216 | bool send_object = false); |
| Christopher Haster |
1:79b6cc67d8b4 | 217 | |
| Christopher Haster |
1:79b6cc67d8b4 | 218 | virtual void resource_to_be_deleted(const String &resource_name); |
| Christopher Haster |
1:79b6cc67d8b4 | 219 | |
| Christopher Haster |
1:79b6cc67d8b4 | 220 | virtual void value_updated(M2MBase *base, const String &object_name); |
| Christopher Haster |
1:79b6cc67d8b4 | 221 | |
| Christopher Haster |
1:79b6cc67d8b4 | 222 | virtual void remove_object(M2MBase *object); |
| Christopher Haster |
1:79b6cc67d8b4 | 223 | |
| Yogesh Pande |
4:ae5178938864 | 224 | virtual void send_delayed_response(M2MBase *base); |
| Yogesh Pande |
4:ae5178938864 | 225 | |
| Christopher Haster |
1:79b6cc67d8b4 | 226 | private: |
| Christopher Haster |
1:79b6cc67d8b4 | 227 | |
| Christopher Haster |
1:79b6cc67d8b4 | 228 | /** |
| Christopher Haster |
1:79b6cc67d8b4 | 229 | * @brief Initializes all the nsdl library component to be usable. |
| Christopher Haster |
1:79b6cc67d8b4 | 230 | * @return true if initialization is successful else false. |
| Christopher Haster |
1:79b6cc67d8b4 | 231 | */ |
| Christopher Haster |
1:79b6cc67d8b4 | 232 | bool initialize(); |
| Christopher Haster |
1:79b6cc67d8b4 | 233 | |
| Christopher Haster |
1:79b6cc67d8b4 | 234 | bool add_object_to_list(M2MObject *object); |
| Christopher Haster |
1:79b6cc67d8b4 | 235 | |
| Christopher Haster |
1:79b6cc67d8b4 | 236 | bool create_nsdl_object_structure(M2MObject *object); |
| Christopher Haster |
1:79b6cc67d8b4 | 237 | |
| Christopher Haster |
1:79b6cc67d8b4 | 238 | bool create_nsdl_object_instance_structure(M2MObjectInstance *object_instance); |
| Christopher Haster |
1:79b6cc67d8b4 | 239 | |
| Christopher Haster |
1:79b6cc67d8b4 | 240 | bool create_nsdl_resource_structure(M2MResource *resource, |
| Christopher Haster |
1:79b6cc67d8b4 | 241 | const String &object_name = "", |
| Christopher Haster |
1:79b6cc67d8b4 | 242 | bool multiple_instances = false); |
| Christopher Haster |
1:79b6cc67d8b4 | 243 | |
| Yogesh Pande |
4:ae5178938864 | 244 | bool create_nsdl_resource(M2MBase *base, const String &name = "", bool publish_uri = true); |
| Christopher Haster |
1:79b6cc67d8b4 | 245 | |
| Christopher Haster |
1:79b6cc67d8b4 | 246 | String coap_to_string(uint8_t *coap_data_ptr, |
| Christopher Haster |
1:79b6cc67d8b4 | 247 | int coap_data_ptr_length); |
| Christopher Haster |
1:79b6cc67d8b4 | 248 | |
| Christopher Haster |
1:79b6cc67d8b4 | 249 | void execute_nsdl_process_loop(); |
| Christopher Haster |
1:79b6cc67d8b4 | 250 | |
| Christopher Haster |
1:79b6cc67d8b4 | 251 | uint64_t registration_time(); |
| Christopher Haster |
1:79b6cc67d8b4 | 252 | |
| Christopher Haster |
1:79b6cc67d8b4 | 253 | M2MBase* find_resource(const String &object); |
| Christopher Haster |
1:79b6cc67d8b4 | 254 | |
| Christopher Haster |
1:79b6cc67d8b4 | 255 | M2MBase* find_resource(const M2MObject *object, |
| Christopher Haster |
1:79b6cc67d8b4 | 256 | const String &object_instance); |
| Christopher Haster |
1:79b6cc67d8b4 | 257 | |
| Christopher Haster |
1:79b6cc67d8b4 | 258 | M2MBase* find_resource(const M2MObjectInstance *object_instance, |
| Christopher Haster |
1:79b6cc67d8b4 | 259 | const String &resource_instance); |
| Christopher Haster |
1:79b6cc67d8b4 | 260 | |
| Christopher Haster |
1:79b6cc67d8b4 | 261 | M2MBase* find_resource(const M2MResource *resource, |
| Christopher Haster |
1:79b6cc67d8b4 | 262 | const String &object_name, |
| Christopher Haster |
1:79b6cc67d8b4 | 263 | const String &resource_instance); |
| Christopher Haster |
1:79b6cc67d8b4 | 264 | |
| Christopher Haster |
1:79b6cc67d8b4 | 265 | bool object_present(M2MObject * object) const; |
| Christopher Haster |
1:79b6cc67d8b4 | 266 | |
| Christopher Haster |
1:79b6cc67d8b4 | 267 | void clear_resource(sn_nsdl_resource_info_s *&resource); |
| Christopher Haster |
1:79b6cc67d8b4 | 268 | |
| Christopher Haster |
1:79b6cc67d8b4 | 269 | M2MInterface::Error interface_error(sn_coap_hdr_s *coap_header); |
| Christopher Haster |
1:79b6cc67d8b4 | 270 | |
| Yogesh Pande |
4:ae5178938864 | 271 | void send_object_observation(M2MObject *object, |
| Yogesh Pande |
4:ae5178938864 | 272 | uint16_t obs_number, |
| Yogesh Pande |
4:ae5178938864 | 273 | m2m::Vector<uint16_t> changed_instance_ids, |
| Yogesh Pande |
4:ae5178938864 | 274 | bool send_object); |
| Yogesh Pande |
4:ae5178938864 | 275 | |
| Yogesh Pande |
4:ae5178938864 | 276 | void send_object_instance_observation(M2MObjectInstance *object_instance, |
| Yogesh Pande |
4:ae5178938864 | 277 | uint16_t obs_number); |
| Yogesh Pande |
4:ae5178938864 | 278 | |
| Yogesh Pande |
4:ae5178938864 | 279 | void send_resource_observation(M2MResource *resource, uint16_t obs_number); |
| Christopher Haster |
1:79b6cc67d8b4 | 280 | |
| Yogesh Pande |
4:ae5178938864 | 281 | void build_observation_number(uint8_t *obs_number, |
| Yogesh Pande |
4:ae5178938864 | 282 | uint8_t *obs_len, |
| Yogesh Pande |
4:ae5178938864 | 283 | uint16_t number); |
| Christopher Haster |
1:79b6cc67d8b4 | 284 | |
| Yogesh Pande |
4:ae5178938864 | 285 | void send_notification(uint8_t *token, |
| Yogesh Pande |
4:ae5178938864 | 286 | uint8_t token_length, |
| Yogesh Pande |
4:ae5178938864 | 287 | uint8_t *value, |
| Yogesh Pande |
4:ae5178938864 | 288 | uint32_t value_length, |
| Yogesh Pande |
4:ae5178938864 | 289 | uint16_t observation, |
| Yogesh Pande |
4:ae5178938864 | 290 | uint32_t max_age, |
| Yogesh Pande |
4:ae5178938864 | 291 | uint8_t coap_content_type, |
| Yogesh Pande |
4:ae5178938864 | 292 | const String &uri_path); |
| Christopher Haster |
1:79b6cc67d8b4 | 293 | |
| Christopher Haster |
1:79b6cc67d8b4 | 294 | private: |
| Christopher Haster |
1:79b6cc67d8b4 | 295 | |
| Christopher Haster |
1:79b6cc67d8b4 | 296 | M2MNsdlObserver &_observer; |
| Christopher Haster |
1:79b6cc67d8b4 | 297 | M2MObjectList _object_list; |
| Christopher Haster |
1:79b6cc67d8b4 | 298 | M2MServer *_server; |
| Christopher Haster |
1:79b6cc67d8b4 | 299 | M2MTimer *_nsdl_exceution_timer; |
| Christopher Haster |
1:79b6cc67d8b4 | 300 | M2MTimer *_registration_timer; |
| Christopher Haster |
1:79b6cc67d8b4 | 301 | sn_nsdl_ep_parameters_s *_endpoint; |
| Christopher Haster |
1:79b6cc67d8b4 | 302 | sn_nsdl_resource_info_s *_resource; |
| Christopher Haster |
1:79b6cc67d8b4 | 303 | sn_nsdl_bs_ep_info_t _bootstrap_endpoint; |
| Christopher Haster |
1:79b6cc67d8b4 | 304 | sn_nsdl_oma_device_t _bootstrap_device_setup; |
| Christopher Haster |
1:79b6cc67d8b4 | 305 | sn_nsdl_addr_s _sn_nsdl_address; |
| Christopher Haster |
1:79b6cc67d8b4 | 306 | nsdl_s *_nsdl_handle; |
| Christopher Haster |
1:79b6cc67d8b4 | 307 | uint32_t _counter_for_nsdl; |
| Christopher Haster |
1:79b6cc67d8b4 | 308 | uint16_t _register_id; |
| Christopher Haster |
1:79b6cc67d8b4 | 309 | uint16_t _unregister_id; |
| Christopher Haster |
1:79b6cc67d8b4 | 310 | uint16_t _update_id; |
| Christopher Haster |
1:79b6cc67d8b4 | 311 | uint16_t _bootstrap_id; |
| Christopher Haster |
1:79b6cc67d8b4 | 312 | |
| Christopher Haster |
1:79b6cc67d8b4 | 313 | friend class Test_M2MNsdlInterface; |
| Christopher Haster |
1:79b6cc67d8b4 | 314 | |
| Christopher Haster |
1:79b6cc67d8b4 | 315 | }; |
| Christopher Haster |
1:79b6cc67d8b4 | 316 | |
| Christopher Haster |
1:79b6cc67d8b4 | 317 | #endif // M2MNSDLINTERFACE_H |
