Can you communicate with nearby devices using a website? - ruby-on-rails

Can a website help a user communicate with nearby devices via bluetooth/WLAN without downloading software?
User requests that something be done on their device (which could be, for example a wirelessly connected printer or a bluetooth keyboard).
The site, which contains a repository of relevant actions, sends specific instructions for that device to the user's own machine.
Those instructions are then relayed to the correct device (with the user's permission) via the user's device's WLAN or existing bluetooth connection.
Part 3 is what I'm not sure of - is there a mechanism by which a website can contribute to a wireless/bluetooth connection held locally?

It is not possible. User browser can't interact with hardware for wireless networking.
You should force user to install some custom software to do this.

You would have to submit the "commands" first, then have the device make requests to the website server, i.e., check for any pending "commands" for the device, and then process them locally. A website is not "thing" that can directly interface with a hardware device.

Related

How to identify IoT devices on WiFi network in Rails production app?

I have an IoT project that I have been developing using Rails. I am using ActionCable to manage websocket connections between my app and Arduino devices. The Arduino's are hardwired to ping into the app and join the websocket channel. In development, it is easy because I tell my server to listen to outside requests and the Arduinos ping localhost:3000. Now that I am trying to deploy, I realized it's tricky to manage this in production.
I would like a user to log in and see a list of smart devices in their home, the same way that many market ready devices work. If my app is on Heroku, is there a way I can configure the Rails app to look for incoming requests that share the same WiFi network as the current user? Otherwise, I would need to set up a form on the Arduinos where users would have to input their login credentials for the app to associate devices to users, but from a user experience perspective that would be a pain.
I would probably try to generate and hardcode a unique token in each arduino, put it on a sticker on the device and then ask the users to register their devices.
Or if there is way for them to input the wifi passwords for the local wifi, then you can do any kind of device identification when you show some secret on the website and ask the user to enter it on the device(s).

Internet access between WiFi-IoT in Access Point mode with mobile phone connected

I did a lot of brain-storming about this, and couldn't reach a solution.
I am posting this as i can get some ideas.
I have developed a WiFi-IoT based device with sensor, which shows up in AP mode. A mobile phone connects to this AP and then the device starts sending sensor data to the mobile phone. A mobile application plots and displays this data.
Now, i want to send this data from mobile to internet. Connecting my mobile to another AP with internet is not an option, as i don't want to break the continuous data transmission.
Using internet of data provider is one option, but that brings constraint of have mobile data.
What other options do i have to send my data from mobile to internet ??
Edit:-
I worked on the suggestions, and came to this point:-
1) WiFi-IoT device (in station mode) and mobile phone connect to same Internet-enabled WiFi access point. WiFi-IoT device has the IP address of the mobile phone for current network, and sends data to a TCP port (eg. 9801) of this IP address. The application in mobile phone reads the data from the port no. 9801 and stores it and hosts it on the internet.
This works fine.
2)WiFi-IoT device comes up in Access Point mode, and the mobile phone connects to this Access Point. Now there is one-to-one connection between WiFi-IoT device and mobile phone.
My question is, in the second scenario, without breaking this one-to-one connection, is there way to host data to internet:-
1) without using mobile internet provided by mobile data service provider ?
2) without using a second mobile phone ?
I may be wrong, but i am just asking this to make be sure whether my requirement can be achieved or not !!
I don't think you can connect to two APs at the same time.
Maybe use Bluetooth as device to phone link?
Or have the device connect directly to internet after some config done in AP mode and then send a copy of the data to your phone app (either via WAN or locally to the private IP your phone gets from the Internet gateway AP)?
--Edit--
Let me explain about the second one:
What I mean is basically have your IoT device directly connect to Internet and send data to a server (your phone has also to be connected to Internet). Then make the server send a data copy back to your phone. It's two step process: 1) while the IoT device is in AP mode, use your phone to login and configure which Internet-connected AP it should be connected to. This serves as UI for your IoT device. 2) start sending data.
Or a bit ugly, just let the IoT device talk to your phone in the same WiFi network via private IP.
I brought up this way because you mentioned anyway your device has to send data to Internet(I assume it's a server) and have phone talk to a known location server is more portable and scalable once you have more than one IoT device.
--Further Edit--
I don't think there is a way to do what you described. At least from my experience:
1) on the link layer, the wireless NIC has to be able to connect to two APs at the same time. This is not a feature currently available.
2) on the network layer, there has to be two IP address attached to the same NIC, which I don't think is available in current OS for wireless NICs. Though there is a way to do this for Ethernet card, I.e. via Aliasing.

iBeacons using a user's mobile to trigger a digital sign

I am trying to figure out a way to use iBeacons to trigger a physical Digital Screen. Has anyone done this or seen this?
What I would like to do is when a customer gets close to a digital screen an iBeacon would be triggered and would load to a digital tv screen an ad hosted on a website. I know you can do this to the phone screen, but can the trigger load content to digital signage? If so what would be needed? I already have an app that is triggering API calls. I assume we need some kind of computer hooked to the screen that receives the trigger and then displays content, but having a hard time wrapping my head around what is needed and have failed to see this anyplace.
Any help is appreciated.
There are a number of architectures that would support this. Below is a simple approach that I have prototyped before:
Make an electronic billboard display out of a computer or tablet that has:
Internet connectivity to refresh an ad from a remote web app.
A Web Browser that opens to the add display URL in the web app mentioned above.
Transmits as a beacon with a known identifier. You can make the tablet or computer send a beacon transmission with the onboard bluetooth interface, or you can simply plug in a USB bluetooth beacon to an open port.
Build a server-side app that does the following:
Has a number of configurable advertisements that display in a web browser.
Has a mapping of user identifiers to advertisements (basically the logic of what users are shown what ads)
Exposes a web service to register new mobile app installations that provide the user identifier, along with any user info (name, address, etc.) needed to target ads.
Exposes a web service to accept notifications of what nearby users have detected the beacon.
Automatically refreshes the advertisement to be targeted to whatever user is nearby, or some default otherwise.
Build a mobile app that:
Upon installation, calls the web service on the server-side app mentioned above to send the user info (name, address, etc.) needed to target advertisements.
Detects the beacon mentioned above using CoreLocation (iOS) or the Android Beacon Library (Android).
When the beacon is detected, calls the web service on server-side app with the user identifier to tell it that the user is nearby.

Remain connected to wifi network that has a captive portal

There's a wireless network I'm connecting to using my iOS device. In order to access the internet, a captive portal page is displayed prompting for a username and password. I would like my device to ignore that page and remain connected to the wireless lan. I don't mind if I can't get on to the internet - I just want to connect to another device on the wifi network. I can do this on other devices (android, laptops etc), it's just iOS devices that seem to enforce a "use captive portal or be disconnected" policy.
So, is there a way for my iOS device to remain connected to a wifi lan that has a captive portal?
This is a well-known problem with iOS. Apple assumes, incorrectly in my view, that any iOS Wi-Fi connected device must access the Internet and must be able to reach Apple's servers (of which there are dozens, only one of which is apple.com).
The device chooses a server apparently randomly from a list and attempts to load a specific HTML file in a random file path from the chosen server.
If the device is connected to the Wi-Fi access point but can't reach Apple, iOS assumes that the user has not logged into the access point and thus must be shown the captive portal login page.
This has caused grief to developers who want the user device only to access web resources on the local network, where no Internet access is provided or needed; and when the access point is open with no login required. The captive portal page just confuses the user.
The solution is to spoof the Apple servers. The only way I know of is to configure a web server to note certain nonrandom content in the HTTP attempts from the user device, and to supply the file the device is looking for. This is how the LibraryBox and PirateBox do it. Check LibraryBox.us.

Connecting to a special wi-fi network via iPhone App

I have to build an App that connects to a special Wi-Fi network and the opens an Ip address that is only available withing the network.
Is it possible to connect to a special wi-fi network (say "Network XYZ") via iPhone App. If so, please let know, so that I have an idea how to solve this.
Sadly no. Not from within the app.
All you can do is instruct user to go to settings and connect to that network.
If iPhone was not registered to any WiFi network before entering your app and your app has usesWiFi key set to YES then user will get a list of available networks to choose from.
One more big problem is: there are no AdHoc networks on this list - only infrastructure networks. AdHoc networks are available only trough settings.
What you could do is to instruct your user to set the auto-join feature on for desired network.
I'm afraid the only way to change the network is via the Settings application. Otherwise, rogue apps might be able to move users to their own proxies without the user's knowing.
It may be possible on jailbroken devices, however, as you would no longer be confined to working within the usual app restrictions on accessing system-level settings.
You can have your app launch once the user connects to the SSID you specify using the CaptiveNetwork API.

Resources