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:
ansond
Date:
Tue Jan 27 22:52:25 2015 +0000
Revision:
1:cabdd0350707
Child:
2:853f9ecc12df
updates

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
ansond 1:cabdd0350707 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 */
ansond 1:cabdd0350707 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...
ansond 1:cabdd0350707 32 void configure_endpoint() {
ansond 1:cabdd0350707 33 Connector::OptionsBuilder builder;
ansond 1:cabdd0350707 34 Connector::Options *options = configure_endpoint(builder);
ansond 1:cabdd0350707 35
ansond 1:cabdd0350707 36 // alloc Endpoint resource
ansond 1:cabdd0350707 37 logger.log("configure_endpoint: allocating endpoint...\r\n");
ansond 1:cabdd0350707 38 Connector::Endpoint endpoint(&logger,options);
ansond 1:cabdd0350707 39
ansond 1:cabdd0350707 40 // initialize Endpoint resource
ansond 1:cabdd0350707 41 logger.log("configure_endpoint: initializing endpoint...\r\n");
ansond 1:cabdd0350707 42 endpoint.initialize();
ansond 1:cabdd0350707 43
ansond 1:cabdd0350707 44 // DONE
ansond 1:cabdd0350707 45 logger.log("configure_endpoint: completed\r\n");
ansond 1:cabdd0350707 46 }