mbed Connector Endpoint interface. This interface permits a mbed endpoint to easily setup MDS resources and emit those resources to an MDS server.

Dependents:   IoT_LED_demo ServoTest uWater_Project hackathon ... more

Committer:
sam_grove
Date:
Tue Jan 27 23:41:34 2015 +0000
Revision:
2:853f9ecc12df
Parent:
1:cabdd0350707
Child:
3:11b2f4e58378
Use auto-format on code and add markup to render class documentation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 1:cabdd0350707 1 /**
ansond 1:cabdd0350707 2 * @file Utils.cpp
ansond 1:cabdd0350707 3 * @brief mbed CoAP Endpoint misc utils collection
ansond 1:cabdd0350707 4 * @author Doug Anson
ansond 1:cabdd0350707 5 * @version 1.0
sam_grove 2:853f9ecc12df 6 * @see
ansond 1:cabdd0350707 7 *
ansond 1:cabdd0350707 8 * Copyright (c) 2014
ansond 1:cabdd0350707 9 *
ansond 1:cabdd0350707 10 * Licensed under the Apache License, Version 2.0 (the "License");
ansond 1:cabdd0350707 11 * you may not use this file except in compliance with the License.
ansond 1:cabdd0350707 12 * You may obtain a copy of the License at
ansond 1:cabdd0350707 13 *
ansond 1:cabdd0350707 14 * http://www.apache.org/licenses/LICENSE-2.0
ansond 1:cabdd0350707 15 *
ansond 1:cabdd0350707 16 * Unless required by applicable law or agreed to in writing, software
ansond 1:cabdd0350707 17 * distributed under the License is distributed on an "AS IS" BASIS,
ansond 1:cabdd0350707 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ansond 1:cabdd0350707 19 * See the License for the specific language governing permissions and
ansond 1:cabdd0350707 20 * limitations under the License.
ansond 1:cabdd0350707 21 */
sam_grove 2:853f9ecc12df 22
ansond 1:cabdd0350707 23 // mbed Endpoint includes
ansond 1:cabdd0350707 24 #include "Endpoint.h"
ansond 1:cabdd0350707 25 #include "OptionsBuilder.h"
ansond 1:cabdd0350707 26
ansond 1:cabdd0350707 27 // External references (defined in main.cpp)
ansond 1:cabdd0350707 28 Connector::Options *configure_endpoint(Connector::OptionsBuilder &builder);
ansond 1:cabdd0350707 29 extern Logger logger;
ansond 1:cabdd0350707 30
ansond 1:cabdd0350707 31 // further simplifies the endpoint main() configuration by removing the final initialization details of the endpoint...
sam_grove 2:853f9ecc12df 32 void configure_endpoint()
sam_grove 2:853f9ecc12df 33 {
ansond 1:cabdd0350707 34 Connector::OptionsBuilder builder;
ansond 1:cabdd0350707 35 Connector::Options *options = configure_endpoint(builder);
sam_grove 2:853f9ecc12df 36
sam_grove 2:853f9ecc12df 37 // alloc Endpoint resource
ansond 1:cabdd0350707 38 logger.log("configure_endpoint: allocating endpoint...\r\n");
ansond 1:cabdd0350707 39 Connector::Endpoint endpoint(&logger,options);
sam_grove 2:853f9ecc12df 40
ansond 1:cabdd0350707 41 // initialize Endpoint resource
ansond 1:cabdd0350707 42 logger.log("configure_endpoint: initializing endpoint...\r\n");
sam_grove 2:853f9ecc12df 43 endpoint.initialize();
sam_grove 2:853f9ecc12df 44
ansond 1:cabdd0350707 45 // DONE
ansond 1:cabdd0350707 46 logger.log("configure_endpoint: completed\r\n");
sam_grove 2:853f9ecc12df 47 }