This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let out_dir = env::var("OUT_DIR").unwrap(); | |
let debug_offset = out_dir.find("debug").unwrap_or(0); | |
let release_offset = out_dir.find("release").unwrap_or(0); | |
let mut path = String::from(""); | |
if debug_offset > 0 { | |
println!(">>> where is debug {}", debug_offset); | |
path.push_str(&format!("{}", &out_dir[..debug_offset])); | |
path.push_str("debug"); | |
println!("{}", path); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let _src: String = String::from("./platforms/win/DynamsoftBarcodeReaderx64.dll"); | |
path.push_str("/DynamsoftBarcodeReaderx64.dll"); | |
let _result = fs::copy(_src, &path); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::ffi::CStr; | |
use std::ffi::CString; | |
use std::os::raw::c_char; | |
use std::env; | |
mod bridge; | |
use bridge::*; | |
extern "C" fn callback(index: i32, barcode_type: *const c_char, barcode_value: *const c_char) { | |
unsafe { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate cc; | |
extern crate bindgen; | |
use std::env; | |
use std::fs; | |
fn main() { | |
// Link Dynamsoft Barcode Reader. | |
println!("cargo:rustc-link-search=./platforms/win"); | |
println!("cargo:rustc-link-lib=DBRx64"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
typedef u_char *address; | |
address current_stack_base() | |
{ | |
MEMORY_BASIC_INFORMATION minfo; | |
address stack_bottom; | |
size_t stack_size; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required (VERSION 2.6) | |
project (dbr) | |
MESSAGE( STATUS "PROJECT_NAME: " ${PROJECT_NAME} ) | |
# Check platforms | |
if (CMAKE_HOST_WIN32) | |
set(WINDOWS 1) | |
set(JAVA_HOME "E:/Program Files (x86)/Java/jdk1.8.0_191") | |
set(JAVA_INCLUDE "${JAVA_HOME}/include") | |
set(JAVA_INCLUDE_OS "${JAVA_HOME}/include/win32") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public | |
static void main(String[] args) | |
{ | |
int count = 1; | |
JNABarcode jnaReader = new JNABarcode(); | |
System.out.println("JNA start."); | |
long start = System.currentTimeMillis(); | |
for (int i = 0; i < count; i++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void dispatch(RCTEventEmitter rctEventEmitter) { | |
rctEventEmitter.receiveEvent(getViewTag(), getEventName(), serializeEventData()); | |
} | |
private WritableMap serializeEventData() { | |
WritableArray barcodesList = Arguments.createArray(); | |
for (int i = 0; i < mBarcodes.size(); i++) { | |
Barcode barcode = mBarcodes.valueAt(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_convertNativeProps(props: PropsType) { | |
const newProps = mapValues(props, this._convertProp); | |
if (props.onBarCodeRead) { | |
newProps.barCodeScannerEnabled = true; | |
} | |
if (props.onGoogleVisionBarcodesDetected) { | |
newProps.googleVisionBarcodeDetectorEnabled = true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected SparseArray<Barcode> doInBackground(Void... ignored) { | |
if (isCancelled() || mDelegate == null || mBarcodeDetector == null || !mBarcodeDetector.isOperational()) { | |
return null; | |
} | |
RNFrame frame = RNFrameFactory.buildFrame(mImageData, mWidth, mHeight, mRotation); | |
return mBarcodeDetector.detect(frame); | |
} | |