0
私はBLEを使ってデータを送受信しています。Xamarin OnCharacteristicChanged
私はBLE
にデータを書き込むことができますが、応答は来ません。"OnCharacteristicChanged"
OnCharacteristicWrite
に応答がありますが、bluetoothgatt WriteCharacteristic
に書き込んでいます。
私を助けてください。私にベストプラクティスまたはサンプルコードを提案してください。 ありがとうございます。
ここに私のコードです。
onDiscovered service
{
string ser = "0003CDD0-0000-1000-8000-00805f9b0131";
string charId = "0003CDD2-0000-1000-8000-00805f9b0131";
bluetoothGatt = gatt;
//bleMTU = bluetoothGatt.RequestMtu(400);
mService = bluetoothGatt.GetService(UUID.FromString(ser));
charbt = mService.GetCharacteristic(UUID.FromString(charId));
bluetoothGatt.SetCharacteristicNotification(charbt, true);
}
Void writetosocket
{
byte[] smallPacket = new byte[numberOfBytes];
charbt.SetValue(smallPacket);
charbt.WriteType = BluetoothGattCharacteristic.WriteTypeNoResponse;
bool check = bluetoothGatt.WriteCharacteristic(charbt);
}