JNIEXPORT void JNICALL Java_com_cghs_stresstest_test_BoardidSwitchTest_setBoardId (JNIEnv *env, jobject obj, jstring bidStr) { struct bid_data tempBid; char *bidchar = js2c(env,bidStr); charToValue(bidchar, tempBid.bid, 90); for (int i = 0; i < 45; i = i + 9) { __android_log_print(ANDROID_LOG_ERROR, "lib_rkinfo", "---------set id: %x %x %x %x %x %x %x %x %x", tempBid.bid[i], tempBid.bid[i+1], tempBid.bid[i+2], tempBid.bid[i+3], tempBid.bid[i+4], tempBid.bid[i+5], tempBid.bid[i+6], tempBid.bid[i+7], tempBid.bid[i+8]); } free(bidchar); bidchar = NULL; board_id_data_set(&tempBid); }
bool PatternGen::parseIRCode(std::string ir_code) { int index = 0; int j = 0; while (index < ir_code.length()) { int step = findStepToNextSpaceOrEnd(ir_code, index); switch (step) { case 0: index++; break; case 1: if (mEncodingType == SDA2208_3 || mEncodingType == GEMINI_C17) { mIrCodes[j++] = '0'; mIrCodes[j++] = '0'; } mIrCodes[j++] = '0'; mIrCodes[j++] = ir_code.at(index++); ++index; break; case 2: if (mEncodingType == SDA2208_3 || mEncodingType == GEMINI_C17) { mIrCodes[j++] = '0'; mIrCodes[j++] = '0'; } mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); ++index; break; case 3: mIrCodes[j++] = '0'; mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); ++index; break; case 4: mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); ++index; break; case 5: mIrCodes[j++] = '0'; mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); ++index; break; case 6: mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); ++index; break; case 7: mIrCodes[j++] = '0'; mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); ++index; break; case 8: mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); mIrCodes[j++] = ir_code.at(index++); ++index; break; default: //printf("Read ir_code failed\n"); return false; } } for (int b = 0; b < mIrCodeLength / 2; b++) { if (b < mUserCodeLength) { mUserCodes[b] = (charToValue(mIrCodes[2 * b]) << 4) + charToValue(mIrCodes[2 * b + 1]); } else if (b < mUserCodeLength + mDataCodeLength) { mDataCodes[b - mUserCodeLength] = (charToValue(mIrCodes[2 * b]) << 4) + charToValue(mIrCodes[2 * b + 1]); } } return true; }