mbed Connector Interface simplification API on top of mbed-client

Fork of mbedConnectorInterfaceV3 by Doug Anson

NOTE:

This repo has been replaced with https://github.com/ARMmbed/mbedConnectorInterface. No further updates will occur with this repo. Please use the github repo instead. Thanks!

Committer:
ansond
Date:
Thu Jul 13 19:21:28 2017 +0000
Revision:
125:4bf229bf14a3
Parent:
121:dfe65a93f26b
Child:
126:f37e34daa100
rebased R1.2B to include EventQueue additions

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 0:1f1f55e73248 1 /**
ansond 0:1f1f55e73248 2 * @file mbedConnectorInterface.h
ansond 0:1f1f55e73248 3 * @brief mbed Connector Inteface configuration header file
ansond 0:1f1f55e73248 4 * @author Doug Anson
ansond 0:1f1f55e73248 5 * @version 1.0
ansond 0:1f1f55e73248 6 * @see
ansond 0:1f1f55e73248 7 *
ansond 0:1f1f55e73248 8 * Copyright (c) 2014
ansond 0:1f1f55e73248 9 *
ansond 0:1f1f55e73248 10 * Licensed under the Apache License, Version 2.0 (the "License");
ansond 0:1f1f55e73248 11 * you may not use this file except in compliance with the License.
ansond 0:1f1f55e73248 12 * You may obtain a copy of the License at
ansond 0:1f1f55e73248 13 *
ansond 0:1f1f55e73248 14 * http://www.apache.org/licenses/LICENSE-2.0
ansond 0:1f1f55e73248 15 *
ansond 0:1f1f55e73248 16 * Unless required by applicable law or agreed to in writing, software
ansond 0:1f1f55e73248 17 * distributed under the License is distributed on an "AS IS" BASIS,
ansond 0:1f1f55e73248 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ansond 0:1f1f55e73248 19 * See the License for the specific language governing permissions and
ansond 0:1f1f55e73248 20 * limitations under the License.
ansond 0:1f1f55e73248 21 */
ansond 0:1f1f55e73248 22
ansond 0:1f1f55e73248 23 #ifndef __MBED_CONNECTOR_INTERFACE_H__
ansond 0:1f1f55e73248 24 #define __MBED_CONNECTOR_INTERFACE_H__
ansond 0:1f1f55e73248 25
ansond 54:dfee8691c83a 26 // mbed
ansond 54:dfee8691c83a 27 #include "mbed.h"
ansond 54:dfee8691c83a 28 #include "rtos.h"
ansond 0:1f1f55e73248 29
ansond 71:5069a202e892 30 // Enable/Disable mbed Cloud support
ansond 71:5069a202e892 31 #include "security.h"
ansond 71:5069a202e892 32
ansond 0:1f1f55e73248 33 /************** DEFAULT CONFIGURATION PARAMETERS ************************/
ansond 0:1f1f55e73248 34
ansond 94:25ce0592620f 35 // Network Selection Definitions (must match easy-connect.h)
ansond 71:5069a202e892 36 #define ETHERNET 1
ansond 94:25ce0592620f 37 #define WIFI_ESP8266 2
ansond 71:5069a202e892 38 #define MESH_LOWPAN_ND 3
ansond 71:5069a202e892 39 #define MESH_THREAD 4
ansond 94:25ce0592620f 40 #define WIFI_ODIN 5
ansond 54:dfee8691c83a 41
ansond 125:4bf229bf14a3 42 // ResourceObserver type selection based on version of mbedOS we are using
ansond 125:4bf229bf14a3 43 #if defined (MBED_CONF_RTOS_PRESENT)
ansond 125:4bf229bf14a3 44 // mbedOS5+ we will use EventQueueResourceObserver
ansond 125:4bf229bf14a3 45 #define CONNECTOR_USING_EVENT_QUEUES 1
ansond 125:4bf229bf14a3 46 #else
ansond 125:4bf229bf14a3 47 // mbedOS2 we will use ThreadedResourceObserver
ansond 125:4bf229bf14a3 48 #define CONNECTOR_USING_THREADS 1
ansond 125:4bf229bf14a3 49 #endif
ansond 125:4bf229bf14a3 50
ansond 125:4bf229bf14a3 51 // mbedOS5 uses LWIP
ansond 125:4bf229bf14a3 52 #define MCI_LWIP_INTERFACE true
ansond 125:4bf229bf14a3 53
ansond 125:4bf229bf14a3 54 // mbed-client utilizes execute parameters
ansond 125:4bf229bf14a3 55 #define HAS_EXECUTE_PARAMS true
ansond 0:1f1f55e73248 56
ansond 71:5069a202e892 57 // Default node name
ansond 71:5069a202e892 58 #define NODE_NAME_LENGTH 128
ansond 71:5069a202e892 59 #define NODE_NAME "mbed-endpoint"
ansond 54:dfee8691c83a 60
ansond 105:aeaaee8fbb1d 61 // Connection URL to mbed Connector (not used for R1.2+ mbed Cloud)
ansond 71:5069a202e892 62 #if MBED_CONF_APP_NETWORK_INTERFACE == MESH_LOWPAN_ND || MBED_CONF_APP_NETWORK_INTERFACE == MESH_THREAD
ansond 71:5069a202e892 63 // IPv6 URL Configuration
ansond 59:dd395412bd19 64 #define CONNECTOR_URL "coaps://[2607:f0d0:2601:52::20]:5684"
ansond 59:dd395412bd19 65
ansond 59:dd395412bd19 66 // OVERRIDE (until patched in mbed-client)
ansond 59:dd395412bd19 67 #define IPV4_OVERRIDE true
ansond 71:5069a202e892 68 #else
ansond 54:dfee8691c83a 69 // IPv4 URL Configuration
ansond 54:dfee8691c83a 70 #define CONNECTOR_URL "coap://api.connector.mbed.com:5684"
ansond 71:5069a202e892 71 #endif
ansond 54:dfee8691c83a 72
ansond 71:5069a202e892 73 // Default Endpoint Type specification
ansond 71:5069a202e892 74 #define ENDPOINT_TYPE_LENGTH 128
ansond 71:5069a202e892 75 #define DEFAULT_ENDPOINT_TYPE "mbed-device"
ansond 54:dfee8691c83a 76
ansond 71:5069a202e892 77 // Default Domain used
ansond 71:5069a202e892 78 #define DOMAIN_LENGTH 128
ansond 71:5069a202e892 79 #define DEFAULT_DOMAIN "domain"
ansond 54:dfee8691c83a 80
ansond 71:5069a202e892 81 // Main loop iteration wait time (ms)
ansond 71:5069a202e892 82 #define MAIN_LOOP_WAIT_TIME_MS 1000
ansond 54:dfee8691c83a 83
ansond 71:5069a202e892 84 // mbed-client endpoint lifetime
ansond 54:dfee8691c83a 85 #define REG_LIFETIME_SEC 100 // Lifetime of the endpoint in seconds
ansond 54:dfee8691c83a 86
ansond 54:dfee8691c83a 87 // default observation period (ms)
ansond 54:dfee8691c83a 88 #define DEFAULT_OBS_PERIOD 0 // 0 - disabled (manual invocation), otherwise "n" in ms...
ansond 0:1f1f55e73248 89
ansond 33:1d0b855df5a5 90 // Maximum CoAP URL length
ansond 49:c603a22495bb 91 #define MAX_CONN_URL_LENGTH 128 // Maximum Connection URL length
ansond 0:1f1f55e73248 92
ansond 0:1f1f55e73248 93 // DynamicResource Configuration
ansond 91:179b5cb420de 94 #define MAX_VALUE_BUFFER_LENGTH 1024 // largest "value" a dynamic resource may assume as a string (max CoAP packet length)
ansond 0:1f1f55e73248 95
ansond 0:1f1f55e73248 96 // Logger buffer size
ansond 54:dfee8691c83a 97 #define LOGGER_BUFFER_LENGTH 128 // largest single print of a given debug line
ansond 0:1f1f55e73248 98
ansond 0:1f1f55e73248 99 // WiFi Configuration
ansond 49:c603a22495bb 100 #define WIFI_SSID_LENGTH 64
ansond 0:1f1f55e73248 101 #define WIFI_DEFAULT_SSID "changeme"
ansond 49:c603a22495bb 102 #define WIFI_AUTH_KEY_LENGTH 64
ansond 0:1f1f55e73248 103 #define WIFI_DEFAULT_AUTH_KEY "changeme"
ansond 60:0d9e607dd678 104
ansond 60:0d9e607dd678 105 // Default context address string for mbed-client
ansond 60:0d9e607dd678 106 #define CONTEXT_ADDRESS_STRING ""
ansond 121:dfe65a93f26b 107
ansond 121:dfe65a93f26b 108 // Uncomment (and implement) for Update authorization and progress handlers
ansond 121:dfe65a93f26b 109 //#define ENABLE_UPDATE_AUTHORIZE_HANDLER true // MUST go into ConnectorEndpoint.cpp and implement... otherwise, update request will not get serviced.
ansond 121:dfe65a93f26b 110 //#define ENALBE_UPDATE_PROGRESS_HANDLER true
ansond 54:dfee8691c83a 111
ansond 0:1f1f55e73248 112 /************** DEFAULT CONFIGURATION PARAMETERS ************************/
ansond 0:1f1f55e73248 113
ansond 0:1f1f55e73248 114 #endif // __MBED_CONNECTOR_INTERFACE___
ansond 0:1f1f55e73248 115