mbed Connector Interface simplification API on top of mbed-client
Fork of mbedConnectorInterfaceV3 by
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!
source/Options.cpp@0:1f1f55e73248, 2016-02-19 (annotated)
- Committer:
- ansond
- Date:
- Fri Feb 19 17:32:14 2016 +0000
- Revision:
- 0:1f1f55e73248
- Child:
- 8:f950fb1b78c0
initial checkin
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 0:1f1f55e73248 | 1 | /** |
ansond | 0:1f1f55e73248 | 2 | * @file Options.cpp |
ansond | 0:1f1f55e73248 | 3 | * @brief mbed CoAP Options (immutable OptionsBuilder instance) class implementation |
ansond | 0:1f1f55e73248 | 4 | * @author Doug Anson/Chris Paola |
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 | #include "mbed-connector-interface/Options.h" |
ansond | 0:1f1f55e73248 | 24 | |
ansond | 0:1f1f55e73248 | 25 | namespace Connector { |
ansond | 0:1f1f55e73248 | 26 | |
ansond | 0:1f1f55e73248 | 27 | // default constructor |
ansond | 0:1f1f55e73248 | 28 | Options::Options() |
ansond | 0:1f1f55e73248 | 29 | { |
ansond | 0:1f1f55e73248 | 30 | } |
ansond | 0:1f1f55e73248 | 31 | |
ansond | 0:1f1f55e73248 | 32 | // copy constructor |
ansond | 0:1f1f55e73248 | 33 | Options::Options(const Options &opt) |
ansond | 0:1f1f55e73248 | 34 | { |
ansond | 0:1f1f55e73248 | 35 | } |
ansond | 0:1f1f55e73248 | 36 | |
ansond | 0:1f1f55e73248 | 37 | // destructors |
ansond | 0:1f1f55e73248 | 38 | Options::~Options() |
ansond | 0:1f1f55e73248 | 39 | { |
ansond | 0:1f1f55e73248 | 40 | } |
ansond | 0:1f1f55e73248 | 41 | |
ansond | 0:1f1f55e73248 | 42 | // lifetime pointer |
ansond | 0:1f1f55e73248 | 43 | int Options::getLifetime() |
ansond | 0:1f1f55e73248 | 44 | { |
ansond | 0:1f1f55e73248 | 45 | return this->m_lifetime; |
ansond | 0:1f1f55e73248 | 46 | } |
ansond | 0:1f1f55e73248 | 47 | |
ansond | 0:1f1f55e73248 | 48 | // NSP domain |
ansond | 0:1f1f55e73248 | 49 | string Options::getDomain() |
ansond | 0:1f1f55e73248 | 50 | { |
ansond | 0:1f1f55e73248 | 51 | return this->m_domain; |
ansond | 0:1f1f55e73248 | 52 | } |
ansond | 0:1f1f55e73248 | 53 | |
ansond | 0:1f1f55e73248 | 54 | // Endpoint name |
ansond | 0:1f1f55e73248 | 55 | string Options::getEndpointNodename() |
ansond | 0:1f1f55e73248 | 56 | { |
ansond | 0:1f1f55e73248 | 57 | return this->m_node_name; |
ansond | 0:1f1f55e73248 | 58 | } |
ansond | 0:1f1f55e73248 | 59 | |
ansond | 0:1f1f55e73248 | 60 | // Endpoint Type |
ansond | 0:1f1f55e73248 | 61 | string Options::getEndpointType() |
ansond | 0:1f1f55e73248 | 62 | { |
ansond | 0:1f1f55e73248 | 63 | return this->m_endpoint_type; |
ansond | 0:1f1f55e73248 | 64 | } |
ansond | 0:1f1f55e73248 | 65 | |
ansond | 0:1f1f55e73248 | 66 | // NODE Radio Channel List |
ansond | 0:1f1f55e73248 | 67 | uint32_t Options::getRadioChannelList() |
ansond | 0:1f1f55e73248 | 68 | { |
ansond | 0:1f1f55e73248 | 69 | return this->m_channel_list; |
ansond | 0:1f1f55e73248 | 70 | } |
ansond | 0:1f1f55e73248 | 71 | |
ansond | 0:1f1f55e73248 | 72 | // mbed Registation update period |
ansond | 0:1f1f55e73248 | 73 | int Options::getRegUpdatePeriod() |
ansond | 0:1f1f55e73248 | 74 | { |
ansond | 0:1f1f55e73248 | 75 | return this->m_reg_update_period; |
ansond | 0:1f1f55e73248 | 76 | } |
ansond | 0:1f1f55e73248 | 77 | |
ansond | 0:1f1f55e73248 | 78 | // Connector URL |
ansond | 0:1f1f55e73248 | 79 | char *Options::getConnectorURL() |
ansond | 0:1f1f55e73248 | 80 | { |
ansond | 0:1f1f55e73248 | 81 | return (char *)this->m_connector_url.c_str(); |
ansond | 0:1f1f55e73248 | 82 | } |
ansond | 0:1f1f55e73248 | 83 | |
ansond | 0:1f1f55e73248 | 84 | // NODE MAC Address |
ansond | 0:1f1f55e73248 | 85 | uint8_t *Options::getMACAddress() |
ansond | 0:1f1f55e73248 | 86 | { |
ansond | 0:1f1f55e73248 | 87 | return this->m_mac_address; |
ansond | 0:1f1f55e73248 | 88 | } |
ansond | 0:1f1f55e73248 | 89 | |
ansond | 0:1f1f55e73248 | 90 | // Device Resources |
ansond | 0:1f1f55e73248 | 91 | DeviceResourcesList *Options::getDeviceResourceList() |
ansond | 0:1f1f55e73248 | 92 | { |
ansond | 0:1f1f55e73248 | 93 | return &this->m_device_resources; |
ansond | 0:1f1f55e73248 | 94 | } |
ansond | 0:1f1f55e73248 | 95 | |
ansond | 0:1f1f55e73248 | 96 | // Static Resources |
ansond | 0:1f1f55e73248 | 97 | StaticResourcesList *Options::getStaticResourceList() |
ansond | 0:1f1f55e73248 | 98 | { |
ansond | 0:1f1f55e73248 | 99 | return &this->m_static_resources; |
ansond | 0:1f1f55e73248 | 100 | } |
ansond | 0:1f1f55e73248 | 101 | |
ansond | 0:1f1f55e73248 | 102 | // Dynamic Resources |
ansond | 0:1f1f55e73248 | 103 | DynamicResourcesList *Options::getDynamicResourceList() |
ansond | 0:1f1f55e73248 | 104 | { |
ansond | 0:1f1f55e73248 | 105 | return &this->m_dynamic_resources; |
ansond | 0:1f1f55e73248 | 106 | } |
ansond | 0:1f1f55e73248 | 107 | |
ansond | 0:1f1f55e73248 | 108 | // WiFi SSID |
ansond | 0:1f1f55e73248 | 109 | string Options::getWiFiSSID() { |
ansond | 0:1f1f55e73248 | 110 | return this->m_wifi_ssid; |
ansond | 0:1f1f55e73248 | 111 | } |
ansond | 0:1f1f55e73248 | 112 | |
ansond | 0:1f1f55e73248 | 113 | // WiFi AuthType |
ansond | 0:1f1f55e73248 | 114 | WiFiAuthTypes Options::getWiFiAuthType() { |
ansond | 0:1f1f55e73248 | 115 | return this->m_wifi_auth_type; |
ansond | 0:1f1f55e73248 | 116 | } |
ansond | 0:1f1f55e73248 | 117 | |
ansond | 0:1f1f55e73248 | 118 | // WiFi AuthKey |
ansond | 0:1f1f55e73248 | 119 | string Options::getWiFiAuthKey() { |
ansond | 0:1f1f55e73248 | 120 | return this->m_wifi_auth_key; |
ansond | 0:1f1f55e73248 | 121 | } |
ansond | 0:1f1f55e73248 | 122 | |
ansond | 0:1f1f55e73248 | 123 | // 802.15.4 Network ID |
ansond | 0:1f1f55e73248 | 124 | string Options::getNetworkID() { |
ansond | 0:1f1f55e73248 | 125 | return this->m_network_id; |
ansond | 0:1f1f55e73248 | 126 | } |
ansond | 0:1f1f55e73248 | 127 | |
ansond | 0:1f1f55e73248 | 128 | // 802.15.4 Network ID |
ansond | 0:1f1f55e73248 | 129 | uint8_t Options::getRadioChannel() { |
ansond | 0:1f1f55e73248 | 130 | return this->m_channel; |
ansond | 0:1f1f55e73248 | 131 | } |
ansond | 0:1f1f55e73248 | 132 | |
ansond | 0:1f1f55e73248 | 133 | // Immediate Observationing Enabled |
ansond | 0:1f1f55e73248 | 134 | bool Options::immedateObservationEnabled() { |
ansond | 0:1f1f55e73248 | 135 | return this->m_enable_immediate_observation; |
ansond | 0:1f1f55e73248 | 136 | } |
ansond | 0:1f1f55e73248 | 137 | |
ansond | 0:1f1f55e73248 | 138 | // Enable/Disable Observation control via GET |
ansond | 0:1f1f55e73248 | 139 | bool Options::enableGETObservationControl() { |
ansond | 0:1f1f55e73248 | 140 | return this->m_enable_get_obs_control; |
ansond | 0:1f1f55e73248 | 141 | } |
ansond | 0:1f1f55e73248 | 142 | |
ansond | 0:1f1f55e73248 | 143 | // Get the Server Certificate |
ansond | 0:1f1f55e73248 | 144 | uint8_t *Options::getServerCertificate() { |
ansond | 0:1f1f55e73248 | 145 | return (uint8_t *) this->m_server_cert; |
ansond | 0:1f1f55e73248 | 146 | } |
ansond | 0:1f1f55e73248 | 147 | |
ansond | 0:1f1f55e73248 | 148 | // Get the Server Certificate length |
ansond | 0:1f1f55e73248 | 149 | int Options::getServerCertificateSize() { |
ansond | 0:1f1f55e73248 | 150 | return this->m_server_cert_length; |
ansond | 0:1f1f55e73248 | 151 | } |
ansond | 0:1f1f55e73248 | 152 | |
ansond | 0:1f1f55e73248 | 153 | // Get the Client Certificate |
ansond | 0:1f1f55e73248 | 154 | uint8_t *Options::getClientCertificate() { |
ansond | 0:1f1f55e73248 | 155 | return (uint8_t *) this->m_client_cert; |
ansond | 0:1f1f55e73248 | 156 | } |
ansond | 0:1f1f55e73248 | 157 | |
ansond | 0:1f1f55e73248 | 158 | // Get the Client Certificate length |
ansond | 0:1f1f55e73248 | 159 | int Options::getClientCertificateSize() { |
ansond | 0:1f1f55e73248 | 160 | return this->m_client_cert_length; |
ansond | 0:1f1f55e73248 | 161 | } |
ansond | 0:1f1f55e73248 | 162 | |
ansond | 0:1f1f55e73248 | 163 | // Get the Client Key |
ansond | 0:1f1f55e73248 | 164 | uint8_t *Options::getClientKey() { |
ansond | 0:1f1f55e73248 | 165 | return (uint8_t *) this->m_client_key; |
ansond | 0:1f1f55e73248 | 166 | } |
ansond | 0:1f1f55e73248 | 167 | |
ansond | 0:1f1f55e73248 | 168 | // Get the Client Key length |
ansond | 0:1f1f55e73248 | 169 | int Options::getClientKeySize() { |
ansond | 0:1f1f55e73248 | 170 | return this->m_client_key_length; |
ansond | 0:1f1f55e73248 | 171 | } |
ansond | 0:1f1f55e73248 | 172 | |
ansond | 0:1f1f55e73248 | 173 | } // namespace Connector |
ansond | 0:1f1f55e73248 | 174 |