All Projects → xiaoxiaohaozai → Bluetoothlib

xiaoxiaohaozai / Bluetoothlib

Licence: other
This is a Bluetooth Library

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Bluetoothlib

easyble
A simple framework for Android Bluetooth Low Energy (BLE)
Stars: ✭ 43 (+22.86%)
Mutual labels:  bluetooth
BLELib
This library contains many of the features you need to interact with BLE peripherals
Stars: ✭ 21 (-40%)
Mutual labels:  bluetooth
rAudio-1
Raspberry Pi audio player: AirPlay, Audio CD, Bluetooth, DAB radio, DSP, Internet rafio, Multi-room, Spotify Connect, UPnP
Stars: ✭ 151 (+331.43%)
Mutual labels:  bluetooth
Blueborne-CVE-2017-1000251
Blueborne CVE-2017-1000251 PoC for linux machines
Stars: ✭ 14 (-60%)
Mutual labels:  bluetooth
noise
A chat app for the end of the world.
Stars: ✭ 27 (-22.86%)
Mutual labels:  bluetooth
Low power TTGO T-beam
Low power consumption for TTGO t-beam
Stars: ✭ 45 (+28.57%)
Mutual labels:  bluetooth
ruuvidriver
Serves your Ruuvitag Weather Station data over HTTP.
Stars: ✭ 13 (-62.86%)
Mutual labels:  bluetooth
Echo
A simple iOS application redirects microphone input to the Bluetooth audio device
Stars: ✭ 33 (-5.71%)
Mutual labels:  bluetooth
BlueReverse
Bluetooth reverse shell.
Stars: ✭ 15 (-57.14%)
Mutual labels:  bluetooth
gnome-keysign
An easier way to sign OpenPGP keys over the local network. A GTK/GNOME application to use GnuPG for signing other peoples' keys. Quickly, easily, and securely.
Stars: ✭ 42 (+20%)
Mutual labels:  bluetooth
BlueRetro
Multiplayer Bluetooth controllers adapter for retro video game consoles
Stars: ✭ 520 (+1385.71%)
Mutual labels:  bluetooth
pymetawear
Community developed SDK around the Python bindings for the C++ SDK
Stars: ✭ 42 (+20%)
Mutual labels:  bluetooth
ios
CoThings's iOS application. CoThings is a realtime counter for shared things.
Stars: ✭ 13 (-62.86%)
Mutual labels:  bluetooth
bluetooth-iot-service-python
This application connects two devices over Bluetooth and allows one to send messages to the other using json. Raspberry Pi Bluetooth interfacing with Linux via RFCOMM BT network
Stars: ✭ 23 (-34.29%)
Mutual labels:  bluetooth
radonreader
Read current radon level from RadonEye RD200
Stars: ✭ 46 (+31.43%)
Mutual labels:  bluetooth
openEMSstim
openEMSstim: open-hardware module to adjust the intensity of EMS/TENS stimulators.
Stars: ✭ 90 (+157.14%)
Mutual labels:  bluetooth
fix-linux-mouse
Hints how to fix USB mouse issues on Linux
Stars: ✭ 36 (+2.86%)
Mutual labels:  bluetooth
Apple-Signal
Connect Apple devices via bluetooth and wifi.
Stars: ✭ 27 (-22.86%)
Mutual labels:  bluetooth
SimpleBLE
The ultimate fully-fledged cross-platform BLE library, designed for simplicity and ease of use.
Stars: ✭ 122 (+248.57%)
Mutual labels:  bluetooth
nxbt
Control your Nintendo Switch through a website, terminal, or macro.
Stars: ✭ 340 (+871.43%)
Mutual labels:  bluetooth

BluetoothLib

该库基于SPP协议(Serial Port Profile)开发,主要用于Android设备与蓝牙模块串口通信 功能表述:

支持蓝牙模块的扫描
支持Android设备和蓝牙模块之间的快速连接
支持串口数据的接收和发送
对Android设备的部分蓝牙状态的监听
支持Ble模块扩展(正在完善中...)
提供一套默认蓝牙功能界面以便使用

简单使用

1.初始化

添加依赖

 compile 'com.chenhao:bluetoothlib:1.0.3'

最好是在Application中调用下面代码

BluetoothUtils.init(this);

获得实例

BluetoothUtils instance = BluetoothUtils.getInstance();

2.功能

1.打开或关闭蓝牙

instance.openBluetooth(null); 
instance.closeBluetooth(null); 

2.开启或结束扫描

instance.searchBluetoothDevices(null);
instance.cancelBluetoothSearch();

3.连接蓝牙模块

  BluetoothUtils.getInstance().connectDevice("", new IClientListenerContract.IConnectListener() {
                    @Override
                    public void onConnectSuccess(BluetoothDevice bluetoothDevice) {

                    }

                    @Override
                    public void onConnectFailure(String msg) {

                    }

                    @Override
                    public void onConnecting() {

                    }
                });

4.对蓝牙当前蓝牙状态的监听

     BluetoothUtils.getInstance().addBlueStasusLitener(new IClientListenerContract.IBluetoothStatusListener() {
            @Override
            public void discoverStart() {
                
            }

            @Override
            public void discoverEnd(ArrayList<BluetoothDevice> mBlueDevices) {

            }

            @Override
            public void bluetoothFound(BluetoothDevice bluetoothDevice) {

            }

            @Override
            public void bluetoothOpen() {

            }

            @Override
            public void bluetoothClose() {

            }

            @Override
            public void bluetoothConnectFailure() {

            }

            @Override
            public void bluetoothConnected(BluetoothDevice bluetoothDevice) {

            }

            @Override
            public void bluetoothDisconnect() {

            }
        });

5.发送数据

BluetoothUtils.getInstance().sendMessage(new byte[]{},null);  

6.接收数据(最好在发送数据之前注册)

    BluetoothUtils.getInstance().recevieMessage(new IClientListenerContract.IDataReceiveListener() {
        @Override
        public void onDataSuccess(byte[] data, int length) {
            //接收数据成功
        }

        @Override
        public void onDataFailure(String msg) {
           //接收数据失败
        }
    });	

3.扩展

该库也支持对单个功能状态进行监听

 public interface IServerStatusListener {
       void onGetClientSuccess(BluetoothDevice remoteDevice);

       void onGetClientFailure(String message);
   }


   /**
    * 寻找设备相关
    */
   public interface ISearchDeviceListener {
       void onSearchStart();

       void onFindDevice(BluetoothDevice bluetoothDevice);

       void onSearchEnd(List<BluetoothDevice> bluetoothDevices);
   }

   /**
    * 连接相关
    */
   public interface IConnectListener {
       void onConnectSuccess(BluetoothDevice bluetoothDevice);

       void onConnectFailure(String msg);

       void onConnecting();//正在连接中
   }

   /**
    * 数据接收相关
    */
   public interface IDataReceiveListener {
       void onDataSuccess(byte[] data, int length);

       void onDataFailure(String msg);
   }
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].