mbedConnectorInterface back port from mbedOS v3 using mbed-client C++ call interface

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Options.cpp Source File

Options.cpp

Go to the documentation of this file.
00001 /**
00002  * @file    Options.cpp
00003  * @brief   mbed CoAP Options (immutable OptionsBuilder instance) class implementation
00004  * @author  Doug Anson/Chris Paola
00005  * @version 1.0
00006  * @see
00007  *
00008  * Copyright (c) 2014
00009  *
00010  * Licensed under the Apache License, Version 2.0 (the "License");
00011  * you may not use this file except in compliance with the License.
00012  * You may obtain a copy of the License at
00013  *
00014  *     http://www.apache.org/licenses/LICENSE-2.0
00015  *
00016  * Unless required by applicable law or agreed to in writing, software
00017  * distributed under the License is distributed on an "AS IS" BASIS,
00018  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00019  * See the License for the specific language governing permissions and
00020  * limitations under the License.
00021  */
00022 
00023 #include "mbed-connector-interface/Options.h"
00024 #include "mbed-connector-interface/Utils.h"
00025 
00026 namespace Connector {
00027 
00028 // default constructor
00029 Options::Options()
00030 {
00031 }
00032 
00033 // copy constructor
00034 Options::Options(const Options &opt)
00035 {
00036 }
00037 
00038 // destructors
00039 Options::~Options()
00040 {
00041 }
00042 
00043 // lifetime pointer
00044 int Options::getLifetime()
00045 {
00046     return this->m_lifetime;
00047 }
00048 
00049 // NSP domain
00050 string Options::getDomain()
00051 {
00052     return this->m_domain;
00053 }
00054 
00055 // Endpoint name
00056 string Options::getEndpointNodename()
00057 {
00058     return this->m_node_name;
00059 }
00060 
00061 // Endpoint Type
00062 string Options::getEndpointType()
00063 {
00064     return this->m_endpoint_type;
00065 }
00066 
00067 // mbed Registation update period
00068 int Options::getRegUpdatePeriod()
00069 {
00070     return this->m_reg_update_period;
00071 }
00072 
00073 // Connector URL
00074 char  *Options::getConnectorURL()
00075 {
00076     return (char *)this->m_connector_url.c_str();
00077 }
00078 
00079 // Connector Port
00080 uint16_t Options::getConnectorPort()
00081 {
00082     return extract_port_from_url(this->getConnectorURL(),DEF_COAP_PORT); 
00083 }
00084 
00085 // Device Resources
00086 DeviceResourcesList *Options::getDeviceResourceList()
00087 {
00088     return &this->m_device_resources;
00089 }
00090 
00091 // Static Resources
00092 StaticResourcesList *Options::getStaticResourceList()
00093 {
00094     return &this->m_static_resources;
00095 }
00096 
00097 // Dynamic Resources
00098 DynamicResourcesList *Options::getDynamicResourceList()
00099 {
00100     return &this->m_dynamic_resources;
00101 }
00102 
00103 // WiFi SSID
00104 string Options::getWiFiSSID() {
00105     return this->m_wifi_ssid;
00106 }
00107 
00108 // WiFi AuthType
00109 WiFiAuthTypes Options::getWiFiAuthType() {
00110     return this->m_wifi_auth_type;
00111 }
00112 
00113 // WiFi AuthKey
00114 string Options::getWiFiAuthKey() {
00115     return this->m_wifi_auth_key;
00116 }
00117 
00118 // 802.15.4 Pre Shared Key
00119 unsigned char  *Options::getPreSharedKey() {
00120     return this->m_psk;
00121 }
00122 
00123 // 802.15.4 Pre Shared Key Identity
00124 unsigned char *Options::getPreSharedKeyIdentity() {
00125     return this->m_psk_identity;
00126 }
00127 
00128 // 802.15.4 Mesh Type
00129 MeshTypes Options::getMeshType() {
00130     return this->m_mesh_type;
00131 }
00132 
00133 // CoAP Connection Type
00134 CoAPConnectionTypes Options::getCoAPConnectionType() {
00135     return this->m_coap_connection_type;
00136 }
00137 
00138 // IP Address Type
00139 IPAddressTypes Options::getIPAddressType() {
00140     return this->m_ip_address_type;
00141 }
00142 
00143 // Immediate Observationing Enabled
00144 bool Options::immedateObservationEnabled() {
00145     return this->m_enable_immediate_observation;
00146 }
00147 
00148 // Enable/Disable Observation control via GET
00149 bool Options::enableGETObservationControl() {
00150     return this->m_enable_get_obs_control;
00151 }
00152 
00153 // Get the Server Certificate
00154 uint8_t *Options::getServerCertificate() {
00155     return (uint8_t *) this->m_server_cert;
00156 }
00157 
00158 // Get the Server Certificate length
00159 int Options::getServerCertificateSize() {
00160     return this->m_server_cert_length;
00161 }
00162 
00163 // Get the Client Certificate
00164 uint8_t *Options::getClientCertificate() {
00165     return (uint8_t *) this->m_client_cert;
00166 }
00167 
00168 // Get the Client Certificate length
00169 int Options::getClientCertificateSize() {
00170     return this->m_client_cert_length;
00171 }
00172 
00173 // Get the Client Key
00174 uint8_t *Options::getClientKey() {
00175     return (uint8_t *) this->m_client_key;
00176 }
00177 
00178 // Get the Client Key length
00179 int Options::getClientKeySize() {
00180     return this->m_client_key_length;
00181 }
00182 
00183 // Get our Endpoint
00184 void *Options::getEndpoint() {
00185     return this->m_endpoint;
00186 }
00187 
00188 } // namespace Connector