Actors:
Server: is a rooted Android device, that never sleep (never goes in standby)
Client: is one of many non-rooted smartphone, Android or IOS
Scenario:
The server is fixed in a place.
Server need to know when some client is near, without user intervention, identifying that device.
The client is switched on but can be in standby (with screen off).
I can install custom app both to client and server.
Target to achieve:
When a client comes near the server, the server knows it, without user intervention.
Detection does not need user intervention, but maybe is possibile the first time that users has to do some configuration to register the server bluetooth.
Questions:
Is it possibile to achieve it?
Both for Android and IOS clients?
Which solutions does I have to implement?
Thank you in advance
Just an idea but with ble you can do an advertisement with a packet of data.
Have an app that advertises some data for the client app.
Then on the server application receive these values by performing a ble scan.
Within this scan you can see the device address, scan record data(advertisement) and the RSSI. The rssi is the received power. From this you should be able to infer distance. As if the RSSI is lower then the device is further away thus a proximity detector. So if the RSSI is above a certain value add this device to a list to say they are in your detector range.
Related
I would have to build two apps (Android and iOS) and control some equipment via Bluetooth. For clarification, i cannot just use OS device discovery to connect to the equipment because there's hundreds of them and their position is very important (as well as the user's position when issuing commands), thus it's less of a hassle for operators to just point the phone's camera at a QR code and connect than having to go through a long list of devices with mangled names.
I haven't found many details about specifically using a QR code for bluetooth connections, but i figured that people experienced with this kind of communication will be able to say if it can be done. Please correct me if i'm wrong, but my understanding is that a bluetooth socket is not that different from a TCP one and a connection could be established by knowing the server's credentials.
Can I use a QR code to store device credentials that I can use to establish a connection? It doesn't really matter how much information needs storing, the QR code can contain any sensitive information.
Is there anything more, apart from the UUID, that would need storing on the QR code?
Is it simpler to configure the device as a server and the phone as a client for this specific request? There will be multiple operators that will need to work with these devices.
This is specific to Android and iOS, but if the points above were possible, would I get an OS pop-up window for each connection? Would skipping the discovery step save the operator the hassle of having to confirm the connection to the OS?
If the target device is configured as a server, each with its UUID as the QR code, can i scan that code and open a socket to that very device without manually connecting to it from the phone's menu?
I'm trying to make a app for report the human interaction because the virus, I just want to know if it's possible for follow a way, I know that exist google nearby, but that requires that both devices has the same app installed and it's the same with the bluetooth or ble, so what others tools could be usefull for make my app? Thanks.
It depends on your approach but ble has the functionality to scan for discover able advertisement from other devices.
This means you can see and store another devices address(ble) to a list / database. The beauty of this is ble only works well within a short range distance though you can filter by distance crudely by the RSSI. The RSSI is received upon scanning it is the received power from another device.
So for a contract tracing app you will need to develop a system which advertises a ble packet and along with the app scan for ble packets.
Then if you find via your scan another device, you add it to your database.
Next you need to check your database "for the virus" this means looking up a backend system where you store the ble addresses of people with the virus. Then the user checks the database with their list of addresses, if there is a match of addresses, then you have come into contact with the virus and should get treatment / self isolate. Just what ever your geographical location laws are.
So simply put you need:
App for both phone
Back end database
Database on each phone of addresses found
Ability to send out address via an advert(beacon)
Scanning of beacons
Checking database(backend for virus)
Uploading to database(Stay you have it, don't have it or are cured)
Hope this helps.
I want to build a simple challenge response protocol in order to authenticate a user to an Arduino via the smartphone (Android and iOS) using BLE. I'm having problems seeing how this would be implemented with BLE. What I want to do:
Arduino sends/broadcasts a challenge
Smartphone receives challenge and computes response
Smarpthone sends response to Arduino
The way I thought about implementing this is to have the Arduino (peripheral and server) start advertising when a button is pressed. Ideally an event would be triggered on the smartphone (central and client) when a certain service shows up. Then the smartphone connects to Arduino, reads the challenge characteristic and writes the response to it. Is this a good approach?
It appears though that it is not possible to trigger an event when a BLE service appears and I would continuously need to scan with the smartphone which is very battery intensive. Not sure how to get around this? Geofencing is not really an option since it can be inside. Maybe detecting if the user is walking, biking, standing still? Any suggestions are greatly appreciated =).
On iOS BLE connectivity looks like this:
initialize CBluetoothManager,
start discovering devices through bluetooth.
when found particular peripheral that u're intrested in, connect to it via core manager and store this peripheral variable in ur Class,
then.. u should STOP discovering cuz it's terrible for batteries ;) (as u said),
after device's found, you can search through services, characteristic and at the end through descriptors <-- IN THIS ORDER otherwise u won't get any of these,
ofc, from now on you're able to store each of these vars in your Class and work with them as you wish to. BLE on iOS's based on delegates and it's own lifecycle, each time when there will be something to read the event will trigger. When you will want to send some msg to Arduino back it shouldn't be a problem. In the partial answer for your question about
'when a certain service shows up. THEN the smarphone connects to
Arduino.'
you have to make steps ABOVE in order to read services. Hope that helps.
I am making an app to alarm the users if their phone is being stolen. I will use an Android phone and an arduino Bluetooth device to be the point of reference ..
My problem is.. is it possible that to set a specific range to the android Bluetooth to trigger the alarm of the phone??
Because my plan is if distance between the arduino and the Android phone reaches 3 meters both the device will alarm..
Pls. I need your help..
One of the most obvious ways you can do this keep the socket connection open until it disconnects. Bluetooth range is approximately 32feet (10m) for most devices upon which the device will be disconnected. Upon disconnection the user can be notified (on the connection being lost/ bike stolen?).
Android's low energy bluetooth might be a solution if you want to conserve battery life, otherwise the normal version is fine.
If you want to get really fancy you can use geocoding(using longitude and latitude of both where your phone is and where the bike is) if the distance exceeds a certain distance( more realistically a couple of 100 meters) a notification can be sent to the phone about a possible bike theft situation.
you can use BLE GATT server and send heart bit to client when heart bit not deliver client is not in Bluetooth range . you cant find distance between two Bluetooth device
This question follows on from Unity3D -- Send message to other mobile phones in the same vicinity
However, I made mistake of restricting to Unity3D.
So I would like to re-ask the question without that constraint.
Let us say we have 20 mobile phone users in a cave (so no Wi-Fi networks / isGPS)
One user hits a button, and every other user's screen flashes, (within a few milliseconds)
How to accomplish this?
What if everyone is using an iPhone?
What if there is a mix of iPhone and android users?
Finally, is there any solution that would cover a wider range of phones?
You should have some network so that mobiles can share some data. Bluetooth can have maximum of 10 m distance coverage (depends upon devices though). Since, all mobile are running same app they should be linked to a network and communicate. Please Check:
http://developer.android.com/samples/BluetoothLeGatt/index.html
You can create one device as server and communicate among other devices.
https://github.com/polyclef/BluetoothChatMulti
If you have installed the app on all of the devices then in all probability yes, if the device supports push (pretty much any smartphone) then you can use the push service to synchronize the devices based on geofencing (ie, 10m from my location), there are some other discovery routes you could try to (without using the B word) pinging other devices
the app would need to be able to provide some sort of server service if it was to create its own private network based on the IP addresses of the devices it found nearby, as those devices would have to connect to that phone acting as a server. the network interface shouldn't be important, but connecting the satellite devices to the server should be. You could try doing it based on which device can provide data services, aka hotspot. You can easily connect devices to networks programmatically.
at that point your faced with the classic client server problem. There is going to be a huge amount of work to get devices configured, network creation, client server infrastructure if it has to be done without data, packet optimization. Very expensive and very high risk depending on how many restrictions there are.
Search for How to make a html5 group chat and then build on that example.
Possibly send commands to the chat delimited by a / character where a javascript could then execute the command.
Good Luck with your design.
Danny117