I'm using the following to initialise Characteristic in ESP32 BLE:
pCharacteristic = pService->createCharacteristic(
CHARACTERISTIC_UUID,
BLECharacteristic::PROPERTY_READ
| BLECharacteristic::PROPERTY_WRITE
| BLECharacteristic::PROPERTY_NOTIFY
);
On Windows Side (using InTheHand.BluetoothLE package), getting "The device does not recognize the command" on:
await serv.GetCharacteristicsAsync()
This only happens when the PROPERTY_NOTIFY flag is set on ESP32.
How else do I enable notifications?
In the end it was because the device was paired and updating the descriptor to allow notifications wasn't taking. Unpaired and retried and it works.
Sorry for wasting your time reading this.
Related
I have Sender and receiver console applications for IBM MQ XMS. The sender populates the Queue and the receiver dequeue the queue manger using receive method. I am using the while loop with bool value to keep running the receiver so that whenever a new message is available in the queue receiver can get that data.
Now i want to change the receiver code to Asynchronous Message Listener instead of consumer.Receive().
The code snippet is,
consumerAsync = sessionWMQ.CreateConsumer(destination);
messageListener = new MessageListener(OnMessageCallBack);
consumerAsync.MessageListener = messageListener;
connectionWMQ.Start();
While(true)
{
console.writeline("Wait for message");
}
The above code fetches only the already available data and not the new one. For example if i have 2 data in my queue while starting the receiver application those messages getting downloaded. but when i keep the receiver application running and send a new data from sender app its not getting downloaded and i have to restart the receiver application to get that data. The similar scenario was working fine with
synchronous mode consumer.ReceiveNoWait().
What am I missing?
Version of XMS? Version 9.2 has a bug that was confirmed by IBM 10.28.2020. They're working on a fix. No APAR yet. Temporary solution would be to downgrade to client version 9.1.
Update: Received a fix built on version 9.2.0.1 IT34722. Tested ok. Should be released with fixpack 9.2.0.4.
I have posted a support-case to ibm on this issue a long time ago(81 days...)
Long time for such a bug. The apar is IT34722 but at the date is still in open status.
9.1.3 might work but have other problems/bugs and will not be found as nuget-package
We are trying to upgrade existing app with your framework, other things are working fine like connection/read/write however we are facing issues with Notification/Disconnect
Can you please guide for following scenarios:-
Need call back for disconnection
Notification not working we are not able to receive any notification alert
Is there any method to check characteristics of devices, as we have different devices and some characteristics are not present in all devices, when we try to read/write non present chacraterstics on devices, it throws exception and app crashes
Code :-
connection.writeDescriptor(
Defs.SVC_AUTOMATIONIO_UUID,
Defs.CHAR_AUTOMATION_IO,
Defs.DESC_CLIENT_CHAR_CONFIGURATION_UUID,
BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE
)
.subscribe(
this::onWriteSuccess,
this::onWriteFailure
);
connection.setupNotification(iCharUuid)
.flatMap(notificationObservable -> notificationObservable)
.subscribe(
this::onNotificationReceived,
this::onConnectionFailure
);
Thanks
Swayam
In general you don't have to write descriptor manually to enable notifications. The library does it for you.
Try: (example)
rxBleConnection.setupNotification(Defs.DESC_CLIENT_CHAR_CONFIGURATION_UUID)
.flatMap(notificationObservable -> notificationObservable)
.subscribe(this::onNotificationReceived, this::onNotificationSetupFailure);
In order to get callback for disconnection: (example)
You can observe onError from establishConnection method.
You can setup connection status observable
bleDevice.observeConnectionStateChanges().subscribe(this::onConnectionStateChange);
To check characteristics you can go with service discovery: (example)
bleDevice.establishConnection(this, false)
.flatMap(RxBleConnection::discoverServices)
.first() // Disconnect automatically after discovery
.subscribe(this::processDiscoveredServices, this::onConnectionFailure);
I'm developing a Bluetooth app using Qt 5.5. Using QBluetoothLocalDevice, I can see the device which I want to pair for. Need to submit a passcode as part of the pairing process. How to do this?
Paired the same device with my phone and passcode entry showed up immediately.
connect(m_localDevice, &QBluetoothLocalDevice::error, this, &BluetoothModel::handleLocalDeviceError);
connect(m_localDevice, &QBluetoothLocalDevice::pairingDisplayConfirmation, this, &BluetoothModel::handlePairingDisplayConfirmation);
This isn't showing any debug message from BluetoothModel::handlePairingDisplayConfirmation slot. The debug / error messages are
qt.bluetooth.bluez: Failed to create pairing "org.freedesktop.DBus.Error.NoReply"
BluetoothModel::setPairingStatusMessage "Pairing request failed."
Anyone tried doing this? Thanks in advance.
I am trying to record voice in symbian S60 5th edition OS. I Am trying to use following code to record the voice as specified in the NOKIA developer's site.
//Create an instance of CMdaAudioRecorderUtility class
CMdaAudioRecorderUtility iRecorder = CMdaAudioRecorderUtility::NewL(*this);
//Open file either by using a filename with full path infor or a descriptor
iRecorder->OpenFileL( aFilename );
//iRecorder->OpenDesL( aDescriptor );
//Recording is started
iRecorder->RecordL();
....
....
//Stop Recording
iRecorder->Stop();
//Close the recording session
iRecorder->Close();
Any other suggestions would be helpful.
Basically, the this pointer in CMdaAudioRecorderUtility::NewL(*this), is pointing to an interface, which you need to implement. And as it has fucntions which are informing you on when the file is opened, closed or other possible states. You would actually need to wait untill you get an event before you start any other operations.
Also see whether the interface functions are giving you any errors.
I am building a blackberry application takes input from user then send input to a server and displays the xml returned from server.
The problem is, while application works fine on simulator it doesn't show results all the time on real device. Sometimes it is working but usually it's not. I am using wifi connection on device. The code is:
Connector.open(url + ";interface=wifi");
I am not using wifi on simulator. I just delete the 'interface=wifi' part and it runs using mds.
When input taken, a class extending Thread starts. It opens the connection and initializes variables. I take the inputstream from class and parse the xml. The device is a Blackberry 9700.I read something about connection timeout but i am not sure where problem is.
Edit: Found a simple way to connect. Here is the code for a GET request:
ConnectionFactory cf = new ConnectionFactory();
ConnectionDescriptor cd = cf.getConnection("YourUrl");
httpConnector = (HttpConnection) cd.getConnection();
httpConnector.setRequestMethod(HttpConnection.GET);
Maybe this might help: http://www.localytics.com/blog/2009/how-to-reliably-establish-a-network-connection-on-any-blackberry-device/
The idea in that blog post is to check if WiFi is enabled, and in that case use that for connection string, and so on for various connection types.