二维码在哪里 采样二维码在哪里( 二 )


DepthData mDepthData;
boolean m_bexit = false; // 控制视频绘制的标志
int m_Width;
int m_Height;
Bitmap m_colorBitmap;
private byte[] m_pixels;
private int[] m_rgbIntData;
/* Live UVC Camera */
WindowManager mWm;
private LiveCamera liveCamera;
LiveStreamProcessor processor = new LiveStreamProcessor();
private SurfaceView mSvPreview;
private SurfaceHolder mSurfaceHolder;
final int PREVIEW_WIDTH = 80;
final int PREVIEW_HEIGHT = 60;
private HomeKeyListener mHomeListener;
private TextView hintText;
private boolean isDialogShow = false; // 判断对话框是否弹出来的标志
private Thread mCameraThread = new Thread(new Runnable() {
@Override
public void run() {
Looper.prepare();
Log.d(TAG, "before initUVCCamera!!");
initUVCCamera();
Log.d(TAG, "after initUVCCamera!!");
Looper.loop();
}
});
private PermissionCallbacks m_callbacks = new PermissionCallbacks() {
@Override
public void onDevicePermissionGranted() {
try {
mDepthData = https://www.scwdwl.com/n/new DepthData(m_xc);
mDepthData.setMapOutputMode(GlobalDef.RES_DEPTH_WIDTH,
GlobalDef.RES_DEPTH_HEIGHT, 30);
m_rgbdata = https://www.scwdwl.com/n/new RGBData(m_xc);
m_rgbdata.setMapOutputMode(GlobalDef.RES_COLOR_WIDTH,
GlobalDef.RES_COLOR_HEIGHT, 30);
m_rgbdata.getGenerator().getMirrorCapability().setMirror(false);// true,false
m_Width = m_rgbdata.GetImageMap().getXRes();
m_Height = m_rgbdata.GetImageMap().getYRes();
// Log.i(TAG,"width = " + m_Width);
// Log.i(TAG,"m_Height = " + m_Height);
m_rgbIntData = https://www.scwdwl.com/n/new int[GlobalDef.RES_DISPLAY_WIDTH
* GlobalDef.RES_DISPLAY_HEIGHT];
m_colorBitmap = Bitmap.createBitmap(
GlobalDef.RES_DISPLAY_WIDTH,
GlobalDef.RES_DISPLAY_HEIGHT, Bitmap.Config.ARGB_8888);
} catch (Exception e) {
Log.w(TAG, "Exception: " + e.getMessage());
}
Log.i(TAG, "start xc!");
try {
m_xc.start(); // 开始生成设定好的数据
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if (GlobalDef.USE_UVC) {
Log.d(TAG, "start Thread of UVC camera!!");
/*mCameraThread.start();
Message msg = new Message();
msg.what = 1;
// 1.5s delay
handler.sendMessageDelayed(msg, 3000);*/
} else {
Message msg = new Message();
msg.what = 1;
// 1.5s delay
handler.sendMessageDelayed(msg, 500);
}
}
@Override
public void onDevicePermissionDenied() {
Toast.makeText(MainActivity.this, "onDevicePermissionDenied ",
Toast.LENGTH_SHORT).show();
}
};
private Handler handler = new Handler() {
@Override
/* 褰撴湁娑堟伅鍙戦?鍑烘潵鐨勬椂鍊欏氨鎵цHandler鐨勮繖涓柟娉? */
public void handleMessage(Message msg) {
super.handleMessage(msg);
setContentView(R.layout.activity_main);
LinearLayout layout = (LinearLayout) findViewById(R.id.RGBLayout);
// Add the adView to it
layout.addView(new ColorView(MainActivity.this));
Log.i(TAG, "Create ColovrView!");
}
};
private Handler updateHandler = new Handler() {
public void handleMessage(Message msg) {
super.handleMessage(msg);
AlertDialog.Builder budler = new AlertDialog.Builder(
MainActivity.this);
budler.setTitle("恭喜您,获取二维码信息成功!");
budler.setMessage((String) msg.obj);
budler.setPositiveButton("确定", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
isDialogShow = false;
}
});
budler.show();
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {