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:
Tue Dec 18 07:37:37 2018 +0000
Revision:
22:a3cd35c5cff0
Parent:
10:c36cf363bf55
Modify README.md file.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 0:eb73febb2bba 1
<> 0:eb73febb2bba 2 #include "mbed.h"
1050186 6:4e43b6f8f772 3 #include "EasyAttach_CameraAndLCD.h"
<> 0:eb73febb2bba 4 #include "ImageReaderSource.h"
dkato 10:c36cf363bf55 5 #include "AsciiFont.h"
<> 0:eb73febb2bba 6
<> 0:eb73febb2bba 7 /**** User Selection *********/
dkato 2:6ec5c1c1d41c 8 /** JPEG out setting **/
1050186 6:4e43b6f8f772 9 #define JPEG_SEND (1) /* Select 0(JPEG images are not output to PC) or 1(JPEG images are output to PC on USB(CDC) for focusing the camera) */
1050186 6:4e43b6f8f772 10 #define JPEG_ENCODE_QUALITY (75) /* JPEG encode quality (min:1, max:75 (Considering the size of JpegBuffer, about 75 is the upper limit.)) */
1050186 6:4e43b6f8f772 11 #define VFIELD_INT_SKIP_CNT (0) /* A guide for GR-LYCHEE. 0:60fps, 1:30fps, 2:20fps, 3:15fps, 4:12fps, 5:10fps */
dkato 2:6ec5c1c1d41c 12 /** Decode hints **/
dkato 2:6ec5c1c1d41c 13 #define DECODE_HINTS (DecodeHints::ONED_HINT | DecodeHints::QR_CODE_HINT | DecodeHints::DATA_MATRIX_HINT | DecodeHints::AZTEC_HINT)
<> 0:eb73febb2bba 14 /*****************************/
<> 0:eb73febb2bba 15
1050186 6:4e43b6f8f772 16 /* Video input and LCD layer 0 output */
1050186 6:4e43b6f8f772 17 #define VIDEO_FORMAT (DisplayBase::VIDEO_FORMAT_YCBCR422)
1050186 6:4e43b6f8f772 18 #define GRAPHICS_FORMAT (DisplayBase::GRAPHICS_FORMAT_YCBCR422)
1050186 6:4e43b6f8f772 19 //#define WR_RD_WRSWA (DisplayBase::WR_RD_WRSWA_32_16BIT)
1050186 6:4e43b6f8f772 20 #define WR_RD_WRSWA (DisplayBase::WR_RD_WRSWA_16BIT)
1050186 6:4e43b6f8f772 21 #define DATA_SIZE_PER_PIC (2u)
1050186 6:4e43b6f8f772 22
1050186 6:4e43b6f8f772 23 /*! Frame buffer stride: Frame buffer stride should be set to a multiple of 32 or 128
1050186 6:4e43b6f8f772 24 in accordance with the frame buffer burst transfer mode. */
1050186 6:4e43b6f8f772 25 #if MBED_CONF_APP_LCD
1050186 6:4e43b6f8f772 26 #define VIDEO_PIXEL_HW LCD_PIXEL_WIDTH /* QVGA */
1050186 6:4e43b6f8f772 27 #define VIDEO_PIXEL_VW LCD_PIXEL_HEIGHT /* QVGA */
<> 0:eb73febb2bba 28 #else
1050186 6:4e43b6f8f772 29 #define VIDEO_PIXEL_HW (640u) /* VGA */
1050186 6:4e43b6f8f772 30 #define VIDEO_PIXEL_VW (480u) /* VGA */
<> 0:eb73febb2bba 31 #endif
1050186 6:4e43b6f8f772 32
1050186 6:4e43b6f8f772 33 #define FRAME_BUFFER_STRIDE (((VIDEO_PIXEL_HW * DATA_SIZE_PER_PIC) + 31u) & ~31u)
1050186 6:4e43b6f8f772 34 #define FRAME_BUFFER_HEIGHT (VIDEO_PIXEL_VW)
1050186 6:4e43b6f8f772 35
1050186 6:4e43b6f8f772 36 DisplayBase Display;
1050186 6:4e43b6f8f772 37 // Timer
1050186 6:4e43b6f8f772 38 static Timer decode_timer;
1050186 6:4e43b6f8f772 39
1050186 6:4e43b6f8f772 40 #if defined(__ICCARM__)
1050186 6:4e43b6f8f772 41 #pragma data_alignment=32
1050186 6:4e43b6f8f772 42 static uint8_t user_frame_buffer0[FRAME_BUFFER_STRIDE * FRAME_BUFFER_HEIGHT]@ ".mirrorram";
1050186 6:4e43b6f8f772 43 #else
1050186 6:4e43b6f8f772 44 static uint8_t user_frame_buffer0[FRAME_BUFFER_STRIDE * FRAME_BUFFER_HEIGHT]__attribute((section("NC_BSS"),aligned(32)));
dkato 2:6ec5c1c1d41c 45 #endif
dkato 2:6ec5c1c1d41c 46
dkato 4:076b3dd7c0e6 47 #if JPEG_SEND
1050186 6:4e43b6f8f772 48 #include "JPEG_Converter.h"
1050186 6:4e43b6f8f772 49 #include "DisplayApp.h"
1050186 6:4e43b6f8f772 50 #include "dcache-control.h"
dkato 2:6ec5c1c1d41c 51
1050186 6:4e43b6f8f772 52 #if defined(__ICCARM__)
1050186 6:4e43b6f8f772 53 #pragma data_alignment=32
1050186 6:4e43b6f8f772 54 static uint8_t JpegBuffer[2][1024 * 64];
dkato 2:6ec5c1c1d41c 55 #else
1050186 6:4e43b6f8f772 56 static uint8_t JpegBuffer[2][1024 * 64]__attribute((aligned(32)));
<> 0:eb73febb2bba 57 #endif
1050186 6:4e43b6f8f772 58 static size_t jcu_encode_size[2];
1050186 6:4e43b6f8f772 59 static JPEG_Converter Jcu;
1050186 6:4e43b6f8f772 60 static int jcu_buf_index_write = 0;
1050186 6:4e43b6f8f772 61 static int jcu_buf_index_write_done = 0;
1050186 6:4e43b6f8f772 62 static int jcu_buf_index_read = 0;
1050186 6:4e43b6f8f772 63 static volatile int jcu_encoding = 0;
1050186 6:4e43b6f8f772 64 static volatile int image_change = 0;
1050186 6:4e43b6f8f772 65 static DisplayApp display_app;
1050186 6:4e43b6f8f772 66 static int Vfield_Int_Cnt = 0;
<> 0:eb73febb2bba 67
<> 0:eb73febb2bba 68 static int decode_wait_time = 0;
<> 0:eb73febb2bba 69 static void (*p_callback_func)(char * addr, int size);
<> 0:eb73febb2bba 70
1050186 6:4e43b6f8f772 71 static void JcuEncodeCallBackFunc(JPEG_Converter::jpeg_conv_error_t err_code) {
1050186 6:4e43b6f8f772 72 if (err_code == JPEG_Converter::JPEG_CONV_OK) {
1050186 6:4e43b6f8f772 73 jcu_buf_index_write_done = jcu_buf_index_write;
1050186 6:4e43b6f8f772 74 image_change = 1;
1050186 6:4e43b6f8f772 75 }
1050186 6:4e43b6f8f772 76 jcu_encoding = 0;
1050186 6:4e43b6f8f772 77 }
<> 0:eb73febb2bba 78
1050186 6:4e43b6f8f772 79 static void snapshot(void) {
1050186 6:4e43b6f8f772 80 while ((jcu_encoding == 1) || (image_change == 0)) {
1050186 6:4e43b6f8f772 81 Thread::wait(1);
<> 0:eb73febb2bba 82 }
1050186 6:4e43b6f8f772 83 jcu_buf_index_read = jcu_buf_index_write_done;
1050186 6:4e43b6f8f772 84 image_change = 0;
1050186 6:4e43b6f8f772 85 display_app.SendJpeg(JpegBuffer[jcu_buf_index_read], (int)jcu_encode_size[jcu_buf_index_read]);
<> 0:eb73febb2bba 86 }
<> 0:eb73febb2bba 87
1050186 6:4e43b6f8f772 88 static void IntCallbackFunc_Vfield(DisplayBase::int_type_t int_type) {
1050186 6:4e43b6f8f772 89 if (Vfield_Int_Cnt < VFIELD_INT_SKIP_CNT) {
1050186 6:4e43b6f8f772 90 Vfield_Int_Cnt++;
1050186 6:4e43b6f8f772 91 return;
1050186 6:4e43b6f8f772 92 }
1050186 6:4e43b6f8f772 93 Vfield_Int_Cnt = 0;
1050186 6:4e43b6f8f772 94
1050186 6:4e43b6f8f772 95 //Interrupt callback function
1050186 6:4e43b6f8f772 96 if (jcu_encoding == 0) {
1050186 6:4e43b6f8f772 97 JPEG_Converter::bitmap_buff_info_t bitmap_buff_info;
1050186 6:4e43b6f8f772 98 JPEG_Converter::encode_options_t encode_options;
1050186 6:4e43b6f8f772 99
1050186 6:4e43b6f8f772 100 bitmap_buff_info.width = VIDEO_PIXEL_HW;
1050186 6:4e43b6f8f772 101 bitmap_buff_info.height = VIDEO_PIXEL_VW;
1050186 6:4e43b6f8f772 102 bitmap_buff_info.format = JPEG_Converter::WR_RD_YCbCr422;
1050186 6:4e43b6f8f772 103 bitmap_buff_info.buffer_address = (void *)user_frame_buffer0;
1050186 6:4e43b6f8f772 104
1050186 6:4e43b6f8f772 105 encode_options.encode_buff_size = sizeof(JpegBuffer[0]);
1050186 6:4e43b6f8f772 106 encode_options.p_EncodeCallBackFunc = &JcuEncodeCallBackFunc;
1050186 6:4e43b6f8f772 107 // encode_options.input_swapsetting = JPEG_Converter::WR_RD_WRSWA_32_16_8BIT;
1050186 6:4e43b6f8f772 108 encode_options.input_swapsetting = JPEG_Converter::WR_RD_WRSWA_16_8BIT;
1050186 6:4e43b6f8f772 109
1050186 6:4e43b6f8f772 110 jcu_encoding = 1;
1050186 6:4e43b6f8f772 111 if (jcu_buf_index_read == jcu_buf_index_write) {
1050186 6:4e43b6f8f772 112 jcu_buf_index_write ^= 1; // toggle
1050186 6:4e43b6f8f772 113 }
1050186 6:4e43b6f8f772 114 jcu_encode_size[jcu_buf_index_write] = 0;
1050186 6:4e43b6f8f772 115 dcache_invalid(JpegBuffer[jcu_buf_index_write], sizeof(JpegBuffer[0]));
1050186 6:4e43b6f8f772 116 if (Jcu.encode(&bitmap_buff_info, JpegBuffer[jcu_buf_index_write],
1050186 6:4e43b6f8f772 117 &jcu_encode_size[jcu_buf_index_write], &encode_options) != JPEG_Converter::JPEG_CONV_OK) {
1050186 6:4e43b6f8f772 118 jcu_encode_size[jcu_buf_index_write] = 0;
1050186 6:4e43b6f8f772 119 jcu_encoding = 0;
1050186 6:4e43b6f8f772 120 }
1050186 6:4e43b6f8f772 121 }
1050186 6:4e43b6f8f772 122 }
1050186 6:4e43b6f8f772 123 #endif
1050186 6:4e43b6f8f772 124
1050186 6:4e43b6f8f772 125 static void Start_Video_Camera(void) {
1050186 6:4e43b6f8f772 126 // Video capture setting (progressive form fixed)
1050186 6:4e43b6f8f772 127 Display.Video_Write_Setting(
1050186 6:4e43b6f8f772 128 DisplayBase::VIDEO_INPUT_CHANNEL_0,
1050186 6:4e43b6f8f772 129 DisplayBase::COL_SYS_NTSC_358,
1050186 6:4e43b6f8f772 130 (void *)user_frame_buffer0,
1050186 6:4e43b6f8f772 131 FRAME_BUFFER_STRIDE,
1050186 6:4e43b6f8f772 132 VIDEO_FORMAT,
1050186 6:4e43b6f8f772 133 WR_RD_WRSWA,
1050186 6:4e43b6f8f772 134 VIDEO_PIXEL_VW,
1050186 6:4e43b6f8f772 135 VIDEO_PIXEL_HW
1050186 6:4e43b6f8f772 136 );
1050186 6:4e43b6f8f772 137 EasyAttach_CameraStart(Display, DisplayBase::VIDEO_INPUT_CHANNEL_0);
1050186 6:4e43b6f8f772 138 }
1050186 6:4e43b6f8f772 139
1050186 6:4e43b6f8f772 140 #if MBED_CONF_APP_LCD
1050186 6:4e43b6f8f772 141 static void Start_LCD_Display(void) {
<> 0:eb73febb2bba 142 DisplayBase::rect_t rect;
<> 0:eb73febb2bba 143
<> 0:eb73febb2bba 144 rect.vs = 0;
1050186 6:4e43b6f8f772 145 rect.vw = LCD_PIXEL_HEIGHT;
<> 0:eb73febb2bba 146 rect.hs = 0;
1050186 6:4e43b6f8f772 147 rect.hw = LCD_PIXEL_WIDTH;
<> 0:eb73febb2bba 148 Display.Graphics_Read_Setting(
<> 0:eb73febb2bba 149 DisplayBase::GRAPHICS_LAYER_0,
1050186 6:4e43b6f8f772 150 (void *)user_frame_buffer0,
<> 0:eb73febb2bba 151 FRAME_BUFFER_STRIDE,
<> 0:eb73febb2bba 152 GRAPHICS_FORMAT,
<> 0:eb73febb2bba 153 WR_RD_WRSWA,
<> 0:eb73febb2bba 154 &rect
<> 0:eb73febb2bba 155 );
<> 0:eb73febb2bba 156 Display.Graphics_Start(DisplayBase::GRAPHICS_LAYER_0);
dkato 2:6ec5c1c1d41c 157
1050186 6:4e43b6f8f772 158 Thread::wait(50);
1050186 6:4e43b6f8f772 159 EasyAttach_LcdBacklight(true);
dkato 2:6ec5c1c1d41c 160 }
dkato 10:c36cf363bf55 161
dkato 10:c36cf363bf55 162 #define VIDEO_PIXEL_HW_STR (VIDEO_PIXEL_HW - 64)
dkato 10:c36cf363bf55 163 #define VIDEO_PIXEL_VW_STR (VIDEO_PIXEL_VW - 64)
dkato 10:c36cf363bf55 164 #define FRAME_BUFFER_BYTE_PER_PIXEL_STR (2u)
dkato 10:c36cf363bf55 165 #define FRAME_BUFFER_STRIDE_STR (((VIDEO_PIXEL_HW_STR * FRAME_BUFFER_BYTE_PER_PIXEL_STR) + 31u) & ~31u)
dkato 10:c36cf363bf55 166
dkato 10:c36cf363bf55 167 static uint8_t user_frame_buffer_string[FRAME_BUFFER_STRIDE_STR * VIDEO_PIXEL_VW_STR]__attribute((section("NC_BSS"),aligned(32)));
dkato 10:c36cf363bf55 168 static AsciiFont ascii_font(user_frame_buffer_string, VIDEO_PIXEL_HW_STR, VIDEO_PIXEL_VW_STR, FRAME_BUFFER_STRIDE_STR, FRAME_BUFFER_BYTE_PER_PIXEL_STR);
dkato 10:c36cf363bf55 169 static bool string_draw;
dkato 10:c36cf363bf55 170 static int error_cnt;
dkato 10:c36cf363bf55 171
dkato 10:c36cf363bf55 172 static void decode_string_init(void) {
dkato 10:c36cf363bf55 173 DisplayBase::rect_t rect;
dkato 10:c36cf363bf55 174
dkato 10:c36cf363bf55 175 /* The layer by which the touch panel location is drawn */
dkato 10:c36cf363bf55 176 ascii_font.Erase(0x00000000); /* rrrrGBAR (r:Reserve G:Green B:Blue A:Alpha R:Red */
dkato 10:c36cf363bf55 177 rect.vs = 32;
dkato 10:c36cf363bf55 178 rect.vw = VIDEO_PIXEL_VW_STR;
dkato 10:c36cf363bf55 179 rect.hs = 32;
dkato 10:c36cf363bf55 180 rect.hw = VIDEO_PIXEL_HW_STR;
dkato 10:c36cf363bf55 181 Display.Graphics_Read_Setting(
dkato 10:c36cf363bf55 182 DisplayBase::GRAPHICS_LAYER_2,
dkato 10:c36cf363bf55 183 (void *)user_frame_buffer_string,
dkato 10:c36cf363bf55 184 FRAME_BUFFER_STRIDE_STR,
dkato 10:c36cf363bf55 185 DisplayBase::GRAPHICS_FORMAT_ARGB4444,
dkato 10:c36cf363bf55 186 DisplayBase::WR_RD_WRSWA_32_16BIT,
dkato 10:c36cf363bf55 187 &rect
dkato 10:c36cf363bf55 188 );
dkato 10:c36cf363bf55 189 Display.Graphics_Start(DisplayBase::GRAPHICS_LAYER_2);
dkato 10:c36cf363bf55 190 string_draw = false;
dkato 10:c36cf363bf55 191 error_cnt = 0;
dkato 10:c36cf363bf55 192 }
dkato 10:c36cf363bf55 193
dkato 10:c36cf363bf55 194 static void decode_string_disp(char ** decode_str) {
dkato 10:c36cf363bf55 195 if ((decode_str != NULL) && (*decode_str != NULL)) {
dkato 10:c36cf363bf55 196 /* Drow string */
dkato 10:c36cf363bf55 197 ascii_font.Erase(0x00000090); /* rrrrGBAR (r:Reserve G:Green B:Blue A:Alpha R:Red */
dkato 10:c36cf363bf55 198 int rest_size = strlen(*decode_str);
dkato 10:c36cf363bf55 199 int draw_idx = 0;
dkato 10:c36cf363bf55 200 int draw_size;
dkato 10:c36cf363bf55 201 int draw_line = 0;
dkato 10:c36cf363bf55 202
dkato 10:c36cf363bf55 203 while (rest_size > 0) {
dkato 10:c36cf363bf55 204 draw_size = ascii_font.DrawStr(*decode_str + draw_idx, 6, 5 + (18 * draw_line), 0x0000ffff, 2);
dkato 10:c36cf363bf55 205 if (draw_size <= 0) {
dkato 10:c36cf363bf55 206 break;
dkato 10:c36cf363bf55 207 }
dkato 10:c36cf363bf55 208 rest_size -= draw_size;
dkato 10:c36cf363bf55 209 draw_idx += draw_size;
dkato 10:c36cf363bf55 210 draw_line++;
dkato 10:c36cf363bf55 211 }
dkato 10:c36cf363bf55 212 string_draw = true;
dkato 10:c36cf363bf55 213 error_cnt = 0;
dkato 10:c36cf363bf55 214 } else {
dkato 10:c36cf363bf55 215 if (string_draw != false) {
dkato 10:c36cf363bf55 216 error_cnt++;
dkato 10:c36cf363bf55 217 if (error_cnt > 15) {
dkato 10:c36cf363bf55 218 /* Clear string */
dkato 10:c36cf363bf55 219 ascii_font.Erase(0x00000000); /* rrrrGBAR (r:Reserve G:Green B:Blue A:Alpha R:Red */
dkato 10:c36cf363bf55 220 string_draw = false;
dkato 10:c36cf363bf55 221 }
dkato 10:c36cf363bf55 222 }
dkato 10:c36cf363bf55 223 }
dkato 10:c36cf363bf55 224 }
<> 0:eb73febb2bba 225 #endif
<> 0:eb73febb2bba 226
<> 0:eb73febb2bba 227
<> 0:eb73febb2bba 228 /****** zxing_init ******/
<> 0:eb73febb2bba 229 void zxing_init(void (*pfunc)(char * addr, int size)) {
1050186 6:4e43b6f8f772 230 // Initialize the background to black
1050186 6:4e43b6f8f772 231 for (int i = 0; i < (int)sizeof(user_frame_buffer0); i += 2) {
1050186 6:4e43b6f8f772 232 user_frame_buffer0[i + 0] = 0x10;
1050186 6:4e43b6f8f772 233 user_frame_buffer0[i + 1] = 0x80;
1050186 6:4e43b6f8f772 234 }
<> 0:eb73febb2bba 235
dkato 10:c36cf363bf55 236 #if MBED_CONF_APP_LCD
dkato 10:c36cf363bf55 237 EasyAttach_Init(Display, 640, 360);
dkato 10:c36cf363bf55 238 #else
1050186 6:4e43b6f8f772 239 EasyAttach_Init(Display);
dkato 10:c36cf363bf55 240 #endif
1050186 6:4e43b6f8f772 241 #if JPEG_SEND
1050186 6:4e43b6f8f772 242 Jcu.SetQuality(JPEG_ENCODE_QUALITY);
1050186 6:4e43b6f8f772 243 // Interrupt callback function setting (Field end signal for recording function in scaler 0)
1050186 6:4e43b6f8f772 244 Display.Graphics_Irq_Handler_Set(DisplayBase::INT_TYPE_S0_VFIELD, 0, IntCallbackFunc_Vfield);
1050186 6:4e43b6f8f772 245 #endif
1050186 6:4e43b6f8f772 246 Start_Video_Camera();
1050186 6:4e43b6f8f772 247 #if MBED_CONF_APP_LCD
dkato 10:c36cf363bf55 248 decode_string_init();
1050186 6:4e43b6f8f772 249 Start_LCD_Display();
1050186 6:4e43b6f8f772 250 #endif
<> 0:eb73febb2bba 251
<> 0:eb73febb2bba 252 p_callback_func = pfunc;
<> 0:eb73febb2bba 253 decode_timer.reset();
<> 0:eb73febb2bba 254 decode_timer.start();
<> 0:eb73febb2bba 255 }
<> 0:eb73febb2bba 256
<> 0:eb73febb2bba 257 /****** zxing_main ******/
<> 0:eb73febb2bba 258 int zxing_loop() {
<> 0:eb73febb2bba 259 int decode_result = -1;
<> 0:eb73febb2bba 260 vector<Ref<Result> > results;
dkato 2:6ec5c1c1d41c 261 char ** decode_str = NULL;
<> 0:eb73febb2bba 262
<> 0:eb73febb2bba 263 /* Decode barcode image */
<> 0:eb73febb2bba 264 if (decode_timer.read_ms() >= decode_wait_time) {
<> 0:eb73febb2bba 265 decode_timer.reset();
dkato 2:6ec5c1c1d41c 266 DecodeHints hints(DECODE_HINTS);
dkato 2:6ec5c1c1d41c 267 hints.setTryHarder(false);
dkato 2:6ec5c1c1d41c 268 decode_result = ex_decode(user_frame_buffer0, (FRAME_BUFFER_STRIDE * VIDEO_PIXEL_VW), VIDEO_PIXEL_HW, VIDEO_PIXEL_VW, &results, hints);
<> 0:eb73febb2bba 269 if (decode_result == 0) {
<> 0:eb73febb2bba 270 decode_str = (char **)&(results[0]->getText()->getText());
dkato 2:6ec5c1c1d41c 271 int size = strlen(*decode_str);
<> 0:eb73febb2bba 272 if (p_callback_func != NULL) {
<> 0:eb73febb2bba 273 p_callback_func(*decode_str, size);
<> 0:eb73febb2bba 274 }
<> 0:eb73febb2bba 275 decode_wait_time = 500;
<> 0:eb73febb2bba 276 } else {
<> 0:eb73febb2bba 277 decode_wait_time = 10;
<> 0:eb73febb2bba 278 }
dkato 10:c36cf363bf55 279 #if MBED_CONF_APP_LCD
dkato 10:c36cf363bf55 280 decode_string_disp(decode_str);
dkato 10:c36cf363bf55 281 #endif
<> 0:eb73febb2bba 282 }
<> 0:eb73febb2bba 283
<> 0:eb73febb2bba 284 return decode_result;
<> 0:eb73febb2bba 285 }
dkato 2:6ec5c1c1d41c 286