custom for >5 resources
Fork of mbedConnectorInterface by
api/Options.cpp@57:ef0fdadde9eb, 2015-05-20 (annotated)
- Committer:
- michaeljkoster
- Date:
- Wed May 20 00:46:01 2015 +0000
- Revision:
- 57:ef0fdadde9eb
- Parent:
- 48:4b9ee3e32f93
10 resources
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 0:b438482ebbfc | 1 | /** |
ansond | 0:b438482ebbfc | 2 | * @file Options.cpp |
ansond | 0:b438482ebbfc | 3 | * @brief mbed CoAP Options (immutable OptionsBuilder instance) class implementation |
ansond | 0:b438482ebbfc | 4 | * @author Doug Anson/Chris Paola |
ansond | 0:b438482ebbfc | 5 | * @version 1.0 |
sam_grove | 2:853f9ecc12df | 6 | * @see |
ansond | 0:b438482ebbfc | 7 | * |
ansond | 0:b438482ebbfc | 8 | * Copyright (c) 2014 |
ansond | 0:b438482ebbfc | 9 | * |
ansond | 0:b438482ebbfc | 10 | * Licensed under the Apache License, Version 2.0 (the "License"); |
ansond | 0:b438482ebbfc | 11 | * you may not use this file except in compliance with the License. |
ansond | 0:b438482ebbfc | 12 | * You may obtain a copy of the License at |
ansond | 0:b438482ebbfc | 13 | * |
ansond | 0:b438482ebbfc | 14 | * http://www.apache.org/licenses/LICENSE-2.0 |
ansond | 0:b438482ebbfc | 15 | * |
ansond | 0:b438482ebbfc | 16 | * Unless required by applicable law or agreed to in writing, software |
ansond | 0:b438482ebbfc | 17 | * distributed under the License is distributed on an "AS IS" BASIS, |
ansond | 0:b438482ebbfc | 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ansond | 0:b438482ebbfc | 19 | * See the License for the specific language governing permissions and |
ansond | 0:b438482ebbfc | 20 | * limitations under the License. |
ansond | 0:b438482ebbfc | 21 | */ |
sam_grove | 2:853f9ecc12df | 22 | |
sam_grove | 2:853f9ecc12df | 23 | #include "Options.h" |
sam_grove | 2:853f9ecc12df | 24 | |
sam_grove | 2:853f9ecc12df | 25 | namespace Connector { |
sam_grove | 2:853f9ecc12df | 26 | |
sam_grove | 2:853f9ecc12df | 27 | // default constructor |
sam_grove | 2:853f9ecc12df | 28 | Options::Options() |
sam_grove | 2:853f9ecc12df | 29 | { |
sam_grove | 2:853f9ecc12df | 30 | } |
sam_grove | 2:853f9ecc12df | 31 | |
sam_grove | 2:853f9ecc12df | 32 | // copy constructor |
sam_grove | 2:853f9ecc12df | 33 | Options::Options(const Options &opt) |
sam_grove | 2:853f9ecc12df | 34 | { |
sam_grove | 2:853f9ecc12df | 35 | } |
sam_grove | 2:853f9ecc12df | 36 | |
sam_grove | 2:853f9ecc12df | 37 | // destructors |
sam_grove | 2:853f9ecc12df | 38 | Options::~Options() |
sam_grove | 2:853f9ecc12df | 39 | { |
sam_grove | 2:853f9ecc12df | 40 | } |
sam_grove | 2:853f9ecc12df | 41 | |
sam_grove | 2:853f9ecc12df | 42 | // lifetime pointer |
sam_grove | 2:853f9ecc12df | 43 | char *Options::getLifetime() |
sam_grove | 2:853f9ecc12df | 44 | { |
sam_grove | 2:853f9ecc12df | 45 | return this->m_lifetime; |
sam_grove | 2:853f9ecc12df | 46 | } |
sam_grove | 2:853f9ecc12df | 47 | |
sam_grove | 2:853f9ecc12df | 48 | // NSP domain |
sam_grove | 2:853f9ecc12df | 49 | string Options::getDomain() |
sam_grove | 2:853f9ecc12df | 50 | { |
sam_grove | 2:853f9ecc12df | 51 | return this->m_domain; |
sam_grove | 2:853f9ecc12df | 52 | } |
sam_grove | 2:853f9ecc12df | 53 | |
sam_grove | 2:853f9ecc12df | 54 | // Endpoint name |
sam_grove | 2:853f9ecc12df | 55 | string Options::getEndpointNodename() |
sam_grove | 2:853f9ecc12df | 56 | { |
sam_grove | 2:853f9ecc12df | 57 | return this->m_node_name; |
sam_grove | 2:853f9ecc12df | 58 | } |
sam_grove | 2:853f9ecc12df | 59 | |
sam_grove | 2:853f9ecc12df | 60 | // Endpoint Type |
sam_grove | 2:853f9ecc12df | 61 | string Options::getEndpointType() |
sam_grove | 2:853f9ecc12df | 62 | { |
sam_grove | 2:853f9ecc12df | 63 | return this->m_endpoint_type; |
sam_grove | 2:853f9ecc12df | 64 | } |
sam_grove | 2:853f9ecc12df | 65 | |
sam_grove | 2:853f9ecc12df | 66 | // NSP Port number |
sam_grove | 2:853f9ecc12df | 67 | int Options::getNSPPortNumber() |
sam_grove | 2:853f9ecc12df | 68 | { |
sam_grove | 2:853f9ecc12df | 69 | return this->m_nsp_port; |
sam_grove | 2:853f9ecc12df | 70 | } |
sam_grove | 2:853f9ecc12df | 71 | |
sam_grove | 2:853f9ecc12df | 72 | // NODE Radio Channel List |
ansond | 4:84159d67d32d | 73 | uint32_t Options::getRadioChannelList() |
sam_grove | 2:853f9ecc12df | 74 | { |
sam_grove | 2:853f9ecc12df | 75 | return this->m_channel_list; |
sam_grove | 2:853f9ecc12df | 76 | } |
sam_grove | 2:853f9ecc12df | 77 | |
sam_grove | 2:853f9ecc12df | 78 | // NSP Read update period |
sam_grove | 2:853f9ecc12df | 79 | int Options::getReadUpdatePeriod() |
sam_grove | 2:853f9ecc12df | 80 | { |
sam_grove | 2:853f9ecc12df | 81 | return this->m_rd_update_period; |
sam_grove | 2:853f9ecc12df | 82 | } |
sam_grove | 2:853f9ecc12df | 83 | |
sam_grove | 2:853f9ecc12df | 84 | // NSP Address |
sam_grove | 2:853f9ecc12df | 85 | uint8_t *Options::getNSPAddress() |
sam_grove | 2:853f9ecc12df | 86 | { |
sam_grove | 2:853f9ecc12df | 87 | return this->m_nsp_address; |
sam_grove | 2:853f9ecc12df | 88 | } |
sam_grove | 2:853f9ecc12df | 89 | |
sam_grove | 2:853f9ecc12df | 90 | // NODE MAC Address |
ansond | 4:84159d67d32d | 91 | uint8_t *Options::getMACAddress() |
sam_grove | 2:853f9ecc12df | 92 | { |
sam_grove | 2:853f9ecc12df | 93 | return this->m_mac_address; |
sam_grove | 2:853f9ecc12df | 94 | } |
sam_grove | 2:853f9ecc12df | 95 | |
sam_grove | 2:853f9ecc12df | 96 | // Static Resources |
sam_grove | 2:853f9ecc12df | 97 | StaticResourcesList *Options::getStaticResourceList() |
sam_grove | 2:853f9ecc12df | 98 | { |
sam_grove | 2:853f9ecc12df | 99 | return &this->m_static_resources; |
sam_grove | 2:853f9ecc12df | 100 | } |
sam_grove | 2:853f9ecc12df | 101 | |
sam_grove | 2:853f9ecc12df | 102 | // Dynamic Resources |
sam_grove | 2:853f9ecc12df | 103 | DynamicResourcesList *Options::getDynamicResourceList() |
sam_grove | 2:853f9ecc12df | 104 | { |
sam_grove | 2:853f9ecc12df | 105 | return &this->m_dynamic_resources; |
sam_grove | 2:853f9ecc12df | 106 | } |
sam_grove | 2:853f9ecc12df | 107 | |
ansond | 15:8ada80242804 | 108 | // WiFi SSID |
ansond | 15:8ada80242804 | 109 | string Options::getWiFiSSID() { |
ansond | 15:8ada80242804 | 110 | return this->m_wifi_ssid; |
ansond | 15:8ada80242804 | 111 | } |
ansond | 15:8ada80242804 | 112 | |
ansond | 15:8ada80242804 | 113 | // WiFi AuthType |
ansond | 15:8ada80242804 | 114 | WiFiAuthTypes Options::getWiFiAuthType() { |
ansond | 15:8ada80242804 | 115 | return this->m_wifi_auth_type; |
ansond | 15:8ada80242804 | 116 | } |
ansond | 15:8ada80242804 | 117 | |
ansond | 15:8ada80242804 | 118 | // WiFi AuthKey |
ansond | 15:8ada80242804 | 119 | string Options::getWiFiAuthKey() { |
ansond | 15:8ada80242804 | 120 | return this->m_wifi_auth_key; |
ansond | 15:8ada80242804 | 121 | } |
ansond | 15:8ada80242804 | 122 | |
ansond | 19:e2cbaeeea509 | 123 | // 802.15.4 Network ID |
ansond | 19:e2cbaeeea509 | 124 | string Options::getNetworkID() { |
ansond | 19:e2cbaeeea509 | 125 | return this->m_network_id; |
ansond | 19:e2cbaeeea509 | 126 | } |
ansond | 19:e2cbaeeea509 | 127 | |
ansond | 19:e2cbaeeea509 | 128 | // 802.15.4 Network ID |
ansond | 19:e2cbaeeea509 | 129 | uint8_t Options::getRadioChannel() { |
ansond | 19:e2cbaeeea509 | 130 | return this->m_channel; |
ansond | 19:e2cbaeeea509 | 131 | } |
ansond | 19:e2cbaeeea509 | 132 | |
ansond | 48:4b9ee3e32f93 | 133 | // Immediate Observationing Enabled |
ansond | 48:4b9ee3e32f93 | 134 | bool Options::immedateObservationEnabled() { |
ansond | 48:4b9ee3e32f93 | 135 | return this->m_enable_immediate_observation; |
ansond | 48:4b9ee3e32f93 | 136 | } |
ansond | 48:4b9ee3e32f93 | 137 | |
ansond | 48:4b9ee3e32f93 | 138 | // Enable/Disable Observation control via GET |
ansond | 48:4b9ee3e32f93 | 139 | bool Options::enableGETObservationControl() { |
ansond | 48:4b9ee3e32f93 | 140 | return this->m_enable_get_obs_control; |
ansond | 48:4b9ee3e32f93 | 141 | } |
ansond | 48:4b9ee3e32f93 | 142 | |
sam_grove | 2:853f9ecc12df | 143 | } // namespace Connector |