custom for >5 resources

Fork of mbedConnectorInterface by Doug Anson

Revision:
1:cabdd0350707
Child:
2:853f9ecc12df
diff -r b438482ebbfc -r cabdd0350707 api/Utils.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/api/Utils.cpp	Tue Jan 27 22:52:25 2015 +0000
@@ -0,0 +1,46 @@
+/**
+ * @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");
+}
\ No newline at end of file