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

api/Utils.cpp

Committer:
sam_grove
Date:
2015-01-27
Revision:
2:853f9ecc12df
Parent:
1:cabdd0350707
Child:
3:11b2f4e58378

File content as of revision 2:853f9ecc12df:

/**
 * @file    Utils.cpp
 * @brief   mbed CoAP Endpoint misc utils collection
 * @author  Doug Anson
 * @version 1.0
 * @see
 *
 * Copyright (c) 2014
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// mbed Endpoint includes
#include "Endpoint.h"
#include "OptionsBuilder.h"

// External references (defined in main.cpp)
Connector::Options *configure_endpoint(Connector::OptionsBuilder &builder);
extern Logger logger;

// further simplifies the endpoint main() configuration by removing the final initialization details of the endpoint...
void configure_endpoint()
{
    Connector::OptionsBuilder builder;
    Connector::Options *options = configure_endpoint(builder);

    // alloc Endpoint resource
    logger.log("configure_endpoint: allocating endpoint...\r\n");
    Connector::Endpoint endpoint(&logger,options);

    // initialize Endpoint resource
    logger.log("configure_endpoint: initializing endpoint...\r\n");
    endpoint.initialize();

    // DONE
    logger.log("configure_endpoint: completed\r\n");
}