Mbed Client sample for GR-LYCHEE where ZXing is incorporated.

Dependencies:   DisplayApp AsciiFont

Fork of GR-PEACH_mbed-os-client-ZXingSample by Renesas

Overview

This sample program shows how to use mbed Client together with ZXing which is an open-source, multi-format 1D/2D barcode image processing library. For more info on ZXing, please refer to https://github.com/zxing/zxing.

Required hardware

Application setup

  1. Select the connection type. For details, please refer to the following wiki:
    https://os.mbed.com/users/1050186/code/GR-LYCHEE_mbed-os-client-ZXingSample/wiki/Connection-type.
  2. Set the client credentials. For details, please refer to the following wiki:
    https://os.mbed.com/users/1050186/code/GR-LYCHEE_mbed-os-client-ZXingSample/wiki/Client-credentials.
  3. Change Wifi settings. For details, please refer to the following wiki:
    https://os.mbed.com/users/1050186/code/GR-LYCHEE_mbed-os-client-ZXingSample/wiki/Wifi-settings.

Building the example

To build this example:

  1. Import this example onto mbed Compiler.
  2. Configure the example in accordance with Application setup.
  3. Compile the example on mbed Compiler and download the resultant binary file.
  4. Plug the micro-USB cable into the OpenSDA port which lies on the next to the RESET button.
  5. Copy the binary previously downloaded to your PC to GR-LYCHEE to flash this example. When the copy is successfully completed, the board is ready to work.
  6. Press the RESET button on the board to run the example.
  7. For verification, please refer to the following wiki:
    https://os.mbed.com/users/1050186/code/GR-LYCHEE_mbed-os-client-ZXingSample/wiki/Monitoring-the-application.

Application resources

This example exposes four resources listed below:

  1. 3202/0/5700. Decode result of barcode data input from camera (GET).
  2. 3201/0/5850. Blink function, blinks LED when executed (POST).
  3. 3201/0/5853. Blink pattern, used by the blink function to determine how to blink. In the format of 1000:500:1000:500:1000:500 (PUT).
  4. 3201/0/5855. Blink color, used by the blink function. Any of green, yellow, orange and red is acceptable (PUT).
Committer:
1050186
Date:
Thu Dec 13 03:31:49 2018 +0000
Revision:
18:0ab91e767950
Parent:
12:7a199eff6988
Child:
20:d4695f4ddc8d
Replace easy-connect.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 0:eb73febb2bba 1 /*
dkato 2:6ec5c1c1d41c 2 * Copyright (c) 2015, 2016 ARM Limited. All rights reserved.
<> 0:eb73febb2bba 3 * SPDX-License-Identifier: Apache-2.0
<> 0:eb73febb2bba 4 * Licensed under the Apache License, Version 2.0 (the License); you may
<> 0:eb73febb2bba 5 * not use this file except in compliance with the License.
<> 0:eb73febb2bba 6 * You may obtain a copy of the License at
<> 0:eb73febb2bba 7 *
<> 0:eb73febb2bba 8 * http://www.apache.org/licenses/LICENSE-2.0
<> 0:eb73febb2bba 9 *
<> 0:eb73febb2bba 10 * Unless required by applicable law or agreed to in writing, software
<> 0:eb73febb2bba 11 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
<> 0:eb73febb2bba 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 0:eb73febb2bba 13 * See the License for the specific language governing permissions and
<> 0:eb73febb2bba 14 * limitations under the License.
<> 0:eb73febb2bba 15 */
dkato 2:6ec5c1c1d41c 16 #include "mbed-trace/mbed_trace.h"
dkato 2:6ec5c1c1d41c 17 #include "mbed.h"
dkato 2:6ec5c1c1d41c 18 #include "zxing_main.h"
dkato 2:6ec5c1c1d41c 19
dkato 2:6ec5c1c1d41c 20 // Network interaction must be performed outside of interrupt context
dkato 2:6ec5c1c1d41c 21 osThreadId mainThread;
dkato 2:6ec5c1c1d41c 22
dkato 2:6ec5c1c1d41c 23 #define NO_CONNECT (-1)
dkato 2:6ec5c1c1d41c 24
dkato 2:6ec5c1c1d41c 25 #if MBED_CONF_APP_NETWORK_INTERFACE == NO_CONNECT
dkato 2:6ec5c1c1d41c 26
dkato 2:6ec5c1c1d41c 27 static void callback_zxing(char * addr, int size) {
dkato 2:6ec5c1c1d41c 28 printf("%s\r\n", addr);
dkato 2:6ec5c1c1d41c 29 }
dkato 2:6ec5c1c1d41c 30
dkato 2:6ec5c1c1d41c 31 // Entry point to the program
dkato 2:6ec5c1c1d41c 32 int main() {
dkato 2:6ec5c1c1d41c 33 // Keep track of the main thread
dkato 2:6ec5c1c1d41c 34 mainThread = osThreadGetId();
dkato 2:6ec5c1c1d41c 35 printf("no connect\n");
dkato 2:6ec5c1c1d41c 36 mbed_trace_init();
dkato 2:6ec5c1c1d41c 37 zxing_init(&callback_zxing);
dkato 2:6ec5c1c1d41c 38
dkato 2:6ec5c1c1d41c 39 while (1) {
dkato 2:6ec5c1c1d41c 40 zxing_loop();
dkato 2:6ec5c1c1d41c 41 Thread::wait(5);
dkato 2:6ec5c1c1d41c 42 }
dkato 2:6ec5c1c1d41c 43 }
dkato 2:6ec5c1c1d41c 44
dkato 2:6ec5c1c1d41c 45 #else // MBED_CONF_APP_NETWORK_INTERFACE != NO_CONNECT
dkato 2:6ec5c1c1d41c 46
dkato 2:6ec5c1c1d41c 47 #define __STDC_FORMAT_MACROS
1050186 12:7a199eff6988 48 #include <inttypes.h>
<> 0:eb73febb2bba 49 #include <string>
<> 0:eb73febb2bba 50 #include <sstream>
<> 0:eb73febb2bba 51 #include <vector>
1050186 12:7a199eff6988 52 #include "mbed-trace/mbed_trace.h"
1050186 12:7a199eff6988 53 #include "mbedtls/entropy_poll.h"
1050186 12:7a199eff6988 54
<> 0:eb73febb2bba 55 #include "security.h"
1050186 12:7a199eff6988 56
1050186 12:7a199eff6988 57 #include "mbed.h"
<> 0:eb73febb2bba 58
dkato 2:6ec5c1c1d41c 59 // easy-connect compliancy, it has 2 sets of wifi pins we have only one
dkato 2:6ec5c1c1d41c 60 #define MBED_CONF_APP_ESP8266_TX MBED_CONF_APP_WIFI_TX
dkato 2:6ec5c1c1d41c 61 #define MBED_CONF_APP_ESP8266_RX MBED_CONF_APP_WIFI_RX
1050186 12:7a199eff6988 62 #include "easy-connect/easy-connect.h"
1050186 12:7a199eff6988 63
1050186 12:7a199eff6988 64 // Should be defined after easy-connect.h
1050186 12:7a199eff6988 65 #include "simpleclient.h"
1050186 12:7a199eff6988 66
1050186 12:7a199eff6988 67 #ifdef TARGET_STM
1050186 12:7a199eff6988 68 #define RED_LED (LED3)
1050186 12:7a199eff6988 69 #define GREEN_LED (LED1)
1050186 12:7a199eff6988 70 #define BLUE_LED (LED2)
1050186 12:7a199eff6988 71 #define LED_ON (1)
1050186 12:7a199eff6988 72 #elif TARGET_GR_LYCHEE
1050186 12:7a199eff6988 73 #define GREEN_LED (LED1)
1050186 12:7a199eff6988 74 #define YELLOW_LED (LED2)
1050186 12:7a199eff6988 75 #define ORANGE_LED (LED3)
1050186 12:7a199eff6988 76 #define RED_LED (LED4)
1050186 12:7a199eff6988 77 #define LED_ON (1)
1050186 12:7a199eff6988 78 #else
1050186 12:7a199eff6988 79 #define RED_LED (LED1)
1050186 12:7a199eff6988 80 #define GREEN_LED (LED2)
1050186 12:7a199eff6988 81 #define BLUE_LED (LED3)
1050186 12:7a199eff6988 82 #define LED_ON (0)
1050186 12:7a199eff6988 83 #endif
1050186 12:7a199eff6988 84 #define LED_OFF (!LED_ON)
1050186 12:7a199eff6988 85
1050186 12:7a199eff6988 86 #define BLINK_SIGNAL 0x1
1050186 12:7a199eff6988 87
1050186 12:7a199eff6988 88 // Status indication
1050186 12:7a199eff6988 89 DigitalOut red_led(RED_LED);
1050186 12:7a199eff6988 90 DigitalOut green_led(GREEN_LED);
1050186 12:7a199eff6988 91 #ifdef TARGET_GR_LYCHEE
1050186 12:7a199eff6988 92 DigitalOut yellow_led(YELLOW_LED);
1050186 12:7a199eff6988 93 DigitalOut orange_led(ORANGE_LED);
1050186 12:7a199eff6988 94 #else
1050186 12:7a199eff6988 95 DigitalOut blue_led(BLUE_LED);
1050186 12:7a199eff6988 96 #endif
1050186 12:7a199eff6988 97
1050186 12:7a199eff6988 98 Ticker status_ticker;
1050186 12:7a199eff6988 99 void blinky() {
1050186 12:7a199eff6988 100 green_led = !green_led;
1050186 12:7a199eff6988 101 }
<> 0:eb73febb2bba 102
<> 0:eb73febb2bba 103 // These are example resource values for the Device Object
<> 0:eb73febb2bba 104 struct MbedClientDevice device = {
<> 0:eb73febb2bba 105 "Manufacturer_String", // Manufacturer
<> 0:eb73febb2bba 106 "Type_String", // Type
<> 0:eb73febb2bba 107 "ModelNumber_String", // ModelNumber
<> 0:eb73febb2bba 108 "SerialNumber_String" // SerialNumber
<> 0:eb73febb2bba 109 };
<> 0:eb73febb2bba 110
<> 0:eb73febb2bba 111 // Instantiate the class which implements LWM2M Client API (from simpleclient.h)
<> 0:eb73febb2bba 112 MbedClient mbed_client(device);
<> 0:eb73febb2bba 113
1050186 12:7a199eff6988 114 // Set up a button interrupt for user interaction
1050186 12:7a199eff6988 115 #ifdef MBED_CONF_APP_BUTTON1
1050186 12:7a199eff6988 116 InterruptIn counter_btn(MBED_CONF_APP_BUTTON1);
1050186 12:7a199eff6988 117 #endif
1050186 12:7a199eff6988 118
1050186 12:7a199eff6988 119
1050186 12:7a199eff6988 120 /**
1050186 12:7a199eff6988 121 * User interaction handler / simulator. Sets up physical button handler and a ticker
1050186 12:7a199eff6988 122 * for regular updates for the resources.
1050186 12:7a199eff6988 123 *
1050186 12:7a199eff6988 124 * MBED_CONF_APP_BUTTON1 is mapped to actual button pin the mbed_app.json file, where you need to
1050186 12:7a199eff6988 125 * specify board-specific value or leave it undefined if the board does not have buttons.
1050186 12:7a199eff6988 126 */
1050186 12:7a199eff6988 127 class InteractionProvider {
1050186 12:7a199eff6988 128
1050186 12:7a199eff6988 129 public:
1050186 12:7a199eff6988 130 InteractionProvider(Semaphore& updates_sem) : updates(updates_sem) {
1050186 12:7a199eff6988 131
1050186 12:7a199eff6988 132 timer_ticked = false;
1050186 12:7a199eff6988 133 clicked = false;
1050186 12:7a199eff6988 134
1050186 12:7a199eff6988 135 // Set up handler function for the interaction button, if available
1050186 12:7a199eff6988 136
1050186 12:7a199eff6988 137 #ifdef MBED_CONF_APP_BUTTON1
1050186 12:7a199eff6988 138 counter_btn.fall(this, &InteractionProvider::counter_button_handler);
1050186 6:4e43b6f8f772 139 #endif
1050186 12:7a199eff6988 140
1050186 12:7a199eff6988 141 // Use the counter button handler to send an update of endpoint resource values
1050186 12:7a199eff6988 142 // to connector every 15 seconds periodically.
1050186 12:7a199eff6988 143 timer.attach(this, &InteractionProvider::timer_handler, 15.0);
1050186 12:7a199eff6988 144 }
1050186 12:7a199eff6988 145
1050186 12:7a199eff6988 146 // flags for interaction, these are read from outside interrupt context
1050186 12:7a199eff6988 147 volatile bool timer_ticked;
1050186 12:7a199eff6988 148 volatile bool clicked;
1050186 12:7a199eff6988 149
1050186 12:7a199eff6988 150
1050186 12:7a199eff6988 151 private:
1050186 12:7a199eff6988 152
1050186 12:7a199eff6988 153 void timer_handler() {
1050186 12:7a199eff6988 154 timer_ticked = true;
1050186 12:7a199eff6988 155 updates.release();
1050186 12:7a199eff6988 156 }
1050186 12:7a199eff6988 157
1050186 12:7a199eff6988 158 void counter_button_handler() {
1050186 12:7a199eff6988 159 clicked = true;
1050186 12:7a199eff6988 160 updates.release();
1050186 12:7a199eff6988 161 }
1050186 12:7a199eff6988 162
1050186 12:7a199eff6988 163 // time-based event source for regular resource updates
1050186 12:7a199eff6988 164 Ticker timer;
1050186 12:7a199eff6988 165
1050186 12:7a199eff6988 166 // Network interaction must be performed outside of interrupt context
1050186 12:7a199eff6988 167 Semaphore& updates;
1050186 12:7a199eff6988 168
1050186 12:7a199eff6988 169 };
1050186 12:7a199eff6988 170
1050186 12:7a199eff6988 171 /*
1050186 12:7a199eff6988 172 * Arguments for running "blink" in it's own thread.
1050186 12:7a199eff6988 173 */
1050186 12:7a199eff6988 174 class BlinkArgs {
1050186 12:7a199eff6988 175 public:
1050186 12:7a199eff6988 176 BlinkArgs() {
1050186 12:7a199eff6988 177 clear();
1050186 12:7a199eff6988 178 }
1050186 12:7a199eff6988 179 void clear() {
1050186 12:7a199eff6988 180 position = 0;
1050186 12:7a199eff6988 181 blink_pattern.clear();
1050186 12:7a199eff6988 182 }
1050186 12:7a199eff6988 183 uint16_t position;
1050186 12:7a199eff6988 184 std::vector<uint32_t> blink_pattern;
1050186 12:7a199eff6988 185 };
1050186 12:7a199eff6988 186
<> 0:eb73febb2bba 187 /*
<> 0:eb73febb2bba 188 * The Led contains one property (pattern) and a function (blink).
<> 0:eb73febb2bba 189 * When the function blink is executed, the pattern is read, and the LED
<> 0:eb73febb2bba 190 * will blink based on the pattern.
<> 0:eb73febb2bba 191 */
<> 0:eb73febb2bba 192 class LedResource {
<> 0:eb73febb2bba 193 public:
<> 0:eb73febb2bba 194 LedResource() {
<> 0:eb73febb2bba 195 // create ObjectID with metadata tag of '3201', which is 'digital output'
1050186 12:7a199eff6988 196 // blinky_thread.start(callback(this, &LedResource::do_blink));
<> 0:eb73febb2bba 197 led_object = M2MInterfaceFactory::create_object("3201");
<> 0:eb73febb2bba 198 M2MObjectInstance* led_inst = led_object->create_object_instance();
<> 0:eb73febb2bba 199
<> 0:eb73febb2bba 200 // 5855 = Multi-state output
<> 0:eb73febb2bba 201 M2MResource* color_res = led_inst->create_dynamic_resource("5855", "Color",
<> 0:eb73febb2bba 202 M2MResourceInstance::STRING, false);
<> 0:eb73febb2bba 203 // read and write
<> 0:eb73febb2bba 204 color_res->set_operation(M2MBase::GET_PUT_ALLOWED);
<> 0:eb73febb2bba 205 // set red as initial color
<> 0:eb73febb2bba 206 color_res->set_value((const uint8_t*)"red", 3);
<> 0:eb73febb2bba 207
<> 0:eb73febb2bba 208 // 5853 = Multi-state output
<> 0:eb73febb2bba 209 M2MResource* pattern_res = led_inst->create_dynamic_resource("5853", "Pattern",
<> 0:eb73febb2bba 210 M2MResourceInstance::STRING, false);
<> 0:eb73febb2bba 211 // read and write
<> 0:eb73febb2bba 212 pattern_res->set_operation(M2MBase::GET_PUT_ALLOWED);
<> 0:eb73febb2bba 213 // set initial pattern (toggle every 200ms. 7 toggles in total)
<> 0:eb73febb2bba 214 pattern_res->set_value((const uint8_t*)"500:500:500:500:500:500:500", 27);
<> 0:eb73febb2bba 215
<> 0:eb73febb2bba 216 // there's not really an execute LWM2M ID that matches... hmm...
<> 0:eb73febb2bba 217 M2MResource* led_res = led_inst->create_dynamic_resource("5850", "Blink",
<> 0:eb73febb2bba 218 M2MResourceInstance::OPAQUE, false);
<> 0:eb73febb2bba 219 // we allow executing a function here...
<> 0:eb73febb2bba 220 led_res->set_operation(M2MBase::POST_ALLOWED);
<> 0:eb73febb2bba 221 // when a POST comes in, we want to execute the led_execute_callback
<> 0:eb73febb2bba 222 led_res->set_execute_function(execute_callback(this, &LedResource::blink));
dkato 2:6ec5c1c1d41c 223
<> 0:eb73febb2bba 224 }
<> 0:eb73febb2bba 225
<> 0:eb73febb2bba 226 M2MObject* get_object() {
<> 0:eb73febb2bba 227 return led_object;
<> 0:eb73febb2bba 228 }
<> 0:eb73febb2bba 229
dkato 2:6ec5c1c1d41c 230 void blink(void *argument) {
<> 0:eb73febb2bba 231 // read the value of 'Pattern'
<> 0:eb73febb2bba 232 M2MObjectInstance* inst = led_object->object_instance();
<> 0:eb73febb2bba 233 M2MResource* res = inst->resource("5853");
<> 0:eb73febb2bba 234 // read the value of 'Color'
<> 0:eb73febb2bba 235 M2MObjectInstance* instC = led_object->object_instance();
<> 0:eb73febb2bba 236 M2MResource* resC = instC->resource("5855");
<> 0:eb73febb2bba 237
<> 0:eb73febb2bba 238 // values in mbed Client are all buffers, and we need a vector of int's
<> 0:eb73febb2bba 239 uint8_t* buffIn = NULL;
<> 0:eb73febb2bba 240 uint32_t sizeIn;
<> 0:eb73febb2bba 241 res->get_value(buffIn, sizeIn);
1050186 12:7a199eff6988 242
<> 0:eb73febb2bba 243 uint8_t* cbuffIn = NULL;
<> 0:eb73febb2bba 244 uint32_t csizeIn;
<> 0:eb73febb2bba 245 resC->get_value(cbuffIn, csizeIn);
<> 0:eb73febb2bba 246
<> 0:eb73febb2bba 247 // turn the buffer into a string, and initialize a vector<int> on the heap
<> 0:eb73febb2bba 248 std::string s((char*)buffIn, sizeIn);
<> 0:eb73febb2bba 249 std::vector<uint32_t>* v = new std::vector<uint32_t>;
<> 0:eb73febb2bba 250
1050186 12:7a199eff6988 251 printf("led_execute_callback pattern=%s\n", s.c_str());
<> 0:eb73febb2bba 252
<> 0:eb73febb2bba 253 // our pattern is something like 500:200:500, so parse that
<> 0:eb73febb2bba 254 std::size_t found = s.find_first_of(":");
<> 0:eb73febb2bba 255 while (found!=std::string::npos) {
<> 0:eb73febb2bba 256 v->push_back(atoi((const char*)s.substr(0,found).c_str()));
<> 0:eb73febb2bba 257 s = s.substr(found+1);
<> 0:eb73febb2bba 258 found=s.find_first_of(":");
<> 0:eb73febb2bba 259 if(found == std::string::npos) {
<> 0:eb73febb2bba 260 v->push_back(atoi((const char*)s.c_str()));
<> 0:eb73febb2bba 261 }
<> 0:eb73febb2bba 262 }
dkato 2:6ec5c1c1d41c 263 int position = 0;
dkato 2:6ec5c1c1d41c 264 while (1) {
dkato 2:6ec5c1c1d41c 265 do_blink(cbuffIn);
dkato 2:6ec5c1c1d41c 266 if (position >= v->size()) {
dkato 2:6ec5c1c1d41c 267 break;
dkato 2:6ec5c1c1d41c 268 }
dkato 2:6ec5c1c1d41c 269 // how long do we need to wait before the next blink?
dkato 2:6ec5c1c1d41c 270 Thread::wait(v->at(position));
dkato 2:6ec5c1c1d41c 271 position++;
dkato 2:6ec5c1c1d41c 272 }
dkato 2:6ec5c1c1d41c 273 free(buffIn);
dkato 2:6ec5c1c1d41c 274 free(cbuffIn);
dkato 2:6ec5c1c1d41c 275 delete v;
<> 0:eb73febb2bba 276 }
<> 0:eb73febb2bba 277
<> 0:eb73febb2bba 278 private:
<> 0:eb73febb2bba 279 M2MObject* led_object;
dkato 2:6ec5c1c1d41c 280 void do_blink(uint8_t* color) {
1050186 12:7a199eff6988 281
1050186 6:4e43b6f8f772 282 #if defined(TARGET_RZ_A1H)
<> 0:eb73febb2bba 283 if (!strcmp((char *)color, "red")) {
<> 0:eb73febb2bba 284 // blink the LED in red color
1050186 12:7a199eff6988 285 red_led = !red_led;
<> 0:eb73febb2bba 286 }
<> 0:eb73febb2bba 287 else if (!strcmp((char *)color, "green")) {
<> 0:eb73febb2bba 288 // blink in green color
1050186 12:7a199eff6988 289 green_led = !green_led;
<> 0:eb73febb2bba 290 }
<> 0:eb73febb2bba 291 else if (!strcmp((char *)color, "blue")) {
<> 0:eb73febb2bba 292 // blink in blue color
1050186 12:7a199eff6988 293 blue_led = !blue_led;
<> 0:eb73febb2bba 294 }
<> 0:eb73febb2bba 295 else if (!strcmp((char *)color, "cyan")) {
<> 0:eb73febb2bba 296 // blink in cyan color
1050186 12:7a199eff6988 297 green_led = !green_led;
1050186 12:7a199eff6988 298 blue_led = !blue_led;
<> 0:eb73febb2bba 299 }
<> 0:eb73febb2bba 300 else if (!strcmp((char *)color, "yellow")) {
<> 0:eb73febb2bba 301 // blink in yellow color
1050186 12:7a199eff6988 302 red_led = !red_led;
1050186 12:7a199eff6988 303 green_led = !green_led;
<> 0:eb73febb2bba 304 }
<> 0:eb73febb2bba 305 else if (!strcmp((char *)color, "magenta")) {
<> 0:eb73febb2bba 306 // blink in magenta color
1050186 12:7a199eff6988 307 red_led = !red_led;
1050186 12:7a199eff6988 308 blue_led = !blue_led;
<> 0:eb73febb2bba 309 }
<> 0:eb73febb2bba 310 else if (!strcmp((char *)color, "white")) {
<> 0:eb73febb2bba 311 // blink in white color
1050186 12:7a199eff6988 312 red_led = !red_led;
1050186 12:7a199eff6988 313 green_led = !green_led;
1050186 12:7a199eff6988 314 blue_led = !blue_led;
<> 0:eb73febb2bba 315 }
<> 0:eb73febb2bba 316 else {
<> 0:eb73febb2bba 317 // no operation
<> 0:eb73febb2bba 318 }
1050186 6:4e43b6f8f772 319 #elif defined(TARGET_GR_LYCHEE)
1050186 6:4e43b6f8f772 320 if (!strcmp((char *)color, "green")) {
1050186 6:4e43b6f8f772 321 // blink the LED1(green color)
1050186 12:7a199eff6988 322 green_led = !green_led;
1050186 6:4e43b6f8f772 323 }
1050186 6:4e43b6f8f772 324 else if (!strcmp((char *)color, "yellow")) {
1050186 6:4e43b6f8f772 325 // blink the LED2(yellow color)
1050186 12:7a199eff6988 326 yellow_led = !yellow_led;
1050186 6:4e43b6f8f772 327 }
1050186 6:4e43b6f8f772 328 else if (!strcmp((char *)color, "orange")) {
1050186 6:4e43b6f8f772 329 // blink the LED3(orange color)
1050186 12:7a199eff6988 330 orange_led = !orange_led;
1050186 6:4e43b6f8f772 331 }
1050186 6:4e43b6f8f772 332 else if (!strcmp((char *)color, "red")) {
1050186 6:4e43b6f8f772 333 // blink the LED4(red color)
1050186 12:7a199eff6988 334 red_led = !red_led;
1050186 6:4e43b6f8f772 335 }
1050186 6:4e43b6f8f772 336 else {
1050186 6:4e43b6f8f772 337 // no operation
1050186 6:4e43b6f8f772 338 }
1050186 6:4e43b6f8f772 339 #endif
<> 0:eb73febb2bba 340 }
<> 0:eb73febb2bba 341 };
<> 0:eb73febb2bba 342
<> 0:eb73febb2bba 343 /*
1050186 12:7a199eff6988 344 * The button contains one property (click count).
1050186 12:7a199eff6988 345 * When `handle_button_click` is executed, the counter updates.
1050186 12:7a199eff6988 346 */
1050186 12:7a199eff6988 347 class ButtonResource {
1050186 12:7a199eff6988 348 public:
1050186 12:7a199eff6988 349 ButtonResource(): counter(0) {
1050186 12:7a199eff6988 350 // create ObjectID with metadata tag of '3200', which is 'digital input'
1050186 12:7a199eff6988 351 btn_object = M2MInterfaceFactory::create_object("3200");
1050186 12:7a199eff6988 352 M2MObjectInstance* btn_inst = btn_object->create_object_instance();
1050186 12:7a199eff6988 353 // create resource with ID '5501', which is digital input counter
1050186 12:7a199eff6988 354 M2MResource* btn_res = btn_inst->create_dynamic_resource("5501", "Button",
1050186 12:7a199eff6988 355 M2MResourceInstance::INTEGER, true /* observable */);
1050186 12:7a199eff6988 356 // we can read this value
1050186 12:7a199eff6988 357 btn_res->set_operation(M2MBase::GET_ALLOWED);
1050186 12:7a199eff6988 358 // set initial value (all values in mbed Client are buffers)
1050186 12:7a199eff6988 359 // to be able to read this data easily in the Connector console, we'll use a string
1050186 12:7a199eff6988 360 btn_res->set_value((uint8_t*)"0", 1);
1050186 12:7a199eff6988 361 }
1050186 12:7a199eff6988 362
1050186 12:7a199eff6988 363 ~ButtonResource() {
1050186 12:7a199eff6988 364 }
1050186 12:7a199eff6988 365
1050186 12:7a199eff6988 366 M2MObject* get_object() {
1050186 12:7a199eff6988 367 return btn_object;
1050186 12:7a199eff6988 368 }
1050186 12:7a199eff6988 369
1050186 12:7a199eff6988 370 /*
1050186 12:7a199eff6988 371 * When you press the button, we read the current value of the click counter
1050186 12:7a199eff6988 372 * from mbed Device Connector, then up the value with one.
1050186 12:7a199eff6988 373 */
1050186 12:7a199eff6988 374 void handle_button_click() {
1050186 12:7a199eff6988 375 if (mbed_client.register_successful()) {
1050186 12:7a199eff6988 376 M2MObjectInstance* inst = btn_object->object_instance();
1050186 12:7a199eff6988 377 M2MResource* res = inst->resource("5501");
1050186 12:7a199eff6988 378
1050186 12:7a199eff6988 379 // up counter
1050186 12:7a199eff6988 380 counter++;
1050186 12:7a199eff6988 381 printf("handle_button_click, new value of counter is %d\n", counter);
1050186 12:7a199eff6988 382 // serialize the value of counter as a string, and tell connector
1050186 12:7a199eff6988 383 char buffer[20];
1050186 12:7a199eff6988 384 int size = sprintf(buffer,"%d",counter);
1050186 12:7a199eff6988 385 res->set_value((uint8_t*)buffer, size);
1050186 12:7a199eff6988 386 } else {
1050186 12:7a199eff6988 387 printf("simulate button_click, device not registered\n");
1050186 12:7a199eff6988 388 }
1050186 12:7a199eff6988 389 }
1050186 12:7a199eff6988 390
1050186 12:7a199eff6988 391 private:
1050186 12:7a199eff6988 392 M2MObject* btn_object;
1050186 12:7a199eff6988 393 uint16_t counter;
1050186 12:7a199eff6988 394 };
1050186 12:7a199eff6988 395
1050186 12:7a199eff6988 396 /*
1050186 12:7a199eff6988 397 * The timer contains one property: counter.
1050186 12:7a199eff6988 398 * When `handle_timer_tick` is executed, the counter updates.
1050186 12:7a199eff6988 399 */
1050186 12:7a199eff6988 400 class TimerResource {
1050186 12:7a199eff6988 401 public:
1050186 12:7a199eff6988 402 TimerResource(): counter(0) {
1050186 12:7a199eff6988 403 // create ObjectID with metadata tag of '3200', which is 'digital input'
1050186 12:7a199eff6988 404 btn_object = M2MInterfaceFactory::create_object("3200");
1050186 12:7a199eff6988 405 M2MObjectInstance* btn_inst = btn_object->create_object_instance();
1050186 12:7a199eff6988 406 // create resource with ID '5502', which is digital input counter
1050186 12:7a199eff6988 407 M2MResource* btn_res = btn_inst->create_dynamic_resource("5502", "Timer",
1050186 12:7a199eff6988 408 M2MResourceInstance::INTEGER, true /* observable */);
1050186 12:7a199eff6988 409 // we can read this value
1050186 12:7a199eff6988 410 btn_res->set_operation(M2MBase::GET_ALLOWED);
1050186 12:7a199eff6988 411 // set initial value (all values in mbed Client are buffers)
1050186 12:7a199eff6988 412 // to be able to read this data easily in the Connector console, we'll use a string
1050186 12:7a199eff6988 413 btn_res->set_value((uint8_t*)"0", 1);
1050186 12:7a199eff6988 414 }
1050186 12:7a199eff6988 415
1050186 12:7a199eff6988 416 ~TimerResource() {
1050186 12:7a199eff6988 417 }
1050186 12:7a199eff6988 418
1050186 12:7a199eff6988 419 M2MObject* get_object() {
1050186 12:7a199eff6988 420 return btn_object;
1050186 12:7a199eff6988 421 }
1050186 12:7a199eff6988 422
1050186 12:7a199eff6988 423 /*
1050186 12:7a199eff6988 424 * When the timer ticks, we read the current value of the click counter
1050186 12:7a199eff6988 425 * from mbed Device Connector, then up the value with one.l
1050186 12:7a199eff6988 426 */
1050186 12:7a199eff6988 427 void handle_timer_tick() {
1050186 12:7a199eff6988 428 if (mbed_client.register_successful()) {
1050186 12:7a199eff6988 429 M2MObjectInstance* inst = btn_object->object_instance();
1050186 12:7a199eff6988 430 M2MResource* res = inst->resource("5502");
1050186 12:7a199eff6988 431
1050186 12:7a199eff6988 432 // up counter
1050186 12:7a199eff6988 433 counter++;
1050186 12:7a199eff6988 434 printf("handle_timer_click, new value of counter is %d\n", counter);
1050186 12:7a199eff6988 435 // serialize the value of counter as a string, and tell connector
1050186 12:7a199eff6988 436 char buffer[20];
1050186 12:7a199eff6988 437 int size = sprintf(buffer,"%d",counter);
1050186 12:7a199eff6988 438 res->set_value((uint8_t*)buffer, size);
1050186 12:7a199eff6988 439 } else {
1050186 12:7a199eff6988 440 printf("handle_timer_tick, device not registered\n");
1050186 12:7a199eff6988 441 }
1050186 12:7a199eff6988 442 }
1050186 12:7a199eff6988 443
1050186 12:7a199eff6988 444 private:
1050186 12:7a199eff6988 445 M2MObject* btn_object;
1050186 12:7a199eff6988 446 uint16_t counter;
1050186 12:7a199eff6988 447 };
1050186 12:7a199eff6988 448
1050186 12:7a199eff6988 449
1050186 12:7a199eff6988 450
1050186 12:7a199eff6988 451 class BigPayloadResource {
1050186 12:7a199eff6988 452 public:
1050186 12:7a199eff6988 453 BigPayloadResource() {
1050186 12:7a199eff6988 454 big_payload = M2MInterfaceFactory::create_object("1000");
1050186 12:7a199eff6988 455 M2MObjectInstance* payload_inst = big_payload->create_object_instance();
1050186 12:7a199eff6988 456 M2MResource* payload_res = payload_inst->create_dynamic_resource("1", "BigData",
1050186 12:7a199eff6988 457 M2MResourceInstance::STRING, true /* observable */);
1050186 12:7a199eff6988 458 payload_res->set_operation(M2MBase::GET_PUT_ALLOWED);
1050186 12:7a199eff6988 459 payload_res->set_value((uint8_t*)"0", 1);
1050186 12:7a199eff6988 460 payload_res->set_incoming_block_message_callback(
1050186 12:7a199eff6988 461 incoming_block_message_callback(this, &BigPayloadResource::block_message_received));
1050186 12:7a199eff6988 462 payload_res->set_outgoing_block_message_callback(
1050186 12:7a199eff6988 463 outgoing_block_message_callback(this, &BigPayloadResource::block_message_requested));
1050186 12:7a199eff6988 464 }
1050186 12:7a199eff6988 465
1050186 12:7a199eff6988 466 M2MObject* get_object() {
1050186 12:7a199eff6988 467 return big_payload;
1050186 12:7a199eff6988 468 }
1050186 12:7a199eff6988 469
1050186 12:7a199eff6988 470 void block_message_received(M2MBlockMessage *argument) {
1050186 12:7a199eff6988 471 if (argument) {
1050186 12:7a199eff6988 472 if (M2MBlockMessage::ErrorNone == argument->error_code()) {
1050186 12:7a199eff6988 473 if (argument->is_last_block()) {
1050186 12:7a199eff6988 474 printf("Last block received\n");
1050186 12:7a199eff6988 475 }
1050186 12:7a199eff6988 476 printf("Block number: %d\n", argument->block_number());
1050186 12:7a199eff6988 477 // First block received
1050186 12:7a199eff6988 478 if (argument->block_number() == 0) {
1050186 12:7a199eff6988 479 // Store block
1050186 12:7a199eff6988 480 // More blocks coming
1050186 12:7a199eff6988 481 } else {
1050186 12:7a199eff6988 482 // Store blocks
1050186 12:7a199eff6988 483 }
1050186 12:7a199eff6988 484 } else {
1050186 12:7a199eff6988 485 printf("Error when receiving block message! - EntityTooLarge\n");
1050186 12:7a199eff6988 486 }
1050186 12:7a199eff6988 487 // printf("Total message size: %" PRIu32 "\n", argument->total_message_size());
1050186 12:7a199eff6988 488 printf("Total message size: %PRIu32\n", argument->total_message_size());
1050186 12:7a199eff6988 489 }
1050186 12:7a199eff6988 490 }
1050186 12:7a199eff6988 491
1050186 12:7a199eff6988 492 void block_message_requested(const String& resource, uint8_t *&/*data*/, uint32_t &/*len*/) {
1050186 12:7a199eff6988 493 printf("GET request received for resource: %s\n", resource.c_str());
1050186 12:7a199eff6988 494 // Copy data and length to coap response
1050186 12:7a199eff6988 495 }
1050186 12:7a199eff6988 496
1050186 12:7a199eff6988 497 private:
1050186 12:7a199eff6988 498 M2MObject* big_payload;
1050186 12:7a199eff6988 499 };
1050186 12:7a199eff6988 500
1050186 12:7a199eff6988 501 /*
<> 0:eb73febb2bba 502 * The Zxing contains a function (send string).
<> 0:eb73febb2bba 503 * When `handle_string_send` is executed, the string after decoding is sent.
<> 0:eb73febb2bba 504 */
<> 0:eb73febb2bba 505 class ZxingResource {
<> 0:eb73febb2bba 506 public:
<> 0:eb73febb2bba 507 ZxingResource() {
<> 0:eb73febb2bba 508 // create ObjectID with metadata tag of '3202', which is 'send string'
<> 0:eb73febb2bba 509 zxing_object = M2MInterfaceFactory::create_object("3202");
<> 0:eb73febb2bba 510 M2MObjectInstance* zxing_inst = zxing_object->create_object_instance();
<> 0:eb73febb2bba 511 // create resource with ID '5700', which is 'send string'
<> 0:eb73febb2bba 512 M2MResource* zxing_res = zxing_inst->create_dynamic_resource("5700", "zxing",
<> 0:eb73febb2bba 513 M2MResourceInstance::STRING, true);
<> 0:eb73febb2bba 514 // we can read this value
<> 0:eb73febb2bba 515 zxing_res->set_operation(M2MBase::GET_ALLOWED);
<> 0:eb73febb2bba 516 // set initial value (all values in mbed Client are buffers)
<> 0:eb73febb2bba 517 // to be able to read this data easily in the Connector console, we'll use a string
dkato 2:6ec5c1c1d41c 518 zxing_res->set_value((uint8_t*)"0", 1);
<> 0:eb73febb2bba 519 }
<> 0:eb73febb2bba 520
<> 0:eb73febb2bba 521 ~ZxingResource() {
<> 0:eb73febb2bba 522 }
<> 0:eb73febb2bba 523
<> 0:eb73febb2bba 524 M2MObject* get_object() {
<> 0:eb73febb2bba 525 return zxing_object;
<> 0:eb73febb2bba 526 }
<> 0:eb73febb2bba 527
<> 0:eb73febb2bba 528 /*
<> 0:eb73febb2bba 529 * When you success the decode process of barcode, we send the string after decoding to mbed Device Connector.
<> 0:eb73febb2bba 530 */
<> 0:eb73febb2bba 531 void handle_string_send(char * addr, int size) {
1050186 12:7a199eff6988 532 if (mbed_client.register_successful()) {
1050186 12:7a199eff6988 533 M2MObjectInstance* inst = zxing_object->object_instance();
1050186 12:7a199eff6988 534 M2MResource* res = inst->resource("5700");
1050186 12:7a199eff6988 535
1050186 12:7a199eff6988 536 printf("%s\r\n", addr);
<> 0:eb73febb2bba 537
1050186 12:7a199eff6988 538 // tell the string to connector
1050186 12:7a199eff6988 539 res->set_value((uint8_t *)addr, size);
1050186 12:7a199eff6988 540 } else {
1050186 12:7a199eff6988 541 printf("handle_string_send, device not registered\n");
1050186 12:7a199eff6988 542 }
<> 0:eb73febb2bba 543 }
<> 0:eb73febb2bba 544
<> 0:eb73febb2bba 545 private:
<> 0:eb73febb2bba 546 M2MObject* zxing_object;
<> 0:eb73febb2bba 547 };
<> 0:eb73febb2bba 548
<> 0:eb73febb2bba 549 ZxingResource zxing_resource;
<> 0:eb73febb2bba 550
<> 0:eb73febb2bba 551 static void callback_zxing(char * addr, int size) {
<> 0:eb73febb2bba 552 zxing_resource.handle_string_send(addr, size);
<> 0:eb73febb2bba 553 }
dkato 2:6ec5c1c1d41c 554
dkato 2:6ec5c1c1d41c 555
1050186 12:7a199eff6988 556 // debug printf function
1050186 12:7a199eff6988 557 void trace_printer(const char* str) {
1050186 12:7a199eff6988 558 printf("%s\r\n", str);
dkato 2:6ec5c1c1d41c 559 }
<> 0:eb73febb2bba 560
<> 0:eb73febb2bba 561 // Entry point to the program
<> 0:eb73febb2bba 562 int main() {
<> 0:eb73febb2bba 563
dkato 2:6ec5c1c1d41c 564 unsigned int seed;
dkato 2:6ec5c1c1d41c 565 size_t len;
<> 0:eb73febb2bba 566
dkato 2:6ec5c1c1d41c 567 #ifdef MBEDTLS_ENTROPY_HARDWARE_ALT
dkato 2:6ec5c1c1d41c 568 // Used to randomize source port
dkato 2:6ec5c1c1d41c 569 mbedtls_hardware_poll(NULL, (unsigned char *) &seed, sizeof seed, &len);
dkato 2:6ec5c1c1d41c 570
dkato 2:6ec5c1c1d41c 571 #elif defined MBEDTLS_TEST_NULL_ENTROPY
dkato 2:6ec5c1c1d41c 572
<> 0:eb73febb2bba 573 #warning "mbedTLS security feature is disabled. Connection will not be secure !! Implement proper hardware entropy for your selected hardware."
dkato 2:6ec5c1c1d41c 574 // Used to randomize source port
dkato 2:6ec5c1c1d41c 575 mbedtls_null_entropy_poll( NULL,(unsigned char *) &seed, sizeof seed, &len);
<> 0:eb73febb2bba 576
<> 0:eb73febb2bba 577 #else
<> 0:eb73febb2bba 578
<> 0:eb73febb2bba 579 #error "This hardware does not have entropy, endpoint will not register to Connector.\
<> 0:eb73febb2bba 580 You need to enable NULL ENTROPY for your application, but if this configuration change is made then no security is offered by mbed TLS.\
<> 0:eb73febb2bba 581 Add MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES and MBEDTLS_TEST_NULL_ENTROPY in mbed_app.json macros to register your endpoint."
<> 0:eb73febb2bba 582
<> 0:eb73febb2bba 583 #endif
<> 0:eb73febb2bba 584
dkato 2:6ec5c1c1d41c 585 srand(seed);
1050186 12:7a199eff6988 586 red_led = LED_OFF;
1050186 12:7a199eff6988 587 #ifdef TARGET_GR_LYCHEE
1050186 12:7a199eff6988 588 orange_led = LED_OFF;
dkato 2:6ec5c1c1d41c 589 #else
1050186 12:7a199eff6988 590 blue_led = LED_OFF;
dkato 2:6ec5c1c1d41c 591 #endif
<> 0:eb73febb2bba 592
1050186 12:7a199eff6988 593 status_ticker.attach_us(blinky, 250000);
1050186 12:7a199eff6988 594 // Keep track of the main thread
1050186 12:7a199eff6988 595 osThreadId mainThread = osThreadGetId();
1050186 12:7a199eff6988 596
1050186 12:7a199eff6988 597 printf("\nStarting mbed Client example\n");
1050186 12:7a199eff6988 598
<> 0:eb73febb2bba 599 mbed_trace_init();
1050186 12:7a199eff6988 600 mbed_trace_print_function_set(trace_printer);
1050186 12:7a199eff6988 601 mbed_trace_config_set(TRACE_MODE_COLOR | TRACE_ACTIVE_LEVEL_INFO | TRACE_CARRIAGE_RETURN);
<> 0:eb73febb2bba 602
1050186 6:4e43b6f8f772 603 #if defined(TARGET_RZ_A1H) && (MBED_CONF_APP_NETWORK_INTERFACE == WIFI_BP3595)
dkato 2:6ec5c1c1d41c 604 DigitalOut usb1en(P3_8);
<> 0:eb73febb2bba 605 usb1en = 1;
<> 0:eb73febb2bba 606 Thread::wait(5);
<> 0:eb73febb2bba 607 usb1en = 0;
<> 0:eb73febb2bba 608 Thread::wait(5);
<> 0:eb73febb2bba 609 #endif
dkato 2:6ec5c1c1d41c 610
dkato 2:6ec5c1c1d41c 611 NetworkInterface* network = easy_connect(true);
dkato 2:6ec5c1c1d41c 612 if(network == NULL) {
dkato 2:6ec5c1c1d41c 613 printf("\nConnection to Network Failed - exiting application...\n");
dkato 2:6ec5c1c1d41c 614 return -1;
<> 0:eb73febb2bba 615 }
1050186 12:7a199eff6988 616
1050186 12:7a199eff6988 617 // we create our button, timer and LED resources
1050186 12:7a199eff6988 618 ButtonResource button_resource;
<> 0:eb73febb2bba 619 LedResource led_resource;
1050186 12:7a199eff6988 620 BigPayloadResource big_payload_resource;
1050186 12:7a199eff6988 621 TimerResource timer_resource;
1050186 12:7a199eff6988 622
1050186 12:7a199eff6988 623 // Network interaction must be performed outside of interrupt context
1050186 12:7a199eff6988 624 Semaphore updates(0);
1050186 12:7a199eff6988 625
1050186 12:7a199eff6988 626 InteractionProvider interaction_provider(updates);
1050186 12:7a199eff6988 627
<> 0:eb73febb2bba 628
<> 0:eb73febb2bba 629 // Create endpoint interface to manage register and unregister
dkato 2:6ec5c1c1d41c 630 mbed_client.create_interface(MBED_SERVER_ADDRESS, network);
<> 0:eb73febb2bba 631
<> 0:eb73febb2bba 632 // Create Objects of varying types, see simpleclient.h for more details on implementation.
<> 0:eb73febb2bba 633 M2MSecurity* register_object = mbed_client.create_register_object(); // server object specifying connector info
<> 0:eb73febb2bba 634 M2MDevice* device_object = mbed_client.create_device_object(); // device resources object
<> 0:eb73febb2bba 635
<> 0:eb73febb2bba 636 // Create list of Objects to register
<> 0:eb73febb2bba 637 M2MObjectList object_list;
<> 0:eb73febb2bba 638
<> 0:eb73febb2bba 639 // Add objects to list
<> 0:eb73febb2bba 640 object_list.push_back(device_object);
1050186 12:7a199eff6988 641 object_list.push_back(button_resource.get_object());
dkato 2:6ec5c1c1d41c 642 object_list.push_back(led_resource.get_object());
1050186 12:7a199eff6988 643 object_list.push_back(big_payload_resource.get_object());
1050186 12:7a199eff6988 644 object_list.push_back(timer_resource.get_object());
<> 0:eb73febb2bba 645 object_list.push_back(zxing_resource.get_object());
<> 0:eb73febb2bba 646
<> 0:eb73febb2bba 647 // Set endpoint registration object
<> 0:eb73febb2bba 648 mbed_client.set_register_object(register_object);
<> 0:eb73febb2bba 649
<> 0:eb73febb2bba 650 // Register with mbed Device Connector
<> 0:eb73febb2bba 651 mbed_client.test_register(register_object, object_list);
1050186 12:7a199eff6988 652 volatile bool registered = true;
<> 0:eb73febb2bba 653
1050186 12:7a199eff6988 654 #ifdef TARGET_GR_LYCHEE
<> 0:eb73febb2bba 655 zxing_init(&callback_zxing);
dkato 2:6ec5c1c1d41c 656
<> 0:eb73febb2bba 657 Timer update_timer;
<> 0:eb73febb2bba 658 update_timer.reset();
<> 0:eb73febb2bba 659 update_timer.start();
<> 0:eb73febb2bba 660
1050186 12:7a199eff6988 661 while (true) {
<> 0:eb73febb2bba 662 if (zxing_loop() == 0) {
<> 0:eb73febb2bba 663 update_timer.reset();
<> 0:eb73febb2bba 664 } else if (update_timer.read() >= 25) {
<> 0:eb73febb2bba 665 mbed_client.test_update_register();
<> 0:eb73febb2bba 666 update_timer.reset();
<> 0:eb73febb2bba 667 } else {
<> 0:eb73febb2bba 668 // do nothing
<> 0:eb73febb2bba 669 }
<> 0:eb73febb2bba 670 Thread::wait(5);
<> 0:eb73febb2bba 671 }
1050186 12:7a199eff6988 672 #else
1050186 12:7a199eff6988 673 while (true) {
1050186 12:7a199eff6988 674 updates.wait(25000);
1050186 12:7a199eff6988 675 if(registered) {
1050186 12:7a199eff6988 676 if(!interaction_provider.clicked) {
1050186 12:7a199eff6988 677 mbed_client.test_update_register();
1050186 12:7a199eff6988 678 }
1050186 12:7a199eff6988 679 }else {
1050186 12:7a199eff6988 680 break;
1050186 12:7a199eff6988 681 }
1050186 12:7a199eff6988 682 if(interaction_provider.clicked) {
1050186 12:7a199eff6988 683 interaction_provider.clicked = false;
1050186 12:7a199eff6988 684 button_resource.handle_button_click();
1050186 12:7a199eff6988 685 }
1050186 12:7a199eff6988 686 if(interaction_provider.timer_ticked) {
1050186 12:7a199eff6988 687 interaction_provider.timer_ticked = false;
1050186 12:7a199eff6988 688 timer_resource.handle_timer_tick();
1050186 12:7a199eff6988 689 }
1050186 12:7a199eff6988 690 }
1050186 12:7a199eff6988 691 #endif
<> 0:eb73febb2bba 692
<> 0:eb73febb2bba 693 mbed_client.test_unregister();
1050186 12:7a199eff6988 694 status_ticker.detach();
<> 0:eb73febb2bba 695 }
dkato 2:6ec5c1c1d41c 696
dkato 2:6ec5c1c1d41c 697 #endif // MBED_CONF_APP_NETWORK_INTERFACE != NO_CONNECT
dkato 2:6ec5c1c1d41c 698
dkato 2:6ec5c1c1d41c 699