Coder Social home page Coder Social logo

Unable to write attribute about blewinrtdll HOT 5 OPEN

adabru avatar adabru commented on July 22, 2024
Unable to write attribute

from blewinrtdll.

Comments (5)

StevenDextrain avatar StevenDextrain commented on July 22, 2024 1

Ah nevermind, I just realized I missed part of the first (and most important part of your reply πŸ™ƒ), I'm gonna try that and come back with another question, or hopefully, everything will work fine and I'll close the issue !
Thanks again !

from blewinrtdll.

adabru avatar adabru commented on July 22, 2024

Hi @StevenDextrain :-)

you only subscribe to characteristics that issue notify events. After subscription you can read incoming messages with PollData.

You can write to characteristics without prior subscription.

"ReadCharacteristic" is not implemented in the dll although it is a ble functionality. If you need it you can checkout #6 (comment) . But subscribing alone might be sufficient for you.

from blewinrtdll.

StevenDextrain avatar StevenDextrain commented on July 22, 2024

Hey again !
Thanks for so quick of a response 😁
I'm wondering what you mean by "But subscribing alone might be sufficient for you.", is there already a way to collect my device's data without implementing ReadCharacteristic ?

from blewinrtdll.

StevenDextrain avatar StevenDextrain commented on July 22, 2024

Hello again,

It doesn't work (yet), and I noticed that the BleApi.SendData(in data, false) method call returned "false".
I was wondering if it meant that there was an issue while sending the data or if I'm totally misled...
Follow-up question, PollData is used to read what the device is sending constantly, right ?
I'm sorry about all of these questions, but I've never programmed in C++, and I've also never had to work with hardware before πŸ™ƒ (So you're basically my only hope)

Thanks again, and have a nice day !

from blewinrtdll.

adabru avatar adabru commented on July 22, 2024

BleApi.SendData(in data, false) method call returned "false".

For the non-blocking call, the result is always false:

bool result = false;
// copy data to stack so that caller can free its memory in non-blocking mode
SendDataAsync(*data, block ? &signal : 0, block ? &result : 0);
if (block)
signal.wait(lock);
return result;

You should see an error in the message window eventually, if it doesn't succeed. The blocking call returns true on success of sending:

if (status != GattCommunicationStatus::Success)
saveError(L"%s:%d Error writing value to characteristic with uuid %s", __WFILE__, __LINE__, data.characteristicUuid);
else if (result != 0)
*result = true;

The success doesn't guarantee that the package arrives at the target device though. There is a possibility to do that though.

PollData is used to read what the device is sending constantly, right ?

Exactly:

SubscribeCharacteristicAsync

subscription->revoker = characteristic.ValueChanged(auto_revoke, &Characteristic_ValueChanged);

Characteristic_ValueChanged

dataQueue.push(data);

PollData

if (!dataQueue.empty()) {
*data = dataQueue.front();
dataQueue.pop();
return true;
}

from blewinrtdll.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.