We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hi ,
Thanks for your api !
It's work fine to recept data from a BLE device !
But Now I need to send a character to my BLE device to control it (I use HM-10).
to do this, I write this specific code :
` // On click : void Disconnect_Clicked(object sender, System.EventArgs e) { Console.WriteLine("Disconnect");
ReadCharacteristics(); Task.Delay(200); Ble_sendMessage("S"); Task.Delay(200); }
void ReadCharacteristics() { BLEconnect.ConnectDevice.CharacteristicsDiscovered(cha => { Device.BeginInvokeOnMainThread(() => { AllCharacteristics.Add(cha); CharacteristicsList.Add(new CharacteristicsList(cha.Uuid, cha.CanRead(), cha.CanWrite(), cha.CanNotify())); }); }); }
void Ble_sendMessage(String str) { foreach (var c in AllCharacteristics) { Console.WriteLine("Characteristic test :" + c.Uuid); // search my specific charac : if (c.Uuid == "0000ffe1-0000-1000-8000-00805f9b34fb") { //var bytes = StringToByteArray(str); var bytes = Encoding.ASCII.GetBytesstr); if (bytes != null) c.Write(bytes); else Console.WriteLine("message empty !"); Console.WriteLine("message send !");
} } }
`
But when I try this code, I have an fatal error on "c.Write(bytes);", bytes is not empty but he don't find reference ...
Do you have an idea to solve this issue ?
Thanks !
The text was updated successfully, but these errors were encountered:
did you solve it?
Sorry, something went wrong.
No branches or pull requests
hi ,
Thanks for your api !
It's work fine to recept data from a BLE device !
But Now I need to send a character to my BLE device to control it (I use HM-10).
to do this, I write this specific code :
`
// On click :
void Disconnect_Clicked(object sender, System.EventArgs e)
{
Console.WriteLine("Disconnect");
void ReadCharacteristics()
{
BLEconnect.ConnectDevice.CharacteristicsDiscovered(cha =>
{
Device.BeginInvokeOnMainThread(() => {
AllCharacteristics.Add(cha);
CharacteristicsList.Add(new CharacteristicsList(cha.Uuid, cha.CanRead(), cha.CanWrite(), cha.CanNotify()));
});
});
}
void Ble_sendMessage(String str)
{
foreach (var c in AllCharacteristics)
{
Console.WriteLine("Characteristic test :" + c.Uuid);
// search my specific charac :
if (c.Uuid == "0000ffe1-0000-1000-8000-00805f9b34fb")
{
//var bytes = StringToByteArray(str);
var bytes = Encoding.ASCII.GetBytesstr);
if (bytes != null) c.Write(bytes);
else Console.WriteLine("message empty !");
Console.WriteLine("message send !");
`
But when I try this code, I have an fatal error on "c.Write(bytes);", bytes is not empty but he don't find reference ...
Do you have an idea to solve this issue ?
Thanks !
The text was updated successfully, but these errors were encountered: