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 // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
Osamu Nakamura 0:7d720671e6dc 2 /*
Osamu Nakamura 0:7d720671e6dc 3 * Copyright 2013 ZXing authors All rights reserved.
Osamu Nakamura 0:7d720671e6dc 4 *
Osamu Nakamura 0:7d720671e6dc 5 * Licensed under the Apache License, Version 2.0 (the "License");
Osamu Nakamura 0:7d720671e6dc 6 * you may not use this file except in compliance with the License.
Osamu Nakamura 0:7d720671e6dc 7 * You may obtain a copy of the License at
Osamu Nakamura 0:7d720671e6dc 8 *
Osamu Nakamura 0:7d720671e6dc 9 * http://www.apache.org/licenses/LICENSE-2.0
Osamu Nakamura 0:7d720671e6dc 10 *
Osamu Nakamura 0:7d720671e6dc 11 * Unless required by applicable law or agreed to in writing, software
Osamu Nakamura 0:7d720671e6dc 12 * distributed under the License is distributed on an "AS IS" BASIS,
Osamu Nakamura 0:7d720671e6dc 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Osamu Nakamura 0:7d720671e6dc 14 * See the License for the specific language governing permissions and
Osamu Nakamura 0:7d720671e6dc 15 * limitations under the License.
Osamu Nakamura 0:7d720671e6dc 16 */
Osamu Nakamura 0:7d720671e6dc 17 #ifndef __ZXING_H_
Osamu Nakamura 0:7d720671e6dc 18 #define __ZXING_H_
Osamu Nakamura 0:7d720671e6dc 19
Osamu Nakamura 0:7d720671e6dc 20 #define ZXING_ARRAY_LEN(v) ((int)(sizeof(v)/sizeof(v[0])))
Osamu Nakamura 0:7d720671e6dc 21 #define ZX_LOG_DIGITS(digits) \
Osamu Nakamura 0:7d720671e6dc 22 ((digits == 8) ? 3 : \
Osamu Nakamura 0:7d720671e6dc 23 ((digits == 16) ? 4 : \
Osamu Nakamura 0:7d720671e6dc 24 ((digits == 32) ? 5 : \
Osamu Nakamura 0:7d720671e6dc 25 ((digits == 64) ? 6 : \
Osamu Nakamura 0:7d720671e6dc 26 ((digits == 128) ? 7 : \
Osamu Nakamura 0:7d720671e6dc 27 (-1))))))
Osamu Nakamura 0:7d720671e6dc 28
Osamu Nakamura 0:7d720671e6dc 29 #ifndef ZXING_DEBUG
Osamu Nakamura 0:7d720671e6dc 30 #define ZXING_DEBUG 0
Osamu Nakamura 0:7d720671e6dc 31 #endif
Osamu Nakamura 0:7d720671e6dc 32
Osamu Nakamura 0:7d720671e6dc 33 namespace zxing {
Osamu Nakamura 0:7d720671e6dc 34 typedef char byte;
Osamu Nakamura 0:7d720671e6dc 35 typedef bool boolean;
Osamu Nakamura 0:7d720671e6dc 36 }
Osamu Nakamura 0:7d720671e6dc 37
Osamu Nakamura 0:7d720671e6dc 38 #include <limits>
Osamu Nakamura 0:7d720671e6dc 39
Osamu Nakamura 0:7d720671e6dc 40 #if defined(_WIN32) || defined(_WIN64)
Osamu Nakamura 0:7d720671e6dc 41
Osamu Nakamura 0:7d720671e6dc 42 #include <float.h>
Osamu Nakamura 0:7d720671e6dc 43
Osamu Nakamura 0:7d720671e6dc 44 namespace zxing {
Osamu Nakamura 0:7d720671e6dc 45 inline bool isnan(float v) {return _isnan(v) != 0;}
Osamu Nakamura 0:7d720671e6dc 46 inline bool isnan(double v) {return _isnan(v) != 0;}
Osamu Nakamura 0:7d720671e6dc 47 inline float nan() {return std::numeric_limits<float>::quiet_NaN();}
Osamu Nakamura 0:7d720671e6dc 48 }
Osamu Nakamura 0:7d720671e6dc 49
Osamu Nakamura 0:7d720671e6dc 50 #else
Osamu Nakamura 0:7d720671e6dc 51
Osamu Nakamura 0:7d720671e6dc 52 #include <cmath>
Osamu Nakamura 0:7d720671e6dc 53
Osamu Nakamura 0:7d720671e6dc 54 namespace zxing {
Osamu Nakamura 0:7d720671e6dc 55 #if defined(__ICCARM__) || defined( __CC_ARM ) //
Osamu Nakamura 0:7d720671e6dc 56 #else //
Osamu Nakamura 0:7d720671e6dc 57 inline bool isnan(float v) {return std::isnan(v);}
Osamu Nakamura 0:7d720671e6dc 58 inline bool isnan(double v) {return std::isnan(v);}
Osamu Nakamura 0:7d720671e6dc 59 #endif //
Osamu Nakamura 0:7d720671e6dc 60 inline float nan() {return std::numeric_limits<float>::quiet_NaN();}
Osamu Nakamura 0:7d720671e6dc 61 }
Osamu Nakamura 0:7d720671e6dc 62 #endif
Osamu Nakamura 0:7d720671e6dc 63
Osamu Nakamura 0:7d720671e6dc 64 #if ZXING_DEBUG
Osamu Nakamura 0:7d720671e6dc 65
Osamu Nakamura 0:7d720671e6dc 66 #include <iostream>
Osamu Nakamura 0:7d720671e6dc 67 #include <string>
Osamu Nakamura 0:7d720671e6dc 68
Osamu Nakamura 0:7d720671e6dc 69 using std::cout;
Osamu Nakamura 0:7d720671e6dc 70 using std::cerr;
Osamu Nakamura 0:7d720671e6dc 71 using std::endl;
Osamu Nakamura 0:7d720671e6dc 72 using std::flush;
Osamu Nakamura 0:7d720671e6dc 73 using std::string;
Osamu Nakamura 0:7d720671e6dc 74 using std::ostream;
Osamu Nakamura 0:7d720671e6dc 75
Osamu Nakamura 0:7d720671e6dc 76 #if ZXING_DEBUG_TIMER
Osamu Nakamura 0:7d720671e6dc 77
Osamu Nakamura 0:7d720671e6dc 78 #include <sys/time.h>
Osamu Nakamura 0:7d720671e6dc 79
Osamu Nakamura 0:7d720671e6dc 80 namespace zxing {
Osamu Nakamura 0:7d720671e6dc 81
Osamu Nakamura 0:7d720671e6dc 82 class DebugTimer {
Osamu Nakamura 0:7d720671e6dc 83 public:
Osamu Nakamura 0:7d720671e6dc 84 DebugTimer(char const* string_) : chars(string_) {
Osamu Nakamura 0:7d720671e6dc 85 gettimeofday(&start, 0);
Osamu Nakamura 0:7d720671e6dc 86 }
Osamu Nakamura 0:7d720671e6dc 87
Osamu Nakamura 0:7d720671e6dc 88 DebugTimer(std::string const& string_) : chars(0), string(string_) {
Osamu Nakamura 0:7d720671e6dc 89 gettimeofday(&start, 0);
Osamu Nakamura 0:7d720671e6dc 90 }
Osamu Nakamura 0:7d720671e6dc 91
Osamu Nakamura 0:7d720671e6dc 92 void mark(char const* string) {
Osamu Nakamura 0:7d720671e6dc 93 struct timeval end;
Osamu Nakamura 0:7d720671e6dc 94 gettimeofday(&end, 0);
Osamu Nakamura 0:7d720671e6dc 95 int diff =
Osamu Nakamura 0:7d720671e6dc 96 (end.tv_sec - start.tv_sec)*1000*1000+(end.tv_usec - start.tv_usec);
Osamu Nakamura 0:7d720671e6dc 97
Osamu Nakamura 0:7d720671e6dc 98 cerr << diff << " " << string << '\n';
Osamu Nakamura 0:7d720671e6dc 99 }
Osamu Nakamura 0:7d720671e6dc 100
Osamu Nakamura 0:7d720671e6dc 101 void mark(std::string string) {
Osamu Nakamura 0:7d720671e6dc 102 mark(string.c_str());
Osamu Nakamura 0:7d720671e6dc 103 }
Osamu Nakamura 0:7d720671e6dc 104
Osamu Nakamura 0:7d720671e6dc 105 ~DebugTimer() {
Osamu Nakamura 0:7d720671e6dc 106 if (chars) {
Osamu Nakamura 0:7d720671e6dc 107 mark(chars);
Osamu Nakamura 0:7d720671e6dc 108 } else {
Osamu Nakamura 0:7d720671e6dc 109 mark(string.c_str());
Osamu Nakamura 0:7d720671e6dc 110 }
Osamu Nakamura 0:7d720671e6dc 111 }
Osamu Nakamura 0:7d720671e6dc 112
Osamu Nakamura 0:7d720671e6dc 113 private:
Osamu Nakamura 0:7d720671e6dc 114 char const* const chars;
Osamu Nakamura 0:7d720671e6dc 115 std::string string;
Osamu Nakamura 0:7d720671e6dc 116 struct timeval start;
Osamu Nakamura 0:7d720671e6dc 117 };
Osamu Nakamura 0:7d720671e6dc 118
Osamu Nakamura 0:7d720671e6dc 119 }
Osamu Nakamura 0:7d720671e6dc 120
Osamu Nakamura 0:7d720671e6dc 121 #define ZXING_TIME(string) DebugTimer __timer__ (string)
Osamu Nakamura 0:7d720671e6dc 122 #define ZXING_TIME_MARK(string) __timer__.mark(string)
Osamu Nakamura 0:7d720671e6dc 123
Osamu Nakamura 0:7d720671e6dc 124 #endif
Osamu Nakamura 0:7d720671e6dc 125
Osamu Nakamura 0:7d720671e6dc 126 #endif // ZXING_DEBUG
Osamu Nakamura 0:7d720671e6dc 127
Osamu Nakamura 0:7d720671e6dc 128 #ifndef ZXING_TIME
Osamu Nakamura 0:7d720671e6dc 129 #define ZXING_TIME(string) (void)0
Osamu Nakamura 0:7d720671e6dc 130 #endif
Osamu Nakamura 0:7d720671e6dc 131 #ifndef ZXING_TIME_MARK
Osamu Nakamura 0:7d720671e6dc 132 #define ZXING_TIME_MARK(string) (void)0
Osamu Nakamura 0:7d720671e6dc 133 #endif
Osamu Nakamura 0:7d720671e6dc 134
Osamu Nakamura 0:7d720671e6dc 135 #endif