Android periipheral mode detection - bluetooth-lowenergy

Can anyone please tel me ,is there any possibility to check in which mode(i.e. central or peripheral mode), the BLE is operating? If so on what basis can we find out. I am using BCM20702. It says it supports both modes. But is there a way in which we can find out as to which mode is the device working in?
Regards,
Sathya

If you are advertising, you're a Peripheral. If you are scanning and initiating connections, you're a Central. It's as simple as that.

Related

Pairing (security) example for Seeed XIAO nRF52840

I can't find example how to do BLE pairing with Seeed XIAO nrf52840 board. It doesn't matter to me if it will be Arduino or Circuitpython libraries. Is there something like this somewhere?
I would like to use this board for my project, but would like to ensure that anyone cannot read or change values in the BLE services.
My idea of use is that on the server side I select the device I want to pair with and on the device side I confirm the pairing manually e.g. with a button. From that point on, the server can then communicate with the unit and read or change its values.
Thank you
With Arduino you could try this example: https://github.com/adafruit/Adafruit_nRF52_Arduino/tree/master/libraries/Bluefruit52Lib/examples/Peripheral/pairing_passkey
I am actually trying to implement this feature as well. I was trying in CircuitPython, but I could not find a suitable way. I opened an issue, as there was nothing in their documentation to help.
UPDATE 2023-01-03 - In CircuitPython BLE security is not yet implemented, see answer to the issue I opened.

Advertising and connection establishment using nRF52 DK with nrf52832 chip on Segger Embedded studio

I want to know how to send out an advertisement with some specific user number and data such that a connection can be established using the the sdk 15.3.0.
could anyone suggest me what changes i need to make in the ble app beacon code given in the sdk examples.
Thanks
One idea would be to start with the ble_peripheral example of the Nordic SDK.
You can find the following two guides on their forum : https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-services-a-beginners-tutorial and https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial
This explains how to build a custom service with a custom characteristic to handle read / write and notification of values from the embedded device to a BLE central device (e.g: smartphone).

How do I program this BLE location tag?

I bought one of these:
https://www.aliexpress.com/item/Smart-finder-Key-finder-Wireless-Bluetooth-Tracker-Anti-lost-alarm-Smart-Tag-Child-Bag-Pet-GPS/32806261079.html
As far as I can tell it is a BLE (Bluetooth Low Energy) location tag.
I downloaded the app for it onto my iphone, and the app instantly recognised it and connected to it. The iPhone app seems to know how far away the tag is - it has a little map of the local area and says how many feet away. I was able to set the device name via the app, but I'm not sure if that set it locally or on the tag itself. The iPhone app also has a "find" button - when you press it, the tag beeps.
So I want to know how I can program this thing myself. I want to be able to identify it when it is nearby, connect to it and make it beep. I've searched for quite a while but not come up with much.
I'm assuming (wrongly/rightly?) that there is some general standard or approach for talking to these BLE location devices and carrying out the basic functions with them - but what is that standard - where is the documentation?
Does anyone have any idea how to program these BLE location tag devices?
BLE devices typically communicate using GATT, either using standard GATT services, or custom ones. The command to make it beep is probably implemented using a custom GATT service.
For finding out the distance to the beacon, typically the RSSI is used. This is a measure of the received power. It needs to be compared to the output power at the emitter. Usually beacons will put their output power in advertisement data, so it can be used without connecting to them. Here since the app is also able to send commands to the beacon, chances are it keeps a connection to it and has a custom GATT protocol to retrieve the output power.
Here is what I would suggest:
Read up on BLE, especially advertising and GATT. For instance read this for advertising and this for GATT. The full BLE spec is available here but should be used for reference and not introduction
Sniff the communication between your device and your phone. You can see this other answer of mine to get started
Replicate the communication protocol in you own app. For that you'll need to use your target platform's BLE libraries. For instance for iOS it is CoreBluetooth

Communication between MCU and PC - wireless

I am working on a project that requires me to use TI's MSP430F5529 launch pad, CC3100 Booster Pack and CC3100XX Emulator.
The project I would like to do is have the MSP430 log sensor data and to transmit it to a PC wirelessly(Without Internet). I am a beginner in using MCU,s but I can handle the datalogging part. I do not know how to get started with the communication part.
Can someone please direct me to where I could get some good reference material to get this project off the ground and if possible better insight on what I need to do to get started.
Thank you all in advance.

Is there any device that can act as a iBeacon and allows writing to one of its GATT characterics?

I would like to detect a beacon and then write a value to some of its GATT characterictics, so other BLE-devices can read it. Is this possible at all? Or some special device is needed for this?
This is not possible with a standard iBeacon because it is a transmit only device.
You might be able to build your own custom device to do this, but making it work on iOS when more than one Bluetooth device is around will be almost impossible. This is because there is no way to correlate detected iBeacon identifiers with as connectable Bluetooth device -- iOS has sandboxed the CoreLocation iBeacon detection APIs and the CoreBluetooth APIs needed to read and write GATT characteristics.
As a result, you can never know for sure if you are writing to the same device you detected.
For a detailed explanation of the sandboxing of the CoreBluetooth and CoreLocation iBeacon APIs, see here.

Resources