91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1.31MB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2023-08-29
  • 語言: 其他
  • 標簽: 單片機??

資源簡介

安卓藍牙連接單片機藍牙模塊,獲取藍牙模塊數據,根據數據進行繪圖

資源截圖

代碼片段和文件信息

package?com.cz.wisdomcity.entity;

import?java.io.InputStream;
import?android.graphics.Canvas;
import?android.graphics.Color;
import?android.graphics.Paint;
import?android.graphics.Rect;
import?android.util.Log;
import?android.view.SurfaceView;
/**
?*?測試用?已無用
?*?@author?Dean
?*
?*/
public?class?ClsWaveDiagram?{

private?boolean?isRecording?=?false;//?線程控制標記
private?InputStream?btInput?=?null;//?藍牙數據輸入流
/**
?*?X軸縮小的比例
?*/
public?int?rateX?=?1;?
/**
?*?Y軸縮小的比例
?*/
public?int?rateY?=?1;
/**
?*?Y軸基線
?*/
public?int?baseLine?=?0;

/**
?*?初始化
?*/
public?ClsWaveDiagram(InputStream?btInput?int?rateX?int?rateY
int?baseLine)?{
this.btInput?=?btInput;
this.rateX?=?rateX;
this.rateY?=?rateY;
this.baseLine?=?baseLine;
}

/**
?*?開始
?*?
?*?@param?recBufSize
?*????????????AudioRecord的MinBufferSize
?*/
public?void?Start(SurfaceView?sfv?Paint?mPaint?int?wait)?{
isRecording?=?true;
new?DrawThread(sfv?mPaint?wait).start();//?開始繪制線程
}

/**
?*?停止
?*/
public?void?Stop()?{
isRecording?=?false;
}

/**
?*?負責繪制inBuf中的數據
?*?
?*?@author?GV
?*?
?*/
class?DrawThread?extends?Thread?{

private?int?oldX?=?0;//?上次繪制的X坐標
private?int?oldY?=?0;//?上次繪制的Y坐標
private?SurfaceView?sfv;//?畫板
private?int?X_index?=?0;//?當前畫圖所在屏幕X軸的坐標
private?Paint?mPaint;//?畫筆
private?int?wait?=?50;//?線程等待時間

public?DrawThread(SurfaceView?sfv?Paint?mPaint?int?wait)?{
this.sfv?=?sfv;
this.mPaint?=?mPaint;
this.wait?=?wait;
}

@Override
public?void?run()?{
while?(isRecording)?{
try?{

byte[]?temp?=?new?byte[1024];

int?len?=?btInput.read(temp);
Log.e(“available“?String.valueOf(len));
if?(len?>?0)?{
byte[]?btBuf?=?new?byte[len];
System.arraycopy(temp?0?btBuf?0?btBuf.length);
SimpleDraw(X_index?btBuf?rateX?rateY?baseLine);//?把緩沖區數據畫出來
X_index?=?X_index?+?(btBuf.length/rateX)?-?1;//?這里-1可以減少空隙
if?(X_index?>?sfv.getHeight())?{
X_index?=?0;
}
}
Thread.sleep(wait);//?延時一定時間緩沖數據
}?catch?(Exception?e)?{
//?TODO?Auto-generated?catch?block
e.printStackTrace();
}

}
}

/**
?*?繪制指定區域
?*?
?*?@param?start
?*????????????X軸開始的位置(全屏)
?*?@param?inputBuf
?*????????????緩沖區
?*?@param?rateX
?*????????????X軸數據縮小的比例
?*?@param?rateY
?*????????????Y軸數據縮小的比例
?*?@param?baseLine
?*????????????Y軸基線
?*/
void?SimpleDraw(int?start?byte[]?inputBuf?int?rateX?int?rateY
int?baseLine)?{
if?(start?==?0)
oldX?=?0;
//?根據需要縮小X軸比例
byte[]?buffer?=?new?byte[inputBuf.length?/?rateX];
for?(int?i?=?0?ii?=?0;?i? buffer[i]?=?inputBuf[ii];

Canvas?canvas?=?sfv.getHolder().lockCanvas(
new?Rect(0?start?sfv.getWidth()?start?+?buffer.length));//?關鍵:獲取畫布
canvas.drawColor(Color.BLACK);//?清除背景

for?(int?i?=?0;?i?

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2013-09-03?04:59??bluetoothECG-master\
?????文件?????????403??2013-09-03?04:59??bluetoothECG-master\.gitignore
?????目錄???????????0??2013-09-03?04:59??bluetoothECG-master\.settings\
?????目錄???????????0??2013-09-03?04:59??bluetoothECG-master\.settings\.svn\
?????文件?????????246??2013-09-03?04:59??bluetoothECG-master\.settings\.svn\all-wcprops
?????文件?????????402??2013-09-03?04:59??bluetoothECG-master\.settings\.svn\entries
?????文件???????????2??2013-09-03?04:59??bluetoothECG-master\.settings\.svn\format
?????目錄???????????0??2013-09-03?04:59??bluetoothECG-master\.settings\.svn\text-base\
?????文件?????????629??2013-09-03?04:59??bluetoothECG-master\.settings\.svn\text-base\org.eclipse.jdt.core.prefs.svn-base
?????文件?????????629??2013-09-03?04:59??bluetoothECG-master\.settings\org.eclipse.jdt.core.prefs
?????目錄???????????0??2013-09-03?04:59??bluetoothECG-master\.svn\
?????文件?????????797??2013-09-03?04:59??bluetoothECG-master\.svn\all-wcprops
?????文件????????1125??2013-09-03?04:59??bluetoothECG-master\.svn\entries
?????文件???????????2??2013-09-03?04:59??bluetoothECG-master\.svn\format
?????目錄???????????0??2013-09-03?04:59??bluetoothECG-master\.svn\prop-base\
?????文件??????????53??2013-09-03?04:59??bluetoothECG-master\.svn\prop-base\ic_launcher-web.png.svn-base
?????目錄???????????0??2013-09-03?04:59??bluetoothECG-master\.svn\text-base\
?????文件?????????364??2013-09-03?04:59??bluetoothECG-master\.svn\text-base\.classpath.svn-base
?????文件?????????846??2013-09-03?04:59??bluetoothECG-master\.svn\text-base\.project.svn-base
?????文件????????2604??2013-09-03?04:59??bluetoothECG-master\.svn\text-base\AndroidManifest.xml.svn-base
?????文件???????55743??2013-09-03?04:59??bluetoothECG-master\.svn\text-base\ic_launcher-web.png.svn-base
?????文件?????????781??2013-09-03?04:59??bluetoothECG-master\.svn\text-base\proguard-project.txt.svn-base
?????文件?????????563??2013-09-03?04:59??bluetoothECG-master\.svn\text-base\project.properties.svn-base
?????文件????????2604??2013-09-03?04:59??bluetoothECG-master\AndroidManifest.xml
?????文件???????10273??2013-09-03?04:59??bluetoothECG-master\LICENSE
?????文件?????????231??2013-09-03?04:59??bluetoothECG-master\README.md
?????目錄???????????0??2013-09-03?04:59??bluetoothECG-master\assets\
?????目錄???????????0??2013-09-03?04:59??bluetoothECG-master\assets\.svn\
?????文件??????????92??2013-09-03?04:59??bluetoothECG-master\assets\.svn\all-wcprops
?????文件?????????256??2013-09-03?04:59??bluetoothECG-master\assets\.svn\entries
?????文件???????????2??2013-09-03?04:59??bluetoothECG-master\assets\.svn\format
............此處省略317個文件信息

評論

共有 條評論