Android Question Filtered WiFi Connections

Declan

Well-Known Member
Licensed User
Longtime User
I am currently developing an app on an Android tablet.
The tablet will act as a Human Interface to a number of remote Arduino based sensor boards.
The remote Arduino based sensors will connect to the Android tablet via WiFi connections.
There will eventually be 18 simultaneous WiFi connections from the remote sensor boards.
The Android app will have a database table that I can enter the MAC addresses (or any other unique ID) of the sensor boards WiFi modules in.
The reason for this is that I want the Android app to only allow connections from the remote sensor boards and NOT from any other WiFi device in range.
Could someone please steer me in the right direction as to how I go about accepting WiFi connections from specific WiFi devices?
 

Declan

Well-Known Member
Licensed User
Longtime User
Thanks Erel.
Yes, My app will be a TCP server and the remote sensors will connect as a client.
 
Upvote 0

Declan

Well-Known Member
Licensed User
Longtime User
@Erel:
I have successfully edited the AsyncStreamsText Example and my remote Arduino sensors are able to connect to my Android app and send / receive data.
However, I must hard-code the IP and Port of the Android device into the Arduino code in order to establish a connection - Obviously ;)
If we look at a scenario where additional Arduino based sensors can be added at any stage, I must be able to control who connects at the Android end - otherwise I could have sensors connecting to the incorrect Android device (It is possible to have 2 or more Android devices within range of the sensors)

My initial thinking was to use the MAC address (or hard-coded ID) of each sensor as a unique identifier which could be entered into the Android app via an EditText into a database or table.
When connection from a remote sensor is attempted, the Android app would search the database or table for valid sensors - If True the connection is established - if False reject the connection.
This approach would allow the Android app to only accept connections from valid remote sensors.

I hope this makes sense?

Is it possible to read/obtain the MAC address of devices attempting to establish a connection?
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
On My Raspberry I have a similar thing. If one connects he has to give a userid & pw. I call my server and ask if the user is valid.

Benefit: You've all the user authorization in one place. You can change it in one place and you don't have a logic on every device.
 
Upvote 0

Declan

Well-Known Member
Licensed User
Longtime User
@KMatle:
Many thanks.
So, once my sensor has received the connect ACK, it can then send a unique ID which the Android app can verify. If False then close the connection?
Problem with this is that the remote sensor could loop into trying to connect multiple times.
I can fully understand having a "central" login on a server - but I am using a WiFi ONLY tablet as I do not require anything other than a localised network.
 
Upvote 0

Declan

Well-Known Member
Licensed User
Longtime User
@Erel,
As life today is very hectic, we often neglect to extend our thanks to those that offer guidance and assistance.
Having purchased B4A and joining this forum, the support from yourself and fellow members is simply awesome.
Many thanks
 
Upvote 0
Top