This is the sample program that can see the decode result of barcode data on Watson IoT.
Dependencies: AsciiFont DisplayApp GR-PEACH_video LCD_shield_config LWIPBP3595Interface_STA_for_mbed-os USBDevice
mbedConnectorInterface/source/Options.cpp@0:7d720671e6dc, 2016-11-10 (annotated)
- Committer:
- Osamu Nakamura
- Date:
- Thu Nov 10 20:04:48 2016 +0900
- Revision:
- 0:7d720671e6dc
Initial Commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Osamu Nakamura |
0:7d720671e6dc | 1 | /** |
Osamu Nakamura |
0:7d720671e6dc | 2 | * @file Options.cpp |
Osamu Nakamura |
0:7d720671e6dc | 3 | * @brief mbed CoAP Options (immutable OptionsBuilder instance) class implementation |
Osamu Nakamura |
0:7d720671e6dc | 4 | * @author Doug Anson/Chris Paola |
Osamu Nakamura |
0:7d720671e6dc | 5 | * @version 1.0 |
Osamu Nakamura |
0:7d720671e6dc | 6 | * @see |
Osamu Nakamura |
0:7d720671e6dc | 7 | * |
Osamu Nakamura |
0:7d720671e6dc | 8 | * Copyright (c) 2014 |
Osamu Nakamura |
0:7d720671e6dc | 9 | * |
Osamu Nakamura |
0:7d720671e6dc | 10 | * Licensed under the Apache License, Version 2.0 (the "License"); |
Osamu Nakamura |
0:7d720671e6dc | 11 | * you may not use this file except in compliance with the License. |
Osamu Nakamura |
0:7d720671e6dc | 12 | * You may obtain a copy of the License at |
Osamu Nakamura |
0:7d720671e6dc | 13 | * |
Osamu Nakamura |
0:7d720671e6dc | 14 | * http://www.apache.org/licenses/LICENSE-2.0 |
Osamu Nakamura |
0:7d720671e6dc | 15 | * |
Osamu Nakamura |
0:7d720671e6dc | 16 | * Unless required by applicable law or agreed to in writing, software |
Osamu Nakamura |
0:7d720671e6dc | 17 | * distributed under the License is distributed on an "AS IS" BASIS, |
Osamu Nakamura |
0:7d720671e6dc | 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Osamu Nakamura |
0:7d720671e6dc | 19 | * See the License for the specific language governing permissions and |
Osamu Nakamura |
0:7d720671e6dc | 20 | * limitations under the License. |
Osamu Nakamura |
0:7d720671e6dc | 21 | */ |
Osamu Nakamura |
0:7d720671e6dc | 22 | |
Osamu Nakamura |
0:7d720671e6dc | 23 | // Class support |
Osamu Nakamura |
0:7d720671e6dc | 24 | #include "mbed-connector-interface/Options.h" |
Osamu Nakamura |
0:7d720671e6dc | 25 | |
Osamu Nakamura |
0:7d720671e6dc | 26 | // Utils |
Osamu Nakamura |
0:7d720671e6dc | 27 | #include "mbed-connector-interface/Utils.h" |
Osamu Nakamura |
0:7d720671e6dc | 28 | |
Osamu Nakamura |
0:7d720671e6dc | 29 | namespace Connector { |
Osamu Nakamura |
0:7d720671e6dc | 30 | |
Osamu Nakamura |
0:7d720671e6dc | 31 | // default constructor |
Osamu Nakamura |
0:7d720671e6dc | 32 | Options::Options() |
Osamu Nakamura |
0:7d720671e6dc | 33 | { |
Osamu Nakamura |
0:7d720671e6dc | 34 | } |
Osamu Nakamura |
0:7d720671e6dc | 35 | |
Osamu Nakamura |
0:7d720671e6dc | 36 | // copy constructor |
Osamu Nakamura |
0:7d720671e6dc | 37 | Options::Options(const Options & /* opt */) |
Osamu Nakamura |
0:7d720671e6dc | 38 | { |
Osamu Nakamura |
0:7d720671e6dc | 39 | } |
Osamu Nakamura |
0:7d720671e6dc | 40 | |
Osamu Nakamura |
0:7d720671e6dc | 41 | // destructors |
Osamu Nakamura |
0:7d720671e6dc | 42 | Options::~Options() |
Osamu Nakamura |
0:7d720671e6dc | 43 | { |
Osamu Nakamura |
0:7d720671e6dc | 44 | } |
Osamu Nakamura |
0:7d720671e6dc | 45 | |
Osamu Nakamura |
0:7d720671e6dc | 46 | // lifetime pointer |
Osamu Nakamura |
0:7d720671e6dc | 47 | int Options::getLifetime() |
Osamu Nakamura |
0:7d720671e6dc | 48 | { |
Osamu Nakamura |
0:7d720671e6dc | 49 | return this->m_lifetime; |
Osamu Nakamura |
0:7d720671e6dc | 50 | } |
Osamu Nakamura |
0:7d720671e6dc | 51 | |
Osamu Nakamura |
0:7d720671e6dc | 52 | // NSP domain |
Osamu Nakamura |
0:7d720671e6dc | 53 | string Options::getDomain() |
Osamu Nakamura |
0:7d720671e6dc | 54 | { |
Osamu Nakamura |
0:7d720671e6dc | 55 | return this->m_domain; |
Osamu Nakamura |
0:7d720671e6dc | 56 | } |
Osamu Nakamura |
0:7d720671e6dc | 57 | |
Osamu Nakamura |
0:7d720671e6dc | 58 | // Endpoint name |
Osamu Nakamura |
0:7d720671e6dc | 59 | string Options::getEndpointNodename() |
Osamu Nakamura |
0:7d720671e6dc | 60 | { |
Osamu Nakamura |
0:7d720671e6dc | 61 | return this->m_node_name; |
Osamu Nakamura |
0:7d720671e6dc | 62 | } |
Osamu Nakamura |
0:7d720671e6dc | 63 | |
Osamu Nakamura |
0:7d720671e6dc | 64 | // Endpoint Type |
Osamu Nakamura |
0:7d720671e6dc | 65 | string Options::getEndpointType() |
Osamu Nakamura |
0:7d720671e6dc | 66 | { |
Osamu Nakamura |
0:7d720671e6dc | 67 | return this->m_endpoint_type; |
Osamu Nakamura |
0:7d720671e6dc | 68 | } |
Osamu Nakamura |
0:7d720671e6dc | 69 | |
Osamu Nakamura |
0:7d720671e6dc | 70 | // Connector URL |
Osamu Nakamura |
0:7d720671e6dc | 71 | char *Options::getConnectorURL() |
Osamu Nakamura |
0:7d720671e6dc | 72 | { |
Osamu Nakamura |
0:7d720671e6dc | 73 | return (char *)this->m_connector_url.c_str(); |
Osamu Nakamura |
0:7d720671e6dc | 74 | } |
Osamu Nakamura |
0:7d720671e6dc | 75 | |
Osamu Nakamura |
0:7d720671e6dc | 76 | // Connector Port |
Osamu Nakamura |
0:7d720671e6dc | 77 | uint16_t Options::getConnectorPort() |
Osamu Nakamura |
0:7d720671e6dc | 78 | { |
Osamu Nakamura |
0:7d720671e6dc | 79 | return extract_port_from_url(this->getConnectorURL(),DEF_COAP_PORT); |
Osamu Nakamura |
0:7d720671e6dc | 80 | } |
Osamu Nakamura |
0:7d720671e6dc | 81 | |
Osamu Nakamura |
0:7d720671e6dc | 82 | // Device Resources Object |
Osamu Nakamura |
0:7d720671e6dc | 83 | void *Options::getDeviceResourcesObject() |
Osamu Nakamura |
0:7d720671e6dc | 84 | { |
Osamu Nakamura |
0:7d720671e6dc | 85 | return this->m_device_resources_object; |
Osamu Nakamura |
0:7d720671e6dc | 86 | } |
Osamu Nakamura |
0:7d720671e6dc | 87 | |
Osamu Nakamura |
0:7d720671e6dc | 88 | // Firmware Resources Object |
Osamu Nakamura |
0:7d720671e6dc | 89 | void *Options::getFirmwareResourcesObject() |
Osamu Nakamura |
0:7d720671e6dc | 90 | { |
Osamu Nakamura |
0:7d720671e6dc | 91 | return this->m_firmware_resources_object; |
Osamu Nakamura |
0:7d720671e6dc | 92 | } |
Osamu Nakamura |
0:7d720671e6dc | 93 | |
Osamu Nakamura |
0:7d720671e6dc | 94 | // Static Resources |
Osamu Nakamura |
0:7d720671e6dc | 95 | StaticResourcesList *Options::getStaticResourceList() |
Osamu Nakamura |
0:7d720671e6dc | 96 | { |
Osamu Nakamura |
0:7d720671e6dc | 97 | return &this->m_static_resources; |
Osamu Nakamura |
0:7d720671e6dc | 98 | } |
Osamu Nakamura |
0:7d720671e6dc | 99 | |
Osamu Nakamura |
0:7d720671e6dc | 100 | // Dynamic Resources |
Osamu Nakamura |
0:7d720671e6dc | 101 | DynamicResourcesList *Options::getDynamicResourceList() |
Osamu Nakamura |
0:7d720671e6dc | 102 | { |
Osamu Nakamura |
0:7d720671e6dc | 103 | return &this->m_dynamic_resources; |
Osamu Nakamura |
0:7d720671e6dc | 104 | } |
Osamu Nakamura |
0:7d720671e6dc | 105 | |
Osamu Nakamura |
0:7d720671e6dc | 106 | // WiFi SSID |
Osamu Nakamura |
0:7d720671e6dc | 107 | string Options::getWiFiSSID() { |
Osamu Nakamura |
0:7d720671e6dc | 108 | return this->m_wifi_ssid; |
Osamu Nakamura |
0:7d720671e6dc | 109 | } |
Osamu Nakamura |
0:7d720671e6dc | 110 | |
Osamu Nakamura |
0:7d720671e6dc | 111 | // WiFi AuthType |
Osamu Nakamura |
0:7d720671e6dc | 112 | WiFiAuthTypes Options::getWiFiAuthType() { |
Osamu Nakamura |
0:7d720671e6dc | 113 | return this->m_wifi_auth_type; |
Osamu Nakamura |
0:7d720671e6dc | 114 | } |
Osamu Nakamura |
0:7d720671e6dc | 115 | |
Osamu Nakamura |
0:7d720671e6dc | 116 | // WiFi AuthKey |
Osamu Nakamura |
0:7d720671e6dc | 117 | string Options::getWiFiAuthKey() { |
Osamu Nakamura |
0:7d720671e6dc | 118 | return this->m_wifi_auth_key; |
Osamu Nakamura |
0:7d720671e6dc | 119 | } |
Osamu Nakamura |
0:7d720671e6dc | 120 | |
Osamu Nakamura |
0:7d720671e6dc | 121 | // CoAP Connection Type |
Osamu Nakamura |
0:7d720671e6dc | 122 | CoAPConnectionTypes Options::getCoAPConnectionType() { |
Osamu Nakamura |
0:7d720671e6dc | 123 | return this->m_coap_connection_type; |
Osamu Nakamura |
0:7d720671e6dc | 124 | } |
Osamu Nakamura |
0:7d720671e6dc | 125 | |
Osamu Nakamura |
0:7d720671e6dc | 126 | // IP Address Type |
Osamu Nakamura |
0:7d720671e6dc | 127 | IPAddressTypes Options::getIPAddressType() { |
Osamu Nakamura |
0:7d720671e6dc | 128 | return this->m_ip_address_type; |
Osamu Nakamura |
0:7d720671e6dc | 129 | } |
Osamu Nakamura |
0:7d720671e6dc | 130 | |
Osamu Nakamura |
0:7d720671e6dc | 131 | // Immediate Observationing Enabled |
Osamu Nakamura |
0:7d720671e6dc | 132 | bool Options::immedateObservationEnabled() { |
Osamu Nakamura |
0:7d720671e6dc | 133 | return this->m_enable_immediate_observation; |
Osamu Nakamura |
0:7d720671e6dc | 134 | } |
Osamu Nakamura |
0:7d720671e6dc | 135 | |
Osamu Nakamura |
0:7d720671e6dc | 136 | // Enable/Disable Observation control via GET |
Osamu Nakamura |
0:7d720671e6dc | 137 | bool Options::enableGETObservationControl() { |
Osamu Nakamura |
0:7d720671e6dc | 138 | return this->m_enable_get_obs_control; |
Osamu Nakamura |
0:7d720671e6dc | 139 | } |
Osamu Nakamura |
0:7d720671e6dc | 140 | |
Osamu Nakamura |
0:7d720671e6dc | 141 | // Get the Server Certificate |
Osamu Nakamura |
0:7d720671e6dc | 142 | uint8_t *Options::getServerCertificate() { |
Osamu Nakamura |
0:7d720671e6dc | 143 | return this->m_server_cert; |
Osamu Nakamura |
0:7d720671e6dc | 144 | } |
Osamu Nakamura |
0:7d720671e6dc | 145 | |
Osamu Nakamura |
0:7d720671e6dc | 146 | // Get the Server Certificate length |
Osamu Nakamura |
0:7d720671e6dc | 147 | int Options::getServerCertificateSize() { |
Osamu Nakamura |
0:7d720671e6dc | 148 | return this->m_server_cert_length; |
Osamu Nakamura |
0:7d720671e6dc | 149 | } |
Osamu Nakamura |
0:7d720671e6dc | 150 | |
Osamu Nakamura |
0:7d720671e6dc | 151 | // Get the Client Certificate |
Osamu Nakamura |
0:7d720671e6dc | 152 | uint8_t *Options::getClientCertificate() { |
Osamu Nakamura |
0:7d720671e6dc | 153 | return this->m_client_cert; |
Osamu Nakamura |
0:7d720671e6dc | 154 | } |
Osamu Nakamura |
0:7d720671e6dc | 155 | |
Osamu Nakamura |
0:7d720671e6dc | 156 | // Get the Client Certificate length |
Osamu Nakamura |
0:7d720671e6dc | 157 | int Options::getClientCertificateSize() { |
Osamu Nakamura |
0:7d720671e6dc | 158 | return this->m_client_cert_length; |
Osamu Nakamura |
0:7d720671e6dc | 159 | } |
Osamu Nakamura |
0:7d720671e6dc | 160 | |
Osamu Nakamura |
0:7d720671e6dc | 161 | // Get the Client Key |
Osamu Nakamura |
0:7d720671e6dc | 162 | uint8_t *Options::getClientKey() { |
Osamu Nakamura |
0:7d720671e6dc | 163 | return this->m_client_key; |
Osamu Nakamura |
0:7d720671e6dc | 164 | } |
Osamu Nakamura |
0:7d720671e6dc | 165 | |
Osamu Nakamura |
0:7d720671e6dc | 166 | // Get the Client Key length |
Osamu Nakamura |
0:7d720671e6dc | 167 | int Options::getClientKeySize() { |
Osamu Nakamura |
0:7d720671e6dc | 168 | return this->m_client_key_length; |
Osamu Nakamura |
0:7d720671e6dc | 169 | } |
Osamu Nakamura |
0:7d720671e6dc | 170 | |
Osamu Nakamura |
0:7d720671e6dc | 171 | // Get our Endpoint |
Osamu Nakamura |
0:7d720671e6dc | 172 | void *Options::getEndpoint() { |
Osamu Nakamura |
0:7d720671e6dc | 173 | return this->m_endpoint; |
Osamu Nakamura |
0:7d720671e6dc | 174 | } |
Osamu Nakamura |
0:7d720671e6dc | 175 | |
Osamu Nakamura |
0:7d720671e6dc | 176 | } // namespace Connector |