Tag: bluetooth lowenergy

BLE图像传输

这是将图像转换为字节数组并发送到ble设备的代码我无法发送完整的数据,并且它几乎停在1kb 有什么方法可以将大数据发送到ble。 是否适合在数据传输中使用延迟,如果可以,则可以共享代码 如果有人有任何代码发送数据高达1mb请分享 公共类RxTxActivity扩展Activity { byte[] imageInByte,SendByte; private static int IMG_RESULT = 1; String ImageDecode; ImageView imageViewLoad; Button LoadImage; Intent intent; String[] FILE; String[] SAImage,SAsent; private final static String TAG = DeviceControlActivity.class.getSimpleName(); public static final String EXTRAS_DEVICE_NAME = “DEVICE_NAME”; public static final String EXTRAS_DEVICE_ADDRESS = “DEVICE_ADDRESS”; private TextView mCharaDescriptor; private TextView mConnectionState; private TextView […]

没有从BLE设备接收数据

我又来了。 所以,长话短说:在我的应用程序中,我试图在Android样本( 那个 )的帮助下从我的BLE设备(tickr心率监视器: 那个 )接收数据。 但是……我没有从我的设备接收数据! 我能够获得特征和描述符,但……仅此而已。 我只是…… 错过了重点 。 这是我的代码: private BluetoothLeService mBluetoothLeService; private ArrayList mGattCharacteristics = new ArrayList(); private BluetoothGattCharacteristic mNotifyCharacteristic; public static final String EXTRAS_DEVICE_NAME = “DEVICE_NAME”; public static final String EXTRAS_DEVICE_ADDRESS = “DEVICE_ADDRESS”; private static final int CONNECTED_ID = 1; private String mDeviceName; private String mDeviceAddress; private boolean mConnected = […]

Ble扫描设备的服务而不连接它

我想用BLE扫描一些设备。 我只想展示我的设备,所以我知道我得到了设备的名称,如果它是好的,我把它放在我的列表中。 if (device.getName().contains(DEVICE_NAME)) { mDevices.put(device.hashCode(), device); invalidateOptionsMenu(); } 我的问题是,如果我更改设备的名称,则此检查将为false。 所以我看看是否有可能得到一些我添加的服务的uuid用不会改变的东西做检查。 唯一的方法是连接到设备上做device.connectGatt(this, false, mGattCallback); 和gatt之后我发现了服务但是,有没有可能从没有连接的设备发现一些服务?

android 4.3蓝牙ble不叫onCharacteristicRead()

我已经将通知设置为android,它没有调用方法onCharacteristicRead() ???? 它不会进入该function。 为什么会这样? 任何帮助表示赞赏 请求解决方案。 这是我的代码: private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() { @Override public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) { if (newState == BluetoothProfile.STATE_CONNECTED) { Log.i(TAG, “Connected to GATT server.”); // Attempts to discover services after successful connection. Log.i(TAG, “Attempting to start service discovery:” + mBluetoothGatt.discoverServices()); } else if (newState […]