天天看點

QRcode Decode : Weekly Report on Aug. 9thQRcode Decode : Weekly Report on Aug. 9th

QRcode Decode : Weekly Report on Aug. 9th

This week I have finished all mode of decode and started with the encoder.

And I have passed the testing bin of OPENCV_EXTRA.

1.FNC1 Mode

In this mode , we just need to recover QR-Code symbols and GS from encoded information.All data information should be remained the same and we don’t need to insert interpretation of application indicator in decoded string.

1.1 FNC1 in the first positon

bool QRDecode::fnc1_first

is the symbol of FNC1 mode.And FNC1 mode is reflected in other mode decoding processes.

Here is the flowchat of how it works:

QRcode Decode : Weekly Report on Aug. 9thQRcode Decode : Weekly Report on Aug. 9th

1.2 FNC1 in the second positon

bool QRDecode::fnc1_second

is the symbol of FNC1 mode .

uint32_t QRDecode::fnc1_second_AI

is the 8-bit codeword of Application Indicator.

Here is the flowchat of how it works:

QRcode Decode : Weekly Report on Aug. 9thQRcode Decode : Weekly Report on Aug. 9th
case QR_MODE_FNC1FIRST:
                fnc1_first = true;
                break;
            case QR_MODE_FNC1SECOND:
            /*get AI codeword*/
                fnc1_second_AI = get_bits(8,ptr);
                fnc1_second = true;
                break;
           
QRcode Decode : Weekly Report on Aug. 9thQRcode Decode : Weekly Report on Aug. 9th

After scanning sevral QR-code , I find that DataToEncode actually does not contain “~2” as beginning indicator or as separator .

The encoded data is straightly :

37AA1234BBB1128200https://www.idautomation.com

.

So I just add the indicator of

]Q3

and

]Q5

, and keep the data all the same.

my output :

]Q537AA1234BBB1128200https://www.idautomation.com

I wonder if it is ok for me to do that…

if(fnc1_first){
        if(payload_len == 0)
            load_string(payload,payload_len,"]Q3");
        for (int i = 0; i < (int) fnc_buffer.length(); i++) {
            payload[payload_len++] = uint8_t(fnc_buffer[i]);
        }
    }
    else if(fnc1_second){//
        if(payload_len == 0)
            load_string(payload,payload_len,"]Q5");
        for (int i = 0; i < (int) fnc_buffer.length(); i++) {
            payload[payload_len++] = uint8_t(fnc_buffer[i]);
        }
    }
           

2. Structure Append Mode

In this mode , we just need to get the additional two codeword of Structure Append Mode.

The first codeword is symbol sequence indicator

The second one is parity data,which is identical in all append message to enable all readable symbols are part of the same Structured Append message

decode_error QRDecode::decode_structure(uint8_t * &ptr){
    if(bits_remaining(ptr)<16)
        return ERROR_DATA_UNDERFLOW;
    int sequence_indicator = get_bits(8,ptr);
    int parity_data = get_bits(8,ptr);
    return  SUCCESS;
}
           

3. Next task

Do I need to finish the Micro QR-code decoder first or the Standard QR-code encoder?

As the number of Locator Pattern is different , the original Detect code does not work for Micro QR-code. So should I focus on the encoder next or not?

Looking forward to hearing from you!

Qiushi 2020.0809