BLE | PSoC 4 BLE design example repository
kandi X-RAY | BLE Summary
kandi X-RAY | BLE Summary
PSoC 4 BLE design example repository
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of BLE
BLE Key Features
BLE Examples and Code Snippets
Community Discussions
Trending Discussions on BLE
QUESTION
I am using the BluetoothLeGatt example from here: https://github.com/android/connectivity-samples/tree/master/BluetoothLeGatt
Assume BLE connection, service and characteristic detection have all happened properly. The following data being sent is value of a characteristic.
From a custom BLE device, I am sending an array of bytes to the smartphone, for example, something line {0x00, 0x01, 0x02, 0x03, 0x04}. In the android program this is received inside the onReceive() function inside BroadcastReceiver mGattUpdateReceiver
in DeviceControlActivity.java
The line
...ANSWER
Answered 2021-Jun-15 at 04:38The example you are using receives the data as a byte array already, but it appends hex representation to the data as string. This is why you get your data in both representations.
You will need to change the example in the file BluetoothLeService.java
on line 149. It is currently reading
intent.putExtra(EXTRA_DATA, new String(data) + "\n" + stringBuilder.toString());
and you would need to change it to
intent.putExtra(EXTRA_DATA, new String(data) + "\n");
if you want to receive only the string representation.
QUESTION
Right now I am developing web which has ability to connect thermal printer. I am using angular framework, and I successfully connect the thermal printer with USB using library ng-thermal-printer
. But I want to my web also being able to connect thermal printer via web bluetooth which is BLE (Bluetooth Low Energy). As far as I know, BLE has specification in term of GATT and has services and characteristics in it.
The progress I did so far, I can connect and send a value to the thermal printer device in a Service and a Characteristic, let's say Service with UUID AS and Characteristics with UUID AC, using my android phone with the help of application named nRF Connect. Targeting Service AS and send hexadecimal value at charateristic AC make me successfully print something on the thermal paper.
But there is a problem. After knowing the right service and characteristic. I implemented it in my project. But, my chrome browser console showed error:
- Origin is not allowed to access any service... and it told me to add optionalServices when requestiDevice()
- After I added Service AS in property optionalServices, the console showed error DOMException: Connection failed for unknown reason. The errors showed both in chrome PC and chrome android.
NB:
- I have enabled Experimental Web Platform features on chrome
- I have enabled Use the new permissions backend for Web Bluetooth on chrome
- I have enabled Allow invalid certificates for resources loaded from localhost. on chrome
- I have enabled Enable new USB backend on chrome
- I have used https.
Additional question. is bluetooth connection that application nRF Connect used different from BLE? if so, why it displays services and characteristics?
...ANSWER
Answered 2021-Jun-14 at 07:34I'd recommend you try sending those hex values directly from the about:bluetooth-internals
page and see if you can reproduce the connection error from there as well. See https://web.dev/bluetooth/#tips
If so, check out https://www.chromium.org/developers/how-tos/file-web-bluetooth-bugs to learn how to properly file a chromium bug so that the team can fix the underlying issue.
If not, could you share your JS code so that we can help you diagnose what could be going wrong in your code?
QUESTION
I'd like to send a beacon signal from my mobile web browser. Is there a way to broadcast BLE in a browser? I checked the non-standard Bluetooth API, but there was no such function.
Thank you for reading it.
...ANSWER
Answered 2021-Jun-14 at 06:31Unfortunately there doesn't seem to be support for this yet. There's an open request for this feature as can be seen here:-
- https://bugs.chromium.org/p/chromium/issues/detail?id=1043409
- https://github.com/WebBluetoothCG/web-bluetooth/issues/231
More information about web bluetooth support is found here:-
QUESTION
I am new to Objective-c. I am using swiftui to make my app. But need to implant objective-c code for BLE. all work until I get this code
in .h file
...ANSWER
Answered 2021-Jun-11 at 22:36Search your code for where the @interface for ESPTaskParameter is defined, that will be in some .h file. Then, make sure the .m file #imports that header file. If it doesn’t the there would indeed be no visible interface defining the selector you want to call to the .m file that is trying to call it
And check that the interface .h does indeed declare a public setter for broadcast.
QUESTION
I have added some custom parameters to personalize my bash and I am experiencing some unexpected behavior, so I think I might have done it wrong. In the code block below are the custom parameters:
...ANSWER
Answered 2021-Jun-11 at 10:13Thank you for the report! I'm the author of ble.sh
. This was a bug of ble.sh
in the coordinate calculation. I fixed it in the latest push. Could you please update ble.sh
by the following command?
QUESTION
I got this code here from an app I am working on. I inherited this code when the BLE guy left the team. I am not good with low level stuff and Data stuff. I am UI/UX front end person, and now I do need to get my hands dirty. This code is now a bit old and using deprecated code. I have unsuccessfully been trying to silence the warning, but I keep ending up with he same code or with errors.
This is the code that generates the warning. On the return line when using withUnsafeBytes
...ANSWER
Answered 2021-Jun-09 at 16:36The version of withUnsafeBytes
that's deprecated here is the version which binds the underlying pointer to a known type (Data.withUnsafeBytes(_ body: (UnsafePointer) throws -> R) rethrows -> R
).
The preferred replacement is the version which does not bind in this way, and returns a raw buffer pointer (withUnsafeBytes(_ body: (UnsafeRawBufferPointer) throws -> R) rethrows -> R
); luckily, transitioning between these only changes how you read from the pointer:
QUESTION
I have an object BleClient which is singleton that responsible for all my BLE operations.
When I run any function from the BleClient as intended that init is called like so:
...ANSWER
Answered 2021-Jun-09 at 12:54Singletons by definition are initialized only once - I don't think you can anyhow re-initialize them. You can make it just a regular class, not singleton and create it when bluetooth is already enabled. You can also keep it a singleton and do not perform initialization in a constructor, but on demand. In most cases, performing more advanced stuff in constructors isn't really a good idea.
You should also consider a case where you initialized your service when bluetooth was enabled and then user disables it.
QUESTION
In TTN they are no longer supporting large decoders.
I know what the decoder needs to be in TTN, it is in my DECODER function, but dont know how to execute it in the function node.
If you use inject Payload [1,2,3] RAW, it injects the raw payload that is msg.payload.payload.uplink_message.frm_payload into the decoder.
The DECODER needs to decode the raw payload and output it in msg.payload.uplink_message.decoded_payload
If you use inject Payload [1,2,3] Decoded in the flow you see how the end result needs to look like and the decoded msg.payload.uplink_message.decoded_payload
I am still learning JavaScript.
The code in the function node
...ANSWER
Answered 2021-Jun-07 at 14:02The question still really isn't clear, but if you want to use that code in a function node then I suggest the following:
Put that code into the "On Start" tab of the function node, but change the first line to the following:
QUESTION
I'm new to working with bytes and I have to filter out some BLE messages by some values on their Payload (bytearray)
According to the documentation of the device I'm working with, the payload 3th and 4th value corresponds to the Company ID. The values I get are [-38, 3]
and the documentation states that this value should be 0x03DA
. Are these values compatible at all? How should I translate that to be sure it's OK?
ANSWER
Answered 2021-Jun-04 at 09:41You don't say what language you are doing this in but there are some general points that can be made about Bluetooth data.
From https://www.bluetooth.com/specifications/assigned-numbers/company-identifiers/ :
If the value in hex is 0x03DA
, decimal 986
and it is for EnOcean GmbH.
Bluetooth transmits it bytes in little endian format so the bytes would be [0xDA, 0x03]
or [218, 3]
. The reason you are seeing the -38
is because the byte is being treated as a signed integer (sometimes referred to as a short) not an unsigned integer (unsigned short).
In Python this would look like:
QUESTION
I am having trouble removing brackets from the value that I am getting from ESP32 i.e BLE device. I want to show the value without brackets in the Heart Rate Widget, but I am difficulty resolving that. Kindly help me out in finding its solution. The data that is coming from device is converted to String format
BLE code:
...ANSWER
Answered 2021-May-23 at 20:36If that's really the data format you are receiving and just want to format it differently, try some string manipulation, e.g:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install BLE
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page