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

Committer:
Osamu Nakamura
Date:
Thu Nov 10 20:23:55 2016 +0900
Revision:
1:67f8b5cfde75
Parent:
0:7d720671e6dc
Revised the initial value of /888/0/7700

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Osamu Nakamura 0:7d720671e6dc 1 /**
Osamu Nakamura 0:7d720671e6dc 2 * @file NamedPointer.cpp
Osamu Nakamura 0:7d720671e6dc 3 * @brief mbed CoAP Endpoint Device Management Named Pointer
Osamu Nakamura 0:7d720671e6dc 4 * @author Doug Anson
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) 2016
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 // Base Class
Osamu Nakamura 0:7d720671e6dc 24 #include "mbed-connector-interface/ObjectInstanceManager.h"
Osamu Nakamura 0:7d720671e6dc 25
Osamu Nakamura 0:7d720671e6dc 26 // constructor
Osamu Nakamura 0:7d720671e6dc 27 NamedPointer::NamedPointer(string name,void *ptr,int index) {
Osamu Nakamura 0:7d720671e6dc 28 this->m_name = name;
Osamu Nakamura 0:7d720671e6dc 29 this->m_ptr = ptr;
Osamu Nakamura 0:7d720671e6dc 30 this->m_index = index;
Osamu Nakamura 0:7d720671e6dc 31 this->m_list = (void *)new NamedPointerList();
Osamu Nakamura 0:7d720671e6dc 32 }
Osamu Nakamura 0:7d720671e6dc 33
Osamu Nakamura 0:7d720671e6dc 34 // copy constructor
Osamu Nakamura 0:7d720671e6dc 35 NamedPointer::NamedPointer(const NamedPointer &np) {
Osamu Nakamura 0:7d720671e6dc 36 this->m_name = np.m_name;
Osamu Nakamura 0:7d720671e6dc 37 this->m_ptr = np.m_ptr;
Osamu Nakamura 0:7d720671e6dc 38 this->m_index = np.m_index;
Osamu Nakamura 0:7d720671e6dc 39 this->m_list = this->copyList(np.m_list);
Osamu Nakamura 0:7d720671e6dc 40 }
Osamu Nakamura 0:7d720671e6dc 41
Osamu Nakamura 0:7d720671e6dc 42 // Destructor
Osamu Nakamura 0:7d720671e6dc 43 NamedPointer::~NamedPointer() {
Osamu Nakamura 0:7d720671e6dc 44 NamedPointerList *list = (NamedPointerList *)this->m_list;
Osamu Nakamura 0:7d720671e6dc 45 if (list != NULL) {
Osamu Nakamura 0:7d720671e6dc 46 delete list;
Osamu Nakamura 0:7d720671e6dc 47 }
Osamu Nakamura 0:7d720671e6dc 48 }
Osamu Nakamura 0:7d720671e6dc 49
Osamu Nakamura 0:7d720671e6dc 50 // Get the Name
Osamu Nakamura 0:7d720671e6dc 51 string NamedPointer::name() {
Osamu Nakamura 0:7d720671e6dc 52 return this->m_name;
Osamu Nakamura 0:7d720671e6dc 53 }
Osamu Nakamura 0:7d720671e6dc 54
Osamu Nakamura 0:7d720671e6dc 55 // Get the Pointer
Osamu Nakamura 0:7d720671e6dc 56 void *NamedPointer::ptr() {
Osamu Nakamura 0:7d720671e6dc 57 return this->m_ptr;
Osamu Nakamura 0:7d720671e6dc 58 }
Osamu Nakamura 0:7d720671e6dc 59
Osamu Nakamura 0:7d720671e6dc 60 // Get the Index
Osamu Nakamura 0:7d720671e6dc 61 int NamedPointer::index() {
Osamu Nakamura 0:7d720671e6dc 62 return this->m_index;
Osamu Nakamura 0:7d720671e6dc 63 }
Osamu Nakamura 0:7d720671e6dc 64
Osamu Nakamura 0:7d720671e6dc 65 // Get any associated list
Osamu Nakamura 0:7d720671e6dc 66 void *NamedPointer::list() {
Osamu Nakamura 0:7d720671e6dc 67 return this->m_list;
Osamu Nakamura 0:7d720671e6dc 68 }
Osamu Nakamura 0:7d720671e6dc 69
Osamu Nakamura 0:7d720671e6dc 70 // Copy the list
Osamu Nakamura 0:7d720671e6dc 71 void *NamedPointer::copyList(void *list) {
Osamu Nakamura 0:7d720671e6dc 72 NamedPointerList *npl = new NamedPointerList();
Osamu Nakamura 0:7d720671e6dc 73 NamedPointerList *tmp_list = (NamedPointerList *)list;
Osamu Nakamura 0:7d720671e6dc 74 for(int i=0;tmp_list != NULL && i<(int)tmp_list->size();++i) {
Osamu Nakamura 0:7d720671e6dc 75 npl->push_back(tmp_list->at(i));
Osamu Nakamura 0:7d720671e6dc 76 }
Osamu Nakamura 0:7d720671e6dc 77 return (void *)npl;
Osamu Nakamura 0:7d720671e6dc 78 }
Osamu Nakamura 0:7d720671e6dc 79