Android Bluetooth 2.0SSP 4.0BLEサンプルapkソースコードのダウンロードとビデオは、自動接続に近い16進数または文字2.0を送受信できます4.0電話とシリアルポートモジュール通信OTGをシリアルwifiシリアルポートにペアリングする必要はありません

Android Bluetooth2.0SSPおよび4.0BLEのすべてのサンプルapkおよびソースコードのダウンロードとビデオを整理しました。ビデオは、16進数または文字を送受信できることを保証します。ペアリングされたデバイスに自動的に接続し、シリアルポートモジュールと通信でき ます。未公開のソースコードの100コピー。

注:Bluetooth SSP2.0デバイスモジュールの原因と解決策に関する20190507は、android6.0以降のシステムでは見つかりません

バージョン6.0より前では、Bluetooth機能を使用するには、次の権限を構成するだけで済みます。

<uses-permission android:name = "android.permission.BLUETOOTH_ADMIN" />

6.0以降のバージョンでは、Bluetoothスキャンを使用して、次の権限も追加する必要があります。また、使用中に権限を動的に適用する必要があります。

<!-Android 6.0Bluetoothスキャンにのみ必要->

    <uses-permission android:name = "android.permission.ACCESS_COARSE_LOCATION"> </ users-permission>

または

    <uses-permission android:name = "android.permission.ACCESS_FINE_LOCATION"> </ users-permission>

したがって、Bluetooth SSP2.0デバイスモジュールを使用するには、合計3つの権限が必要です。

    <uses-permission android:name = "android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name = "android.permission.BLUETOOTH" />
    <uses-permission android:name = "android.permission.ACCESS_COARSE_LOCATION"> </ uses-permission>

(APPがBluetoothを開く許可とポジショニング許可を要求するときに拒否しないでください)

 

1. Bluetooth 2.0SSPの例:(対応するハードウェアモジュール:HuichengHC-05およびその他のチップCSRBC

推奨事項: 1.Android Bluetooth 2.0シリアルポートアシスタント、16進数/文字の自動接続apkリンクの送受信 :https://pan.baidu.com/s/1wD6t2-yOFET5GE9BaWA-2w抽出コード:y7gu 

2. BluetoothChat携帯電話とシリアルポートモジュールの通信は自動接続2.0apkの例に近い:リンク:  https  
://pan.baidu.com/s/1MEdcT-ImcveYytu8Mb79DQ抽出コード:flk4 

3.音声付きの制御車は、指示とボタン名をカスタマイズできます。リンク:http://pan.baidu.com/s/1nuEeFVVパスワード:16uq

4. BluetoothChat携帯電話と携帯電話携帯電話とシリアルポートモジュールの通信例:http://pan.baidu.com/s/1dDTZdJj

5.産業用制御アプリケーションISwitch13jscwカスタマイズ-ライトバージョン-5.0タイヤ圧力検出OK.apkリンク:http://pan.baidu.com/s/1c1IRNpQパスワード:k58x

0〜60のバイトを受信する

 6.インテリジェント温度計apk:リンク:http://pan.baidu.com/s/1hsybiuCパスワード:g85c

通过蓝牙接收,能记录31天的温度,并给出医学健康建议。蓝牙自动连接。
数据格式 比如36.98度对应十六进制03 06 09 08 固定为四个字节

7.最新の水掘削リグプロジェクトBluetooth包括的なアプリケーションリンク:https://pan.baidu.com/s/1WJ2G-7rY2Thj6o_0bsymRw抽出コード:55ak 

IOSの例:appstoreのダウンロード

 

2. Bluetooth 4.0 BLEの例:(対応するハードウェアモジュール:CC2541 / CC2540深センBolukBLE CC41、Huicheng HC-08Bluetoothモジュールなど。JDY-30/ 31/32)

推奨事項: 1.アンドロイドブルートゥース4.0BLEシリアルポートアシスタントを送信し、APKで、パスワードなしでペアへの必要性を16進数または文字を受け取ることはできません http://pan.baidu.com/s/1o8i5Iie

Bluetoothカーリモートコントロール、パスワードble4.0を使用して学習機能に自動的に接続します。リンク:https://pan.baidu.com/s/1bLv1OMパスワード:f3tr

(初期パスワード123456)

2. Bolukeの公式ソースリンク:http://pan.baidu.com/s/1c2No4A8パスワード:cbje

3.AMOMCU http://pan.baidu.com/s/1boiqyzP

4.AmoMcu-0.2簡略化されたOK リンク:http://pan.baidu.com/s/1mhUMJw8パスワード:4pap

5.AmoMcu-カスタム名とコマンドバージョンユニバーサルバージョンリンク:http://pan.baidu.com/s/1dEZeKTjパスワード:2pnb

6.PO141103045深センボルケBLECC41 BluetoothLeGatt.apk http://pan.baidu.com/s/1o70QIO6

7.産業用制御アプリケーション(Android Bluetoothシリアル産業用制御ソフトウェアのビデオデモンストレーション-Xiaohuangrenソフトウェアhttp://v.youku.com/v_show/id_XNzAwMTgxNzY0.html?from=y1.7-1.2)サンプルapk:http:// pan.baidu.com/s/1beoIia

8.誰かUSR-BLE100BLE + SSP Bluetooth低エネルギーデバッグアシスタントapk:https://pan.baidu.com/s/17yAcQCOGbjbvqPLXDsOZQQ

 IOSの例:appstoreのダウンロード

JDY-30 / 31/32デュアルモードモード、両方がサポートされています。

 

3. Android OTGからシリアルUSBからシリアルポート(ハードウェア:FT232、cp2102チップに対応するUSB​​からシリアルケーブル)

リンク:https://pan.baidu.com/s/1jI999Imパスワード:zjks(FT232 cp2102チップに対応するUSB​​-シリアルケーブル)

OTGは、文字の送受信、ポートのボーレート設定の開閉などを行うことができます。

リンク:https://pan.baidu.com/s/1kVkT98jパスワード:uvg7(CH34x、CH340チップUSB-シリアルケーブルに対応)

 

4、androidシリアルポートシリアルからシリアルポート(ハードウェア:シリアルケーブルとデバイスが直接接続されている)

リンク:   https   ://pan.baidu.com/s/1pL1Gultパスワード:5wev

5、android WIFIシリアルアシスタント(ハードウェア:HC-22、Esp8266)LAN

リンク:https  ://pan.baidu.com/s/1g3-BfBHngVuWeqRUbiMO8w抽出コード:81al 
 

 

package com.example.fileread2;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;


import android.support.v7.app.ActionBarActivity;
import android.text.format.Time;
import android.content.Context;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;


public class MainActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        save("12\r\n1234");
        Button btnLine=(Button)findViewById(R.id.button1);
        Button btnAll=(Button)findViewById(R.id.button2);
        final TextView dis = (TextView) findViewById(R.id.tv); // 得到数据显示句柄
        btnLine.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				dis.setText(readFirstLine());
			}
		});
        btnAll.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				dis.setText(readAll());
			}
		});

    }
	public void save(String filecontent)  //位于/data/data/<package name>/files 
    {
		//Time t = new Time(); // or Time t=new Time("GMT+8"); 加上Time Zone资料。
		//t.setToNow(); // 取得系统时间。
		//String filename=String.format("%04d-%02d-%02d.txt", t.year,t.month+1,t.monthDay);
		String filename="视力记录表.txt";
		  try {
	            if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
	            	File f2 = new File(Environment.getExternalStorageDirectory()+"/test/");
            	f2.mkdir();
            	//Toast.makeText(this,"卡"+f2.toString()+"/"+filename,Toast.LENGTH_SHORT).show();
            	//执行存储sdcard方法
            
            	File f = new File(f2,filename);
            	FileOutputStream out = new FileOutputStream(f,true);
            	out.write(filecontent.getBytes("UTF-8"));
            }
            else{
            	//存储到手机中,或提示
            	Toast.makeText(this,"无卡,保存到手机"+getFilesDir().toString()+"/"+filename,Toast.LENGTH_SHORT).show();
            	   FileOutputStream outStream=this.openFileOutput(filename,Context.MODE_APPEND); //模式会检查文件是否存在,存在就往文件追加内容,否则就创建新文件。
                   outStream.write(filecontent.getBytes("UTF-8"));
                   outStream.close();
            }
            
        } catch (FileNotFoundException e) {
            return;
        }
        catch (IOException e){
            return ;
        }   
    }
    public String readAll()
    {
    	StringBuffer sb = new StringBuffer();
    	String filename="test.txt";
		  try {
	            if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
	            	File f2 = new File(Environment.getExternalStorageDirectory()+"/test/");
               
          	File f = new File(f2,filename);
        	BufferedReader br = new BufferedReader(new FileReader(f));
			String readline = "";
			
			while ((readline = br.readLine()) != null) {
			//	System.out.println("readline:" + readline);
				Log.d("chenhao", "chenhao"+"readline:" + readline);	
				sb.append(readline);
			}
			br.close();
          }
          else{
          	//存储到手机中,或提示
          	Toast.makeText(this,"无卡"+getFilesDir().toString()+"/"+filename,Toast.LENGTH_SHORT).show();
          }
          
      } catch (FileNotFoundException e) {
          return "";
      }
      catch (IOException e){
          return "";
      } 
		  
			return "读取成功:" + sb.toString();
	            	
    }
    public String readFirstLine()
    {  	
    	StringBuffer sb = new StringBuffer();
    	String filename="test.txt";
		  try {
	            if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
	            	File f2 = new File(Environment.getExternalStorageDirectory()+"/test/");
               
          	File f = new File(f2,filename);
        	BufferedReader br = new BufferedReader(new FileReader(f));
			String readline = "";
			readline = br.readLine();
		//	while ((readline = br.readLine()) != null) {
			//	System.out.println("readline:" + readline);
				Log.d("chenhao", "chenhao"+"readline:" + readline);	
				sb.append(readline);
		//	}
			br.close();
          }
          else{
          	//存储到手机中,或提示
          	Toast.makeText(this,"无卡"+getFilesDir().toString()+"/"+filename,Toast.LENGTH_SHORT).show();
          }
          
      } catch (FileNotFoundException e) {
          return "没有找到文件";
      }
      catch (IOException e){
          return "IO异常";
      } 
			return "首行读取成功:" + sb.toString();
    	
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
    
 	/**
 	 * 判断SDCard是否存在 [当没有外挂SD卡时,内置ROM也被识别为存在sd卡]
 	 * 
 	 * @return
 	 */
 	public static boolean isSdCardExist() {
 		return Environment.getExternalStorageState().equals(
 				Environment.MEDIA_MOUNTED);
 	}
 	/**
 	 * 获取SD卡根目录路径
 	 * 
 	 * @return
 	 */
 	public static String getSdCardPath() {
 		boolean exist = isSdCardExist();
 		String sdpath = "";
 		if (exist) {
 			sdpath = Environment.getExternalStorageDirectory()
 					.getAbsolutePath();
 		} else {
 			sdpath = "不适用";
 		}
 		return sdpath;

 	}
 	/**
 	 * 获取默认的文件路径
 	 * 
 	 * @return
 	 */
 	public static String getDefaultFilePath() {
 		String filepath = "";
 		File file = new File(Environment.getExternalStorageDirectory(),
 				"test.txt");
 		if (file.exists()) {
 			filepath = file.getAbsolutePath();
 		} else {
 			filepath = "不适用";
 		}
 		return filepath;
 	}
 	/*
 	public void readFileFS()  //使用FileInputStream读取文件
 	{
         try {
     		File file = new File(Environment.getExternalStorageDirectory(),
     				"test.txt");
             FileInputStream is = new FileInputStream(file);
           
 			byte[] b = new byte[is.available()];
             is.read(b);
             String result = new String(b);
             System.out.println("读取成功:"+result);
         } catch (Exception e) {
         	e.printStackTrace();
         }
 	}
 	*/
 	public void readFileBR() //使用BufferReader读取文件
 	{
 		try {
 			File file = new File(Environment.getExternalStorageDirectory(),
 					"test.txt");
 			BufferedReader br = new BufferedReader(new FileReader(file));
 			String readline = "";
 			StringBuffer sb = new StringBuffer();
 			while ((readline = br.readLine()) != null) {
 				System.out.println("readline:" + readline);
 				sb.append(readline);
 			}
 			br.close();
 			System.out.println("读取成功:" + sb.toString());
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
 	}
}

 

 

 

 

 

 

Xiaohuangren Software Taobao Flagship Store

プログラムのソースコード、カスタマイズされた専門家の電話:18910620895欲しい:chenhao0568 QQ:345139427

 

 

 

おすすめ

転載: blog.csdn.net/chenhao0568/article/details/50950227